CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Computing LES variable (

vatant May 2, 2006 19:38

Hi: I am running icoFoam

I am running icoFoam. However, wanted to compute the turbulent variable 'nuSGS' without using the turbulence model. I tried to compute the following way:

surfaceScalarField nusgs = sqrt(mesh().V()/thickness)*symm(grad(U));

computing the thickness variable as given in LESdeltas, but was not able to work it out.

some errors include:

error: no match for call to (Foam :: fvMesh) ()
error: grad was not declared in this scope..

Can someone elaborate on how to obtain this quantity?

further, in the incompressible code, Can i Add this computed field to constant "nu" to make it an effective nueff = nu+nusgs.



hjasak May 3, 2006 02:22

Why mesh().V() instead of mesh
Why mesh().V() instead of mesh.V()? I would also say Foam::sqrt and the rest looks OK.


vatant May 3, 2006 10:58

Hello Hrv: I tried to imple
Hello Hrv:
I tried to implement your suggestions. on Compiling, I received following errors:

error: no match for 'operator*' in 'Foam::operator*(const Foam::scalar&, const Foam::tmp<foam::field<type> >&) [with Ty
pe = double](((const Foam::tmp<foam::field<double> >&)((const Foam::tmp<foam::field<double> >*)(& Foam::sqrt(const Foam::UList<double>
&)())))) * Foam::symm(const Foam::GeometricField<foam::tensor<double>, PatchField, GeoMesh>&) [with PatchField = Foam::fvPatchField, G
eoMesh = Foam::volMesh]()'

I am not able to access mesh volume for some reason. Please let me know your thoughts on this.



hjasak May 3, 2006 11:20

Split it up and try bits of th
Split it up and try bits of the expression - not obvious like his...


vatant May 3, 2006 14:45

I tried to compute mesh.V(), m
I tried to compute mesh.V(), mesh().V(),I keep getting the same error Foam::fvMesh problem.

Is there any other way to access the cell structure?



hjasak May 3, 2006 16:33

Actually, now that I look at t
Actually, now that I look at this, it is so full of rubbish that I should not have bothered to answer in the first place. Let's just go slowly through it.

1) so, U is a volVectorField, right. Thank makes fvc::grad(U) a volTensor field. You forgot the fvc:: bit in the grad; I will discuss the type of result further

2) symm(fvc::grad(U)) is still a volTensorField (well, a symmetric tensor, but we've still haven't got that one). Fine.

3) mesh.V(), according to fvMesh.H returns a scalar field:

//- Return cell volumes
const scalarField& V() const;

Note that V() gives you cell volumes, so it does not have any boundary conditions.

4) I sincerely hope that thickness is also a scalarField. If so, Foam::sqrt(mesh.V()/thickness) will give you a scalar field. Not clear if you've tried that.

5) So, now we've got:


which would be a scalarField times a volTensorField. How do you imagine I will deal with the boundary conditions: the gradient is defined on the boundary, but the scale is not. In other words, this is a completely wrong operation - the best I can do for you is to multiply the internal field of the gradient with the scalar field and let you deal with the boundary conditions yourself. Thus:

Info<< "Reading field U\n" << endl;
volVectorField U

scalarField thickness(mesh.V().size(), 3.73);

volTensorField a = fvc::grad(U);
scalarField t = Foam::sqrt(mesh.V()/thickness);
volTensorField b = fvc::grad(U);
b.internalField() *= t;

6) and finally, the best one of all:

surfaceScalarField nusgs = all this lot! How did you imagine that a surfaceScalarField (one scalar for all faces) can be initiated from a product of a scalar field and a tensor field? scalar = tensor??? Hmm. What happened to interpolation: how do I get face value from celll values?

I think some serious thought is required before continuing :-)

Enjoy (and sorry about the tone),


All times are GMT -4. The time now is 21:34.