|
[Sponsors] |
Getting coarse mesh from a finer initial mesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 16, 2015, 11:16 |
Getting coarse mesh from a finer initial mesh
|
#1 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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? |
|
September 17, 2015, 12:38 |
|
#2 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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.
|
|
April 1, 2016, 08:28 |
|
#3 |
Member
Join Date: Jul 2011
Posts: 54
Rep Power: 15 |
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. |
|
April 1, 2016, 09:57 |
|
#4 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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.
|
|
April 1, 2016, 11:03 |
|
#5 |
Member
Join Date: Jul 2011
Posts: 54
Rep Power: 15 |
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. |
|
April 4, 2016, 04:51 |
|
#6 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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.
|
|
April 4, 2016, 08:15 |
|
#7 |
Member
Join Date: Jul 2011
Posts: 54
Rep Power: 15 |
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.
|
|
May 4, 2017, 13:25 |
pairPatchAgglomeration for coarser mesh
|
#8 | |
Member
Yeru
Join Date: Jul 2014
Location: UK
Posts: 36
Rep Power: 12 |
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 |
||
May 5, 2017, 05:15 |
|
#9 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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: #include "pairPatchAgglomeration.H" #include "PatchToPatchInterpolation.H" autoPtr<pairPatchAgglomeration> AgglomeratedPatch_; autoPtr<PatchToPatchInterpolation<bPatch, polyPatch> > P2PIPtr_; //In constructor AgglomeratedPatch_.set(new pairPatchAgglomeration(patch().patch(), dict, false)); AgglomeratedPatch_().agglomerate(); if(patch().size() > 0) Pout << "Agglomerated patch " << patch().name() << " from " << patch().size() << " to " << AgglomeratedPatch_().patchLevel(AgglomeratedPatch_().size() - 1).size() << " faces." << endl; P2PIPtr_.reset ( new PatchToPatchInterpolation<bPatch,polyPatch> ( AgglomeratedPatch_().patchLevel(AgglomeratedPatch_().size() - 1), patch().patch(), intersection::FULL_RAY, intersection::VECTOR ) ); //Get coarse fields and face centres surfaceField = vectorField(AgglomeratedPatch_().patchLevel(AgglomeratedPatch_().size() - 1).size()); faceCentres = vectorField(AgglomeratedPatch_().patchLevel(AgglomeratedPatch_().size() - 1).faceCentres()); Info << "Agglomerating surface with " << AgglomeratedPatch_().patchLevel(AgglomeratedPatch_().size() - 1).size() << " / " << patch().size() << "faces" << endl; //Interpolate back on fine mesh fvPatchVectorField::operator=(P2PIPtr_().faceInterpolate<vector>(surfaceField)()); AgglomeratedPatch_().prolongField(*this, coarse, 0); |
|
May 8, 2017, 15:07 |
|
#10 |
Member
Yeru
Join Date: Jul 2014
Location: UK
Posts: 36
Rep Power: 12 |
Thanks Chris, I will try that out. Regards, Yeru
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Star CCM Overset Mesh Error (Rotating Turbine) | thezack | Siemens | 7 | October 12, 2016 12:14 |
[Other] Coarse Mesh | be_inspired | OpenFOAM Meshing & Mesh Conversion | 1 | January 9, 2014 11:47 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |
Icemcfd 11: Loss of mesh from surface mesh option? | Joe | CFX | 2 | March 26, 2007 19:10 |