CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Compilation of custom transportModel in OpenFOAM-3.0.1 (https://www.cfd-online.com/Forums/openfoam-programming-development/176780-compilation-custom-transportmodel-openfoam-3-0-1-a.html)

KingKraut August 26, 2016 07:02

Compilation of custom transportModel in OpenFOAM-3.0.1
 
Hi all,

I am trying to port a custom transportModel from OpenFOAM2.2.2 to OpenFOAM-3.0.1.

Like for custom turbulenceModels this seems not a straightforward task. Copy&Paste does not work as is described and explained for turbulenceModels in very good detail here:
http://hassankassem.me/posts/newturbulencemodel/

I suppose similar to this, the compilation and adding of new transportModels to the runTimeSelectionTable is the problem.

As described in the above link, I tried generating a similar function "makeBaseTransportModel" in a newly created file "makeTraModel.C", (compare makeTurModel.C in the link). The output generated from the wmake command in the folder states that the new library is up to date and the inclusion of the library from within the controlDict-file does not give errors either. However, when I give the new transportModel as keyworkd in the constant/transportProperties file, I get the error, that the called viscosityModel does not exist...

The file makeTurModel.C from the above link is based on two different files,
turbulentTransportModels.C and makeTurbulenceModel.H. I looked for similar files (e.g. makeTransportModel, or whatever) in the OpenFOAM/src/ hinting at a correct definition for a function to create a Base transportModel, however could not find anything alike...

The code I am using in makeTraModel.C is the following:

Quote:


// #include "IncompressibleTurbulenceModel.H"
#include "transportModel.H"
#include "transportModel.C"
#include "addToRunTimeSelectionTable.H"
// #include "makeTurbulenceModel.H"
#include "viscosityModelNew.C"
#include "viscosityModel.H"


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define createBaseTransportModel(XXXXX)

createBaseTransportModel
(
XXXX
);

#define makeNewTransportModel(Type) \


#include "generalizedPowerLaw.H"
makeNewTransportModel(generalizedPowerLaw);

// ************************************************** *********************** //
I really don't know, how to define the "createBaseTransportModel" at all, or if this is necessary at all... As I said, the library seems to compile fine, as the library is up to date according to the ouput of wmake. However, it does not work, when I call the keyword for the transportModel from within a simulation case...

I am bit stuck here right now. Is there anyone who has managed to implement a new transportModel in OpenFOAM-3.0.1, so far and give me a hint in which direction I need to look for a solution?

Thanks a lot for looking into this! All help is highly appreciated.

JOhannes

KingKraut August 29, 2016 09:44

Just in case someone else is making themselves life difficult, too...
 
It was really quite stupid and easy...

The following lines were missing in the generalizedPowerLaw.H file:

Quote:

//- Return the laminar viscosity for patch
tmp<scalarField> nu(const label patchi) const
{
return nu_.boundaryField()[patchi];
}
The way they appear in all of the viscosityModels/{}/{}.H files coming with OpenFOAM-3.0.1 anyway...

No makeTransportModel-File or whatever is needed...


All times are GMT -4. The time now is 05:57.