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/)
-   -   Duplicate and sort a patch (https://www.cfd-online.com/Forums/openfoam-programming-development/255095-duplicate-sort-patch.html)

MarcoC501 March 18, 2024 13:51

Duplicate and sort a patch
 
Hello,

I just started programming in OpenFOAM and, as exercise, I wanted to develop radial equilibrium boundary conditions on a given patch.

To this scope, I first converted the cartesian coordinates to cylindrical coordinates and make some operations to obtain the tangential velocity component. My mesh is structured and follows the annulus profile (this simplifies the implementation...)

However, to apply the radial equilibrium I need to have sorted coordinates (from min to max radius), so it is easier to store everything in a matrix N_radius x N_theta (where N_radius and N_theta are the number of radial and tangential positions).

I think the best idea is to copy the patch, sort it, apply the radial equilibrium, and then interpolate back on the non-sorted grid.

I think I can handle the interpolation, I just need to find a quick way for duplicate and sort the patch and the related flow fields. I could not find examples on how to do that, and I would like to know if you could help me (or give good references) on how I could do this implementation using existing OpenFOAM syntax and programming logic.

Thanks a lot for your help


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