- **OpenFOAM Programming & Development**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/*)

- - **Laplacian operator and nuSgs for heat equation**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/65767-laplacian-operator-nusgs-heat-equation.html*)

Laplacian operator and nuSgs for heat equationHello 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 |

What about
Code:
`- fvm::laplacian(DT+sgsModel->nuSgs()/0.6, T)` |

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 ^^) |

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 |

Quote:
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) .... ) ? |

All times are GMT -4. The time now is 11:37. |