Problem creating a new Wallfunction on OF 2.2 !
2 Attachment(s)
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 */ 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 = \ Does anybody know how to compile a new wall function on OpenFoam 2.2 ? You can find enclosed my custom RAS model. |
Small up:)
|
Second up :(
|
Error while compiling a custom wall function (OF 2.2)
2 Attachment(s)
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 */ 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 |
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 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 One last thing is that OpenFOAM commands usually respond to "-help": Code:
wmake -help Bruno |
My mistake then :p
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"); Thx again ;) |
compile custom wall function in v 2.3.x
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? |
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 |
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 :D. FYI: A new turbulence modelling framework is introduced in OpenFOAM 2.3.0 [2]. Quote:
Weiwen [1] https://github.com/OpenFOAM/OpenFOAM...m/Make/options [2] http://www.openfoam.org/version2.3.0/multiphase.php |
All times are GMT -4. The time now is 20:57. |