CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 13, 2016, 04:58
Exclamation How to get a BC's primitive type and motified it in the programm?
  #1
New Member
 
Democritus's Avatar
 
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 3
Democritus is on a distinguished road
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 is offline   Reply With Quote

Old   June 13, 2016, 05:35
Default
  #2
New Member
 
Democritus's Avatar
 
Xiaoqiu HE
Join Date: Mar 2016
Location: Wuhan, China
Posts: 29
Rep Power: 3
Democritus is on a distinguished road
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
Democritus is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:36.