CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Modified mapFields? (http://www.cfd-online.com/Forums/openfoam-pre-processing/95841-modified-mapfields.html)

mturcios777 January 4, 2012 17:56

Modified mapFields?
 
Hello all,

I've been doing some simulations using snappyHexMesh and other tools that requires re-meshing the domain and mapping of fields. I'm finding that the boundaries aren't strictly coincident which leads to problems when mapping. The differences are small, but cause eventual instability with the solver. The picture from the user manual will help explain:

http://www.openfoam.org/docs/user/ma...p#x28-17500317.

The problem for me occurs when there is a region outside the original geometry. Using a mapFieldsDict I get a mapping, but the grey region is populated with whatever the file residing in the target time directory specifies (which is usually uniform and much different than the surrounding values). What I was thinking of would be a modified (or even new) version of mapFields that does the following:

1) Map the boundary conditions (including values) from the source to the target. For non-coincident patches, there would need to be some interpolation, akin to stretching a balloon onto a rigid surface (this really only matter for patches on the boundary of the gray region; cuttingPlanes work fine for the "internal" boundaries). Perhaps this could be another set of patches in the mapFieldsDict, called interpolatePatches?

2) Map as much of the internal field of the target with data from the source

3) For regions like the gray area, perform some kind of interpolation between the mapped internal region and the interpolated boundary.

This won't be perfect, but I hope it will result in a "smoother" field that runs a bit more stably. I'm going to start looking at the code for mapFields and see what I can learn, but I'm wondering if anyone has ever thought of this approach (or similar), or even if there has been any work done.

One issue that may come up is when there is a patch in the target that is only partially outside of the source, in which case the behaviour would need to switch from cuttingPlane to interpolatePatch, which means we may have to do this face by face as opposed to patch by patch.

Going to start digging, will let you know if I come across any nuggets of wisdom. Please let me know if there are other seams I can mine :).

mturcios777 January 9, 2012 18:47

Some progress
 
So I've made a modified version of mapFields that writes values to the cells of an inconsistent mesh that are outside the original mesh. I'm copying over the value from the nearest location in the new mesh that has a mapped value (identifying the cells that need values is already implemented.

I'm trying to make the search for the nearest location more efficient than N^2. I was looking at this thread and thought I could use the cellCells(cellI) function to only search the neighbour cells, but it seems list I get starts from 0. Is there a function (or simple piece of code) that give me a list of global cell indices for neighbour cells?

rcastilla October 18, 2012 15:58

Hi, Marco,

I have the same problem as you. I am mapping to very similar (but nor identical) meshes and I am experiencing some stability problems due to the 0 values in certain cells. Have you made the modified mapFields to overcome this problem? Is it working?

Regards

Robert

rcastilla October 31, 2012 06:26

Hi, Marco,

I have programmed an utility that "corrects" the mapped fields with an auxiliary Mark fields, as you suggested.

To access the neighbour cells with cellCell() you have to access to the global Id, identified by the local list returned by the function. I used a loop as following:

Quote:

forAll(mesh.cellCells()[cellI],cellII)
{
label cellId = mesh.cellCells()[cellI][cellII];
..........
your code here
cellId is the global identifier for the neighbour cell
............
}
Hope it will help you, if you have not already found the solution by your means...

Regards

Robert

mturcios777 October 31, 2012 12:33

Thanks Robert! I hadn't optimized the mapFields as there were only a small number of cells to modify, but this will be useful when we run on meshes that have a larger number of unmapped cells.


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