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 obtain initial condition in codedFixedValue boundary condition (https://www.cfd-online.com/Forums/openfoam-programming-development/255783-how-obtain-initial-condition-codedfixedvalue-boundary-condition.html)

Junyu April 29, 2024 10:34

How to obtain initial condition in codedFixedValue boundary condition
 
Hi, everyone. I want to achieve a particular dynamic boundary that is coupled with fluid pressure and dependent on initial geometry.
In a brief form, the boundary displacement \eta satisfies the equation \partial^2\eta/\partial{t^2}+\nabla^2\eta=-p,where \eta is the displacement along the initial normal direction of the wall(here it is a cylinder), and p is the fluid pressure.
I use the dynamicMotionSolverFvMesh as dynamicFvMesh and displacementLaplacian solver. In the pointDisplacement dictionary, I set the moving boundary as the codedFixedValue type and try to solve the above equation.
Now I need to obtain the normal direction at the initial time. I don't know which patch I should use.
By the way, I found a 'points0' in the displacementLaplacian that seems to be the initial position, but it seems not accesible directly.
I have the following codes to obtain pressure on the boundary at present Time:
Code:

const fvMesh& mesh = this->patch().boundaryMesh().mesh();
label cylinderID = mesh.boundaryMesh().findPatchID("cylinder");
volScalarField& tempP = mesh.lookupObjectRef<volScalarField>("p");
const fvPatchScalarField& cylinderP = tempP.boundaryField()[cylinderID];

Any suggestion will be appreciated. Thanks in advance!


All times are GMT -4. The time now is 16:19.