Getting coarse mesh from a finer initial mesh
I have some calculations which are very expensive, so I would like to run them on a coarser mesh with reduced accuracy compared to the rest of the solver. I've looked around in the source code and the forums but I couldn't find any proper method to generate a coarse mesh yet. Does anyone know of such a function in OpenFOAM or a usable strategy one could use to implement something like this?
There are some overlaps in the GAMG code however GAMG only creates the lduMesh and not the fvMesh objects it seems. Since fvMesh inherits from lduMesh, I'm not sure if we can construct an fvMesh from it. Dynamic meshes have support for refining but not coarsening, so they aren't a real option either (because control over the main mesh is desired; creating it as a refinement causes problems with cell count and small features). Another thing is the faceAgglomerate tool used in view factor radiation modelling to agglomerate faces on the boundaries. This would possibly be helpful to me already, but I would prefer coarsening the whole mesh for a presumably better accuracy/performance rating. I find it quite surprising that such a relatively common task hasn't been covered before. Am I missing anything? |
I have settled with using the pairPatchAgglomeration class to generate a coarser boundary mesh. I would've preferred a coarser mesh instead of only a coarse boundary because I would expect better accuracy at the same computation time but this is likely good enough for me right now. pairPatchAgglomeration can be a bit difficult to make it work properly if you want to coarsen by a larger factor but using a higher number of mergeLevels helped me. Before I had wrong values when interpolating back to the fine mesh. I didn't explicitly check the values on the coarse mesh though.
|
Hey chriss85,
did you manage to generate a whole coarse fvMesh from your original fine mesh? I am looking for ways to do the same thing. I want to use a coarser mesh for just a few operations inside of the code, which originates from the mesh I use for my simulation. |
I have settled with another method. In my case I needed to calculate an integral over the volume. What I did was to use a Monte-Carlo based integration scheme, picking random cells for the integral and weighting them appropriately.
|
Ah ok. Thanks anyways for answering this quickly.
I have to evaluate if a lagrangian particle does hit a wall, but can not loop over the original cells, since the particles may hit a wall but be located way outside of it. I will now try to replace the cells with bigger geometrical objects near the walls, which are checked whether particles are inside them and hitting the walls. In your case, maybe you can use cellZones as well to integrate over a certain volume? This could be costly though. |
cellZones won't really help since I need the complete volume. I can get rid of some cells based on a threshold criterium though. For your case, how about using an octree structure? This might be very helpful. I think there may be some function to find the cell in which a point lies though.
|
Thank you. Yes, we thought about an octree structure as well. But we still need to reduce the mesh to a coarser one near the considered surface.
|
pairPatchAgglomeration for coarser mesh
Quote:
Would you mind sharing how did you use pairPatchAgglomeration class to generate a coarser boundary mesh. I want to do the same but can't figure out how. Many thanks. Kind regards, Yeru |
I don't actually use it now because it didn't give me the results I wanted but I can paste a few lines of code.
Code:
//In Header: |
Thanks Chris, I will try that out. Regards, Yeru
|
All times are GMT -4. The time now is 21:21. |