CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

mapFields between inconsistent meshes

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2009, 04:58
Default mapFields between inconsistent meshes
  #1
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Hello,

I have two meshes with inconsistent geometries which I would like to map fields in between, but I can not understand how to use e.g. mapFields.

For the from mesh I've calculated the coordinates which corresponds to the coordinates in the to mesh, i.e. P(S,r,\theta) = (x,y,z). Now I would like to use these coordinates together with an interpolation routine (if different amount of cells) to map fields. The two meshes have patches which correspond to each other. I've attached a fig. that shows a simple example of meshes.

Will mapFields perform this mapping? If so could anyone please give an example/hint of how the mapFieldsDict file would look like or is there a better way of performing this mapping?

All the Best
/NW
Attached Images
File Type: jpg meshes.jpg (90.7 KB, 165 views)
nikwin is offline   Reply With Quote

Old   June 13, 2009, 05:05
Default
  #2
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Or, could anyone explain how to load two meshes, please. Thinking of trying to use the meshToMesh class.

/NW
nikwin is offline   Reply With Quote

Old   June 16, 2009, 14:26
Default
  #3
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Writing since I still need some help or proposals of how to map fields between two meshes with different geometries.

I would like to map fields between the two meshes according to a coordinate system derived for my source mesh corresponding to the cartesian coordinate system for the target mesh. The new coordinate system is saved as a volVectorField. (createMesh.H is rewritten to be able to load two meshes, source and target mesh)

a) Is it possible to replace the cartesian coordinate system in my source mesh with the derived coordinate system with e.g. the coordinateSystem class? How? (Would allow me to directly find corresponding cell values for a direct mapping)

b) Is there a class that performs a map between meshes and desirably performs an interpolation too? I've tried to understand how the meshToMesh class can be used for my case but without success.

Sincerely
/NW
nikwin is offline   Reply With Quote

Old   June 17, 2009, 05:07
Default
  #4
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
If you have a function that maps a point in the 'from' geometry onto the corresponding point in the 'to' geometry you can just go through meshToMesh and add this transformation to all accesses of any 'from' geometry. Look for mesh.cellCentres(), faceCentres(), mesh.C(), mesh.Cf() etc. This will make sure that the correspondence (addressing and weights) between the meshes is found correctly. You'll then need to apply your coordinate system transformation when mapping (vector and tensor)fields.

a) above coordinate transformation function can be coded as a 'coordinateSystem'. Use toLocal and toGlobal to convert coordinates. However this is not the hard bit; the hard bit is finding the coordinate transformation function.
mattijs is offline   Reply With Quote

Old   June 18, 2009, 05:23
Default
  #5
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Dear Mattijs,

Thanks for your reply, unfortunately I still have problems understanding how to perform the mapping and would need a more detailed explanation, please.

The function you refer to I assume is my calculated coordinate variables in the 'from' mesh corresponding to the cartesian coordinates in the 'to' mesh? Then, how should I do to, "go through meshToMesh and add this transformation to all accesses of any 'from' geometry"?

mesh.C(), .Cf() etc. returns cellcentres, faceCentres etc. but how can I use this info together with meshToMesh?

Thanks
/NW
nikwin is offline   Reply With Quote

Old   June 18, 2009, 17:05
Default
  #6
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Say you have a function F (your coordinate system) which takes a coordinate in the 'fromMesh' and produces the equivalent coordinate in the 'toMesh'. Go through all of meshToMesh files (in sampling/meshToMeshInterpolation/meshToMesh/) and replace all usage of coordinates of the fromMesh with its transformed equivalence.

E.g.
const vectorField& centresFrom = fromMesh.cellCentres();
..
scalar distSqr = magSqr(p - centresFrom[curCell]);

becomes
const vectorField& centresFrom = fromMesh.cellCentres();
..
scalar distSqr = magSqr(p - F(centresFrom[curCell]));

I can't explain it any clearer.
mattijs is offline   Reply With Quote

Old   June 24, 2009, 17:35
Default
  #7
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Thank You! Now I start to understand mapFields and meshToMesh etc.

Just one thing, I would need to obtain a pointField from a volVectorField, but I can not find any example or syntax as from my understanding in the doxygen manual or in the forum.

Could you give me a hint, please?
nikwin is offline   Reply With Quote

Old   July 30, 2009, 05:35
Default
  #8
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
To finish this thread! The fields between the two meshes can be mapped as consistent after a coordinate transformation which can be done as,

pointMesh pMesh(meshSource);
volPointInterpolation newCoordInt(meshSource, pMesh);
pointVectorField pNewCoord(newCoordInt.interpolate(newCoord));
meshSource.movePoints(pNewCoord);

where newCoord is a volVectorField.

Regards
/NW
nikwin is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Technical] Automatic Mesh Refinement and Tetrahedral Meshes philippose OpenFOAM Meshing & Mesh Conversion 8 May 21, 2016 16:44
Getting prism to inflate into mixed tet-hex meshes Joe CFX 16 October 10, 2011 08:06
Dynamic Meshes Cfdtoy FLUENT 2 February 6, 2004 13:14
Merging Meshes Matteo Giacobello. FLUENT 1 February 16, 2000 10:22
Large 3D tetrahedral meshes Aldo Bonfiglioli Main CFD Forum 4 August 27, 1999 04:33


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