CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to define a field on a patch (http://www.cfd-online.com/Forums/openfoam-programming-development/104270-how-define-field-patch.html)

Aleksey_R July 5, 2012 12:42

How to define a field on a patch
 
Greetings, dear colleagues!

I have a case with 2 meshes (say, "a" and "b"). And I need to implement a boundary condition (for the field u) like:

grad (u_a) = const*(u_a - u_b)

i.e. boundary gradient for the field u on the "a"-mesh side is proportional to the difference between the values of the u field on the "a"-"b" interface.

Now the question: is it possible to define a field on the patch?

When I do patch to patch interpolation I obtain a scalar field which groovyBC doesn't recognize (because it is not associated with specific patch). So I think I have to define a field on a specific patch. But how to do it? Or is there any other ideas how to implement desired BC?

Thanks in advance.

Best regards, Aleksey.

tomislav_maric July 9, 2012 11:23

Hi Aleksey,

try this to get an access to a boundary field:

Code:

fvPatchField<Type>& someFieldBuondaryField = someField.boundaryField()[patchI];
just rename someField to the name that you use. This will give you write access to the patch field. Is this what you need?

Be careful to use scalar, vector or tensor instead of Type, depending on the GeometricField<Type, ...> that you are dealing with. There are also some typedefs for the boundary patch fields like fvPatchScalarField I think....

Tomislav


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