CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Problem creating a new Wallfunction on OF 2.2 !

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By fredo490
  • 2 Post By wwzhao

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 24, 2013, 05:17
Default Problem creating a new Wallfunction on OF 2.2 !
  #1
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
Dear all,
I'm trying to implement a new wall Function into OF 2.2 but I keep having bugs at compiling.

Here is what I did:
1) I copied the wall compressible turbulence model to my desktop:
opt/openfoam220/src/turbulenceModels/compressible/RAS

2) I made a copy of mutkRoughWallFunction and called it MYmutkRoughWallFunction
I've opened the MYmutkRoughWallFunction.C and MYmutkRoughWallFunction.H and I have replaced all "mutkRoughWallFunction" by "MYmutkRoughWallFunction" with a case matching.

3) I made a copy of alphaWallFunctions and called it MYalphaWallFunctions
I've opened the MYalphaWallFunctions.C and MYalphaWallFunctions.H and I have replaced all "alphaWallFunctions" by "MYalphaWallFunctions" with a case matching.

4) I went to the Make folder and I've changed the files to
Code:
/* Wall functions */
wallFunctions = derivedFvPatchFields/wallFunctions

alphatWallFunctions = $(wallFunctions)/alphatWallFunctions
$(alphatWallFunctions)/MYalphatWallFunction/MYalphatWallFunctionFvPatchScalarField.C

mutWallFunctions = $(wallFunctions)/mutWallFunctions

$(mutWallFunctions)/MYmutkRoughWallFunction/MYmutkRoughWallFunctionFvPatchScalarField.C

LIB = $(FOAM_USER_LIBBIN)/MyRoughlibcompressibleRASModels
5) Then I made a "wclaen" and after a "wmake" but a problem occurred during compiling:
See enclosed for the bug report

6) To solve my problem, I tried to include a maximum of library into the options file:
Code:
EXE_INC = \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/genericPatchFields/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
    -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
    -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
    -I$(LIB_SRC)/dynamicMesh/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/derivedFvPatchFields/lnInclude \
    -I$(LIB_SRC)/finiteVolume/cfdTools \
    -I$(LIB_SRC)/fvOptions/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/OpenFOAM/lnInclude \

LIB_LIBS = \
    -ldynamicFvMesh \
    -ltopoChangerFvMesh \
    -ldynamicMesh \
    -lfluidThermophysicalModels \
    -lspecie \
    -lcompressibleTurbulenceModel \
    -lcompressibleRASModels \
    -lcompressibleLESModels \
    -lfiniteVolume \
    -lmeshTools \
    -lsampling \
    -lfvOptions
But the problem remain the same...

Does anybody know how to compile a new wall function on OpenFoam 2.2 ? You can find enclosed my custom RAS model.
Attached Files
File Type: txt bugCompiling.txt (23.8 KB, 32 views)
File Type: zip myRAS.zip (91.7 KB, 16 views)
fredo490 is offline   Reply With Quote

Old   May 26, 2013, 12:31
Default
  #2
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
Small up
fredo490 is offline   Reply With Quote

Old   May 28, 2013, 08:58
Default
  #3
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
Second up
fredo490 is offline   Reply With Quote

Old   May 29, 2013, 14:53
Default Error while compiling a custom wall function (OF 2.2)
  #4
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
Dear all,
I'm trying to implement a new wall Function into OF 2.2 but I keep having bugs at compiling. I guess I'm doing something wrong but I don't know where.

PART 1 I tried to create a Custom library

Here is what I did:
1) I copied the wall compressible turbulence model to my desktop:
opt/openfoam220/src/turbulenceModels/compressible/RAS

2) I made a copy of mutkRoughWallFunction folder and called it MYmutkRoughWallFunction
I've opened the MYmutkRoughWallFunction.C and MYmutkRoughWallFunction.H and I have replaced all "mutkRoughWallFunction" by "MYmutkRoughWallFunction" with a case matching.

3) I made a copy of alphaWallFunctions and called it MYalphaWallFunctions
I've opened the MYalphaWallFunctions.C and MYalphaWallFunctions.H and I have replaced all "alphaWallFunctions" by "MYalphaWallFunctions" with a case matching.

4) I went to the Make folder and I've changed the files to
Code:
/* Wall functions */
wallFunctions = derivedFvPatchFields/wallFunctions

alphatWallFunctions = $(wallFunctions)/alphatWallFunctions
$(alphatWallFunctions)/MYalphatWallFunction/MYalphatWallFunctionFvPatchScalarField.C

mutWallFunctions = $(wallFunctions)/mutWallFunctions

$(mutWallFunctions)/MYmutkRoughWallFunction/MYmutkRoughWallFunctionFvPatchScalarField.C

LIB = $(FOAM_USER_LIBBIN)/MyRoughlibcompressibleRASModels
5) Then I made a "wclaen" and after a "wmake" but a problem occurred during compiling. You can see enclosed the bug report.

I thought the problem might come from a missing library but even adding all the possible OpenFoam library to the option file doesn't solve the problem.

PART 2 I tried to edit OpenFoam library

Then I tried to edit the actual OpenFoam compressible library by editing the source files in opt/openfoam220/src/turbulenceModels/compressible/RAS and recompiling all OpenFoam but I still cannot use the new wall function.

I did the same things as described above but this time for the libcompressibleRASModels. I didn't change any code, I have simply copied the wall function code and replaced the names by adding "MY".

I wonder, is there any special "link" that is hard coded ? Also, how does the list of the possible wall function is generated when a solver settings are wrong ? Is it dynamic or hard coded ?

Thx in advance, Fred
Attached Files
File Type: txt bugCompiling.txt (23.8 KB, 8 views)
File Type: zip myRAS.zip (91.7 KB, 11 views)
fredo490 is offline   Reply With Quote

Old   May 29, 2013, 17:29
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Fred,

I've merged your latest thread into this one, since it's on the same topic.

As for the problem you're having, it's as simple as running wmake like this:
Code:
wmake libso
This is very briefly explained in the User Guide, section "3.2.2.4 Running wmake", table 3.1: http://www.openfoam.org/docs/user/co...php#x10-750011

Ironically, 8 days ago this was fixed in OpenFOAM 2.2.x: https://github.com/OpenFOAM/OpenFOAM...4c48941c9f1981 - so, if you had the latest OpenFOAM 2.2.x, you wouldn't have had this problem


By the way, I saw that you had forgotten the "libso" option, because of this line:
Code:
          -lOpenFOAM -ldl   -lm -o OpenFOAM.out
The last name "OpenFOAM.out" is the indication that it tried to build it as an executable.


One last thing is that OpenFOAM commands usually respond to "-help":
Code:
wmake -help
Best regards,
Bruno
__________________
wyldckat is online now   Reply With Quote

Old   May 30, 2013, 04:12
Default
  #6
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17
fredo490 is on a distinguished road
My mistake then

I have also found another mistake. I forgot to change the wall function name in the .H file. I had a bug of "double declaration"... Now the code works.
Code:
    TypeName("MYmutkRoughWallFunction");
Once I finish coding the wall function I will create a topic with the source code and the procedure to compile it.

Thx again
wyldckat likes this.
fredo490 is offline   Reply With Quote

Old   July 14, 2014, 17:10
Default compile custom wall function in v 2.3.x
  #7
Member
 
Kevin Maki
Join Date: Mar 2009
Location: Ann Arbor, MI, USA
Posts: 43
Rep Power: 17
kjmaki is on a distinguished road
I am trying to compile a custom rough-wall function in version 2.3.x. I have tried starting with the nutkRoughWallFunction by renaming it and compiling it into its own library. when I try to include the library (in system/controlDict) it isn't loaded by the solver.

I tried a second way, by copying nutkRoughWallFunction to say nutk2RoughWallFunction, changing the file names and all occurences in the .H and .C files, and then re-compiling libturbulenceModels with the new .C file. The library compiles, but then when I try to access the new boundary condtion the solver cannot find it.

Does any one have a suggestion?
kjmaki is offline   Reply With Quote

Old   July 15, 2014, 09:31
Default
  #8
Member
 
Kevin Maki
Join Date: Mar 2009
Location: Ann Arbor, MI, USA
Posts: 43
Rep Power: 17
kjmaki is on a distinguished road
I thought I might add more details to entice comments from the community. If I copy $FOAM_SRC/TurbulenceModels/turbulenceModels to my work space and change only the last line in Make/files from

LIB = $(FOAM_LIBBIN)/libturbulenceModels

to

LIB = $(FOAM_USER_LIBBIN)/libmyTurbulenceModels

I can compile the library with wmake libso. When I run a case and include the line
libs( "libmyTurbulenceModels.so" ); in my system/controlDict, and the solver produces a long stream of information complaining about things such as

Duplicate entry atmBoundaryLayerInletVelocity in runtime selection table fvPatchField

I understand that there are duplicate entries. So, I try to modify an existing wall function by just changing its name. Such as converting nutkRough to nutk2Rough. I update the Make/files file to reflect the new wallFunction, and the library compiles. When I run simpleFoam on a case that uses the new wall function, I get an error that says:
Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model kOmegaSST


--> FOAM FATAL ERROR:

request for turbulenceModel turbulenceProperties from objectRegistry region0 failed
available objects of type turbulenceModel are
0()

From function objectRegistry::lookupObject<Type>(const word&) const
in file /l/kjmaki/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 198.

FOAM aborting
kjmaki is offline   Reply With Quote

Old   July 22, 2014, 06:16
Default
  #9
New Member
 
Weiwen Zhao
Join Date: Dec 2013
Posts: 19
Rep Power: 13
wwzhao is on a distinguished road
Hi, Kevin.

You should copy source code from $FOAM_SRC/turbulenceModels (lower case "t"), as the simpleFoam solver is linking to the libincompressibleTurbulenceModel.so generated by $FOAM_SRC/turbulenceModels [1].
One more thing, you should only keep the wall-function code which you want to modify, other code should be removed from your working directory otherwise it will complain duplicated entries .

FYI: A new turbulence modelling framework is introduced in OpenFOAM 2.3.0 [2].

Quote:
The framework can be found in $FOAM_SRC/TurbulenceModel (upper case “T”) and includes the incompressible, compressible, phase-incompressible and phase-compressible options including support for laminar, RAS and LES simulations with wall-functions and other specialised boundary conditions.
Best regards,
Weiwen

[1] https://github.com/OpenFOAM/OpenFOAM...m/Make/options
[2] http://www.openfoam.org/version2.3.0/multiphase.php
tiam and Chaoran like this.
wwzhao is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Problem in creating different zones in ICEM-CFD samurai_01 ANSYS Meshing & Geometry 2 November 28, 2012 13:41
2D axisymmetric Mesh problem in OpenFoam Javed OpenFOAM 3 September 22, 2011 03:23
[Commercial meshers] Handling cyclic BC from gambit to openfoam for a cascade airfoil problem - OF 1.6 maverick OpenFOAM Meshing & Mesh Conversion 2 June 18, 2011 05:36
Velocity profiles problem behind the elbow (3D problem) kabat73 FLUENT 8 May 9, 2010 05:26
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13


All times are GMT -4. The time now is 11:14.