|
[Sponsors] |
codeInclude in coded function in controlDict, and yPlus |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 16, 2015, 13:25 |
codeInclude in coded function in controlDict, and yPlus
|
#1 |
New Member
Luis Alberto
Join Date: Aug 2015
Location: Spain
Posts: 8
Rep Power: 11 |
Good afternoon everyone,
I am trying to write a coded function object into my controlDict in order to play around with the calculation of yPlus and, by the way, learn more about programming in OpenFOAM. At the moment, I am trying to do it in the way it is done in nutkWallFunctionFvPatchScalarField.C The thing is that I need to include the header "incompressible/turbulenceModel/turbulenceModel.H" where the type turbulenceModel is defined, but when I run pisoFoam, he does not find the file. However, he is able to find pointField.H (I don't need it, it is just for testing) Why does he find this one and not turbulenceModel.H? Code and errors below. Any help is appreciated. At the same time, any suggestions about how to compute the distance from the wall at the cells adjacent to it in a coded function objetct? Code:
functions { test { // Load the library containing the 'coded' functionObject functionObjectLibs ("libutilityFunctionObjects.so"); type coded; // Name of on-the-fly generated functionObject redirectType error; codeInclude #{ #include "pointField.H" // Why does he find this one but not the rest?? #include "nutkWallFunctionFvPatchScalarField.H" // only in case he needed this to find the next, but not. #include "incompressible/turbulenceModel/turbulenceModel.H" #}; codeOptions // To try to fix the above files not found, but does not work #{ -I /opt/openfoam231/src/turbulenceModels/ #}; code #{ label patchID = mesh().boundaryMesh().findPatchID("movingWall"); const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>("turbulenceModel"); const scalarField& y = turbModel.y()[patchID]; #}; } } Code:
could not open file nutkWallFunctionFvPatchScalarField.H for source file functionObjectTemplate.C due to No such file or directory could not open file incompressible/turbulenceModel/turbulenceModel.H for source file functionObjectTemplate.C due to No such file or directory Making dependency list for source file FilterFunctionObjectTemplate.C could not open file nutkWallFunctionFvPatchScalarField.H for source file FilterFunctionObjectTemplate.C due to No such file or directory could not open file incompressible/turbulenceModel/turbulenceModel.H for source file FilterFunctionObjectTemplate.C due to No such file or directory In file included from functionObjectTemplate.C:26:0: Luis |
|
August 16, 2015, 14:06 |
|
#2 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
The problem is that you must point include directory "-I" to lnInclude, for example
Code:
-I$(FOAM_SRC)/turbulenceModels/incompressible/turbulenceModel/lnInclude \ -I$(FOAM_SRC)/turbulenceModels/incompressible/RAS/lnInclude \ |
|
August 16, 2015, 15:50 |
|
#3 |
New Member
Luis Alberto
Join Date: Aug 2015
Location: Spain
Posts: 8
Rep Power: 11 |
Thank you very much mkraposhin,
Following your suggestion, it finally finds it using Code:
codeOptions #{ -I$(FOAM_SRC)/turbulenceModels/incompressible/turbulenceModel/lnInclude \ -I$(FOAM_SRC)/transportModels \ #}; Code:
/home/lpadron/OpenFOAM/lpadron-2.3.1/run/tutorials/incompressible/pisoFoam/ras/cavity-test-yplus-coded/system/controlDict.functions.test:74:8: error: ‘turbulenceModel’ does not name a type thanks! |
|
August 17, 2015, 03:12 |
|
#4 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Hello, are using incompressible or compressible turbulence model?
If turbulence mode is incompressible, then you must declare variable for it using namespace Foam::incompressible, for example: Code:
const Foam::incompressible::turbulenceModel& turbModel = db().lookupObject<Foam::incompressible::turbulenceModel>("turbulenceModel"); |
|
August 18, 2015, 13:48 |
|
#5 |
New Member
Luis Alberto
Join Date: Aug 2015
Location: Spain
Posts: 8
Rep Power: 11 |
Thank you very much mkraposhin,
It indeed works that way. I should have realized that it was a TypeName that could be found in Doxygen and going to Namespaces->Incompressible (Foam::incompressible) ->class turbulenceModel (the one whose header I include), and there you find typeName turbulenceModel as the run-time information for the turbulence model. Of course, you can directly search for turbulence model in Doxygen. Thanks. My only doubt there, perhaps you can help me, is why 'turbulenceModel' does not appear in Doxygne's Namespaces -> Namespace members. In case it might be of use to someone in the future, the final working code to add at the end of controlDict is: Code:
functions { test { // Load the library containing the 'coded' functionObject functionObjectLibs ("libutilityFunctionObjects.so"); type coded; // Name of on-the-fly generated functionObject redirectType error; codeInclude #{ #include "turbulenceModel.H" #}; codeOptions #{ -I$(FOAM_SRC)/turbulenceModels/incompressible/turbulenceModel/lnInclude \ -I$(FOAM_SRC)/transportModels \ #}; code #{ label patchID = mesh().boundaryMesh().findPatchID("movingWall"); const Foam::incompressible::turbulenceModel& turbModel = mesh().thisDb().lookupObject<Foam::incompressible::turbulenceModel>("turbulenceModel"); const scalarField& y = turbModel.y()[patchID]; Info << "y= " << y << endl; #}; } } |
|
Tags |
codeinclude, codestream, yplus |
|
|