CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Interpolation for fvPatchField

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

LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2024, 14:07
Default Interpolation for fvPatchField
New Member
Junyu Ni
Join Date: Sep 2022
Posts: 3
Rep Power: 3
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");
volScalarFieldtempP this->db().objectRegistry::lookupObject<volScalarField>("p");
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, 03:18
New Member
Junyu Ni
Join Date: Sep 2022
Posts: 3
Rep Power: 3
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.
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


boundary, codedfixedvalue, fvpatchfield, interpolate

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 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 13:31
[ANSYS Meshing] Error in Workbench "Unable to attach to geometry file" Jeremie84 ANSYS Meshing & Geometry 70 October 25, 2017 16:03
Am I using the Interpolation Function Correctly? Andrew Norfolk CFX 3 July 21, 2016 10:26
Interpolation with multiple weighing criteria i_m3_mys3lf Main CFD Forum 13 May 11, 2015 11:03
Surface interpolation schemes and parallelization jutta OpenFOAM Running, Solving & CFD 0 February 25, 2010 14:32

All times are GMT -4. The time now is 09:50.