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/)
-   -   Source in k-equation (https://www.cfd-online.com/Forums/openfoam-programming-development/103793-source-k-equation.html)

paalj June 27, 2012 04:07

Source in k-equation
 
Dear all,

I want to include a temperature dependent source term in the k-equation of the kOmegaSST turbulence model. There is a tutorial how to copy and compile the keps model and I was able to do the mentioned steps for the kOmegaSST model too. It works. Now the modification of the k-equation has to be performed. I tried to access field values of T via

const volScalarField& T = mesh().objectRegistry::lookupObject<volScalarField >("T");

but I got the error that "mesh" was not declared in this scope.
I really read a lot about accessing field values but was not able to succeed. Furthermore I am not shure where exactly I have to add this few commands (e.g. right before k-equation or somewhere else...). I am quite new to OF and my knowledge about C++ is very bad.

Best regards!

Andreas.Herwig July 2, 2012 06:33

please have a look here

http://www.cfd-online.com/Forums/ope...t-2-1-1-a.html

You need something like

Code:

const volScalarField& T_ = U_.db().lookupObject<volScalarField>(TName_);
where TName_ is the name of your temperature field like "T" and U_ a field which is accessible because the objectRegistry you access by db() seems to be attached to a field (or somehow like this).

greetings

andreas

paalj July 2, 2012 09:23

Thx a lot - the compiler showed no error and the solver runs with reasonable results in serial mode. But I face a problem in parallel computing. When executing "decomposePar" I receive following error message:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.1.0-0bc225064152
Exec : decomposePar
Date : Jul 02 2012
Time : 15:01:40
Host : "paalj-openfoam"
PID : 3811
Case : /home/paalj/OpenFOAM/paalj-2.1.0/run/cavity
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"
Time = 0
Create mesh

Calculating distribution of cells
Selecting decompositionMethod simple

Finished decomposition in 0.07 s

Calculating original mesh data

Distributing cells to processors

Distributing faces to processors

Distributing points to processors

Constructing processor meshes
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"

Processor 0
Number of cells = 3335
Number of faces shared with processor 1 = 44
Number of processor patches = 1
Number of processor faces = 44
Number of boundary faces = 6934
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"

Processor 1
Number of cells = 3334
Number of faces shared with processor 0 = 44
Number of faces shared with processor 2 = 44
Number of processor patches = 2
Number of processor faces = 88
Number of boundary faces = 6824
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"

Processor 2
Number of cells = 3334
Number of faces shared with processor 1 = 44
Number of processor patches = 1
Number of processor faces = 44
Number of boundary faces = 6866

Number of processor faces = 88
Max number of cells = 3335 (0.019994% above average 3334.33)
Max number of processor patches = 2 (50% above average 1.33333)
Max number of faces between processors = 88 (50% above average 58.6667)


Processor 0: field transfer
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"
Processor 1: field transfer
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"
Processor 2: field transfer
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/paalj/OpenFOAM/paalj-2.1.0/platforms/linuxGccDPOpt/lib/libccRASModel.so: undefined symbol: _ZN4Foam14incompressible8RASModel11printCoeffsEv
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libccRASModel.so"

End.
__________________________________________________ __________________________________



In Make/files directory I included:
_____________________________________
cckOmegaSST.C

LIB = $(FOAM_USER_LIBBIN)/libccRASModel
_____________________________________

and in system/controlDict

libs ("libccRASModel.so");



Any ideas?

be_inspired May 23, 2013 04:32

Hi,

I have the same problem. I have modified the standard k-epsilon model with extra terms in the k and epsilon equations.
It compiles with no error and the simulations runs, converges and the results seems correct. I can run in serial or in parallel but I always receive the same warning as you.

Could you detect where was the problem?

zhulianhua October 7, 2015 22:56

Hi, I faced the same problem on OF 2.4.0.

I developed a new dsmcFoam wall interaction submodel ($FOAM_SRC/lagrangian/dsmc/submodels/WallInterationModel).
Then I compiled it to a new self-defined lib called 'libVarDsmc.so"
The serial dsmcFoam run works. But if I use decomposePar, each process issues a Warning like:

Code:

From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/lhzhu/OpenFOAM/lhzhu-2.4.0/platforms/linux64IccDPOpt/lib/libVarDsmc.so: undefined symbol: _ZN4Foam20WallInteractionModelINS_9DsmcCloudINS_10DsmcParcelINS_8particleEEEEEE30dictionaryConstructorTablePtr_E
--> FOAM Warning :
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libVarDsmc.so"

Quote:

Originally Posted by be_inspired (Post 429437)
Hi,

I have the same problem. I have modified the standard k-epsilon model with extra terms in the k and epsilon equations.
It compiles with no error and the simulations runs, converges and the results seems correct. I can run in serial or in parallel but I always receive the same warning as you.

Could you detect where was the problem?



All times are GMT -4. The time now is 18:46.