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/)
-   -   How access member variable of a boundary condition (https://www.cfd-online.com/Forums/openfoam-programming-development/131204-how-access-member-variable-boundary-condition.html)

Vesposo March 11, 2014 07:38

How access member variable of a boundary condition
 
Hi,

i want to access in my own boundary condition a member variable of another boundary condition.

For example:

There is a boundary "anotherFvPatchScalarField" condition with the variable

word info = "anInfo";


in my own boundary condition I want to access the variable info:

word patchName = "patchWithVariableInfo";
label patchID = this->patch().boundaryMesh().findPatchID(patchName)

const fvPatch& anotherPatch = this->patch().boundaryMesh()[patchId_];


Info << reCast<anotherFvPatchScalarField>(anotherPatch).in fo;


But, there is a cast error in the last line.

Attempt to cast type wall to type anotherFvPatchScalarField.

Any hints?
Thanks

Vesposo March 13, 2014 07:49

The problem is that

this->patch().boundaryMesh()[patchId_]

returns a fvPatch and not a specific fvPatchField like anotherFvPatchScalarField.

Is there a possibility in my boundary condition to access fvPatchFields from a specific fvPatch?


All times are GMT -4. The time now is 08:52.