CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Laplacian operator and nuSgs for heat equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2009, 10:03
Default Laplacian operator and nuSgs for heat equation
  #1
New Member
 
Quentin
Join Date: May 2009
Posts: 22
Rep Power: 17
Bedotto is on a distinguished road
Hello Foamers,

I've a problem with the laplacian operator in openFoam. Indeed in my solver I've written successfully in my file.C the following heat equation:

(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
)
However I would like to add the term corresponding to the subsgrid scale model, I mean the term Nu_t/Pr_t. Where Nu_t is the turbulent viscosity and Pr_t the turbulent prandtl. The equation I have to write under openFoam is now: dT/dt + d(T*Ui)/dxi = d [( Nu/Pr +Nu_t/Pr_t) * dT/dxi ]/dxi
where Nu_t is not a constant of course. I call Nu_t with the sentence sgsModel->nuSgs(). (Thanks again Santos!)
I've tried to write the new equation like:
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT,T)
- (fvm::laplacian(sgsModel->nuSgs(),T)) *(1/0.6)
-( fvc::grad(T) & fvc::grad(sgsModel->nuSgs()) ) *1/0.6
);
where Pr_t=0.6.
The problem is I get an error when I try to compile. The error comes from this line:
- (fvm::laplacian(sgsModel->nuSgs(),T)) *(1/0.6)
Indeed it says:

Nueff.C: In function âint main(int, char**)â:
Nueff.C:133: error: no match for âoperator*â in âFoam::fvm::laplacian(const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double](((Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&)(& T))) * 1.66666666666666674068153497501043602824211120605e +0â
/home/bedotto/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/dimensionedTensor.H:77:

I've tried to write this line in other ways
(for instance:
fvm::laplacian(sgsModel->nuSgs()) *(1/0.6)*T + fvm::laplacian(T)*(1/0.6)*sgsModel->nuSgs(), but it doesn't work)
I think I don't use correctly this operator, maybe someone could tell me more about how does work this operator, or is there something in the programmer's guide I've missed?

My regards

Quentin


Last edited by Bedotto; June 25, 2009 at 10:55.
Bedotto is offline   Reply With Quote

Old   June 25, 2009, 13:22
Default
  #2
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
What about

Code:
- fvm::laplacian(DT+sgsModel->nuSgs()/0.6, T)
?
santos is offline   Reply With Quote

Old   June 30, 2009, 05:18
Default
  #3
New Member
 
Quentin
Join Date: May 2009
Posts: 22
Rep Power: 17
Bedotto is on a distinguished road
Yes, I had alerady tried that. When you compile, it seems to work fine, but if you do that, you have to define the term 'DT+sgsModel' as a constant in the file transportProperties... and nuSgs isn't a constant.

Finally I've succeeded to write my equation like that and it seems to work:

fvm::ddt(T)
+ fvm::div(phi, T)
-( fvc::grad(T) & fvc::grad(sgsModel->nuSgs()) ) *1/0.6
- fvm::laplacian(DT,T)
- sgsModel->nuSgs() * (fvm::laplacian(T))

P.S: By the way if one wants to use the laplacian of nuSgs it's required to write :
fvm::laplacian((sgsModel->nuSgs())()), if you miss theses brackets, the compilation will fail.

EDIT:
By the way I did a mistake in my equation. I don't need to write the laplacian of nuSgs*T finally because I have div.[nuSgs*grad(T)] and I can write that like:nuSgs*grad(T) + grad(nuSgs) X grad(T) where X corresponds to the scalar product. (So there was no laplacian at all , sorry ^^)
Bedotto is offline   Reply With Quote

Old   September 3, 2009, 17:59
Default
  #4
Member
 
Join Date: Mar 2009
Posts: 46
Rep Power: 17
mmahdinia is on a distinguished road
Hi Quentin,

Is the method you mentioned above, for the solution of the heat equation with LES solver? Did you get acceptable results from it? Can it also be used with the dynamic Smagorinsky solver?

Best regards,

Mani

mmahdinia is offline   Reply With Quote

Old   September 7, 2009, 16:08
Default
  #5
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
Quote:
P.S: By the way if one wants to use the laplacian of nuSgs it's required to write :
fvm::laplacian((sgsModel->nuSgs())()), if you miss theses brackets, the compilation will fail.
Because function nuSgs returns tmp<volScalarField>. Additional brackets means dereference of pointer, incapsulated in tmp<...> object

nuSgs() returns object of type tmp<volScalarField>
nuSgs()() returns reference to object of type volScalarField

Have you tried this:
volScalarField DT = SGS->nuSgs() * scalar(1/0.6);

and then:

solve ( .... fvm::laplacian(DT,T) .... )

?
mkraposhin is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 19:52.