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

mapField doesn't give correct Source and Target Time in openFoam

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2023, 14:33
Default mapField doesn't give correct Source and Target Time in openFoam
  #1
New Member
 
Join Date: Sep 2023
Posts: 8
Rep Power: 3
maxning is on a distinguished road
I am following the openFOAM tutorial's "lid-driven cavity case" and am doing the "cavityfine" part. I have ran the original "cavity" process and got a good result, and is trying to do "2.1.5.3 Mapping the coarse mesh results onto the fine mesh" by typing the mapField Command in the terminal. I got very similar outputs as shown in the tutorial, but their source and target time are both 0.5, while mine is 0. Could you tell me what happened and how to solve it?

I am using a native-windows version of OpenFOAM-v2306.
maxning is offline   Reply With Quote

Old   October 17, 2023, 06:10
Smile
  #2
New Member
 
Alex Krochak
Join Date: May 2022
Posts: 9
Rep Power: 4
okrochak is on a distinguished road
Hello maxning,

the correct usage of mapFields, given your mesh topology is consistent is:

mapFields -sourceTime xxx ../patchToSourceCase -consistent.


Make sure that in the target directory in controlDict startTime is set equal to the sourceTime, I suspect this is the cause of your error.

If your mesh is not consistent you need to setup a mapFieldsDict file.
okrochak is offline   Reply With Quote

Old   October 28, 2023, 13:07
Default
  #3
New Member
 
Join Date: Sep 2023
Posts: 8
Rep Power: 3
maxning is on a distinguished road
Sorry, is it like I can directly copy your code, or I have to change the pathToSourceCase to something else? Also, when you say make sure startTime is equal to sourceTime, do you mean go into controlDict and change it? Like originally it is startTime startTime, and now I have to change it to startTime sourceTime?
maxning is offline   Reply With Quote

Old   October 28, 2023, 13:14
Default
  #4
New Member
 
Join Date: Sep 2023
Posts: 8
Rep Power: 3
maxning is on a distinguished road
I changed xxx to 0.5, changed patchToSourceCase to cavity in your code, and, in cavityFine, change the startTime startTime to startTime sourceTime in controlDict. But I still only get Source Time = 0.5, Target Time equal 0
maxning is offline   Reply With Quote

Old   November 1, 2023, 04:43
Default
  #5
New Member
 
Alex Krochak
Join Date: May 2022
Posts: 9
Rep Power: 4
okrochak is on a distinguished road
Quote:
Originally Posted by maxning View Post
I changed xxx to 0.5, changed patchToSourceCase to cavity in your code, and, in cavityFine, change the startTime startTime to startTime sourceTime in controlDict. But I still only get Source Time = 0.5, Target Time equal 0

Sorry for the late reply, if you don't quote my post I don't get a notification.

You need to change the pathToSource case to an actual relative path of our source directory relative to your target directory.

This way the mapFields utility know where to actually read the input mesh and field data from. Otherwise you can't expect it to know what source case you want to use.

Second, you need to specify:

startFrom startTime;

startTime 0; --< here you put timestep of the input field data you want to use. If you ran your source simulation for 10000 timesteps and your final data is in directory 10000 you put 10000 here.

Third, you need to go in your source directory and take your boundary conditions folder (usually 0 or 0.orig) and copy this folder and rename it to ''10000''.

Now you can run the command I've given previously.

mapFields utility will read your source case, and then apply it to the input case where boundary conditions are given.

I hope this helps

Alex
okrochak is offline   Reply With Quote

Old   July 19, 2024, 15:41
Default
  #6
New Member
 
Jared Guzman
Join Date: Apr 2020
Posts: 2
Rep Power: 0
jag21791 is on a distinguished road
Quote:
Originally Posted by okrochak View Post
Sorry for the late reply, if you don't quote my post I don't get a notification.

You need to change the pathToSource case to an actual relative path of our source directory relative to your target directory.

This way the mapFields utility know where to actually read the input mesh and field data from. Otherwise you can't expect it to know what source case you want to use.

Second, you need to specify:

startFrom startTime;

startTime 0; --< here you put timestep of the input field data you want to use. If you ran your source simulation for 10000 timesteps and your final data is in directory 10000 you put 10000 here.

Third, you need to go in your source directory and take your boundary conditions folder (usually 0 or 0.orig) and copy this folder and rename it to ''10000''.

Now you can run the command I've given previously.

mapFields utility will read your source case, and then apply it to the input case where boundary conditions are given.

I hope this helps

Alex


Hello! I am running into a similar issue with mapFields. I'm attempting to use mapFields to initialize a finer mesh using a coarse one, and have followed the directions posted in the quote above. However, I get a fatal IO error:

--> FOAM FATAL IO ERROR: (openfoam-2312 patch=240220)
Size 83832 is not equal to the expected length 23496

path/to/case/T/internalField at line 21.

I suspect this is because the mesh sizes dont match but I thought that didn't matter (when viewing the utility doc). To put it simply, I want to use mapFields to take the computed fields in:

caseA (~20k cells)
- 0
- 1
- 2
- ...
- 100
- constant
- system

and map them to:
caseB (~100k cells)
- 0
- constant
- system

caseB has a finer mesh, identical geometry, BC's, and IC's as case A.

Any help on this would be greatly appreciated! Thanks in advance
jag21791 is offline   Reply With Quote

Reply

Tags
map fields, openfoam 2306, tutorial, windows 10

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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 04:52
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 09:06
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 05:13
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34


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