Help with this line of code :
Hi all.
I dont quite understand what these lines of code mean in the file nuSgsUSpaldingWallFunctionFvPatchScalarField.C , which is the Spalding Wall Function for LES. I use OpenFOAM 2.1.1 U has been defined as Code:
const fvPatchVectorField& U = lesModel.U().boundaryField()[patchi]; Code:
const scalarField magUp(mag(U.patchInternalField() - U)); I am confused as to why this is being done. Any help will be appreciated. Also, I CANNOT find the nuSgsUSpaldingWallFunction folder in the Github for OpenFOAM 2.1.x https://github.com/OpenFOAM/OpenFOAM-2.1.x whereas its there in OpenFOAM-2.1.1 / src / turbulenceModels / incompressible / LES / derivedFvPatchFields / wallFunctions / nuSgsWallFunctions / nuSgsUSpaldingWallFunction /nuSgsUSpaldingWallFunctionFvPatchScalarField.C in my install directory of OpenFOAM 2.1.1 in my machine!!! Why is this? :confused: Thank you all for your time. Regards A.T.M |
U.patchInternalField() will only give U field in neighboring cells to the patch and not complete internal field.
Regards, -Yogesh |
Quote:
Thank you. Just to make sure I understand right, lesModel.U().boundaryField()[patchi] has the patchID mentioned here, whereas the U.patchInternalField() doesnt have anything like that. Which patch does it refer to by default? Also, the "boundaryField" refers to the cells which are adjacent to the boundary, and the "internalField" refers to the cells adjacent to the boundaryField cells? is this correct? Regards, ATM |
Greetings!
Just some more info for you. The line Code:
const fvPatchVectorField& U = lesModel.U().boundaryField()[patchi]; Code:
const scalarField magUp(mag(U.patchInternalField() - U)); |
Dan,
Thank you very much! That was helpful. On a similar note, can I just call pressure (press) in the code as Code:
const volScalarField& press = db().lookupObject<volScalarField>("p") Code:
const fvPatchScalarField& P = press().boundaryField()[patchi]; Sorry if this seems very rudimentary....I am not very comfortable with the way OF is coded. Thanks again. |
The compiler should tell you if it is a redefinition of the variable names or if it is a reserved word....since its job is to keep track of that. These variables have local scope so you can name them what you have suggested unless they are defined in another part of the code you are altering.
Quote:
|
Some additional info:
The above code compiles fine if i do not make the pr().boundaryField call , remove [patchi] from Line 130, and use the 'pr' field as itself. Looks like If I just find out the function to use to create a boundaryField from a complete volScalarField, I will be done. Thanks, atm |
If you want access to your boundary field from your volScalarField, look at your first post on how you originally accessed the boundary field
Code:
const fvPatchVectorField& U = lesModel.U().boundaryField()[patchi]; |
Dan,
Thanks for responding. I will look into it more..... Regards Atm |
Hi guys,
I have a similar problem. I have a patch named "fluid_to solid" in my mesh. In order to copy the values of a field in correspondence to this specific patch I have written the following code: Code:
forAll( TFluid[j].boundaryField(), patchi) Can anyone help me? Best Giancarlo |
All times are GMT -4. The time now is 15:55. |