CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How to Map Fields in openFOAM using the utility (https://www.cfd-online.com/Forums/openfoam-solving/119231-how-map-fields-openfoam-using-utility.html)

Alhasan June 12, 2013 11:14

How to Map Fields in openFOAM using the utility
 
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 :confused:

-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.

immortality June 14, 2013 08:26

Hi
could you attach an image of your case?are there two different cases or both boxes in one case?

Alhasan June 14, 2013 09:25

Two different Cases.
 
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 !!!

immortality June 14, 2013 10:21

in the doc/guide file there explained a not consistent mapFields for cavity case.
Read it.ask if had any problem.

Alhasan June 14, 2013 10:35

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.

zhengzh5 June 14, 2013 12:30

Quote:

Originally Posted by Alhasan (Post 434028)
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

Alhasan June 14, 2013 17:52

Query
 
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 :eek:

Thanks :)
Best Regards,
Hasan K.J

zhengzh5 June 14, 2013 18:06

Quote:

Originally Posted by Alhasan (Post 434066)
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 :eek:

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!

Alhasan June 14, 2013 18:22

Quote:

Originally Posted by zhengzh5 (Post 434067)
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 :)

zhengzh5 June 14, 2013 18:36

Quote:

Originally Posted by Alhasan (Post 434069)
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 October 23, 2013 17:13

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

Alhasan November 5, 2013 15:59

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 December 5, 2013 17:34

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

wyldckat December 8, 2013 08:50

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 )

ripudaman January 8, 2014 18:59

Empty Time Folder
 
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 (Post 458629)
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


Alhasan January 8, 2014 21:06

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

hiuluom June 30, 2015 23:33

The command mapFields import U,T,P into target fields. If I only import T into target, can mapFields do that?

Alhasan July 1, 2015 03:27

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

hiuluom July 1, 2015 11:34

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.

Alhasan July 1, 2015 11:38

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


All times are GMT -4. The time now is 12:56.