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

Using the snGrad operation

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Display Modes
Old   August 2, 2006, 10:16
Default Using the snGrad operation
  #1
New Member
 
Ruediger Bahrmann
Join Date: Mar 2009
Posts: 4
Rep Power: 8
bahrmann is on a distinguished road
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
bahrmann is offline   Reply With Quote

Old   August 2, 2006, 10:29
Default Yes. The first parameter of f
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,769
Rep Power: 21
hjasak will become famous soon enough
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
ramon likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 3, 2006, 09:13
Default Hrvoje, Thank you for answe
  #3
New Member
 
Ruediger Bahrmann
Join Date: Mar 2009
Posts: 4
Rep Power: 8
bahrmann is on a distinguished road
Hrvoje,

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

Rüdiger
bahrmann is offline   Reply With Quote

Old   January 28, 2011, 10:44
Default
  #4
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 174
Rep Power: 8
linch is on a distinguished road
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
linch is offline   Reply With Quote

Old   January 28, 2011, 11:48
Default
  #5
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 1,011
Rep Power: 18
akidess will become famous soon enough
phi is a surfaceScalarField. It's components are the vector U scalar multiplied with the vector Sf on a face.
akidess is offline   Reply With Quote

Old   October 1, 2015, 04:30
Default
  #6
New Member
 
David Casasnovas
Join Date: May 2013
Posts: 1
Rep Power: 0
Novas is on a distinguished road
Quote:
Originally Posted by linch View Post
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))
Novas is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Operation conditions Paweł FLUENT 2 October 27, 2006 01:35
File operation in UDF Ajay FLUENT 0 April 10, 2004 16:33
Boolean operation Lam FLUENT 1 July 22, 2003 17:18
About the technology of operation Masaru Phoenics 0 June 13, 2003 23:58
Matrix operation : Jay FLUENT 0 November 11, 2002 10:20


All times are GMT -4. The time now is 07:43.