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

How to Map Fields in openFOAM using the utility

Register Blogs Community New Posts Updated Threads Search

Like Tree25Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2016, 00:22
Default
  #21
New Member
 
Jade Chantrell
Join Date: Dec 2015
Location: Newcastle, Australia
Posts: 12
Rep Power: 11
Chanterz is on a distinguished road
Hi guys, I am trying to do something very similar to what you are trying to do. I will post what I have discovered so far relating to my problem and hopefully it can help yours. I am sick of mapFields problems - I just want to solve this!

So far I have:
  • A target mesh that has an STL file meshed with SHM
  • A source mesh that is the same but without the meshed STL file inside

The target mesh is thus 'finer' than the source file. I.e. it has more cells, points and faces.

System architecture:
  • I have a 0,constant,system, 3962 folder (left empty), and 'blah' folder... these are ALL inside my target folder
  • 'blah' folder has a 0,constant and system folder of a pre-solved case of 3692. This is my 'source' case.
  • controlDict in target directory has been changed with a startTime of 3692
The Source and Target cases have the same boundary conditions apart from my desired cutting patch of 'heliostat', which is my meshed STL file.



What I do:
  • blockMesh and SHM the target case (see other threads about how to do this)
  • call <mapFields blah -sourceTime latestTime>
This is my mapFields:
*Note: heliostat is the STL file/object I have added into the farfield.


Code:
patchMap        
(
inlet inlet
outlet outlet
sides sides
top top
ground ground
 );

cuttingPatches  
(
heliostat
);
And this is the output:


Code:
Source: "." "blah"
Target: "/mnt/worimi/jade/Final_System" "simple_atm_smallerlayers_z0ofZero_withHeliostat"

Create databases as time

Source time: 3692
Target time: 3692
Create meshes

Source mesh size: 2534400    Target mesh size: 2860432


Mapping fields for time 3692


End
When I check 3692 folder in target directory there is nothing there.


This method has worked for me when I leave mapFields blank, but of course, but only when I go from a fine to a coarse mesh. In this case, it mapped everything from Source to Target 3692 as nonuniform lists, to which I could add my extra BC for 'heliostat' at the end. (supplementary question: can I do this?)


I have tried messing around with mapFields, by leaving out parts of cuttingPatches and patchMap, but it hasn't worked (I get the above output where it accepts the command but doesn't do anything).



I WAS using 2.3x but if you get this error:


Code:
Source: ".." "frac1" Target: "/home/ripuvm/OpenFOAM/ripuvm-2.3.x/multiFrac/cases/Consecutive1Well" "frac2"  Create databases as time Case   : ../frac1 nProcs : 1  Source time: 133 Target time: 54  Create meshes  Source mesh size: 68670    Target mesh size: 83482   Creating and mapping fields for time 133  Creating mesh-to-mesh addressing for region0 and region0 regions using cellVolumeWeight   --> FOAM FATAL ERROR:  Plane normal defined with zero length Bad points:(15.24 -114.3 -22.86) (15.24 -106.68 -22.86) (15.24 -99.06 -22.86)      From function void plane::calcPntAndVec (     const point&,     const point&,     const point& )      in file meshes/primitiveShapes/plane/plane.C at line 116.  FOAM aborting  #0  Foam::error::printStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1  Foam::error::abort() in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2  Foam::plane::calcPntAndVec(Foam::Vector<double> const&, Foam::Vector<double> const&, Foam::Vector<double> const&) in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #3  Foam::tetOverlapVolume::tetTetOverlapVol(Foam::tetPoints const&, Foam::tetPoints const&) const in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libmeshTools.so" #4  Foam::tetOverlapVolume::cellCellOverlapVolumeMinDecomp(Foam::primitiveMesh const&, int, Foam::primitiveMesh const&, int, Foam::treeBoundBox const&) const in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libmeshTools.so" #5  Foam::meshToMeshMethod::interVol(int, int) const in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libsampling.so" #6  Foam::cellVolumeWeightMethod::calculateAddressing(Foam::List<Foam::List<int> >&, Foam::List<Foam::List<double> >&, Foam::List<Foam::List<int> >&, Foam::List<Foam::List<double> >&, int, int, Foam::List<int> const&, Foam::List<bool>&, int&) in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libsampling.so" #7  Foam::cellVolumeWeightMethod::calculate(Foam::List<Foam::List<int> >&, Foam::List<Foam::List<double> >&, Foam::List<Foam::List<int> >&, Foam::List<Foam::List<double> >&) in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libsampling.so" #8  Foam::meshToMesh::calcAddressing(Foam::polyMesh const&, Foam::polyMesh const&) in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libsampling.so" #9  Foam::meshToMesh::calculate() in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libsampling.so" #10  Foam::meshToMesh::meshToMesh(Foam::polyMesh const&, Foam::polyMesh const&, Foam::meshToMesh::interpolationMethod const&, Foam::HashTable<Foam::word, Foam::word, Foam::string::hash> const&, Foam::List<Foam::word> const&) in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libsampling.so" #11    in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/bin/mapFields" #12    in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/bin/mapFields" #13  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #14    in "/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/bin/mapFields"  Program received signal SIGABRT, Aborted. 0x00007ffff4260425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(taken from ripudaman in this thread: http://www.cfd-online.com/Forums/openfoam-pre-processing/81780-issues-mapfields.html)



... then I have been led to believe this is a problem with mapFields in 2.3.

OpenFoam 2.2 is supposed to work, but the creators have noticed this and have reverted back to 2.2 functionality in 3.0x.



So I downloaded 3.0x and now in stead of getting this error with cuttingPatches it accepts it, but doesn't do anything. I feel like there is an issue with how it is reading the points or something - or the way the files are set up?



If I have any development on the matter I will post, but at the moment I am quite stuck. Any help would be much appreciated by myself and, I'm guessing, MANY OF users.



Kind regards, Jade
Chanterz is offline   Reply With Quote

Old   February 5, 2016, 01:25
Default Wow found a possible solution:
  #22
New Member
 
Jade Chantrell
Join Date: Dec 2015
Location: Newcastle, Australia
Posts: 12
Rep Power: 11
Chanterz is on a distinguished road
Back again!

Ok, so I managed to successfully mapFields with everying, including my cuttingPatch of heliostat, filled out above.

What is also great, is that the cuttingPatch BC's are also mapped into the list of field numbers of the mapped solution files from source.

Here's what I did:

  • copied the 0 files from target case (of the boundary conditions I want of the patches INCLUDING heliostat boundary) into the-previously-blank 3692 file (where the source files 'were' to be uploaded).
  • When I employ mapFields as above, it seems that the mapFields function overwrites the target boundary files and fills it with the list of numbers that have matching boundary conditions between the target and source cases (outlined in patchMap) and leaves the 'heliostat' cutting patch alone.

The number of faces indicating that the coarse source mesh has been mapped onto the fine target mesh is also indicated at the top of these new files.

I have to wait until Monday to run it. I will let you know how it goes.
wyldckat likes this.
Chanterz is offline   Reply With Quote

Old   April 27, 2016, 03:19
Default
  #23
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hello everybody,

I found this thread while I was searching for mapping methods.
In my case, I want to map a fully developed flow profile to a different inlet.
Situation:
Run a simulation of a tube (l=1m), sample at 0.9m and use this "cut" as inlet BC for a different case 2. Meshes are not the same...
I tried meshFields, but I can only map an overlapping volume.
Is there a way to map a cutting plane to the inlet of case 2?

Thanks a lot for your info

Regards
sisetrun is offline   Reply With Quote

Old   June 24, 2016, 03:40
Default
  #24
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17
Elham is on a distinguished road
Dear sisetrun,

Could you find any solution for this problem? Please let me know since I have the same issue.

Thanks.

Elham
Elham is offline   Reply With Quote

Old   June 24, 2016, 03:52
Default
  #25
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hey Elham.,

I managed it by sampling a fully developed flow from a pipe. Use "foamFile" as output in the sampleDict.

Then you can have a look at incompressible/simpleFoam/pitzDailyExptinlet.
In your constant directory, create a folder boundaryData and in this folder another one with the name of your inlet patch. Within this inlet-folder, your copy your points from sampleDict and a third folder "0" where you put your "U" file. make sure, that you add the OpenFoam header:

Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorField; (points) // vectorAverageField for U
object points; or values for U
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
As BC for your patch, use
Quote:
inlet
{
type timeVaryingMappedFixedValue;
offset (0 0 0);
setAverage off;
}
offset is a dummy here, the actual data is taken from your "U" file in the constant/boundaryData... folder.

Regards
sisetrun is offline   Reply With Quote

Old   June 24, 2016, 04:58
Default
  #26
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17
Elham is on a distinguished road
Dear sisetrun,

Thanks for prompt reply. I have followed your instruction and sampled my inlet patch. Now I have points, U and P of inlet. But I don't know where should I assign BC for patch, since I have U and P ?

Thanks.

Elham
Elham is offline   Reply With Quote

Old   June 24, 2016, 05:01
Default
  #27
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17
Elham is on a distinguished road
And another question:

Should I execute mapFields now?
Elham is offline   Reply With Quote

Old   June 24, 2016, 05:52
Default
  #28
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hey Alham,

there is no need for mapFields.

Set the BC in your case/0 as shown above.
In the constant/boundaryData/inlet/0/U is just the list of values for your points located in constant/boundaryData/inlet/points. This "plane" or "
Circle" is taken as inlet BC for your geometry. For p it is a scalar and for U a vector...
If you want to simulate a tube, just use U and set the p BC in case/0 to zeroGradient as usual. With this settings, you have a zeroGradient pressure at the inlet and for U you get the desired U profile
sisetrun is offline   Reply With Quote

Old   June 27, 2016, 04:59
Default
  #29
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 17
Elham is on a distinguished road
Dear sisetrun,

Thanks. It took a day to manipulate and run the case succesfuly but you gave me the right points.

Cheers,

Elham
Elham is offline   Reply With Quote

Old   July 4, 2016, 11:14
Default
  #30
New Member
 
Join Date: Jun 2016
Posts: 6
Rep Power: 10
Esther Jin is on a distinguished road
Hello Sisetrun,

I have quite same problem with your case.

I still not clear about how to map the inlet data onto another case.

After creating the BoundaryData folder and setting inlet BC as timevaryingMappedFixedValue as you described in your case, what do I need to do in next step so that the inlet data can be mapped? Or is it already mapped and I can run the solvers directly?

Looking forward to your reply.
Thank you in advance.


Best regards,
Esther
Esther Jin is offline   Reply With Quote

Old   July 5, 2016, 02:42
Default
  #31
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hey Esther,

the setup shut be fine...just run your case and with timevaryingMappedFixedValue as BC and the profile is mapped.

Quote:
This boundary conditions interpolates the values from a set of supplied points in space and
time. Supplied data should be specifi ed in constant/boundaryData/ < patchname > where:
- points : pointField with locations
- ddd : supplied values at time ddd
The points should be more or less on a plane since they get triangulated in 2-D.
Best regards
sisetrun is offline   Reply With Quote

Old   July 7, 2016, 05:42
Default
  #32
New Member
 
Join Date: Jun 2016
Posts: 6
Rep Power: 10
Esther Jin is on a distinguished road
Dear Sisetrun,

According to the points you gave me I found out reason of the problem, now it works. Thank you for your help.

cheers
Esther
Esther Jin is offline   Reply With Quote

Old   August 14, 2016, 07:14
Default lagrangian mapField
  #33
Member
 
amin jalalian
Join Date: Mar 2014
Posts: 34
Rep Power: 12
amin_jalalian is on a distinguished road
I want to separate some boundaries to some walls which had been merged into one wall.
They are some walls of a combustion chamber. particles come into chamber to combust.
I mapField them by mapFieldDict, but O.F only maps lagrangian datas.
What can I do?
amin_jalalian is offline   Reply With Quote

Old   August 15, 2016, 05:44
Default
  #34
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hey amin_jalalian,
I do completely get your problem.
Can you please add a picture or try to be more precise?
sisetrun is offline   Reply With Quote

Old   August 18, 2016, 10:31
Default mapField Euler-Lagrange field with new wall.
  #35
Member
 
amin jalalian
Join Date: Mar 2014
Posts: 34
Rep Power: 12
amin_jalalian is on a distinguished road
Quote:
Originally Posted by sisetrun View Post
Hey amin_jalalian,
I do completely get your problem.
Can you please add a picture or try to be more precise?
I draw one quarter of IFRF No.1 combustion chamber and mesh in gambit. Pic has been attached. I put all walls in one boundary by name "walls". After some weeks I dedicate that separate inlet and outlet pipes walls and front and back walls from that boundary which now has top and side walls. Because it is better to put them adiabatic instead of fixed temperature. I named it "other_walls". Thus I have to wall boundary one "walls" which has top and side walls, the other "other_walls" which has inlet & outlet pipes walls and front & back walls.
I want to mapField from previous results. What can I do now?
When I adjust mapFieldsDict in target folder to this:

Code:
patchMap   (  ); 

cuttingPatches  (other_walls);

O.F only maps lagrangian results.
Excuse because of poor english.
Attached Images
File Type: jpg vascellari and cau.jpg (42.6 KB, 84 views)
File Type: jpg IFRF.jpg (49.1 KB, 97 views)
amin_jalalian is offline   Reply With Quote

Old   August 19, 2016, 04:29
Default
  #36
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hey,

with mapFields, as far as I know, you can do the following things:
-map fields from one case to a different case, so you can map the whole field from the old case to your new one. If the geometry is the same, use mapFields -consistant
-map patches from old one to knew one by the name of each pactch
-you can use transformPoints -translate to translate one of your meshes. Then you can map the overlapping part

I have just maped U,p,k... fields. Though I do not have any experiences with lagrangian so far.
sisetrun is offline   Reply With Quote

Old   August 19, 2016, 06:41
Default
  #37
Member
 
amin jalalian
Join Date: Mar 2014
Posts: 34
Rep Power: 12
amin_jalalian is on a distinguished road
Quote:
Originally Posted by sisetrun View Post
Hey,

with mapFields, as far as I know, you can do the following things:
-map fields from one case to a different case, so you can map the whole field from the old case to your new one. If the geometry is the same, use mapFields -consistant
-map patches from old one to knew one by the name of each pactch
-you can use transformPoints -translate to translate one of your meshes. Then you can map the overlapping part

I have just maped U,p,k... fields. Though I do not have any experiences with lagrangian so far.

Thanks
What does "transformPoints -translate" command do briefly?
amin_jalalian is offline   Reply With Quote

Old   August 19, 2016, 07:11
Default
  #38
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
use transformPoints -translate '(x y z)' in the terminal to translate the Mesh of your current working directory.

FYI:
with surfaceTransformPoints -translate (or -scale) input.stl output.stl you can manipulate your stl geometry
sisetrun is offline   Reply With Quote

Old   October 12, 2016, 19:24
Default
  #39
Senior Member
 
Himanshu Sharma
Join Date: Jul 2012
Posts: 101
Rep Power: 14
himanshu28 is on a distinguished road
Quote:
Originally Posted by Chanterz View Post
Back again!

Ok, so I managed to successfully mapFields with everying, including my cuttingPatch of heliostat, filled out above.

What is also great, is that the cuttingPatch BC's are also mapped into the list of field numbers of the mapped solution files from source.

Here's what I did:

  • copied the 0 files from target case (of the boundary conditions I want of the patches INCLUDING heliostat boundary) into the-previously-blank 3692 file (where the source files 'were' to be uploaded).
  • When I employ mapFields as above, it seems that the mapFields function overwrites the target boundary files and fills it with the list of numbers that have matching boundary conditions between the target and source cases (outlined in patchMap) and leaves the 'heliostat' cutting patch alone.

The number of faces indicating that the coarse source mesh has been mapped onto the fine target mesh is also indicated at the top of these new files.

I have to wait until Monday to run it. I will let you know how it goes.
Hi All,

I am trying something similar and I tried the approach presented above but no luck till now.

I have two geometries with different mesh size and one different patches. Attached the images of source and target geo.

I am trying to use the mapFieldDict for the cases and following is the what mapFieldDict looks like.

Code:
// List of pairs of source/target patches for mapping
patchMap
(
inlet inlet
outlet outlet
wall.ceiling wall.ceiling
);

// List of target patches cutting the source domain (these need to be
// handled specially e.g. interpolated from internal values)
cuttingPatches
(
wall.floor
wall.human 
wall.hot
wall.left
emptyZ
);

// ********************************************** //
After running mapFields I am getting a following error.

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "../source_case" ""
Target: "/media/meisu/Storage/OpenFOAM/meisu-2.4.0/Project_SensorPlacement/Maptest" "target_case"

Create databases as time
Case   : ../source_case
nProcs : 1

Source time: 0
Target time: 0

Create meshes

Source mesh size: 11140	Target mesh size: 9462


Creating and mapping fields for time 0

Creating mesh-to-mesh addressing for region0 and region0 regions using cellVolumeWeight
    Overlap volume: 2.635
Creating AMI between source patch outlet and target patch outlet using faceAreaWeightAMI
    AMI: Creating addressing and weights between 10 source faces and 12 target faces
    AMI: Patch source sum(weights) min/max/average = 1, 1, 1
    AMI: Patch target sum(weights) min/max/average = 0.333333, 0.333333, 0.333333
Creating AMI between source patch inlet and target patch inlet using faceAreaWeightAMI
    AMI: Creating addressing and weights between 4 source faces and 5 target faces
    AMI: Patch source sum(weights) min/max/average = 1, 1, 1
    AMI: Patch target sum(weights) min/max/average = 0.333333, 0.333333, 0.333333
Creating AMI between source patch wall.ceiling and target patch wall.ceiling using faceAreaWeightAMI
    AMI: Creating addressing and weights between 190 source faces and 166 target faces
    AMI: Patch source sum(weights) min/max/average = 1, 1, 1
    AMI: Patch target sum(weights) min/max/average = 0.333333, 0.333333, 0.333333
    interpolating U
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  ? at ??:?
#4  ? at ??:?
#5  ? at ??:?
#6  ? at ??:?
#7  ? at ??:?
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9  ? at ??:?
Segmentation fault
I don't know what could be the reason for this.
Is mapField capable of doing what I am trying to do.??

Thanks in advance.
Attached Images
File Type: png cfd_help1.png (29.2 KB, 50 views)
himanshu28 is offline   Reply With Quote

Old   October 17, 2016, 12:42
Default
  #40
Member
 
Sebastian Trunk
Join Date: Mar 2015
Location: Erlangen, Germany
Posts: 60
Rep Power: 11
sisetrun is on a distinguished road
Hey,
sorry for the late reply, I have been on holiday !
I did not try such a geometry yet, but I think that the problem is in the bottom of your geometry.
In the source, you have the gap in the x-axis. This gap is not present in the target.
The gap also leads to different front and back geometries...
Is it possible to map the inlet, outlet and the top?
Cheers
sisetrun 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
Map fields every time step sebas OpenFOAM Programming & Development 17 December 5, 2012 14:13
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 04:52
Matching Velocity and Pressure fields Fluent OpenFoam alimansouri OpenFOAM Running, Solving & CFD 0 January 13, 2009 18:51
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07
The OpenFOAM extensions project mbeaudoin OpenFOAM 16 October 9, 2007 10:33


All times are GMT -4. The time now is 14:31.