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

OpenFOAM - Implement Change To Modelled Term Reynolds Stress Models (LRR & SSG)

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 2, 2024, 15:33
Default OpenFOAM - Implement Change To Modelled Term Reynolds Stress Models (LRR & SSG)
  #1
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

I am a PhD researcher based at the University of Leeds. I want to implement a change to the Reynolds Stress models in OpenFOAM (LRR & SSG).

One of the terms modelled in the LRR and SSG model (turbulent diffusive transport) is based on the generalised gradient diffusion model of Daly & Harlow (1970). Using this approach leads to numerical instabilities and robustness issues in solution.

Instead what I want to do is use the simplified gradient diffusion model of Shir (1973). This model is what is implemented in commerical CFD codes such as FLUENT and can improve solution robustness and accuracy.

However, I am really struggling to implement such a model as I am more of an OpenFOAM user with 0 experience in modifying.

Is there an expert out there who has experience in performing such procedures. I would greatly appreciate either being mentored or if they have done something similar to this, if they could share how exactly they did it?
Attached Images
File Type: jpg Turbulent Diffusive Transport Term.jpg (30.6 KB, 37 views)
sr786 is offline   Reply With Quote

Old   February 5, 2024, 10:13
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
To be honest, your question is far too open ... this explains why you haven't had any reply thus far. You'll find much more engagement if you can narrow it down to a specific question on a particular point.

Some thoughts from my side:
1. Learn how to implement a clone of the LRR model say, creating a myLRR model in your USERLIB library. Google a bit, and you will find some how-to guides (e.g. "chalmers openfoam new turbulence model" threw up a bunch of stuff for me - beware, some of it will be out of date since the coding around turbulence modelling has changed over the OF versions).

2. Once you have step 1 sorted, then start making the changes. Looking at LRR.C, the line you are interested in is:
Code:
fvm::laplacian(alpha*rho*DREff(), R)
(If this makes no sense, then spend some time researching what the fvm::laplacian class does!). You'll need to come up with an alternative for DREff() - should be pretty simple since you have all the necessary variables available.

In the end, the path to enlightenment in OpenFOAM is a painful one that requires a chunk of effort on your part - there's a LOT to take in. Luckily you're a PhD student, so have plenty of time! Good luck, and come back when you get stuck.
Tobermory is offline   Reply With Quote

Old   February 5, 2024, 15:04
Default
  #3
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

Thanks for the reply and advice.

I realised that touching the CFD source code is a skill that I am lacking and it will be extremely useful to bridge this gap. My experience with OpenFOAM is largely front-end as I transferred skills from using FLUENT (running stirred tank reactor simulations, single phase & multi phase with steady state and transient solvers using two-equation turbulence models for both softwares without issue). This is the first time I've noticed OpenFOAM & FLUENT have a difference in implementation which took a bit of reading around.

I am planning to do one of the training programs for cpp programming in OpenFOAM offered by OpenFOAM.org (I'm using OpenFOAM-9).

I have one question though regarding lines 244-255. I assume this is where the turbulent diffusivity equation has been defined? But I notice the terms look different to Daly & Harlow (equation 1 from original JPEG) and don't exactly match

template<class BasicTurbulenceModel>
tmp<volSymmTensorField> LRR<BasicTurbulenceModel>:REff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
"DREff",
(Cs_*(this->k_/this->epsilon_))*this->R_ + I*this->nu()
)
);
}
Tobermory likes this.
sr786 is offline   Reply With Quote

Old   February 5, 2024, 15:15
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
@sr786: congrats for picking up ideas so fast. The term this->nu() is a laminar contribution that is typically small, and therefore neglected.

@tobermory: I will steal you "paths of enlightment" expression, he he. Thank you for providing your ever short, concise and to the point answers. Much appreciated.
Tobermory likes this.
dlahaye is offline   Reply With Quote

Old   February 10, 2024, 06:34
Default
  #5
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

I've been thinking more about it

The two main lines of code are

1:

Code:
template<class BasicTurbulenceModel>
tmp<volSymmTensorField> LRR<BasicTurbulenceModel>: DREff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
"DREff",
(Cs_*(this->k_/this->epsilon_))*this->R_ + I*this->nu()
)
);
}
&

2.
Code:
fvm::laplacian(alpha*rho*DREff(), R)
I essentially want to change the terms modelled for the DREff() which will be reflected in the Laplacian equation by removing Cs and R and adding a new constant sigmak.

3:

Code:
template<class BasicTurbulenceModel>
tmp<volSymmTensorField> LRR<BasicTurbulenceModel>:DREff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
"DREff",
(this->nut_/sigmak_)+ I*this->nu()
)
);
}
I don't think I need to define nut as its already been defined in the file?

Code:
 template<class BasicMomentumTransportModel>
void LRR<BasicMomentumTransportModel>::correctNut()
{
    this->nut_ = this->Cmu_*sqr(k_)/epsilon_;
    this->nut_.correctBoundaryConditions();
    fvConstraints::New(this->mesh_).constrain(this->nut_);
}

Last edited by sr786; February 10, 2024 at 08:53.
sr786 is offline   Reply With Quote

Old   February 10, 2024, 06:58
Default
  #6
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
So in essence all I need to do is re-define DREff() which I don't believe is complicated as it involves arithmetic operators to manipulate the equation and introduce a new constant term sigmak_ and remove Cs_ (provided I don't need to define nut).

This is all in the .C file. Do I need to make a complementary change to the .H file if I am introducing a new constant term and removing an old constant term?
sr786 is offline   Reply With Quote

Old   February 10, 2024, 08:04
Default
  #7
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
Quote:
This is all in the .C file. Do I need to make a complementary change to the .H file if I am introducing a new constant term and removing an old constant term?
No, you could just make the edits you suggest in the .C file. My suggestion, though, is that you create a copy of the DREff function and call it something like DReffSimple, whilst leaving the old DREff in the coding. That way you will have better visibility of the change. Also, add plenty of comments in your code to remind you (and others who might pick the code up later) where the new correlation came from. If you do do this, then you'll need to add an entry into the .H file for the new function.
Tobermory is offline   Reply With Quote

Old   February 10, 2024, 08:50
Default
  #8
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

No worries so the header file is irrelevant regardless if I add a new constant to the .C file. I ask because the header file has all the constants from the .C file.

Code:
protected:

    // Protected data

        // Model coefficients

            dimensionedScalar Cmu_;

            dimensionedScalar C1_;
            dimensionedScalar C1s_;
            dimensionedScalar C2_;
            dimensionedScalar C3_;
            dimensionedScalar C3s_;
            dimensionedScalar C4_;
            dimensionedScalar C5_;

            dimensionedScalar Ceps1_;
            dimensionedScalar Ceps2_;
            dimensionedScalar Cs_;
            dimensionedScalar Ceps_;

        // Fields

            volScalarField k_;
            volScalarField epsilon_;
sr786 is offline   Reply With Quote

Old   February 10, 2024, 09:38
Default
  #9
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
No - it's not that the .H file is irrelevant (far from it), it's just that if you are just changing some of the terms inside the DREff function, without changing the parameters of the function, then the DREff entry in the .H file

Code:
         //- Return the effective diffusivity for R
         tmp<volSymmTensorField> DREff() const;
is still valid.
Tobermory is offline   Reply With Quote

Old   February 10, 2024, 09:51
Default
  #10
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Ah okay I see so it will recognise that a new term has been added (nut/sigmak) in my case. What about the model coefficients in the .H file surely do I not add a

dimensionedScalar sigmak_ 0.82;
sr786 is offline   Reply With Quote

Old   February 11, 2024, 08:30
Default
  #11
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

If I implement the change below I'm wondering if defining this class as symmetrictensor would still be valid as nut and sigmak_ are scalars?

Code:
template<class BasicTurbulenceModel>
tmp<volSymmTensorField> LRR<BasicTurbulenceModel>:DREff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
"DREff",
(this->nut_/sigmak_)+ I*this->nu()
)
);
}
I ask because it seems the implementation approach is similar to what is done for eddy viscosity models, look at excerpt below:

Code:
        //- Return the effective diffusivity for k
        tmp<volScalarField> DkEff() const
        {
            return tmp<volScalarField>
            (
                new volScalarField
                (
                    "DkEff",
                    (this->nut_/sigmak_ + this->nu())
                )
            );
        }
sr786 is offline   Reply With Quote

Old   February 11, 2024, 09:04
Default
  #12
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Yes because I've removed the Reynolds Stress Tensor, R(), from DREff, for the first term. The second term contains an Identity Tensor, I.

So if I try my original implementation of

Code:
template<class BasicTurbulenceModel>
tmp<volSymmTensorField> LRR<BasicTurbulenceModel>:DREff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
"DREff",
(this->nut_/sigmak_)+ I*this->nu()
)
);
}
It would be mathematically inconsistent because I am adding a scalar term (first term) with a tensor term (second term).

Should I just make DREff() a scalar, i.e., remove I from second term, or leave it as a tensor but multiply first term by I (same as second term)?
sr786 is offline   Reply With Quote

Old   February 12, 2024, 09:33
Default
  #13
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi I have attempted to start off by just compiling a new turbulence model for OpenFOAM-9 based on online resources. I tried using the kOmega tutorials first and was able to compile a new turbulence model.

I am now attempting to compile a new turbulence model for SSG, called simpleSSG. This is without making any modifications to base code barring changing the callsign to simpleSSG.

I am getting the following error:

Code:
 wmake libso .
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file mykinematicMomentumTransportModels.C
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude   -fPIC -c mykinematicMomentumTransportModels.C -o Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o
In file included from simpleSSG.H:210:0,
                 from mykinematicMomentumTransportModels.C:47:
simpleSSG.C: In instantiation of ‘Foam::RASModels::simpleSSG<BasicMomentumTransportModel>::simpleSSG(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&) [with BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>; Foam::RASModels::simpleSSG<BasicMomentumTransportModel>::alphaField = Foam::geometricOneField; Foam::RASModels::simpleSSG<BasicMomentumTransportModel>::rhoField = Foam::geometricOneField; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::RASModels::simpleSSG<BasicMomentumTransportModel>::transportModel = Foam::kinematicTransportModel]’:
/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude/RASModel.H:100:9:   required from ‘static Foam::autoPtr<Foam::RASModel<BasicMomentumTransportModel> > Foam::RASModel<BasicMomentumTransportModel>::adddictionaryConstructorToTable<RASModelType>::New(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&) [with RASModelType = Foam::RASModels::simpleSSG<Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel> >; BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>; Foam::RASModel<BasicMomentumTransportModel>::alphaField = Foam::geometricOneField; Foam::RASModel<BasicMomentumTransportModel>::rhoField = Foam::geometricOneField; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::RASModel<BasicMomentumTransportModel>::transportModel = Foam::kinematicTransportModel]’
/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude/RASModel.H:100:9:   required from ‘Foam::RASModel<BasicMomentumTransportModel>::adddictionaryConstructorToTable<RASModelType>::adddictionaryConstructorToTable(const Foam::word&) [with RASModelType = Foam::RASModels::simpleSSG<Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel> >; BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>]’
mykinematicMomentumTransportModels.C:48:1:   required from here
simpleSSG.C:228:14: error: ‘bound’ was not declared in this scope
         bound(epsilon_, this->epsilonMin_);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simpleSSG.C:228:14: note: suggested alternative: ‘found’
         bound(epsilon_, this->epsilonMin_);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         found
simpleSSG.C: In instantiation of ‘void Foam::RASModels::simpleSSG<BasicMomentumTransportModel>::correct() [with BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>]’:
mykinematicMomentumTransportModels.C:48:24:   required from here
simpleSSG.C:335:10: error: ‘bound’ was not declared in this scope
     bound(epsilon_, this->epsilonMin_);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
simpleSSG.C:335:10: note: suggested alternative: ‘found’
     bound(epsilon_, this->epsilonMin_);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     found
make: *** [/home/cfd/OpenFOAM/OpenFOAM-9/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o] Error 1
I do not know why this error appears as I have not changed the base model yet? Could anyone please give me advice on how to fix it?
sr786 is offline   Reply With Quote

Old   February 12, 2024, 10:13
Default
  #14
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14
Tobermory will become famous soon enough
Sounds like you are missing a header file (?) or library (libfiniteVolume.so) from your make command, maybe?
Tobermory is offline   Reply With Quote

Old   February 12, 2024, 11:31
Default
  #15
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

This is my set up in files

Code:
 mykinematicMomentumTransportModels.C


LIB = $(FOAM_LIBBIN)/mykinematicMomentumTransportModels
and my set up in options

Code:
 EXE_INC = \
    -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
    -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \

LIB_LIBS = \
    -ltransportModels \
    -lmomentumTransportModels \
    -lfiniteVolume \
    -lmeshTools
I think I already have the lfiniteVolume included. I'm a bit confused as to what's causing the issue.
sr786 is offline   Reply With Quote

Old   February 12, 2024, 15:10
Default
  #16
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
I have compiled two turbulence models "mykOmega" and "mykEpsilon" using the exact same method and there were no issues:

mykEpsilon

Code:
 wmake libso .
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file mykinematicMomentumTransportModels.C
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude   -fPIC -c mykinematicMomentumTransportModels.C -o Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude   -fPIC -fuse-ld=bfd -shared -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o -L/home/cfd/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/lib \
    -ltransportModels -lmomentumTransportModels -lfiniteVolume -lmeshTools  -o /home/cfd/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/lib/mykinematicMomentumTransportModels.so
mykOmega

Code:
 wmake libso .
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file mykinematicMomentumTransportModels.C
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude   -fPIC -c mykinematicMomentumTransportModels.C -o Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude   -fPIC -fuse-ld=bfd -shared -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o -L/home/cfd/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/lib \
    -ltransportModels -lmomentumTransportModels -lfiniteVolume -lmeshTools  -o /home/cfd/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/lib/mykinematicMomentumTransportModels.so
The only deviation is when I compile the SSG model? I've also noticed a similar issue compiling the LRR model too

Code:
 wmake libso .
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file mykinematicMomentumTransportModels.C
g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude   -fPIC -c mykinematicMomentumTransportModels.C -o Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o
In file included from myLRR.H:219:0,
                 from mykinematicMomentumTransportModels.C:49:
myLRR.C: In instantiation of ‘Foam::RASModels::myLRR<BasicMomentumTransportModel>::myLRR(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&) [with BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>; Foam::RASModels::myLRR<BasicMomentumTransportModel>::alphaField = Foam::geometricOneField; Foam::RASModels::myLRR<BasicMomentumTransportModel>::rhoField = Foam::geometricOneField; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::RASModels::myLRR<BasicMomentumTransportModel>::transportModel = Foam::kinematicTransportModel]’:
/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude/RASModel.H:100:9:   required from ‘static Foam::autoPtr<Foam::RASModel<BasicMomentumTransportModel> > Foam::RASModel<BasicMomentumTransportModel>::adddictionaryConstructorToTable<RASModelType>::New(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&) [with RASModelType = Foam::RASModels::myLRR<Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel> >; BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>; Foam::RASModel<BasicMomentumTransportModel>::alphaField = Foam::geometricOneField; Foam::RASModel<BasicMomentumTransportModel>::rhoField = Foam::geometricOneField; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::RASModel<BasicMomentumTransportModel>::transportModel = Foam::kinematicTransportModel]’
/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude/RASModel.H:100:9:   required from ‘Foam::RASModel<BasicMomentumTransportModel>::adddictionaryConstructorToTable<RASModelType>::adddictionaryConstructorToTable(const Foam::word&) [with RASModelType = Foam::RASModels::myLRR<Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel> >; BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>]’
mykinematicMomentumTransportModels.C:50:1:   required from here
myLRR.C:219:14: error: ‘bound’ was not declared in this scope
         bound(epsilon_, this->epsilonMin_);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myLRR.C:219:14: note: suggested alternative: ‘found’
         bound(epsilon_, this->epsilonMin_);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         found
myLRR.C: In instantiation of ‘void Foam::RASModels::myLRR<BasicMomentumTransportModel>::correct() [with BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>]’:
mykinematicMomentumTransportModels.C:50:20:   required from here
myLRR.C:325:10: error: ‘bound’ was not declared in this scope
     bound(epsilon_, this->epsilonMin_);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myLRR.C:325:10: note: suggested alternative: ‘found’
     bound(epsilon_, this->epsilonMin_);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     found
make: *** [/home/cfd/OpenFOAM/OpenFOAM-9/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o] Error 1
sr786 is offline   Reply With Quote

Old   February 14, 2024, 04:11
Default
  #17
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
Are you sure that mykEpsilon.C and mykOmegas.C are compiled?

Rephrased: do you the the object files mykEpsilon.o and mykOmegas.o?

Can you share here the output of the command "nm -g mykEpsilon.o" to make sure that the mykEpsilon.o is effectively there?

Last edited by dlahaye; February 14, 2024 at 04:20. Reason: Added
dlahaye is offline   Reply With Quote

Old   February 14, 2024, 04:19
Default
  #18
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
Hi,

Yes they are compiled. I’ve ran a test case using pitzDaily tutorial and the new kEpsilon and kOmega models were recognised after compilation. I’m stuck as to why Reynolds Stress models are failing to compile
sr786 is offline   Reply With Quote

Old   February 14, 2024, 04:45
Default
  #19
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 798
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
How do you make sure that the new mykEpsilon and mykOmegas are picked up by the solver as you claim?

Thx!
dlahaye is offline   Reply With Quote

Old   February 14, 2024, 06:35
Default
  #20
Member
 
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3
sr786 is on a distinguished road
I went into the test case, changed the turbulence model in constant file to mykOmega and mykEpsilon and the solver recognised the terms. I also wrote the word 'test' in the turbulence model, which I knew would be invalid, and the solver gave me alternative suggestions for turbulence models which included the new ones mykEpsilon and mykOmega.
sr786 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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 06:29
STATEMENT about how to implement new turbulent models in OpenFOAM PeterShi OpenFOAM Running, Solving & CFD 0 February 28, 2017 08:18
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04
Reynolds Stress Model in OpenFOAM harsha_kulkarni OpenFOAM Pre-Processing 0 August 3, 2014 03:23
How the trace term of SGS stress tensor implemented in Openfoam star shower OpenFOAM Running, Solving & CFD 0 March 3, 2012 09:56


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