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

Problem in Implementing a non-linear SGS model

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

Like Tree1Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   November 20, 2014, 00:00
Default Problem in Implementing a non-linear SGS model
  #1
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Hi, all:
I want to implement a non-linear SGS model into OF. However, as I read from the source code that the GenSGSStress only works with linear model. Is there anyone who have similar experience about that? Any suggestion is OK.


Xianbei
huangxianbei is offline   Reply With Quote

Old   November 20, 2014, 03:33
Default
  #2
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
After reading the source code, I think it's probably needed to modify the GenEddyVisc.C or GenSGSStress.C, the formula of devBeff,depending on which kind of model you want to solve. Because the solver will solve this part
huangxianbei is offline   Reply With Quote

Old   November 20, 2014, 08:52
Default
  #3
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
it's actually the right way to modify the GenEddyVisc into GennonlinearSGS, the problem remains is that how to add a new namespace into OpenFoam, as in LESModel.C, nuSgs is transferred to GenEddyVisc, so I should modify this file to something like LESModelnonlinear.

However, when I copied LESModel.C and LESModel.H into a new folder(also the make folder), it returns that no rule to create .dep
huangxianbei is offline   Reply With Quote

Old   November 20, 2014, 21:44
Default
  #4
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Hi,all:
As nonlinear model is not compatible with the made-in code, I need to deal with the SGS stress instead of the eddy viscosity. So the nuSgs used in the conventional model should be replaced by a volTensorField representing the SGS stress.
However, in the namespace of LESModel, there are too many places where nuSgs is used, so I'd like to create a new namespace called LESNonlinearModel

However, when I compile, it returns that:

Code:
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::incompressible::LESNonlinearModel::correct(Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> > const&)':
LESNonlinearModel.C:(.text+0x272): undefined reference to `Foam::incompressible::turbulenceModel::correct()'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::incompressible::LESNonlinearModel::LESNonlinearModel(Foam::word const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&)':
LESNonlinearModel.C:(.text+0x867): undefined reference to `Foam::incompressible::turbulenceModel::turbulenceModel(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&)'
LESNonlinearModel.C:(.text+0xba3): undefined reference to `Foam::LESdelta::New(Foam::word const&, Foam::fvMesh const&, Foam::dictionary const&)'
LESNonlinearModel.C:(.text+0xbf7): undefined reference to `Foam::surfaceInterpolation::deltaCoeffs() const'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::incompressible::turbulenceModel::type() const':
LESNonlinearModel.C:(.text._ZNK4Foam14incompressible15turbulenceModel4typeEv[Foam::incompressible::turbulenceModel::type() const]+0x3): undefined reference to `Foam::incompressible::turbulenceModel::typeName'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::fvPatchField<Foam::Tensor<double> >::type() const':
LESNonlinearModel.C:(.text._ZNK4Foam12fvPatchFieldINS_6TensorIdEEE4typeEv[Foam::fvPatchField<Foam::Tensor<double> >::type() const]+0x3): undefined reference to `Foam::fvPatchField<Foam::Tensor<double> >::typeName'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::type() const':
LESNonlinearModel.C:(.text._ZNK4Foam14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEE4typeEv[Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::type() const]+0x3): undefined reference to `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::typeName'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh>::type() const':
LESNonlinearModel.C:(.text._ZNK4Foam16DimensionedFieldINS_6TensorIdEENS_7volMeshEE4typeEv[Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh>::type() const]+0x3): undefined reference to `Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh>::typeName'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::incompressible::turbulenceModel::addturbulenceModelConstructorToTable<Foam::incompressible::LESNonlinearModel>::~addturbulenceModelConstructorToTable()':
LESNonlinearModel.C:(.text._ZN4Foam14incompressible15turbulenceModel36addturbulenceModelConstructorToTableINS0_17LESNonlinearModelEED2Ev[_ZN4Foam14incompressible15turbulenceModel36addturbulenceModelConstructorToTableINS0_17LESNonlinearModelEED5Ev]+0x1): undefined reference to `Foam::incompressible::turbulenceModel::destroyturbulenceModelConstructorTables()'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const':
LESNonlinearModel.C:(.text._ZNK4Foam14objectRegistry12lookupObjectINS_14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEEEEERKT_RKNS_4wordE[Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const]+0x122): undefined reference to `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::typeName'
LESNonlinearModel.C:(.text._ZNK4Foam14objectRegistry12lookupObjectINS_14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEEEEERKT_RKNS_4wordE[Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const]+0x1a5): undefined reference to `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::typeName'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::fv::gradScheme<Foam::Vector<double> >::New(Foam::fvMesh const&, Foam::Istream&)':
LESNonlinearModel.C:(.text._ZN4Foam2fv10gradSchemeINS_6VectorIdEEE3NewERKNS_6fvMeshERNS_7IstreamE[Foam::fv::gradScheme<Foam::Vector<double> >::New(Foam::fvMesh const&, Foam::Istream&)]+0x1d): undefined reference to `Foam::fv::debug'
LESNonlinearModel.C:(.text._ZN4Foam2fv10gradSchemeINS_6VectorIdEEE3NewERKNS_6fvMeshERNS_7IstreamE[Foam::fv::gradScheme<Foam::Vector<double> >::New(Foam::fvMesh const&, Foam::Istream&)]+0x3c): undefined reference to `Foam::fv::gradScheme<Foam::Vector<double> >::IstreamConstructorTablePtr_'
LESNonlinearModel.C:(.text._ZN4Foam2fv10gradSchemeINS_6VectorIdEEE3NewERKNS_6fvMeshERNS_7IstreamE[Foam::fv::gradScheme<Foam::Vector<double> >::New(Foam::fvMesh const&, Foam::Istream&)]+0x234): undefined reference to `Foam::fv::gradScheme<Foam::Vector<double> >::IstreamConstructorTablePtr_'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricBoundaryField(Foam::DimensionedField<Foam::Tensor<double>, Foam::volMesh> const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField const&)':
LESNonlinearModel.C:(.text._ZN4Foam14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEE22GeometricBoundaryFieldC2ERKNS_16DimensionedFieldIS2_S4_EERKS6_[_ZN4Foam14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEE22GeometricBoundaryFieldC5ERKNS_16DimensionedFieldIS2_S4_EERKS6_]+0x3c): undefined reference to `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::debug'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const&)':
LESNonlinearModel.C:(.text._ZN4Foam14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEEC2ERKS5_[_ZN4Foam14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEEC5ERKS5_]+0xfe): undefined reference to `Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::debug'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::tmp<Foam::GeometricField<Foam::outerProduct<Foam::Vector<double>, Foam::Vector<double> >::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad<Foam::Vector<double> >(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&)':
LESNonlinearModel.C:(.text._ZN4Foam3fvc4gradINS_6VectorIdEEEENS_3tmpINS_14GeometricFieldINS_12outerProductIS3_T_E4typeENS_12fvPatchFieldENS_7volMeshEEEEERKNS5_IS7_SA_SB_EE[Foam::tmp<Foam::GeometricField<Foam::outerProduct<Foam::Vector<double>, Foam::Vector<double> >::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad<Foam::Vector<double> >(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&)]+0xa5): undefined reference to `Foam::fvSchemes::gradScheme(Foam::word const&) const'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `Foam::fvPatchField<Foam::Tensor<double> >::snGrad() const':
LESNonlinearModel.C:(.text._ZNK4Foam12fvPatchFieldINS_6TensorIdEEE6snGradEv[Foam::fvPatchField<Foam::Tensor<double> >::snGrad() const]+0x17): undefined reference to `Foam::fvPatch::deltaCoeffs() const'
Make/linux64GccDPOpt/LESNonlinearModel.o: In function `_GLOBAL__sub_I_LESNonlinearModel.C':
LESNonlinearModel.C:(.text.startup+0xaf): undefined reference to `Foam::incompressible::turbulenceModel::constructturbulenceModelConstructorTables()'
LESNonlinearModel.C:(.text.startup+0xc7): undefined reference to `Foam::incompressible::turbulenceModel::turbulenceModelConstructorTablePtr_'
collect2: ld
huangxianbei is offline   Reply With Quote

Old   November 21, 2014, 00:49
Default
  #5
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Problem solved
Here is the new class named LESNonlinearModel

LESNonlinear.tar.gz
Also, the GenEddyVisc is modified so that nuSgs here represents the SGS stress

The problem remains that how to apply this to the nonlinear model
huangxianbei is offline   Reply With Quote

Old   November 21, 2014, 05:35
Default
  #6
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
update again!

I have checked the above code and didn't found anything wrong. Also, it's successfully compiled into the source of openfoam-2.1.1.

So I go on with this~

In order to test it's ability in non-linear SGS stress modelling, I make a simple test
I modified the Smagorinsky model, make nuSgs = 2*nu()*(S+Omega)
S is the strain rate tensor and Omega is the rotation-rate tensor
Here is the test model
DNSM-forum.tar.gz

After this , I do a simple test using channel395 tutorial with the modified Smagorinsky model, however, error occurs as following
Code:
Create mesh for time = 0


Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting LES turbulence model DNSM
#0  Foam::error::printStack(Foam::Ostream&) in "/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigSegv::sigHandler(int) in "/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::incompressible::LESNonlinearModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&) in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so"
#4  
 in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/bin/channelRotate"
#5  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#6  
 in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/bin/channelRotate"
Does anyone knows how to solve it?

Xianbei
huangxianbei is offline   Reply With Quote

Old   November 21, 2014, 23:07
Default
  #7
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
As I read from here https://openfoamwiki.net/index.php/HowTo_debugging

sigSegV is caused by an application accessing memory outside the allocated space. These are nearly always caused by a programming error.However, I still can't figure out the problem.

The error appears at Foam::incompressible::LESNonlinearModel::New, however, this is a very common definition as a constructor
huangxianbei is offline   Reply With Quote

Old   November 23, 2014, 07:49
Default case run in debug mode, while crashes in opt mode,how?
  #8
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Hi,all:
I tried to implement a nonlinear SGS model into OF as here
http://www.cfd-online.com/Forums/ope...sgs-model.html

When I turn to the debug mode, the case runs normally, however, if I turn to Opt mode, it crashes with the following errors:
Code:
Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting LES turbulence model Smagorinsky
#0  Foam::error::printStack(Foam::Ostream&) in "/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigSegv::sigHandler(int) in "/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::incompressible::LESNonlinearModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&) in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so"
#4  
 in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/bin/channelRotate"
#5  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#6  
 in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/bin/channelRotate"
huangxianbei is offline   Reply With Quote

Old   November 23, 2014, 08:19
Default
  #9
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Another question is that the case can't be run in both modes,in Debug mode, it returns
Code:
huangxianbei@huangxianbei-MS-7673:/media/87771eb4-3e70-4aa9-b073-17fd62fd2c2a/huangxianbei/SM-non$ mpirunDebug -np 4 channelRotate -parallel
-np
channelRotate
-parallel
nProcs=4
exec=channelRotate
args="-parallel"
Constructed gdb initialization file /media/87771eb4-3e70-4aa9-b073-17fd62fd2c2a/huangxianbei/SM-non/gdbCommands
Choose running method: 0)normal  1)gdb+xterm  2)gdb  3)log  4)log+xterm  5)xterm+valgrind: 2
Run all processes local or distributed? 1)local  2)remote: 1
**sourceFoam:FOAM_INST_DIR=/home/huangxianbei/OpenFOAM . /home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc 
    tail -f processor0.log
    tail -f processor1.log
    tail -f processor2.log
    tail -f processor3.log
Constructed /media/87771eb4-3e70-4aa9-b073-17fd62fd2c2a/huangxianbei/SM-non/mpirun.schema file.

    mpirun -app /media/87771eb4-3e70-4aa9-b073-17fd62fd2c2a/huangxianbei/SM-non/mpirun.schema </dev/null

Press return to execute.
--------------------------------------------------------------------------
Sorry!  You were supposed to get help about:
    find-available:not-valid
But I couldn't open the help file:
    /home/huangxianbei/OpenFOAM/ThirdParty-2.1.1/platforms/linux64Gcc/openmpi-1.5.3/share/openmpi/help-mca-base.txt: No such file or directory.  Sorry!
--------------------------------------------------------------------------
[huangxianbei-MS-7673:09097] *** Process received signal ***
[huangxianbei-MS-7673:09097] Signal: Segmentation fault (11)
[huangxianbei-MS-7673:09097] Signal code: Address not mapped (1)
[huangxianbei-MS-7673:09097] Failing at address: 0x28
[huangxianbei-MS-7673:09097] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7f6cc5deacb0]
[huangxianbei-MS-7673:09097] [ 1] /usr/lib/libopen-pal.so.0(mca_base_select+0x108) [0x7f6cc601a518]
[huangxianbei-MS-7673:09097] [ 2] /usr/lib/libopen-pal.so.0(opal_crs_base_select+0x7e) [0x7f6cc602c90e]
[huangxianbei-MS-7673:09097] [ 3] /usr/lib/libopen-pal.so.0(opal_cr_init+0x31e) [0x7f6cc600b0ee]
[huangxianbei-MS-7673:09097] [ 4] /usr/lib/libopen-pal.so.0(opal_init+0x159) [0x7f6cc600aa59]
[huangxianbei-MS-7673:09097] [ 5] /usr/lib/libopen-rte.so.0(orte_init+0x4d) [0x7f6cc625ca0d]
[huangxianbei-MS-7673:09097] [ 6] mpirun() [0x402fe5]
[huangxianbei-MS-7673:09097] [ 7] mpirun() [0x402b34]
[huangxianbei-MS-7673:09097] [ 8] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f6cc5a3c76d]
[huangxianbei-MS-7673:09097] [ 9] mpirun() [0x402a59]
[huangxianbei-MS-7673:09097] *** End of error message ***
huangxianbei is offline   Reply With Quote

Old   November 23, 2014, 08:38
Default
  #10
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
I tried http://www.cfd-online.com/Forums/ope...tml#post417690

And fixed the above error in Debug mode

However, when run in parallel, the error appears the same as in Opt mode
Code:
Selecting incompressible transport model Newtonian
Selecting LES turbulence model Smagorinsky

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff62e3d5e in Foam::incompressible::LESNonlinearModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&) ()
   from /home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so
#0  0x00007ffff62e3d5e in Foam::incompressible::LESNonlinearModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&) ()
   from /home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so
#1  0x000000000044d5e0 in main (argc=2, argv=0x7fffffffced8)
    at createFields.H:43
(gdb) quit
A debugging session is active.

    Inferior 1 [process 21505] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
It's so strange that a case can be run in serial, but can't run in parallel!
huangxianbei is offline   Reply With Quote

Old   November 23, 2014, 16:53
Default
  #11
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Greetings Xianbei,

I'll be moving these posts to the other thread you've mentioned 3 posts ago, because the problem can only be diagnosed with the code provided there.

The problem is this piece of code:
Code:
DNSM::DNSM
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:
    LESNonlinearModel(modelName, U, phi, transport, turbulenceModelName),
    GennonlinearSGS(U, phi, transport),
The last two lines are wrong, very-very wrong. You should only have the last one, namely:
Code:
DNSM::DNSM
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:
    GennonlinearSGS(U, phi, transport),
otherwise, you've forcing a double construction of the derived class "LESNonlinearModel".
This is odd, because the compiler should have complained about this right away.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 23, 2014, 21:04
Default
  #12
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings Xianbei,


The problem is this piece of code:
Code:
DNSM::DNSM
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:
    LESNonlinearModel(modelName, U, phi, transport, turbulenceModelName),
    GennonlinearSGS(U, phi, transport),
The last two lines are wrong, very-very wrong. You should only have the last one, namely:
Code:
DNSM::DNSM
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:
    GennonlinearSGS(U, phi, transport),
otherwise, you've forcing a double construction of the derived class "LESNonlinearModel".
This is odd, because the compiler should have complained about this right away.

Best regards,
Bruno
Hi,Bruno:
Thank you very much for your reply.

In the above package, I realize something could cause problem when I use a SymmTensor + Tensor

I make a modification and upload the following new code here
LESNonlinear-update.tar.gz

Also, I modified the Smagorinsky model
SM-non.tar.gz

There should be no problem in the mathematical expression then

I tried your method, however, the compiler complains that
Code:
Smagorinsky.C: In constructor 'Foam::incompressible::LESNonlinearModels::Smagorinsky::Smagorinsky(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&, const Foam::word&)':
Smagorinsky.C:74:5: error: no matching function for call to 'Foam::incompressible::LESNonlinearModel::LESNonlinearModel()'
Smagorinsky.C:74:5: note: candidates are:
/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/turbulenceModels/incompressible/LESNonlinear/lnInclude/LESModel.H:133:9: note: Foam::incompressible::LESNonlinearModel::LESNonlinearModel(const Foam::word&, const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&)
/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/turbulenceModels/incompressible/LESNonlinear/lnInclude/LESModel.H:133:9: note:   candidate expects 5 arguments, 0 provided
/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/turbulenceModels/incompressible/LESNonlinear/lnInclude/LESModel.H:101:9: note: Foam::incompressible::LESNonlinearModel::LESNonlinearModel(const Foam::incompressible::LESNonlinearModel&)
/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/turbulenceModels/incompressible/LESNonlinear/lnInclude/LESModel.H:101:9: note:   candidate expects 1 argument, 0 provided
make: *** [Make/linux64GccDPDebug/Smagorinsky.o] Error 1
It can be compiled only if
Code:
LESNonlinearModel(modelName, U, phi, transport, turbulenceModelName),
is kept.

Also, in the original source in Smagorinsky.C
Code:
Smagorinsky::Smagorinsky
(
    const volVectorField& U,
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:
    LESModel(modelName, U, phi, transport, turbulenceModelName),
    GenEddyVisc(U, phi, transport),
I'm confused about the problem


I recompiled the whole code in Opt mode and then run the case in Debug mode in parallel using

mpirun -np 4 channelFoam -parallel

it goes well.

However, it's still a problem that the case crashes in Opt mode with the same error returns in the former post, or if we run the case like this:

mpirunDebug -np 4 channelFoam -parallel

The error remains because the program will load libso from Opt instead of Debug as following
Code:
Selecting incompressible transport model Newtonian
Selecting LES turbulence model Smagorinsky
[0] #0  Foam::error::printStack(Foam::Ostream&) in "/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[0] #1  Foam::sigSegv::sigHandler(int) in "/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[0] #2   in "/lib/x86_64-linux-gnu/libc.so.6"
[0] #3  Foam::incompressible::LESNonlinearModel::New(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel&, Foam::word const&) in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so"
[0] #4  
[0]  at ~/OpenFOAM/huangxianbei-2.1.1/applications/channelRotate/createFields.H:56
[0] #5  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
[0] #6  
[0]  in "/home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPDebug/bin/channelRotate"
[huangxianbei-MS-7673:18884] *** Process received signal ***
[huangxianbei-MS-7673:18884] Signal: Segmentation fault (11)
[huangxianbei-MS-7673:18884] Signal code:  (-6)
[huangxianbei-MS-7673:18884] Failing at address: 0x3e8000049c4
[huangxianbei-MS-7673:18884] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7ff111a604a0]
[huangxianbei-MS-7673:18884] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7ff111a60425]
[huangxianbei-MS-7673:18884] [ 2] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7ff111a604a0]
[huangxianbei-MS-7673:18884] [ 3] /home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so(_ZN4Foam14incompressible17LESNonlinearModel3NewERKNS_14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEERKNS2_IdNS_13fvsPatchFieldENS_11surfaceMeshEEERNS_14transportModelERKNS_4wordE+0x18e) [0x7ff112f5bd5e]
[huangxianbei-MS-7673:18884] [ 4] /home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPDebug/bin/channelRotate() [0x44d5e0]
[huangxianbei-MS-7673:18884] [ 5] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7ff111a4b76d]
[huangxianbei-MS-7673:18884] [ 6] /home/huangxianbei/OpenFOAM/huangxianbei-2.1.1/platforms/linux64GccDPDebug/bin/channelRotate() [0x44cbe9]
[huangxianbei-MS-7673:18884] *** End of error message ***
It's really quite strange

Last edited by huangxianbei; November 23, 2014 at 23:33.
huangxianbei is offline   Reply With Quote

Old   January 2, 2015, 10:48
Default
  #13
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Hi Xianbei,

I've finally managed to look into this. Here's what I've found:
  1. The file "LESNonlinear/Make/files" was incorrectly configured, since it should be something like this:
    Code:
    LIB = $(FOAM_USER_LIBBIN)/libLESNonlinearModels
  2. In "LESNonlinear/Make/options" you had this:
    Code:
    -I/home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/turbulenceModels/LES/LESdeltas/lnInclude
    When it should be this:
    Code:
    -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude
  3. And the rest is related to how things are organized.
This one was very tricky... I had a hard time getting this to work properly. The main problem is that the pointer "dictionaryConstructorTablePtr_" was empty when the constructor tried to get things working.

I've attached the tarball "nonlinearLESkit-v1.tar.gz" that has the working folder structure I built based on your files, in addition to adding more of the necessary files and example case. Note: This is meant to be used with OpenFOAM 2.1.1.
To use:
  1. Unpack:
    Code:
    tar -xf nonlinearLESkit-v1.tar.gz
  2. Build:
    Code:
    cd nonlinearLESkit
    ./Allwmake
  3. The test case:
    Code:
    cd exampleCaseChannel395/
    ./Allrun
    Note: this last command will also copy the "0" folder from the original tutorial "incompressible/channelFoam/channel395", since it's about 1MB of initial boundary conditions that the tutorial already has.
The modified solver is not yet working, since "nuSgs" is different from the original model.


Oh, the missing important detail is that this line:
Code:
    constructdictionaryConstructorTables();
It was missing from the "LESNonlinearModel::New" method... although I haven't figured out why "LESModel" doesn't need this hack... I'll dig deeper and edit this post to report back if I can figure it out.

------------------

edit: OK, I've figured it out. When optimized, there are some-things that aren't called because it's non-optimal to call something that isn't going to be used in the first place. This might not be the exact situation in this case, but it's probably very close to the truth.
So, if the example simulation case has this entry in the "controlDict" file:
Code:
libs
(
  "libSmagorinsky.so"
);
it will enforce that the table is constructed in order to add the very first new model. If no models were added, then the table would not be constructed in the first place. This pretty much happens in the file "Smagorinsky.C", in this line:
Code:
addToRunTimeSelectionTable(LESNonlinearModel, Smagorinsky, dictionary);
which will construct said table for the first time.

-----------------

Best regards,
Bruno
Attached Files
File Type: gz nonlinearLESkit-v1.tar.gz (10.3 KB, 10 views)
__________________

Last edited by wyldckat; February 8, 2015 at 09:28. Reason: see "edit:" and "Note:"
wyldckat is offline   Reply With Quote

Old   January 6, 2015, 07:08
Default
  #14
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Xianbei,


So, if the example simulation case has this entry in the "controlDict" file:
Code:
libs
(
  "libSmagorinsky.so"
);
it will enforce that the table is constructed in order to add the very first new model. If no models were added, then the table would not be constructed in the first place. This pretty much happens in the file "Smagorinsky.C", in this line:
Code:
addToRunTimeSelectionTable(LESNonlinearModel, Smagorinsky, dictionary);
which will construct said table for the first time.

-----------------

Best regards,
Bruno
Hi, Bruno:
Thank you very much for the details. You mean that
Code:
libs
(
  "libSmagorinsky.so"
);
This part of code should be added to the controlDict, right?
I will try it latter.
Xianbei
huangxianbei is offline   Reply With Quote

Old   January 10, 2015, 10:40
Default
  #15
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Hi Xianbei,

Quote:
Originally Posted by huangxianbei View Post
You mean that
Code:
libs
(
  "libSmagorinsky.so"
);
This part of code should be added to the controlDict, right?
Yes, that's correct. But make sure you do not have two different blocks, like this:
Code:
libs
(
  "libSmagorinsky.so"
);

//....

libs
(
  "libOpenFOAM.so"
);
because this will mean that only one of them will be loaded. If you need more than one, then it would be something like this:
Code:
libs
(
  "libSmagorinsky.so"
  "libOpenFOAM.so"
);
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   January 11, 2015, 00:02
Default
  #16
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Xianbei,


Yes, that's correct. But make sure you do not have two different blocks, like this:
Code:
libs
(
  "libSmagorinsky.so"
);

//....

libs
(
  "libOpenFOAM.so"
);
because this will mean that only one of them will be loaded. If you need more than one, then it would be something like this:
Code:
libs
(
  "libSmagorinsky.so"
  "libOpenFOAM.so"
);
Best regards,
Bruno
Oh,I see, the order is important, if not, the built-in Smagorinsky is loaded!
huangxianbei is offline   Reply With Quote

Old   January 11, 2015, 13:38
Default
  #17
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Quote:
Originally Posted by huangxianbei View Post
Oh,I see, the order is important, if not, the built-in Smagorinsky is loaded!
Quick answer: It's not a question of order. The problem is really that two occurrences of "libs" will result in failure to load the other libraries, because the parser will not care about them.
wyldckat is offline   Reply With Quote

Old   January 11, 2015, 21:40
Default
  #18
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 283
Rep Power: 6
huangxianbei is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer: It's not a question of order. The problem is really that two occurrences of "libs" will result in failure to load the other libraries, because the parser will not care about them.
Thank you,Bruno. But I'm confused about the libs, as here http://www.cfd-online.com/Forums/ope...agorinsky.html
The testcase provided is used as
Code:
libs ( "libOpenFOAM.so" "libdynamicSmagorinskyModel.so" ) ;
This will not cause problem. So when will the problem occur?
huangxianbei is offline   Reply With Quote

Old   January 18, 2015, 16:07
Default
  #19
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Quote:
Originally Posted by huangxianbei View Post
So when will the problem occur?
Quick answer - the error might happen if you do the following by accident:
Code:
libs ( "libOpenFOAM.so" );

libs ( "libdynamicSmagorinskyModel.so" );
And the only problem is that not all of the listed libraries will be loaded, because only the first entry of "libs" will work.
wyldckat is offline   Reply With Quote

Old   February 3, 2015, 19:30
Default
  #20
New Member
 
karar
Join Date: Feb 2013
Posts: 13
Rep Power: 6
zoptirik is on a distinguished road
Hi

Did you solve your problem. because I
also, deal with the SGS stress instead of the eddy viscosity. i have try to compiled yours nonlinearLEskit. but it gave me compalition error (error 1)
zoptirik 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
Two way Fsi Problem- Non linear problem kmgraju CFX 4 April 28, 2015 11:15
the combustion model problem hanshandiaoke STAR-CD 7 December 2, 2011 04:47
the combustion model problem hanshandiaoke CD-adapco 0 November 25, 2011 21:37
Problem in Buoyancy Model? dhrubo CFX 3 June 5, 2010 05:32
solution diverges when linear upwind interpolation scheme is used subash OpenFOAM 0 May 29, 2010 01:23


All times are GMT -4. The time now is 17:03.