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

Using the snGrad operation

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By hjasak
  • 1 Post By akidess
  • 1 Post By Novas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 2, 2006, 11:16
Default Using the snGrad operation
  #1
New Member
 
Ruediger Bahrmann
Join Date: Mar 2009
Posts: 4
Rep Power: 17
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, 11:29
Default Yes. The first parameter of f
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
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 and nepomnyi like this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 3, 2006, 10:13
Default Hrvoje, Thank you for answe
  #3
New Member
 
Ruediger Bahrmann
Join Date: Mar 2009
Posts: 4
Rep Power: 17
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: 176
Rep Power: 17
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: Germany
Posts: 1,377
Rep Power: 30
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.
nepomnyi likes this.
akidess is offline   Reply With Quote

Old   October 1, 2015, 05: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))
nepomnyi likes this.
Novas 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


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


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