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/)
-   -   Access volume field in the boundary condition of a point field (https://www.cfd-online.com/Forums/openfoam-programming-development/229233-access-volume-field-boundary-condition-point-field.html)

peyman.havaej July 31, 2020 12:10

Access volume field in the boundary condition of a point field
 
Dear Foamers

I have developed a new boundary condition for a point field. In this boundary condition, I need to calculate forces that act on a specific surface; therefore, I have loaded pressure from the object registry. The code was compiled successfully but whenever I run a case with this boundary and the code wants to access to pressure field (please see below), I receive the floating-point error.

here is the code:

Code:

        const polyMesh&  pointMeshIF = this->dimensionedInternalField().mesh()();
       
        const volScalarField& p_ = pointMeshIF.thisDb().lookupObject<volScalarField>("p");

        const fvMesh& mesh = p_.mesh();

        label IDts = mesh.boundaryMesh().findPatchID(targetSurface_);
 
        scalarField targetPatchPressureField  = p_.boundaryField()[IDts];

I could not find the actual problem, but I am sure that floating-point error is because of loading volume fields (pressure). I think it should be possible to use a volume Field in the calculation of a point field.


I will appreciate it if anyone has any idea or suggestion about this problem.

Kind regards,
Peyman


All times are GMT -4. The time now is 01:29.