CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Using the snGrad operation (http://www.cfd-online.com/Forums/openfoam-programming-development/60962-using-sngrad-operation.html)

bahrmann August 2, 2006 10:16

Using the snGrad operation
 
Hi,
I want to modify the epsilon equation of the LaunderGibsonRSTM in the way, which is discribed below. The Problem lies in the snGrad() operation. With snGrad(...) in the equation, compiling the code is not possible. By changing the gradient with a constant, compiling the code is possible.
Could anybody say, what mistake I'm doing?


=================ORIGINAL=EQUATION================ ===========

tmp<fvscalarmatrix> epsEqn
(
fvm::ddt(epsilon_)
+ fvm::div(phi_, epsilon_)
//- fvm::laplacian(Ceps*(k_/epsilon_)*R_, epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
C1*G*epsilon_/k_ + boundarySource
- fvm::Sp(C2*epsilon_/k_ + boundaryCentral, epsilon_)
);
================MODIFIED=EQUATION================= ===========

tmp<fvscalarmatrix> epsEqn
(
fvm::ddt(epsilon_)
+ fvm::div(phi_, epsilon_)
//- fvm::laplacian(Ceps*(k_/epsilon_)*R_, epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
C1*G*epsilon_/k_ + boundarySource
- fvm::Sp(C2*(1.0-((C2-1.4)/C2)*exp(-sqr(sqr(k_)/(6.0*epsilon_*nu()))))*(epsilon_- 2.0*nu()*sqr(fvc::snGrad(pow(k_,0.5))))/k_ + boundaryCentral, epsilon_)
);

Thanks,
Rüdiger

hjasak August 2, 2006 10:29

Yes. The first parameter of f
 
Yes. The first parameter of fvm::Sp should be a volume scalar field. In your operations you use fvc::snGrad(pow(k_,0.5) which is a face-normal gradient of k^0.5 (why not sqrt k?).

A face-normal gradient is defined on the faces, and you cannot sum up a cell centred and a face centred field. My guess is that you assume snGrad is doing something different from what it actually does.

Hrv

bahrmann August 3, 2006 09:13

Hrvoje, Thank you for answe
 
Hrvoje,

Thank you for answering so quickly. The answer was very plausible. I think you could help me.

Rüdiger

linch January 28, 2011 10:44

what about
Code:

phi&(fvc::snGrad(rho))
I suppose phi to be a face centred vector field, and rho to be a cell centred scalar field, so fvc::snGrad(rho) should transform it to a face centered vector field or am I wrong?

I get an error
Quote:

no match for ‘operator&’ in ‘phi & Foam::fvc::snGrad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]()’
when I try to perform the operation

akidess January 28, 2011 11:48

phi is a surfaceScalarField. It's components are the vector U scalar multiplied with the vector Sf on a face.

Novas October 1, 2015 04:30

Quote:

Originally Posted by linch (Post 292673)
what about
Code:

phi&(fvc::snGrad(rho))
I suppose phi to be a face centred vector field, and rho to be a cell centred scalar field, so fvc::snGrad(rho) should transform it to a face centered vector field or am I wrong?

I get an error when I try to perform the operation

Obviously is too late for answering this post, but it could help to someone with the same issue. The problem in this operation is that you are trying to make a dot product between a scalar and a vector , instead of two vectors. The correct code is (the outer product between scalar and vector):

Code:

phi*(fvc::snGrad(rho))


All times are GMT -4. The time now is 05:45.