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   June 12, 2013, 12:14
Unhappy How to Map Fields in openFOAM using the utility
  #1
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey All,

How to use mapping fields function in openFOAM,

-say there are two different case two boxes, one big box and one small box with inlet on one side and outlet on the other side and all the other sides are walls. the small box is within the big box and it is in the right place in space.

-how do i even go about this i read the manual dint do much help

-share any cases if u have mapped between them please

-usually i experiment with things play around with it, but right now i dont have time for that

- so please help me, by explaining how to do it, is there any tutorial cases that has been mapped between them..?

Regards,
Hasan K.J.
amuzeshi and mingwucn like this.
Alhasan is offline   Reply With Quote

Old   June 14, 2013, 09:26
Default
  #2
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
Hi
could you attach an image of your case?are there two different cases or both boxes in one case?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 14, 2013, 10:25
Default Two different Cases.
  #3
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
They are two different cases !!
the big box and the small box !!!!

i want the velocity fields from the big box to be mapped to the small one !!!
Alhasan is offline   Reply With Quote

Old   June 14, 2013, 11:21
Default
  #4
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
in the doc/guide file there explained a not consistent mapFields for cavity case.
Read it.ask if had any problem.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 14, 2013, 11:35
Default
  #5
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Ehsan,
i am aware of this and i have read it, dint help me much is there any tutorial which has mapped the cases in openFOAM

- just want an example of the mapFieldDict with two cases so i can see whats happenign and understand or just mapFieldsDict would do

Thanks,
Hasan K.J.
Alhasan is offline   Reply With Quote

Old   June 14, 2013, 13:30
Default
  #6
Member
 
Jace
Join Date: Oct 2012
Posts: 77
Rep Power: 16
zhengzh5 is on a distinguished road
Quote:
Originally Posted by Alhasan View Post
Hey Ehsan,
i am aware of this and i have read it, dint help me much is there any tutorial which has mapped the cases in openFOAM

- just want an example of the mapFieldDict with two cases so i can see whats happenign and understand or just mapFieldsDict would do

Thanks,
Hasan K.J.
Hey, for non-consistent mapping, you can do the following in your mapFieldDict:

//matching pair of source and target patches
patchMap
(
patch1_source patch1_target
patch2_source patch2_target
...
);

//list of target patches
cuttingPatches
(
patch1
patch2
...
);

whereas patchMap requires that the source and target patches be collocated. and cuttingPatches is when the target patch is within the domain of the source.

so in your case, since you're mapping from big box to small box, and that the small box is completely within the big box. your patchMap will be empty, and your cuttingPatches will list all the patches from your small box, such that:

patchMap
(
);

cuttingPatches
(
left_side
right_side
top
bottom
front
back
);

give that a try. Oh and don't forget to have the usual OpenFOAM header in the mapFieldsDict
Elham, atoof, Alhasan and 11 others like this.
zhengzh5 is offline   Reply With Quote

Old   June 14, 2013, 18:52
Thumbs up Query
  #7
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Guys,

thanks Jace

Thats nice, so in my cutting patches do i need only to mention the inlet ? coz i want only the inlet to be patched, or do i still need to mention all the patches

- another main doubt is see there are two case folders big box small box, i keep my mappingFieldsDict in my target cases (small box) System folder ?

- so when i am in my target case folder i execute the command mapFields

- how does that openFOAM know where to map the fields from ?

- i know for a fact i am doing something drastically wrong here what is it

Thanks
Best Regards,
Hasan K.J
amuzeshi likes this.
Alhasan is offline   Reply With Quote

Old   June 14, 2013, 19:06
Default
  #8
Member
 
Jace
Join Date: Oct 2012
Posts: 77
Rep Power: 16
zhengzh5 is on a distinguished road
Quote:
Originally Posted by Alhasan View Post
Hey Guys,

thanks Jace

Thats nice, so in my cutting patches do i need only to mention the inlet ? coz i want only the inlet to be patched, or do i still need to mention all the patches

- another main doubt is see there are two case folders big box small box, i keep my mappingFieldsDict in my target cases (small box) System folder ?

- so when i am in my target case folder i execute the command mapFields

- how does that openFOAM know where to map the fields from ?

- i know for a fact i am doing something drastically wrong here what is it

Thanks
Best Regards,
Hasan K.J
Hi Hasan,

1. within cuttingPatches, you only include the patches that you want to be mapped from the big box case (in your case, yes the inlet). remember you still need to assign boundary conditions for other patches separately if you don't want to map them from the bigBox case.

2. to use mapFields utility, first make sure you have the mesh created for the small box. then create a time directory, say 0 (assuming your simulation will start at time 0). create a separate folder, and call it bigBox (or whatever you want) and put the time directory from the big box case inside the newly created bigBox directory, (call the time directory 0, to match the small box initial time name). then simply call "mapFields bigBox/", where the argument for the mapFields utility is the path of the bigBox information.

I hope that makes sense, let me know =)

good luck!
amuzeshi likes this.
zhengzh5 is offline   Reply With Quote

Old   June 14, 2013, 19:22
Thumbs up
  #9
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Quote:
Originally Posted by zhengzh5 View Post
Hi Hasan,

1. within cuttingPatches, you only include the patches that you want to be mapped from the big box case (in your case, yes the inlet). remember you still need to assign boundary conditions for other patches separately if you don't want to map them from the bigBox case.

2. to use mapFields utility, first make sure you have the mesh created for the small box. then create a time directory, say 0 (assuming your simulation will start at time 0). create a separate folder, and call it bigBox (or whatever you want) and put the time directory from the big box case inside the newly created bigBox directory, (call the time directory 0, to match the small box initial time name). then simply call "mapFields bigBox/", where the argument for the mapFields utility is the path of the bigBox information.

I hope that makes sense, let me know =)

good luck!
Ahh,, im sorry i just got too confused now, i have two cases bigbox and smallpox both of the are two different folders

-say the big box has 0,1000(timefolder) constant and systems folder only in it. (case has been run)

- say the small box has 0,constant, systems folder in it and i have the mappingFieldsDict within the systems folder and mesh created.

- say now i just create a folder lets call it MapData within the smallbox case folder and i copy the time directory from the big box (1000) into the MapData folder

- then i rename the file 1000 to 0 since 0 is my start time

- then i run the command mapFields MapData

am i right or am missing something in-between, just say Yes or No .. thanks

Thanks for your time Jace

Hasan K.J
amuzeshi likes this.
Alhasan is offline   Reply With Quote

Old   June 14, 2013, 19:36
Default
  #10
Member
 
Jace
Join Date: Oct 2012
Posts: 77
Rep Power: 16
zhengzh5 is on a distinguished road
Quote:
Originally Posted by Alhasan View Post
Ahh,, im sorry i just got too confused now, i have two cases bigbox and smallpox both of the are two different folders

-say the big box has 0,1000(timefolder) constant and systems folder only in it. (case has been run)

- say the small box has 0,constant, systems folder in it and i have the mappingFieldsDict within the systems folder and mesh created.

- say now i just create a folder lets call it MapData within the smallbox case folder and i copy the time directory from the big box (1000) into the MapData folder

- then i rename the file 1000 to 0 since 0 is my start time

- then i run the command mapFields MapData

am i right or am missing something in-between, just say Yes or No .. thanks

Thanks for your time Jace

Hasan K.J
that should do!
Alhasan and amuzeshi like this.
zhengzh5 is offline   Reply With Quote

Old   October 23, 2013, 18:13
Default
  #11
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hi pp,

It worked only when i did it like this

Source: "/panfs/storage/s199038" "TestWT1"
Target: "/panfs/storage/s199038" "Windtunnel3"

it wants the entire case to be present coz it asks for System folder to look at the control dict for some reason

all the best,
Hasan K.J
amuzeshi likes this.
Alhasan is offline   Reply With Quote

Old   November 5, 2013, 16:59
Default
  #12
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hi Jace,

Boundary conditions for mapped fields how do i have boundary conditions for patches that lie on the cutting plane of the Target case. ( the stream wise patches that lie right on the middle of the flow )

- even if i give free stream it asks for this value ? and the value is not consistent so what do i give

Kind Regards,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   December 5, 2013, 18:34
Default
  #13
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hi Jace,
For initial conditions when you are Mapping data what boundary conditions are preferable to keep the flow as close to the source case ?

For instance i was using Mapping Fields from a wind tunnel setup with a good moderate mesh to a smaller very fine mesh around the airfoil - I used Fixed Value for the inlet and Top and bottom of the airfoil domain - but the results vary a Lot !

Any suggestion on the boundary conditions ! ! to have Exact same flow field within in the smaller domain that maps from the larger domain.
Kind Regards,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   December 8, 2013, 09:50
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Hasan: You might not be aware of this, but the problem you seem to be having is very likely a lot more complex than the brief explanation you've given.

Please start a new thread and explain in detail the case you're performing, as well as showing some images of what you're seeing with problems. I ask this because I'm guessing that there are at least 3 problems in your case, which are not necessarily related to mapFields:
  1. The refined mesh might be incorrect for your case, since it might be introducing problems in locations you're not expecting.
  2. The solvers used, their configuration and turbulence models.
  3. The boundary conditions used.
Best regards,
Bruno

(edit: Hasan posted the new question here: http://www.cfd-online.com/Forums/ope...tml#post465387 )
Alhasan and amuzeshi like this.
__________________

Last edited by wyldckat; January 10, 2014 at 14:51. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   January 8, 2014, 19:59
Default Empty Time Folder
  #15
Member
 
Ripudaman Manchanda
Join Date: May 2013
Posts: 55
Rep Power: 13
ripudaman is on a distinguished road
Hasan,

I tried following all the steps you discussed above to do something similar maybe even something simpler. The problem I am facing is that after mapping the fields my time directory in the target folder remains empty. Did you face this problem? How did you fix it? I give more details of my problem set-up below :-

I use solidDisplacementFoam to create a circular fracture in the middle of a grid using snappyHexMesh. I simulate the opening of the fracture by using a constant stress on the two separated faces of the fracture ff1 and ff1_slave (faces separated using SHM). This fracture causes changes in the sigma and D fields around it in the remaining grid.

Now I want to create another fracture at a certain distance away from this created fracture but I want to create this fracture in the displaced field of the first fracture. So the converged solution of the first fracture needs to be mapped on to a new grid that has a second fracture in it. So I create a second case file where I have the same blockMesh but two fractures in the grid instead of 1. I again use SHM to create this initial configuration. Next I create an empty time directory in the case folder of the second fracture. The folder name is 100 which is the name of the 'latestTime' folder of the first fracture. The controlDict file of the second fracture reflects a startTime of 100. I believe this is very similar to the initial configuration that you obtain. The mapFieldsDict file has the existing patches from the first fracture in patchMap section and the new patches for the second fracture - ff2 and ff2_slave in the cuttingPatch section.

next I run the following command from the second fracture case directory (frac2)

mapFields ../frac1

and I get the following output

Code:
Case : ./frac2 nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Source: "." "frac1" Target: "." "frac2" Create databases as time Source time: 100 Target time: 100 Create meshes Source mesh size: 64145 Target mesh size: 65006 Mapping fields for time 100 End
At the end of it when I look at the time folder of the second fracture I find it empty. This suggests that the mapping has not been done. Am I right?

Please do respond and share your experience.

Thank you.
Ripu
Quote:
Originally Posted by Alhasan View Post
Hi pp,

It worked only when i did it like this

Source: "/panfs/storage/s199038" "TestWT1"
Target: "/panfs/storage/s199038" "Windtunnel3"

it wants the entire case to be present coz it asks for System folder to look at the control dict for some reason

all the best,
Hasan K.J
ripudaman is offline   Reply With Quote

Old   January 8, 2014, 22:06
Default
  #16
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Ripudaman,

let me begin with I did not understand you case setup -

- but I kinda know the possible mistakes that could be causing your problem

- you have to Make sure very important that both the cases exist in their correct ordinates like geometrically (x,y,z)

- you need to have a file in your time directory with the boundary conditions like for CFD we have U and p files before you begin mapping, NOTE: it will map the fields only the files that you put here for eg. i would want to map only velocity so i will put only U file when I am mapping.

- it does not show it mapping any files in your Map histroy you have provided so you might be having a empty time folder when you are mapping in your target directory

- and i hope you have the patches that has to be mapped in the MapFields Dict if the same patch exist on both cases you can use the patchMap function

Code:
//matching pair of source and target patches
patchMap
(
patch1_source patch1_target
patch2_source patch2_target
...
);
If it does not Exist the the make sure the bot cases merge geometrically and you can use
Code:
cuttingPatches
(
Patch1 
Patch2
);
Best Regards,
Hasan K.J
Alhasan is offline   Reply With Quote

Old   July 1, 2015, 00:33
Default
  #17
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
The command mapFields import U,T,P into target fields. If I only import T into target, can mapFields do that?
hiuluom is offline   Reply With Quote

Old   July 1, 2015, 04:27
Default
  #18
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hi,
I'm definitely sure you can only import the required field. Like T or just U. Even If it imports all feilds by default you can delete the unnecessary fields and put your own BC
Regards,
Hasan K.J
__________________
"Real knowledge is to know the extent of one's ignorance." - Confucius
Alhasan is offline   Reply With Quote

Old   July 1, 2015, 12:34
Default
  #19
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 13
hiuluom is on a distinguished road
Thank you Hasan.

I am using OF 2.1.0, so it doesn't have option -fields(T) as OF height version. It imports list scalar much more value. I think that it is not good if I delete by hand these value.
hiuluom is offline   Reply With Quote

Old   July 1, 2015, 12:38
Default
  #20
Senior Member
 
Alhasan's Avatar
 
Hasan K.J.
Join Date: Dec 2011
Location: Bristol, United Kingdom
Posts: 200
Rep Power: 15
Alhasan is on a distinguished road
Hey Huy,

Can you please explain what you are trying to do. So it will be easier for us to help you.

If you want to map only one field have only that field in the time step that you are trying to map.

are you mapping the entire domain or just a patch or what type of setup please explain to us clearly so we will be able to help you.

Regards,
Hasan K.J
__________________
"Real knowledge is to know the extent of one's ignorance." - Confucius
Alhasan 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 15:52.