CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   DDES implementation (http://www.cfd-online.com/Forums/openfoam-programming-development/65540-ddes-implementation.html)

 leonardo.morita June 18, 2009 05:36

DDES implementation

Hello everybody,

I'm trying to implement a DDES model based on Spalart-Allmaras model from OF-1.5. However, I've never worked with C++ before, I only know C. I took a look into some models code already implemented in OF, but I still have some questions, so I would be very happy if anyone could help me a little.

1. the basic difference of DDES from DES is the definition of the distance d~:

d~ = d - fd*max(0, d - CDES*delta)
fd = 1 - tanh([8rd]^3)
rd = (nut + nu)/((sqr(Ui,j*Ui,j))*(kappa*d)^2)

where Ui,j represents the velocity gradient and other variables are the same as in DES,

accordingly to Spalart et al. (A New version of Detached-Eddy Simulation, Resistant to Ambiguous Grid Densities)

2. so I think one should

- declarate the new variables in the SpalartAllmaras.H
- initialize them in the constructors
- add the new definition of d~ in the if (mesh_.changing()) {...} (line 237 from SpalartAllmaras.C)

3. my questions:

- should one call rd and fd as rd_ and fd_?
- should they be declared as volScalarField rd_ and volScalarField fd_?
- in the constructors, I added

fd_(1 - tanh(pow(8*rd_,3))),

dTilda_(wallDist(mesh_).y() - fd_*max(0, wallDist(mesh_).y() - CDES_*delta())),

but it seems that gradU should also be declared/initialized. How should I do that if gradU is a calculated variable? Or should I initialize them in the constructors in another way?
- in the ProgrammersGuide,it's said that the velocity gradient should be called grad(U), but in the SpalartAllmaras code I found it being called as gradU. What would be the difference? gradU would be a kind of simplified representation of grad(U)?
- is there any other big change I have to do, not listed in 2?

4. when I try to compile it, I get some errors, like the non-declaration of gradU and the following:

SpalartAllmaras2/SpalartAllmaras2.C:224: error: no matching function for call to ‘max(int, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’

(refering to max(0, wallDist(mesh_).y() - CDES_*delta()))

In addition, I get lots of similar messages like:

/model/giampani/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/label.H:190: note: candidates are: char Foam::max(char, char)

What would they mean?

Thank you very much,

Leonardo

 leonardo.morita June 26, 2009 09:31

For practical reasons I'll maybe keep my code at

~/OpenFOAM/<user>-<version>/src/turbulenceModels/hybrid/SpalartAllmaras2

separated from original code. I've created a Make/files file:

***************************************
hybrid/SpalartAllmaras2/SpalartAllmaras2.C

libMyTurbulenceModels.C
LIB = \$(FOAM_USER_LIBBIN)/libMyTurbulenceModels
***************************************

and a Make/options file (identical to original one):

***************************************
EXE_INC = \
-I\$(LIB_SRC)/finiteVolume/lnInclude \
-I\$(LIB_SRC)/meshTools/lnInclude \
-I../LESdeltas/lnInclude \
-I../LESfilters/lnInclude \
-I\$(LIB_SRC)/transportModels

LIB_LIBS = \
-lLESdeltas \
-lLESfilters\
-lfiniteVolume \
-lmeshTools
***************************************

I've also created a libMyTurbulenceModels.C file, exactly like I had done for libfoamUser.C when implemented a boundary condition (note that I actually don't know if it is necessary...):

***************************************
namespace Foam
{

void libMyTurbulenceModels()
{}

} // End namespace Foam
***************************************

However, I don't know if it is possible to use member functions from turbulenceModel class, since my code will be compiled separatelly from original models. So I'd like to know if it is possible to do what I want to and, in the case it isn't too complicated, what should I add to my files.

Thank you very much!

 braennstroem July 28, 2009 15:40

Hi Leonardo,

you saw probably the model in version 1.6!?

Regards!
FAbian

 leonardo.morita July 28, 2009 15:46

Great!
I'll take a look into it as soon as possible!
Regards

 All times are GMT -4. The time now is 20:50.