|
[Sponsors] |
August 14, 2015, 15:41 |
Modifying solver for LES simulation
|
#1 |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Dear Foamers,
I am trying to modify pimpleFoam to include SGS Reynolds stress as this thread has pointed out: http://www.cfd-online.com/Forums/ope...n-etc-les.html posts #15, #16, and #17. For this aim, I have created a Tensor field in "createFields.H" as follows: Code:
volSymmTensorField B ( IOobject ( "B", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Then, I have added the following line to my new modified solver, "MypimpleFoam.C" : Code:
while (runTime.run()) { .... .... B = dynamicSmagorinsky->B(); ... } Code:
Making dependency list for source file MypimpleFoam.C SOURCE=MypimpleFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels/incompressible/turbulenceModel -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels/incompressible/LES/dynamicSmagorinsky -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/transportModels -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/incompressible/singlePhaseTransportModel -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/meshTools/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/fvOptions/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/sampling/lnInclude -IlnInclude -I. -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/MypimpleFoam.o MypimpleFoam.C: In function ‘int main(int, char**)’: MypimpleFoam.C:89:18: error: ‘dynamicSmagorinsky’ was not declared in this scope B = dynamicSmagorinsky->B(); ^ make: *** [Make/linux64GccDPOpt/MypimpleFoam.o] Error 1 Please help me to understand and solve this problem. Thanks, Syavash |
|
August 14, 2015, 16:52 |
|
#2 |
Senior Member
|
Hi,
Why would you need to modify pimpleFoam to use LES? The solver is quite general so it can use LES turbulence models without any modifications, see for example tutorials/incompressible/pimpleFoam/channel395 case. |
|
August 14, 2015, 19:07 |
|
#3 | |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Quote:
Let me clarify myself: I need to modify the solver to include SGS Reynolds stresses and subsequently activating its averaging in controlDict to have an averaged SGS Reynolds stress field for post-processing. As you know, by default, only the "resolved" Reynolds stresses are generated when averaging. Can you help me do that?! Syavash |
||
August 15, 2015, 09:35 |
|
#4 |
Senior Member
|
Hi,
Still did not quite get what you are trying to achieve. All machinery for LES is already in code base. If you take a look at LESModel class: Code:
class LESModel : public turbulenceModel, public IOdictionary { ... //- Return the sub-grid stress tensor. virtual tmp<volSymmTensorField> B() const = 0; ... //- Return the Reynolds stress tensor virtual tmp<volSymmTensorField> R() const { return B(); } ... } At this point nuance appears, because there are two types of LES models. One type is a children of GenSGSStress class, which directly solve for the SGS stress tensor B, another is a children of GenEddyVisc class. While GenSGSStress class has B_ tensor field, which is recalculated and automatically saved, GenEddyVisc does not have this field, so even Reynolds stress tensor in these models is calculated, it is not automatically written. So to save Reynolds stress tensor you can do something like: 1. Add this to createField.H Code:
volSymmTensorField B ( IOobject ( "B", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Code:
B = turbulence->R() Also instead of IOobject::MUST_READ, you can use IOobject::READ_IF_PRESENT flag in constructor, so you do not have to create B file in 0 folder. If this case instead of mesh in constructor you should use turbulence->R(). |
|
August 16, 2015, 07:28 |
|
#5 | ||
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Quote:
Thank you for your comprehensive explanation. So I should use turbulence->R() in any case, whether using a SGS model e.g. dynSmagorinsky model or a OneEqn model and put B = turbulence->R() immediately after turbulence->correct() in the solver(please correct me if I am wrong). Quote:
Thanks, Syavash |
|||
August 16, 2015, 07:55 |
|
#6 | ||
Senior Member
|
Hi,
Quote:
Concerning second part of the question: in principle, yes. Though first you have to create B field in creareField.H file (or elsewhere in main function before time loop). Quote:
Also since you need this sub-grid scale stress during post-processing, you can use R utility to calculate stress tensor. Though since you are trying to use algebraic and one-equation models there could be certain problems with the field name. |
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
thobois class engineTopoChangerMesh error | Peter_600 | OpenFOAM | 4 | August 2, 2014 10:52 |
Searching solver for welding simulation | Kenna | OpenFOAM Running, Solving & CFD | 6 | December 3, 2013 12:03 |
Simulation of a laval nozzle - which solver? | summer_of_69 | OpenFOAM | 0 | August 12, 2013 12:35 |
Solver For low subsonic speed simulation | firda | FLUENT | 0 | January 28, 2011 08:45 |
Compilation problem after modifying a solver. | PetSul | OpenFOAM Running, Solving & CFD | 2 | October 1, 2009 18:28 |