CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Mapping values from 2D mesh to 3D mesh boundary during runtime

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2012, 14:51
Default Mapping values from 2D mesh to 3D mesh boundary during runtime
  #1
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Hi all, I'm making a model that has 2 meshes: a 2D mesh and a 3D mesh. The 3D mesh is identical to the 2D mesh in all dimensions except that it extends into the z-direction.

During runtime, I need to map values from the 2D mesh onto a boundary of the 3D mesh because they are coupled. The dimensions of the 3D boundary that I'm trying to map onto is exactly the same as the 2D mesh.

What is the easiest/best way of doing this?


Since this is just a 1:1 mapping, I thought that this would be relatively easy by just looping over the boundary values of the 3D mesh, something like this:

Code:
label frontWall = mesh3D.boundaryMesh().findPatchID("frontWall");
fixedValueFvPatchScalarField& faceValues = refCast<fixedValueFvPatchScalarField>(Cvalues_3D.boundaryField()[frontWall]);
scalarField& Cvalues_3D_boundary = faceValues; //this selects the boundary values on the 3D mesh

forAll(Cvalues_3D_boundary,i){
Cvalues_3D_boundary[i] = Cvalues_2D[i]; //where Cvalues_2D are the values on the 2D mesh that I want mapped onto the 3D mesh boundary
}
The problem that I have with the above code is that the 3D boundary values are sorted in a different order than the 2D values. For example, in the forAll loop i the code above, I've found that Cvalues_3D_boundary[1] should actually be equal to Cvalues_2D[100].

Is there another way to map values between meshes during runtime?
benk is offline   Reply With Quote

Old   June 13, 2014, 03:39
Default
  #2
New Member
 
Detian Liu
Join Date: Mar 2013
Location: Beijing, P.R.China
Posts: 20
Rep Power: 13
Detian Liu is on a distinguished road
Dear Ben,
I am recently studying about the mesh mapping, I have a simple question, and hope get some help from you. That is how to create 2 different meshes in one case, such as mesh3D and mesh 2D you mentioned before.
Thanks a billion.

Detian
2014.6.13
Detian Liu is offline   Reply With Quote

Reply


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
[ICEM] Hybrid mesh for 2D boundary layer Bigio ANSYS Meshing & Geometry 33 November 18, 2019 10:15
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
CFX does not continue Shafiul CFX 10 February 17, 2011 08:57
Concentric tube heat exchanger (Air-Water) Young CFX 5 October 7, 2008 00:17
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


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