|
[Sponsors] |
Adding a new member function in src/../turbulenceModel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 25, 2011, 17:55 |
Adding a new member function in src/../turbulenceModel
|
#1 |
Member
Join Date: Oct 2010
Location: Stuttgart
Posts: 35
Rep Power: 16 |
Hi FOAMers,
I'm using OF 1.7.1 and i wanted to add a new member function into src/turbulenceModels/incompressible/turbulenceModel called 'nuSgs'. It's similar to 'nut' so i just copied all the lines with 'nut' within turbulenceModel.H, laminar.H and laminar.C and changed to nuSgs. The problem is, that when i start a modified pisoFoam solver with the energy equation in it, i get these error messages: Courant Number mean: 0 max: 0.520522 #0 Foam::error:rintStack(Foam::Ostream&) in "/home/gee/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libOpenFOAM.so" #1 Foam::sigSegv::sigSegvHandler(int) in "/home/gee/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libOpenFOAM.so" #2 in "/lib64/libc.so.6" #3 Foam::incompressible::LESModel::correct() in "/home/gee/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libincompressibleLESModels.so" #4 in "/home/gee/OpenFOAM/gee-1.7.1/applications/bin/linux64GccDPOpt/pisoFoamTNuLES" #5 __libc_start_main in "/lib64/libc.so.6" #6 at /usr/src/packages/BUILD/glibc-2.11.2/csu/../sysdeps/x86_64/elf/start.S:116 Speicherzugriffsfehler Does anyone know, what's wrong? Best regards grandgo |
|
April 11, 2011, 09:34 |
|
#2 |
Senior Member
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 21 |
Dear Grandgo,
Well, the problem is that the nut defined in ./src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H is a virtual function, so it doesn't do anything. The whole turbulenceModel.* in that folder are prototype functions, and should be implemented in specific models themselves. Since you seem confused by this constructions, I recommend you first start by improving your C++ skills, with a special attention on inheritance, polymorphism and templates. This will greatly improve your understanding of how the OpenFOAM code is programmed. As for the use of your new variable, you will probably have to program it inside the turbulence model you want to use. Choose a turbulence model making use of nut as reference, to understand how it can be done in OpenFOAM. Good luck! Kind regards, Francois. |
|
May 9, 2011, 07:17 |
|
#3 | |
Member
Join Date: Oct 2010
Location: Stuttgart
Posts: 35
Rep Power: 16 |
Quote:
hi francois, first of all: thanks and sorry for the delay.
//- Return the effective thermal diffusivity tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( new volScalarField("alphaEff", nuSgs_ + nu()) ); } i compilied this turbulence model with a new name.
volScalarField alphaEff ( "alphaEff", laminarTransport.nu()/pr + turbulence->nuSgs_/prSgs ); //solves scalar equation { //add energy equation fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(alphaEff, T) ); TEqn.solve(); } (the equation is from this page: www.idurun.com/?p=556) the problem is that compiling doesn't work. i get these messages: Making dependency list for source file pisoFoamTNuLES.C SOURCE=pisoFoamTNuLES.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/gee/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/incompressible/turbulenceModel -I/home/gee/OpenFOAM/OpenFOAM-1.7.1/src/transportModels -I/home/gee/OpenFOAM/OpenFOAM-1.7.1/src/transportModels/incompressible/singlePhaseTransportModel -I/home/gee/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/gee/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude -I/home/gee/OpenFOAM/OpenFOAM-1.7.1/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/pisoFoamTNuLES.o In file included from pisoFoamTNuLES.C:38:0: /home/gee/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:172:37: error: ‘nuSgs_’ declared as a ‘virtual’ field /home/gee/OpenFOAM/OpenFOAM-1.7.1/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:172:44: error: expected ‘;’ before ‘const’ pisoFoamTNuLES.C: In function ‘int main(int, char**)’: pisoFoamTNuLES.C:137:42: error: ‘class Foam::incompressible::turbulenceModel’ has no member named ‘nuSgs_’ pisoFoamTNuLES.C:137:49: error: ‘prSgs’ was not declared in this scope /home/gee/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude/readPISOControls.H:11:10: warning: unused variable ‘transonic’ /home/gee/OpenFOAM/OpenFOAM-1.7.1/src/finiteVolume/lnInclude/readPISOControls.H:14:9: warning: unused variable ‘nOuterCorr’ make: *** [Make/linux64GccDPOpt/pisoFoamTNuLES.o] Fehler 1 i dont know what the problem is. something about nuSgs_ and prSgs obviously but i just don't know what to do. anyone with an idea? |
||
May 10, 2011, 10:25 |
|
#4 |
Member
Join Date: Oct 2010
Location: Stuttgart
Posts: 35
Rep Power: 16 |
hi,
the modified dynSmagorinsky is inaccurate, i think. this http://openfoamwiki.net/index.php/Si...ry_/_Tutorials says in chapter 3.2.2 that i need to add the member function, which i want to use, in src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H . so i added this line: virtual tmp<volScalarField> nuSgs const=0; . but the modified pisoFoam solver with TEqn: turbulence->correct(); volScalarField alphaEff ( "alphaEff", laminarTransport.nu()/pr + turbulence->nuSgs()/prSgs ); //solves scalar equation { //add energy equation fvScalarMatrix TEqn ( fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(alphaEff, T) ); TEqn.solve(); } doesn't work. i get some erros about printStack: #0 Foam::error:rintStack(Foam::Ostream&) in "/home/gee/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libOpenFOAM.so" #1 Foam::sigSegv::sigSegvHandler(int) in "/home/gee/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libOpenFOAM.so" #2 in "/lib64/libc.so.6" #3 Foam::incompressible::LESModel::correct() in "/home/gee/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libincompressibleLESModels.so" #4 in "/home/gee/OpenFOAM/gee-1.7.1/applications/bin/linux64GccDPOpt/pisoFoamTNuLES" #5 __libc_start_main in "/lib64/libc.so.6" #6 at /usr/src/packages/BUILD/glibc-2.11.2/csu/../sysdeps/x86_64/elf/start.S:116 Speicherzugriffsfehler i don't understand why everything works fine when i'm using the original pisoFoam + dynSmagorinsky, but doesn't work when i use a modified pisoFoam with energy equation in it. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 09:31 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 04:37 |
Error with Wmake | skabilan | OpenFOAM Installation | 3 | July 28, 2009 00:35 |
Compilation errors in ThirdPartymallochoard | feng_w | OpenFOAM Installation | 1 | January 25, 2009 06:59 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 14:00 |