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

Interpolation for fvPatchField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2024, 15:07
Default Interpolation for fvPatchField
  #1
New Member
 
Junyu Ni
Join Date: Sep 2022
Posts: 3
Rep Power: 4
Junyu is on a distinguished road
Hi, everyone. I'm about to write a dynamic boundary with codedFixedValue.
I want to use the pressure to force the boundary deform and move, so I need the pressure value on the boundary points.

Now I can successfully obtain the pressure on the volume center on the boundary by the following code:
PHP Code:
label cylinderID patch.boundaryMesh().findPatchID("cylinder");
const 
volScalarFieldtempP this->db().objectRegistry::lookupObject<volScalarField>("p");
const 
fvPatchField<scalar>& cylinderP tempP.boundaryField()[cylinderID]; 
The question is how to interpolate this to a pointField on the boundary?
Maybe there are also some other ways to get boundary points infomation that I don't know, so any suggestions or discussions would be helpful. Thanks in advance!
Junyu is offline   Reply With Quote

Old   May 6, 2024, 04:18
Default
  #2
New Member
 
Junyu Ni
Join Date: Sep 2022
Posts: 3
Rep Power: 4
Junyu is on a distinguished road
OK, I found a way: use primitivePatchInterpolation. It returns the field on the boundary point. Here is the corresponding code and "primitivePatchInterpolation.H" should be included.
Code:
const volScalarField& tempP = this->db().objectRegistry::lookupObject<volScalarField>("p");
const scalarField& cylinderFaceP = tempP.boundaryField()[cylinderID];
primitivePatchInterpolation facePointInterpP(tempP.mesh().boundaryMesh()[cylinderID]);   
auto cylinderP = facePointInterpP.faceToPointInterpolate(cylinderFaceP)();
Then cylinderP elements can be accessed with the form "cylinderP[x]".
By the way, I found that openFoam8 has both "primitivePatchInterpolation" and "PrimitivePatchInterpolation" class. When the upper letter case is selected, the errors will be reported.
And also, it is valid to declare cylinderFaceP either as "scalarField&" type or "fvPatchField<scalar>" type, but the latter one cannot match the argument of the interpolation function.
Junyu is offline   Reply With Quote

Reply

Tags
boundary, codedfixedvalue, fvpatchfield, interpolate


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapping (interpolation) between two meshes Ebrahim OpenFOAM Programming & Development 2 June 15, 2020 14:31
[ANSYS Meshing] Error in Workbench "Unable to attach to geometry file" Jeremie84 ANSYS Meshing & Geometry 70 October 25, 2017 17:03
Am I using the Interpolation Function Correctly? Andrew Norfolk CFX 3 July 21, 2016 11:26
Interpolation with multiple weighing criteria i_m3_mys3lf Main CFD Forum 13 May 11, 2015 12:03
Surface interpolation schemes and parallelization jutta OpenFOAM Running, Solving & CFD 0 February 25, 2010 15:32


All times are GMT -4. The time now is 13:10.