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

Problem in Implementing a non-linear SGS model

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 4, 2015, 15:37
Default
  #21
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by zoptirik View Post
but it gave me compalition error (error 1)
Quick answer:
  1. Use the package from post #13
  2. Provide more details on the exact steps you've used.
  3. Please indicate which OpenFOAM version you're using.
__________________
wyldckat is offline   Reply With Quote

Old   February 8, 2015, 08:12
Default
  #22
New Member
 
karar
Join Date: Feb 2013
Posts: 13
Rep Power: 13
zoptirik is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer:
  1. Use the package from post #13
  2. Provide more details on the exact steps you've used.
  3. Please indicate which OpenFOAM version you're using.
Hi wyldckat

I used the package from post 13, i followed the way that u said post 13. first unpack than build cd nonlinearLESkit ./Allwmake... after compilation

Code:
generic@generic-M4700:~/OpenFOAM/generic-2.3.0/src/turbulenceModels/incompressible/nonlinearLESkit$ ./Allwmake
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file LESNonlinearModel.C
Making dependency list for source file GennonlinearSGS.C
SOURCE=LESNonlinearModel.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/turbulenceModels/LES/LESfilters/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/LESNonlinearModel.o
SOURCE=GennonlinearSGS.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/turbulenceModels/LES/LESfilters/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/GennonlinearSGS.o
'/home/generic/OpenFOAM/generic-2.3.0/platforms/linux64GccDPOpt/lib/libLESNonlinearModels.so' is up to date.
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file Smagorinsky.C
SOURCE=Smagorinsky.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/turbulenceModels/LES/LESfilters/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I../LESNonlinear/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/Smagorinsky.o
In file included from ../LESNonlinear/lnInclude/GennonlinearSGS.H:42:0,
                 from Smagorinsky.H:53,
                 from Smagorinsky.C:26:
../LESNonlinear/lnInclude/LESNonlinearModel.H: In static member function ‘static Foam::autoPtr<Foam::incompressible::LESNonlinearModel> Foam::incompressible::LESNonlinearModel::adddictionaryConstructorToTable<LESNonlinearModelType>::New(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&) [with LESNonlinearModelType = Foam::incompressible::LESNonlinearModels::Smagorinsky, Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>, Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’:
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9:   instantiated from ‘Foam::incompressible::LESNonlinearModel::adddictionaryConstructorToTable<LESNonlinearModelType>::adddictionaryConstructorToTable(const Foam::word&) [with LESNonlinearModelType = Foam::incompressible::LESNonlinearModels::Smagorinsky]’
Smagorinsky.C:41:1:   instantiated from here
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9: error: cannot allocate an object of abstract type ‘Foam::incompressible::LESNonlinearModels::Smagorinsky’
Smagorinsky.H:68:7: note:   because the following virtual functions are pure within ‘Foam::incompressible::LESNonlinearModels::Smagorinsky’:
/opt/openfoam230/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:217:37: note:     virtual Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::incompressible::turbulenceModel::divDevRhoReff(const volScalarField&, Foam::volVectorField&) const
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linux64GccDPOpt/Smagorinsky.o] Error 1
Openfoam version is 2.3.0
zoptirik is offline   Reply With Quote

Old   February 10, 2015, 07:35
Default
  #23
New Member
 
karar
Join Date: Feb 2013
Posts: 13
Rep Power: 13
zoptirik is on a distinguished road
I tried to compile the files separately. LESNonlinear file was compiled successfuly. But when i tried to compile SM-non, it gave me following error
Code:
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file Smagorinsky.C
SOURCE=Smagorinsky.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/turbulenceModels/LES/LESfilters/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I../LESNonlinear/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/Smagorinsky.o
In file included from ../LESNonlinear/lnInclude/GennonlinearSGS.H:42:0,
                 from Smagorinsky.H:53,
                 from Smagorinsky.C:26:
../LESNonlinear/lnInclude/LESNonlinearModel.H: In static member function ‘static Foam::autoPtr<Foam::incompressible::LESNonlinearModel> Foam::incompressible::LESNonlinearModel::adddictionaryConstructorToTable<LESNonlinearModelType>::New(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&) [with LESNonlinearModelType = Foam::incompressible::LESNonlinearModels::Smagorinsky, Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>, Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’:
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9:   instantiated from ‘Foam::incompressible::LESNonlinearModel::adddictionaryConstructorToTable<LESNonlinearModelType>::adddictionaryConstructorToTable(const Foam::word&) [with LESNonlinearModelType = Foam::incompressible::LESNonlinearModels::Smagorinsky]’
Smagorinsky.C:41:1:   instantiated from here
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9: error: cannot allocate an object of abstract type ‘Foam::incompressible::LESNonlinearModels::Smagorinsky’
Smagorinsky.H:68:7: note:   because the following virtual functions are pure within ‘Foam::incompressible::LESNonlinearModels::Smagorinsky’:
/opt/openfoam230/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:217:37: note: 	virtual Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::incompressible::turbulenceModel::divDevRhoReff(const volScalarField&, Foam::volVectorField&) const
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linux64GccDPOpt/Smagorinsky.o] Error 1
zoptirik is offline   Reply With Quote

Old   March 2, 2015, 08:38
Default
  #24
New Member
 
karar
Join Date: Feb 2013
Posts: 13
Rep Power: 13
zoptirik is on a distinguished road
Hi All

As i said before I am dealing with the SGS stress instead of the eddy viscosity. i tried to compiled nonlinearLEskit, but it gave me compalition error. I couldnt solve the error. Therefore I have used to DeardorffDiffStress based on GenSGSStress. but this model also use nu_sgs in the calculation of divDevReff(U). for making same things with nonlinearLEskit in the computation of divdevreff, i product 0 to nu_sgs term as follows
Code:
 nuSgs_ = 0*rho()*sqrt(K)*delta()
Could I have done something wrong?

Best
zoptirik is offline   Reply With Quote

Old   March 19, 2015, 04:34
Default
  #25
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14
huangxianbei is on a distinguished road
Quote:
Originally Posted by zoptirik View Post
I tried to compile the files separately. LESNonlinear file was compiled successfuly. But when i tried to compile SM-non, it gave me following error
Code:
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file Smagorinsky.C
SOURCE=Smagorinsky.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/turbulenceModels -I/opt/openfoam230/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam230/src/turbulenceModels/LES/LESfilters/lnInclude -I/opt/openfoam230/src/transportModels -I/opt/openfoam230/src/finiteVolume/lnInclude -I/opt/openfoam230/src/meshTools/lnInclude -I../LESNonlinear/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/Smagorinsky.o
In file included from ../LESNonlinear/lnInclude/GennonlinearSGS.H:42:0,
                 from Smagorinsky.H:53,
                 from Smagorinsky.C:26:
../LESNonlinear/lnInclude/LESNonlinearModel.H: In static member function ‘static Foam::autoPtr<Foam::incompressible::LESNonlinearModel> Foam::incompressible::LESNonlinearModel::adddictionaryConstructorToTable<LESNonlinearModelType>::New(const volVectorField&, const surfaceScalarField&, Foam::transportModel&, const Foam::word&) [with LESNonlinearModelType = Foam::incompressible::LESNonlinearModels::Smagorinsky, Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>, Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’:
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9:   instantiated from ‘Foam::incompressible::LESNonlinearModel::adddictionaryConstructorToTable<LESNonlinearModelType>::adddictionaryConstructorToTable(const Foam::word&) [with LESNonlinearModelType = Foam::incompressible::LESNonlinearModels::Smagorinsky]’
Smagorinsky.C:41:1:   instantiated from here
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9: error: cannot allocate an object of abstract type ‘Foam::incompressible::LESNonlinearModels::Smagorinsky’
Smagorinsky.H:68:7: note:   because the following virtual functions are pure within ‘Foam::incompressible::LESNonlinearModels::Smagorinsky’:
/opt/openfoam230/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:217:37: note: 	virtual Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::incompressible::turbulenceModel::divDevRhoReff(const volScalarField&, Foam::volVectorField&) const
../LESNonlinear/lnInclude/LESNonlinearModel.H:115:9: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linux64GccDPOpt/Smagorinsky.o] Error 1
Hi,
sorry for the late reply. This may be solved when you turn on the debug mode. I can compile this when debug mode is turned on, although I didn't find any error in opti mode on another computer. This is strange, but this may overcome this problem. Anthoer solution may be changing the OF version, to 2.1.1 as I used.

I'm not sure if you have solved your problem, but I have a question that you may also face: how to implement a wall function for nonlinear models?

As in OF, the nuSgs wall function is implemented to correct the turbulent viscosity, however, if as I have done, the SGS stress is treated instead of the turbulent viscosity, so this method can't be used in the nonlinear models.

Do you have any suggestions?

Xianbei
huangxianbei is offline   Reply With Quote

Old   May 19, 2015, 14:30
Default
  #26
Member
 
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12
Astrodan is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
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
Hey Bruno & Xianbei,

I just had the same problem with an empty constructorTablePtr_, and it took me 2h to debug and finally find this thread here. It really did annoy me, because I was sure there was nothing wrong, and checked my code five times anyway.. and the stack message is not really helpful.

Do you have any idea if there is any OF-internal possibility to catch this error? I can work with the runTimeSelection interface, but I'm not really familiar, so I don't know where this check could be placed..
__________________
PhD Student at the Institute of Biochemical Engineering at TU München
Modelling of fluid dynamics in open photobioreactors.

System:
OpenFOAM 2.3.x, 64bit, 8 Core Xeon Workstation
Astrodan is offline   Reply With Quote

Old   May 21, 2015, 17:29
Default
  #27
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by Astrodan View Post
Do you have any idea if there is any OF-internal possibility to catch this error? I can work with the runTimeSelection interface, but I'm not really familiar, so I don't know where this check could be placed..
Quick answer: If you can give us a clear example of what you're trying to fix/solve/catch, it would make it a lot easier to diagnose/search for the solution.
I ask this because I wrote that post 4 months ago and I barely remember what it was all about
wyldckat is offline   Reply With Quote

Old   May 24, 2015, 12:55
Default
  #28
Member
 
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12
Astrodan is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer: If you can give us a clear example of what you're trying to fix/solve/catch, it would make it a lot easier to diagnose/search for the solution.
I ask this because I wrote that post 4 months ago and I barely remember what it was all about
Sorry, I just read it, so this seemed obvious. My Problem is that this line
Code:
dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(exampleType);
produces a segmentation fault when there is no model in the list, as you described:

Quote:
Originally Posted by wyldckat View Post
...
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.
...
Whoever wants to reproduce, I attached an example objet library and a solver that creates such an object.

Just compile (./Allwmake) and run exampleFoam.

The error occurs in lib/exampleBaseClassNew.C:18:
Code:
Selecting exampleType randomClass
Veni...
Vidi...
Segmentation fault (core dumped)
(Where Veni vidi vici would be my oldschool debug output)
Attached Files
File Type: zip exampleNewObject.zip (5.8 KB, 2 views)
__________________
PhD Student at the Institute of Biochemical Engineering at TU München
Modelling of fluid dynamics in open photobioreactors.

System:
OpenFOAM 2.3.x, 64bit, 8 Core Xeon Workstation

Last edited by Astrodan; May 26, 2015 at 04:30.
Astrodan is offline   Reply With Quote

Old   May 24, 2015, 17:28
Default
  #29
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by Astrodan View Post
Whoever wants to reproduce, I attached an example objet library and a solver that creates such an object.

Just compile (./Allwmake) and run exampleFoam.
Quick answer: There is no attachment in your post
wyldckat is offline   Reply With Quote

Old   May 26, 2015, 04:33
Default
  #30
Member
 
Timm Severin
Join Date: Mar 2014
Location: Munich
Posts: 63
Rep Power: 12
Astrodan is on a distinguished road
Reasonable argument. Apparently this thread has some negative influence on my concentration .

I uploaded the file and added some additional notes at the end of the last post.
__________________
PhD Student at the Institute of Biochemical Engineering at TU München
Modelling of fluid dynamics in open photobioreactors.

System:
OpenFOAM 2.3.x, 64bit, 8 Core Xeon Workstation
Astrodan is offline   Reply With Quote

Old   September 20, 2015, 14:26
Default
  #31
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

OK, this was on my to-do list since... March of this year? And I've finally managed to look into this.

I've used the code from my post #13 and started a new repository for handling all of the modifications of this proof of concept: https://github.com/wyldckat/nonlinearLESkit

The repository now provides the source code adapted to work on:
  • OpenFOAM 2.1.1, which is the source code from post #13.
  • OpenFOAM 2.1.x
  • OpenFOAM 2.3.x - which should work with OpenFOAM versions 2.3.0 to 2.3.x and possibly with OpenFOAM 2.2.
Instructions on how to download and build are provided on the front-page of the project.

Best regards,
Bruno
cfdonline2mohsen likes this.
__________________
wyldckat 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
Two way Fsi Problem- Non linear problem kmgraju CFX 4 April 28, 2015 12:15
the combustion model problem hanshandiaoke STAR-CD 7 December 2, 2011 04:47
the combustion model problem hanshandiaoke Siemens 0 November 25, 2011 21:37
Problem in Buoyancy Model? dhrubo CFX 3 June 5, 2010 06:32
solution diverges when linear upwind interpolation scheme is used subash OpenFOAM 0 May 29, 2010 02:23


All times are GMT -4. The time now is 18:16.