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

Turbulence model implementation errors

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 10, 2010, 01:48
Default Turbulence model implementation errors
  #1
New Member
 
elbert
Join Date: Mar 2009
Location: Ames, IA
Posts: 9
Rep Power: 7
elbertj is on a distinguished road
Send a message via Skype™ to elbertj
Dear Foamers,
I have implemented a non-linear eddy viscosity model, by modifying the kOmegaSST and including additional non-linear terms (code attached). I get a number of errors as:
no matching function to call to 'Foam:: .....'
final error as:

Quote:
BSLEARSM.C:254: instantiated from here
/home/ejp/codes/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/FieldFunctions.C:695: error: no match for ‘operator&&’ in ‘*(f2P ++) && *(f3P ++)’
/home/ejp/codes/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/FieldFunctions.C:695: note: candidates are: operator&&(bool, bool) <built-in>
/home/ejp/codes/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/dimensionSet.H:285: note: Foam::dimensionSet Foam:perator&&(const Foam::dimensionSet&, const Foam::dimensionSet&)
make: *** [Make/linuxGccDPOpt/BSLEARSM.o] Error 1
Seems like I'm getting an error due to wrong use of double inner product operator (&&) and consequently with dimensions. However, I am unable to spot the error with the formula implementation. Kindly let me know if you know the source of error

Thanks,
Elbert
Attached Files
File Type: zip BSLEARSM.zip (18.0 KB, 26 views)
File Type: txt error.txt (19.3 KB, 8 views)
elbertj is offline   Reply With Quote

Old   November 10, 2010, 06:26
Default
  #2
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 691
Rep Power: 18
niklas will become famous soon enough
Is IV_ a scalar or tensor?

IV_( (S_&&W_)&&W_),

If it is a scalar there should be a normal matrix multiplication somewhere

either
IV_( (S_&W_)&&W_)
or
IV_( S_&& (W_ & W_) )
niklas is offline   Reply With Quote

Old   November 10, 2010, 07:28
Default
  #3
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 691
Rep Power: 18
niklas will become famous soon enough
some other issues...

C1prime_ is defined as a volScalarField, but its just a constant, so I would change it to dimensionedScalar, otherwise you need to supply size information et.c....

Beta2_ is a volScalarField, but you cant just initialize it with a value it needs more information than
that. (same error as C1prime_)
To get it to compile i just set it to
Beta2_( 0.*N_), // why use a volScalarField for a zero?

but Im guessing that it really should be something else, otherwise why have it

aij_ is a symmetric tensor
W_ is a tensor and
W_ & W_ is just a tensor multiplication, this does not imply that the result is a symmetric tensor.
sure in this example it will be, but the code sees this as any other tensor multiplication

so you need to explicitly extract the symmetric part.

aij_
(
Beta1_ *S_
+ Beta2_ * ( (S_ & S_)-(1./3.)*(IIs_ * I ))
+ Beta3_ * (symm(W_ & W_)-(1./3.)*( IIo_*I)) // why should a tensor multiplication yield a symm tensor?
+ Beta4_*symm((S_ & W_)-(W_ & S_))
+ Beta6_*(symm(((S_ & W_) & W_) + ((W_ & W_) & S_)) - (2./3.)*IV_*I - IIo_*S_)
+ Beta9_*(symm(((W_ & S_) & (W_ & W_)) - ((W_ & W_) & (S_ & W_)) + 0.5*IIo_*((S_ & W_) - (W_ & S_))))
),
niklas is offline   Reply With Quote

Old   November 11, 2010, 16:03
Default
  #4
New Member
 
elbert
Join Date: Mar 2009
Location: Ames, IA
Posts: 9
Rep Power: 7
elbertj is on a distinguished road
Send a message via Skype™ to elbertj
Hi Niklas,
Thanks, after making changes you suggested, it is working! I did this for aij_ ,
Quote:
aij_ = symm(
Beta1_*S_
+ Beta2_*((S_ & S_)-(1./3.)*IIs_*I)
+ Beta3_*((W_ & W_)-(1./3.)*IIo_*I)
+ Beta4_*((S_ & W_)-(W_ & S_))
+ Beta6_*(((S_ & W_) & W_) + ((W_ & W_) & S_) - (2./3.)*IV_*I - IIo_*S_)
+ Beta9_*(((W_ & S_) & (W_ & W_)) - ((W_ & W_) & (S_ & W_)) + 0.5*IIo_*((S_ & W_) - (W_ & S_)))
);
Are you saying that though A_ = W_ & W_ is symmetric it has to be explicitly said, as
A_=symm(W_&W_) ?

In the constructor portion of my BSLEARSM.C (attached) , can you please tell me how I can include this code:

Quote:
forAll(N_,cellI)
{
if(P2_[cellI] >= 0)
{
N_[cellI]= (C1prime_.value()/3.)+pow((P1_[cellI]+sqrt(P2_[cellI])),(1./3.))
+sign(P1_[cellI]-sqrt(P2_[cellI]))*pow(mag(P1_[cellI]-sqrt(P2_[cellI])),(1./3.));
}
else
{
N_[cellI]= (C1prime_.value()/3.)+2.*pow((sqr(P1_[cellI])-P2_[cellI]),(1./6.))
*cos((1./3.)*acos(P1_[cellI]/(sqrt(sqr(P1_[cellI])-P2_[cellI]))));
}
}
-Elbert
Attached Files
File Type: c BSLEARSM.C (12.6 KB, 34 views)
elbertj is offline   Reply With Quote

Old   November 12, 2010, 02:02
Default
  #5
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 691
Rep Power: 18
niklas will become famous soon enough
Quote:
Originally Posted by elbertj View Post
Are you saying that though A_ = W_ & W_ is symmetric it has to be explicitly said, as
A_=symm(W_&W_) ?
Yes, because
in the tensor class the multiplication operation between two tensors returns another tensor,
not a symmetric tensor.


Quote:
In the constructor portion of my BSLEARSM.C (attached) , can you please tell me how I can include this code:
N_(scalar(0.)*IIs_),
This is a good start if the dimensions of IIs_ and N_ are the same otherwise use another field
which has the same dimensions as N_ or a constructor like the one for nut_.
For that kind of complicated expressions you have to place it in here.
Code:
{
    bound(omega_, omega0_);

    nut_ = a1_*k_/max(a1_*omega_, F2()*mag(symm(fvc::grad(U_))));
//    nut_ = k_/(omega_+smallOmega_);
    nut_.correctBoundaryConditions();

    // calculation of N_ goes here ....

    printCoeffs();
}
niklas is offline   Reply With Quote

Old   December 21, 2010, 04:51
Default
  #6
New Member
 
Maolong LIU
Join Date: Apr 2010
Location: Japan
Posts: 28
Rep Power: 6
maolongliu is on a distinguished road
Hi, I am also using this model.
Which reference did you use to write this model.
Because your correlations are a little different with mine.

Quote:
Originally Posted by elbertj View Post
Dear Foamers,
I have implemented a non-linear eddy viscosity model, by modifying the kOmegaSST and including additional non-linear terms (code attached). I get a number of errors as:
no matching function to call to 'Foam:: .....'
final error as:

Seems like I'm getting an error due to wrong use of double inner product operator (&&) and consequently with dimensions. However, I am unable to spot the error with the formula implementation. Kindly let me know if you know the source of error

Thanks,
Elbert
maolongliu is offline   Reply With Quote

Old   December 21, 2010, 08:25
Default
  #7
New Member
 
elbert
Join Date: Mar 2009
Location: Ames, IA
Posts: 9
Rep Power: 7
elbertj is on a distinguished road
Send a message via Skype™ to elbertj
I used the formulation described here:
"Explicit Algebraic Reynolds Stress Models for Anisotropic Wall-Bounded Flows", F.R. Menter, A.V. Garbaruk, and Y. Egorov.
EUCASS – 3rd European Conference for Aero-Space Sciences, July 6-9th 2009 Versailles
elbertj is offline   Reply With Quote

Old   December 22, 2010, 03:34
Default
  #8
New Member
 
Maolong LIU
Join Date: Apr 2010
Location: Japan
Posts: 28
Rep Power: 6
maolongliu is on a distinguished road
Does this model work well?
I use the formula of " Wallin, S. and A. Johansson (2000). "An explicit algebraic Reynolds stress model for incompressible and compressible turbulent flows." Journal of Fluid Mechanics 403: 89-132 ", it does not work quite well.
I want to try this one you use. Would you mind to send me the reference you use because I cannot find the file.
my mail: maolongliu@gmail.com
Thank you.

Quote:
Originally Posted by elbertj View Post
I used the formulation described here:
"Explicit Algebraic Reynolds Stress Models for Anisotropic Wall-Bounded Flows", F.R. Menter, A.V. Garbaruk, and Y. Egorov.
EUCASS – 3rd European Conference for Aero-Space Sciences, July 6-9th 2009 Versailles
maolongliu is offline   Reply With Quote

Old   December 26, 2010, 13:47
Default
  #9
Member
 
Markus Weinmann
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 77
Rep Power: 7
cfdmarkus is on a distinguished road
Hi Elbert,

I am also using the WJ model. The reference you are using seem much newer.
Would it be possible for you to send me copy as well please: mw405@soton.ac.uk

Thanks, Markus.
cfdmarkus is offline   Reply With Quote

Old   June 17, 2011, 11:07
Default
  #10
Senior Member
 
Florian Krause
Join Date: Mar 2009
Location: Munich
Posts: 103
Rep Power: 7
florian_krause is on a distinguished road
Quote:
Originally Posted by niklas View Post
N_(scalar(0.)*IIs_),
This is a good start if the dimensions of IIs_ and N_ are the same otherwise use another field
which has the same dimensions as N_ or a constructor like the one for nut_.
For that kind of complicated expressions you have to place it in here.
Code:
{
    bound(omega_, omega0_);

    nut_ = a1_*k_/max(a1_*omega_, F2()*mag(symm(fvc::grad(U_))));
//    nut_ = k_/(omega_+smallOmega_);
    nut_.correctBoundaryConditions();

    // calculation of N_ goes here ....

    printCoeffs();
}
Hi Niklas,
I recently had a similar issue when implementing Wilcox 1998 k-omega model (http://turbmodels.larc.nasa.gov/wilcox.html), which is different than the k-omega model implemented in OF (Wilcox 1988 k-omega model).

I have the following expression

Code:
    forAll(fBetaStar_, cellI)
    {
    if(xiK_[cellI] <= scalar(0))
        fBetaStar_[cellI] = scalar(1);
    else
        fBetaStar_[cellI] = (scalar(1)+680*sqr(xiK_[cellI]))/(scalar(1)+400*sqr(xiK_[cellI]));
    }
and I was wondering where to place it in the constructor. Well, I placed it where you suggested above and it works.

Why should it be placed there and how is that related to the complexity of the expression?

Thanks and best regards,
Florian
florian_krause 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
Modified k-e turbulence model UDF - help! Travis FLUENT 5 January 20, 2014 07:34
Centrifugal Pump and Turbulence Model Michiel CFX 12 January 25, 2010 03:20
turbulence model equation Andy Chen FLOW-3D 4 January 1, 2010 21:45
k-w Turbulence model implementation suneesh Main CFD Forum 4 November 23, 2005 17:35
turbulence model question Jason Wei Main CFD Forum 1 May 6, 2003 00:45


All times are GMT -4. The time now is 04:40.