|
[Sponsors] |
probelm in Implementing dynamic Vreman model(LES) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 19, 2014, 05:20 |
probelm in Implementing dynamic Vreman model(LES)
|
#1 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Hi,all
I want to implement dynamic Vreman model proposed by You(2006), A dynamic global-coefficient subgrid-scale eddy-viscosity model for large-eddy simulation in complex geometries, Annual Research Briefs,2006. Most of the code is finished as follows dynamicVreman.tar.gz While when compiling it , an error occurs: Code:
dynamicVreman.C:64:32: error: could not convert ‘Foam::average(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]()’ from ‘Foam::dimensioned<double>’ to ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ Xianbei |
|
August 19, 2014, 05:26 |
|
#2 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
cD and cI represents numerator and denominator respectively in formula 3.6
|
|
August 19, 2014, 08:26 |
|
#3 |
Senior Member
|
hi Huang,
AFAIK, average() will return a dimensionedScalar and you used a volScalarField instead. So, I think you should modify your code like below: Code:
//volScalarField dynamicVreman::cD dimensionedScalar dynamicVreman::cD ( const volTensorField& gradU ) const { const volScalarField aafil = filter_(sqr(mag(alpha(gradU)))); const volScalarField filaa = sqr(mag(filter_(alpha(gradU)))); return average(aafil-filaa); } I just see your code and I didn't compile it. hope it helps. Regards, Mostafa |
|
August 19, 2014, 10:52 |
|
#4 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Quote:
Thank you very much for your help. Yes, the type of cD should be dimensionedScalar , while cI should be volScalarField because Code:
return average(filter_(II*sqr(mag(D)))-filII*sqr(mag(filter_(D))))/filII Now this error is modified, also, the SGS kinetic energy should be added. Here, I have a question about the order in the constructors(dynamicVreman.C) if the code is written like this Code:
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // dynamicVreman::dynamicVreman ( const volVectorField& U, const surfaceScalarField& phi, transportModel& transport, const word& turbulenceModelName, const word& modelName ) : LESModel(typeName, U, phi, transport), GenEddyVisc(U, phi, transport), filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filter_(filterPtr_()), ck_ ( dimensioned<scalar>::lookupOrAddToDict ( "ck", coeffDict_, 0.094 ) ), small1_ ( dimensioned<scalar> ( "small1_", dimensionSet(0,0,-1,0,0,0,0), 1e-10 ) ) { updateSubGridScaleFields(dev(symm(fvc::grad(U))),fvc::grad(U)); printCoeffs(); } However, if the code is written like this Code:
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // dynamicVreman::dynamicVreman ( const volVectorField& U, const surfaceScalarField& phi, transportModel& transport, const word& turbulenceModelName, const word& modelName ) : LESModel(typeName, U, phi, transport), GenEddyVisc(U, phi, transport), ck_ ( dimensioned<scalar>::lookupOrAddToDict ( "ck", coeffDict_, 0.094 ) ), small1_ ( dimensioned<scalar> ( "small1_", dimensionSet(0,0,-1,0,0,0,0), 1e-10 ) ), filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filter_(filterPtr_()) { updateSubGridScaleFields(dev(symm(fvc::grad(U))),fvc::grad(U)); printCoeffs(); } Code:
dynamicVreman.H:111:27: warning: ‘Foam::incompressible::LESModels::dynamicVreman::small1_’will [-Wreorder] dynamicVreman.H:108:28: warning: ‘Foam::autoPtr<Foam::LESfilter> Foam::incompressible::LESModels::dynamicVreman::filterPtr_’ [-Wreorder] dynamicVreman.C:83:1: warning: initialized here after initialization [-Wreorder] Here is the non-warning version dynamicVreman.tar.gz Xianbei |
||
August 19, 2014, 11:39 |
|
#5 |
Senior Member
|
yeah, you're right about cI, my bad!
I haven't seen this warning till now, but I think it's back to the .H file. you defined: Code:
class dynamicVreman : public GenEddyVisc { // Private data autoPtr<LESfilter> filterPtr_; LESfilter& filter_; dimensionedScalar ck_; dimensionedScalar small1_; . . . Sorry, what am I saying is just come from the experiences I got from modifying a LES model and there is no conception behind it!! I'm not a really openFOAM expert. Regards, Mostafa |
|
August 19, 2014, 21:49 |
|
#6 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Quote:
|
||
August 20, 2014, 10:21 |
|
#7 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Hi, Mostafa:
Problem again.Here is the new version dynamicVreman-modify.tar.gz , I corrected a few errors in the formulations. I test it in a case I have already successfully performed using Smagorinsky, however, when I use the newly implemented model, error occurs: Code:
--> FOAM FATAL ERROR: [0] temporary deallocated [0] [0] From function const T& Foam::tmp<T>::operator()() const [0] in file /home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/tmpI.H at line 187. [0] FOAM parallel run aborting [0] [1] --> FOAM FATAL ERROR: [1] temporary deallocated [1] [1] From function const T& Foam::tmp<T>::operator()() const [1] in file /home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/tmpI.H at line 187. [1] FOAM parallel run aborting [1] [0] #0 Foam::error::printStack(Foam::Ostream&)[1] #0 Foam::error::printStack(Foam::Ostream&)[2] [2] [2] --> FOAM FATAL ERROR: [2] temporary deallocated [2] [2] From function const T& Foam::tmp<T>::operator()() const [2] in file /home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/tmpI.H at line 187. [2] FOAM parallel run aborting [2] [2] #0 Foam::error::printStack(Foam::Ostream&)[3] [3] [3] --> FOAM FATAL ERROR: [3] temporary deallocated [3] [3] From function const T& Foam::tmp<T>::operator()() const [3] in file /home/huangxianbei/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/tmpI.H at line 187. [3] FOAM parallel run aborting [3] Xianbei |
|
August 20, 2014, 11:14 |
|
#8 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Hi, I searched the forum and find that has something to do with tmp, so when I delete all the tmp used in the code , the solution can run without any error, also, I find the speed of the calculation is not affected, so I think it's no need to use tmp, however, I still want to know if it's better when tmp used or is it necessary? From my code, can you do some explain on how the error occurs? I have no idea about how
Xianbei |
|
August 20, 2014, 11:32 |
|
#9 |
Senior Member
|
hi Huang,
I checked your code and I found nothing! I've been challenged by this error in two cases: 1- when I was modifying the momentum eqn I'd forgot to write UEqn() instead of UEqn. 2- when I was using cyclic bc for inlet and outlet patches, actually my inlet consisted of two patch, and the same for the outlet. When I combined the two patches into one patch the the error was solved. try to run your case without parallel mode and see if there's this error again. Regards, Mostafa P.S why did you use T(gradU) in your .H file? |
|
August 20, 2014, 11:46 |
|
#10 | |
Senior Member
|
Quote:
It isn't needed at all, but it reduces the effort and increases the efficiency of your program. When C++ returns a local object, it copies the object, returns the copy, and deletes the original. This behaviour is safe memory management; however, if you are dealing with large objects (such as a 10 million element geometric tensor field), it can be a costly process. |
||
August 20, 2014, 21:17 |
|
#11 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Quote:
Actually the above error occurs when using mpirun. As for T(gradU), the formulation is d(alpha)ij=duj/dxi, so the T is needed. Xianbei |
||
August 20, 2014, 21:24 |
|
#12 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Quote:
Some more try: I start to think the property using 'filter_' operation in the .H file when using tmp. So I add tmp in alphaij and Bbetaij , filapha and filBbeta without tmp, the calculation can still run without error. Thus the key point is that the 'filter_' operation may be not proper in the .H file when tmp is used. Another point is that if a variant contains filter_, it's element can't be tmp either(const tmp<volTensorField>& gradU can't be used) As you said before, the tmp can improve the efficiency, then I tried to use tmp more. I was thinking putting filalpha and filBbeta in the .C file, however, as cD and cI both contains the two variants, it may take more time to calculate them twice, hence, I give up this idea. PS: your avatar is so cute Last edited by huangxianbei; August 20, 2014 at 22:40. |
||
August 29, 2014, 05:39 |
|
#13 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 |
Quote:
Thank you Xianbei |
||
March 31, 2015, 07:32 |
|
#14 |
New Member
Christoph Kratzsch
Join Date: Nov 2011
Location: Freiberg
Posts: 28
Rep Power: 15 |
Hello Huang,
actually i want to start implementing the Vreman-SGS model by myself. Then i realized, that you have done it already. It would be glad, if you can share your final version. Best regards, Christoph |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic SGS model procedure in Large eddy simulation | mrf6166 | Main CFD Forum | 39 | November 25, 2016 15:13 |
Implementing a dynamic retention force in interFoam | u2947 | OpenFOAM Programming & Development | 2 | June 17, 2013 10:14 |
Implementing Dynamic Patch/mesh Deformation linked to the flow solution | fredo490 | OpenFOAM Programming & Development | 0 | March 4, 2013 07:02 |
Dynamic Mesh moving interface help | akash.iitb | FLUENT | 0 | August 24, 2010 00:53 |