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 get a non-const referento to fvBoundaryMesh (https://www.cfd-online.com/Forums/openfoam-programming-development/245363-how-get-non-const-referento-fvboundarymesh.html)

msaravia September 30, 2022 13:45

How to get a non-const referento to fvBoundaryMesh
 
Hi guys, we are trying to change the fvPatch type of a boundary mesh at runtime (changing from wall type to empty type); therefore, we need a non-const reference to the fvBoundaryMesh, so we can assign a new patch using something like

Code:

fvBoundaryMesh& bmesh = mesh.boundary();

emptyFvPatch newPatch
(
    bmesh["front"].patch(),
    bmesh
);

bmesh.set(0, newPatch);

However, this does not work because mesh.boundary() returns a const reference to the fvBoundaryMesh. Any ideas about how we could change the patch type at runtime? Thanks in advance.


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