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 to get a BC's primitive type and motified it in the programm? (https://www.cfd-online.com/Forums/openfoam-programming-development/173077-how-get-bcs-primitive-type-motified-programm.html)

Democritus June 13, 2016 04:58

How to get a BC's primitive type and motified it in the programm?
 
Dear Foamers~!

Here I met a problem: I want to get the primitive type of BC for a field, for example the field "v".

Code:

const & fvBoundaryMesh & thisBoundary = mesh.boundary(); // here i get the boundary mesh
const & fvPatch = thisBoundary[ 0 ]; // here i get the first patch
const & thisFvPatchField =  v.boundaryField()[ 0 ]; // i get the fvPatchField on the first patch

then how can i get the primitive type of this fvPatchField? For example i want to know if this patch field is fixedValue or fixedGradient? and furthermore, i want to modify it in the program. This is useful when imposing a BC inside a program which saves a lot if time comparing to setting up a case.

Democritus June 13, 2016 05:35

there is a easy method to indicate the primitive type of the BC:
Code:

Foam::word nameSpecial = v.boundaryField()[fvPatchID].type();
Info << "\n this patch is of type: " << nameSpecial << endl;

the method type() will show the primitive type:)


All times are GMT -4. The time now is 03:55.