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

Help with if statement

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

Like Tree2Likes
  • 2 Post By alexeym

Reply
 
LinkBack Thread Tools Display Modes
Old   September 6, 2013, 17:26
Default Help with if statement
  #1
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
Hello,

I am trying to modify the k-omega model to implement Wilcox 2006 version.

I want to use an if statement to assign a value to a constant, "alplhad", depending on the sign of partial(k)/partial(x_j)*partial(omega)/partial(x_j) but I keep on getting compile errors caused by the if statement. I know that the solution has to be quite simple but I just can't figure it out!

Please help!

Below is my definition of alphadCheck and that for the if statement.

I have also attached copies of my .C and .H files

Code:
const volScalarField alphadCheck
    (
        mag(fvc::grad(k_) & fvc::grad(omega_))
    ); //Added to check alphad
Then, I have an if statement:

Code:
if ( alphadCheck <= scalar(0.0)) 
    {
       alphad_=alphado_ ; 
    }
When I try to compile, I get the following error:

Code:
/kOmega2006Changes2$ wmake libso
Making dependency list for source file kOmega2006C2.C
SOURCE=kOmega2006C2.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/turbulenceModels -I/opt/openfoam220/src/transportModels -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/kOmega2006C2.o
kOmega2006C2.C: In member function ‘virtual void Foam::incompressible::RASModels::kOmega2006C2::correct()’:
kOmega2006C2.C:300:31: error: no match for ‘operator<=’ in ‘alphadCheck <= 0.0’
kOmega2006C2.C:300:31: note: candidates are:
/opt/openfoam220/src/OpenFOAM/lnInclude/UList.C:224:6: note: bool Foam::UList<T>::operator<=(const Foam::UList<T>&) const [with T = double]
/opt/openfoam220/src/OpenFOAM/lnInclude/UList.C:224:6: note:   no known conversion for argument 1 from ‘double’ to ‘const Foam::UList<double>&’
/opt/openfoam220/src/OpenFOAM/lnInclude/VectorSpaceI.H:693:13: note: template<class Form, class Cmpt, int nCmpt> bool Foam::operator<=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&, const Foam::VectorSpace<Form, Cmpt, nCmpt>&)
make: *** [Make/linux64GccDPOpt/kOmega2006C2.o] Error 1
Thank you ahead of time!
Attached Files
File Type: c kOmega2006C2.C (7.5 KB, 3 views)
File Type: h kOmega2006C2.H (5.9 KB, 0 views)
CHARLES is offline   Reply With Quote

Old   September 9, 2013, 12:50
Default
  #2
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
Anyone please?
CHARLES is offline   Reply With Quote

Old   September 10, 2013, 02:21
Default
  #3
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 12
Bernhard is on a distinguished road
What are you trying to do? Your are comparing a volScalarField with a scalar. Looks like that is not defined in OpenFOAM.
Bernhard is offline   Reply With Quote

Old   September 10, 2013, 03:16
Default
  #4
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 156
Rep Power: 8
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
Maybe you have forgotten to wrap a loop over all cells around the if statement and compare each cell individually?
jhoepken is offline   Reply With Quote

Old   September 10, 2013, 05:39
Default
  #5
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
Quote:
Originally Posted by CHARLES View Post
Code:
const volScalarField alphadCheck
    (
        mag(fvc::grad(k_) & fvc::grad(omega_))
    ); //Added to check alphad
Then, I have an if statement:

Code:
if ( alphadCheck <= scalar(0.0)) 
    {
       alphad_=alphado_ ; 
    }
Maybe it can be rewritten as
Code:
alphad_ = 0.5*(1 - sign(alphaCheck))*alphado_ + 0.5*(1 + sign(alphaCheck))*alphad_;
Or you can loop over the field with

Code:
forAll(alphad_, cellI))
{
    if ( alphadCheck[cellI] <= scalar(0.0)) 
    {
       alphad_[cellI]=alphado_[cellI]; 
    }
}
as suggested by Jens Höpken.
jhoepken and CHARLES like this.
alexeym is offline   Reply With Quote

Old   September 10, 2013, 19:49
Default
  #6
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
Thank you for replying!

Quote:
What are you trying to do? Your are comparing a volScalarField with a scalar. Looks like that is not defined in OpenFOAM.
@Bernhard
I am trying to add a routine that checks the sign of partial(k)/partial(x_j)*partial(omega)/partial(x_j) and assigns a value to "alphad" according on the result of the sign check. However, I have never modified OpenFOAM so I don't know where to place the extra code. Now I understand why I was getting an error comparing the volScalaraField to the scalar though!

Jens Höpken's idea to loop over all cells was in fact missing from my routine!!
I added the following:

Code:
forAll(alphad_, celli)
{
if ( alphadCheck[celli] <= scalar(0.0)) //check this!
    {
       alphad_[celli]=alphado_[celli] ; 
    }
}
However, I am still getting compile errors:

Code:
Making dependency list for source file kOmega2006C2.C
SOURCE=kOmega2006C2.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/turbulenceModels -I/opt/openfoam220/src/transportModels -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/kOmega2006C2.o
kOmega2006C2.C: In member function ‘virtual void Foam::incompressible::RASModels::kOmega2006C2::correct()’:
kOmega2006C2.C:284:26: error: ‘celli’ was not declared in this scope
kOmega2006C2.C:301:1: error: ‘Foam::dimensionedScalar’ has no member named ‘size’
In file included from /opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.H:309:0,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedScalar.H:38,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedTypes.H:31,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.H:43,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                 from /opt/openfoam220/src/finiteVolume/lnInclude/volFields.H:37,
                 from /opt/openfoam220/src/finiteVolume/lnInclude/nearWallDist.H:39,
                 from /opt/openfoam220/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:51,
                 from /opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude/RASModel.H:47,
                 from kOmega2006C2.H:65,
                 from kOmega2006C2.C:26:
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.C: In member function ‘Foam::dimensioned<typename Foam::pTraits<T>::cmptType> Foam::dimensioned<Type>::component(Foam::direction) const [with Type = double, typename Foam::pTraits<T>::cmptType = double, Foam::direction = unsigned char]’:
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.C:344:23:   instantiated from ‘Foam::dimensioned<typename Foam::pTraits<T>::cmptType> Foam::dimensioned<Type>::operator[](Foam::direction) const [with Type = double, typename Foam::pTraits<T>::cmptType = double, Foam::direction = unsigned char]’
kOmega2006C2.C:305:21:   instantiated from here
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.C:236:5: error: request for member ‘component’ in ‘((const Foam::dimensioned<double>*)this)->Foam::dimensioned<double>::value_’, which is of non-class type ‘const double’
make: *** [Make/linux64GccDPOpt/kOmega2006C2.o] Error 1
sebastian@navier1:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/kOmega2006Changes2$
I have tried looking at the LRR.C file to see how they define the looping index, "celli" but it is never defined. In the error, the computer says that "celli" wasn't declared in this scope...?

The modified .C and .H files are attached if that's of any help.
Attached Files
File Type: c kOmega2006C2.C (7.6 KB, 5 views)
File Type: h kOmega2006C2.H (5.9 KB, 3 views)
CHARLES is offline   Reply With Quote

Old   September 11, 2013, 01:18
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
Quote:
Originally Posted by CHARLES View Post
Jens Höpken's idea to loop over all cells was in fact missing from my routine!!
I added the following:

Code:
forAll(alphad_, celli)
{
if ( alphadCheck[celli] <= scalar(0.0)) //check this!
    {
       alphad_[celli]=alphado_[celli] ; 
    }
}
However, I am still getting compile errors:

Code:
Making dependency list for source file kOmega2006C2.C
SOURCE=kOmega2006C2.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/turbulenceModels -I/opt/openfoam220/src/transportModels -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/kOmega2006C2.o
kOmega2006C2.C: In member function ‘virtual void Foam::incompressible::RASModels::kOmega2006C2::correct()’:
kOmega2006C2.C:284:26: error: ‘celli’ was not declared in this scope
kOmega2006C2.C:301:1: error: ‘Foam::dimensionedScalar’ has no member named ‘size’
In file included from /opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.H:309:0,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedScalar.H:38,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedTypes.H:31,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.H:43,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                 from /opt/openfoam220/src/finiteVolume/lnInclude/volFields.H:37,
                 from /opt/openfoam220/src/finiteVolume/lnInclude/nearWallDist.H:39,
                 from /opt/openfoam220/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:51,
                 from /opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude/RASModel.H:47,
                 from kOmega2006C2.H:65,
                 from kOmega2006C2.C:26:
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.C: In member function ‘Foam::dimensioned<typename Foam::pTraits<T>::cmptType> Foam::dimensioned<Type>::component(Foam::direction) const [with Type = double, typename Foam::pTraits<T>::cmptType = double, Foam::direction = unsigned char]’:
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.C:344:23:   instantiated from ‘Foam::dimensioned<typename Foam::pTraits<T>::cmptType> Foam::dimensioned<Type>::operator[](Foam::direction) const [with Type = double, typename Foam::pTraits<T>::cmptType = double, Foam::direction = unsigned char]’
kOmega2006C2.C:305:21:   instantiated from here
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedType.C:236:5: error: request for member ‘component’ in ‘((const Foam::dimensioned<double>*)this)->Foam::dimensioned<double>::value_’, which is of non-class type ‘const double’
make: *** [Make/linux64GccDPOpt/kOmega2006C2.o] Error 1
sebastian@navier1:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/kOmega2006Changes2$
As you can see from the error message: you are trying to iterate over scalar but forAll statement usually used for iterating over a field. And your alphad_ and alphado_ are really scalars:

Code:
    alphad_
    (
        dimensioned<scalar>::lookupOrAddToDict
        (
            "alphad",
            coeffDict_,
            0.125 //sigma_d=1/8 in 2006
        )
    ),
            
    alphado_
    (
        dimensioned<scalar>::lookupOrAddToDict
        (
            "alphado",
            coeffDict_,
            0.0 //sigma_d=0 in if statement of 2006 ***
        )
    ),
If these values are something you'd like to recalculate (and if this parameters should vary) for the whole domain then you'd create volScalarField similar to alphadCheck.
alexeym is offline   Reply With Quote

Old   September 12, 2013, 14:54
Default
  #8
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
@alexym

Thank you for your suggestion! Changing them to a VolScalarField solved the error but I have now created new ones...

I have some questions that, if answered, may point me in the right direction instead of blindly trying to fix the errors:

1. How should I define a volScalarField?
For example, for alphadCheck, I have defined it as :
Code:
 const volScalarField alphadCheck
    (
        mag(fvc::grad(k_) & fvc::grad(omega_))
    );
However, I think this is incorrect because what I intend for alphadCheck to do is to check if the sign of partial(k)/partial(x_j)*partial(omega)/partial(x_j) for each cell. So, I should really have 'sign(fvc::grad....)' instead of 'mag(fvc::grad...)' ?

In order for alphadCheck to go through each cell in the domain, it should be placed within the forAll(alphad_, celli) loop, but first I have to define it somehow, which is where I'm stuck.

Should I be defining these volScalarFields in the "void kOmega::correct()" section or outside of it?

2. I want to be able to change the value of alphad_ on each cell (if necessary), depending on the result of alphadCheck. Should alphad_ be defined as a volScalarField since there will be a corresponding alphad_ value for each cell? If so, how can I initialize alphad_ (all of the components should be set equal to .125 for the first iteration and then changed according to results from alphadCheck (if necessary))?

3. How do I define the index for the forAll loop (i.e.: celli)?
I would like to use a forAll loop in the following way:

Code:
forAll(alphad_,celli)
{
if ( sign(alphaCheck[celli]) #IS NEGATIVE )
{
alphad_[celli]=scalar(0.0) ;
}
}
Thank you very much for taking the time to answer my questions.

The most recent .C and .H files are attached
Attached Files
File Type: c kOmega2006C2.C (7.8 KB, 5 views)
File Type: h kOmega2006C2.H (6.0 KB, 3 views)
CHARLES is offline   Reply With Quote

Old   September 12, 2013, 16:34
Default
  #9
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
1. Well, you can try to create it as you've described it in the post. Though I'm not quite sure that mag(...) can be negative. Do I get it right and you'd like to check sign of scalar product of two gradient vectors? Then you can define it as volScalarField alphaCheck_(fvc::grad(k_) & fvc::grad(omega_)) or volScalarField alphaCheck_(sign(fvc::grad(k_) & fvc::grad(omega_))). Though as you'll check alphaCheck_[cellI] then maybe additional call to sign is not necessary.

You can define this variables (alphaCheck_ and alphad_) as a private properties of kOmega2006 and create then in constructor. Or as alphaCheck_ is recalculated on every update call you can create it in update method as const volScalarField& alphaCheck_(fvc::grad(k_) & fvc::grad(omega_)).

2. Surely there are more correct ways but for alphad_ you can try to use something like volScalarField alphad_(0.125 + 0.0*nut_).

3. You don't need to define index variable as forAll is the macro (documentation) and it will define index variable for you. So you can just use
Code:
forAll(alphad_, cellI)
{
     ...something using cellI... 
}
and it will be preprocessed into

Code:
for (Foam::label cellI=0; cellI<(alphad_).size(); cellI++)
{
    ...something using cellI... 
}
alexeym is offline   Reply With Quote

Old   September 12, 2013, 18:40
Default
  #10
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
@alexeym

Thank you for replying quickly!
You are correct: I want to check the sign of the scalar product of two gradient vectors.

I have defined alphaCheck_ and alphad_ as you suggested:

Code:
const volScalarField alphadCheck_
    (
        fvc::grad(k_) & fvc::grad(omega_)
    ); //Added to check alphad  


const volScalarField alphad_
    (
        0.125+0.0*nut_
    );
Which seems to have decreased the number of errors I was getting.


I have also implemented the forAll as:
Code:
forAll(alphad_, cellI)
{
if ( neg(alphadCheck_[cellI]) )  
    {
       alphad_[cellI]=scalar(0.0) ; 
    }
}
This should only modify the contents of alphad_ for the respective cell if the value of alphadCheck_[cellI] is negative.

Below are the errors I am still getting:
Code:
sebastian@navier1:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/kOmega2006Changes3$ wmake libso
Making dependency list for source file kOmega2006C2.C
SOURCE=kOmega2006C2.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/turbulenceModels -I/opt/openfoam220/src/transportModels -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/kOmega2006C2.o


kOmega2006C2.C: In constructor ‘Foam::incompressible::RASModels::kOmega2006C2::kOmega2006C2(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&, const Foam::word&)’:
kOmega2006C2.C:160:5: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
kOmega2006C2.C:160:5: note: candidates are:
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note:   candidate expects 4 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note:   candidate expects 3 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note:   candidate expects 1 argument, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note:   candidate expects 1 argument, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dictionary&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note:   candidate expects 3 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::Field<TypeR>&, const Foam::PtrList<PatchField<Type> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note:   candidate expects 4 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note:   candidate expects 4 arguments, 0 provided
kOmega2006C2.C:160:5: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
kOmega2006C2.C:160:5: note: candidates are:
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note:   candidate expects 4 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note:   candidate expects 3 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note:   candidate expects 1 argument, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note:   candidate expects 1 argument, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dictionary&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note:   candidate expects 3 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::Field<TypeR>&, const Foam::PtrList<PatchField<Type> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note:   candidate expects 4 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note:   candidate expects 4 arguments, 0 provided
kOmega2006C2.C: In member function ‘virtual void Foam::incompressible::RASModels::kOmega2006C2::correct()’:
kOmega2006C2.C:294:33: error: assignment of read-only location ‘alphad_.Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::<anonymous>.Foam::DimensionedField<double, Foam::volMesh>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double, Foam::label = int](cellI)’
make: *** [Make/linux64GccDPOpt/kOmega2006C2.o] Error 1
sebastian@navier1:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/kOmega2006Changes3$
CHARLES is offline   Reply With Quote

Old   September 13, 2013, 02:12
Default
  #11
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
Well...

1. As you'd like to change alphad_ it should not be declared as const. This will fix the last error.

2. On the other hand if you create alphad_ as
Code:
volScalarField alphad_
    (
        0.125+0.0*nut_
    );
It will compile but there will be run-time error as 0.0*nut_ will have units of nut_ and 0.125 is dimensionless. So I've decided to move alphad_ initialisation to constructor of the class:
Code:
...
    alphad_
    (
        IOobject
        (
            "alphad_",
            runTime_.timeName(),
            mesh_,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh_,
        dimless
    )
{
    bound(k_, kMin_);
    ...
And you don't need to redeclare this variable in update method.

3. And finally the error with very long description. For some strange reason I wasn't able to build library from your source files. So I've taken original kOmega model and added modifications from your source files. After this I was able to compile library. You can find archive with source files and wmake configuration attached to the message. To build library you just run 'wmake libso' in the folder.
Attached Files
File Type: gz kOmega2006.tar.gz (3.2 KB, 2 views)
alexeym is offline   Reply With Quote

Old   September 13, 2013, 13:06
Default
  #12
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
Thank you! That definitely fixed the last error.

I went through line by line and compared all of the files that you kindly sent to me and I found a few differences which may explain why yours is compiling and mine isn't. Below you'll find segments of your code with comments of how it differs from mine:

In kOmega2006.C:
Code:
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

defineTypeNameAndDebug(kOmega, 0);
addToRunTimeSelectionTable(RASModel, kOmega, dictionary);
The name in your files was never changed from kOmega to kOmega2006

Code:
// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
tmp<volSymmTensorField> kOmega::R() const
{
    return tmp<volSymmTensorField>
    (
        new volSymmTensorField
        (
            IOobject
            (
                "R",
                runTime_.timeName(),
                mesh_,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
            k_.boundaryField().types()
        )
    );
.
.
.
I have changed all of the kOmega's to match the name of my model. In the file that you sent, they would be changed to kOmega2006.

On line 262, your file has
Code:
volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));
Mine says:
volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_))));


In kOmega2006.H:
Again, I have changed all of my instances from kOmega to kOmega2006

Our files and options in Make are the same.

The error that was generated this time around was:
Code:
:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/kOmega2006Changes3$ wmake libso
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file kOmega2006C2.C
SOURCE=kOmega2006C2.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/turbulenceModels -I/opt/openfoam220/src/transportModels -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/meshTools/lnInclude -I/opt/openfoam220/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/kOmega2006C2.o
kOmega2006C2.C: In constructor ‘Foam::incompressible::RASModels::kOmega2006C2::kOmega2006C2(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&, const Foam::word&)’:
kOmega2006C2.C:173:5: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
kOmega2006C2.C:173:5: note: candidates are:
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note:   candidate expects 4 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note:   candidate expects 3 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note:   candidate expects 1 argument, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note:   candidate expects 1 argument, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dictionary&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note:   candidate expects 3 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note:   candidate expects 2 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::Field<TypeR>&, const Foam::PtrList<PatchField<Type> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note:   candidate expects 4 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note:   candidate expects 5 arguments, 0 provided
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam220/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note:   candidate expects 4 arguments, 0 provided
make: *** [Make/linux64GccDPOpt/kOmega2006C2.o] Error 1
:~/OpenFOAM/sebastian-2.2.0/src/turbulenceModels/incompressible/RAS/kOmega2006Changes3$
Alexey, I really appreciate the amount of time you've take to help me solve this problem.

I have attached my version of your last attachment.
Attached Files
File Type: gz MykOmega.tar.gz (8.1 KB, 2 views)
CHARLES is offline   Reply With Quote

Old   September 13, 2013, 17:14
Default
  #13
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
You are right, I forgot to change the name in all places. This time I've fixed it.

I don't know why, there's no major differences between our file sets (diff -u kOmega2006.* kOmega2006C2.* gives only lines with names of the classes). Also difference in

Code:
volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));
and

Code:
volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_))));
caused by different code bases. In 2.2.0 your variant is used, in 2.2.1 - new variant. It's rather funny cause in transition between 2.2.0 and 2.2.1 developers decided to change naming of G field and in 2.2.0 it is type() + ".G" while in 2.2.1 it is type() + ":G".

As I don't know the reason for error while compiling your sources, so I just attach my variant (with added 2006 in the name, and I think I've changed the name of the class in all necessary places). Hope this will help.
Attached Files
File Type: gz kOmega2006.tar.gz (3.2 KB, 2 views)
alexeym is offline   Reply With Quote

Old   September 17, 2013, 12:58
Default
  #14
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
alexeym,

IT FINALLY COMPILED!!! :0

I found out why I was having problems...

In the .C file, I was missing the first "&" in
Code:
 const volScalarField& alphadCheck_(fvc::grad(k_) & fvc::grad(omega_));
In the .H file, under protected Fields, I had listed
Code:
volScalarField alphaCheck_;
but it is not in your .H file.

Can you explain why you don't have it?
CHARLES is offline   Reply With Quote

Old   September 17, 2013, 14:03
Default
  #15
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20
alexeym will become famous soon enoughalexeym will become famous soon enough
Quote:
Originally Posted by CHARLES View Post
alexeym,

In the .H file, under protected Fields, I had listed
Code:
volScalarField alphaCheck_;
but it is not in your .H file.

Can you explain why you don't have it?
I create temporary alphaCheck_ field on every call to correct method (so I don't need this field on the class level) as I thought you only need this variable in correct() method. If you're going to use in other methods you can declare it as protected class property and change

Code:
const volScalarField& alphaCheck_(fvc::grad(k_) & fvc::grad(omega_));
to

Code:
alphaCheck_ = fvc::grad(k_) & fvc::grad(omega_);
Otherwise redeclaration of the alphaCheck_ in the method will shadow protected property.
alexeym is offline   Reply With Quote

Old   September 18, 2013, 18:29
Default
  #16
Member
 
CHARLES
Join Date: May 2013
Posts: 46
Rep Power: 4
CHARLES is on a distinguished road
Got it!

alexeym, Thank you so much for all of your help!!

I am going to run a few test cases and I will share the results and the source code for the slightly modified model.
CHARLES is offline   Reply With Quote

Reply

Tags
openfoam-2.2.0

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
USING IF statement in a UDF for defining Velocity profile at Inlet amir2920 Fluent UDF and Scheme Programming 3 May 23, 2013 23:46
Restricting area in if statement Blackhawks84 Fluent UDF and Scheme Programming 4 July 22, 2012 16:50
If statement question mariam.sara CFX 3 May 24, 2012 02:33
Weak statement for Galerkin Method rugabug Main CFD Forum 0 March 26, 2010 20:19
Problem Statement balkrishna Main CFD Forum 0 October 6, 2009 23:55


All times are GMT -4. The time now is 08:12.