CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Doubt about 'MapFields' output

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By tomf
  • 1 Post By akidess

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2017, 11:21
Default Doubt about 'MapFields' output
  #1
New Member
 
Savino Martino
Join Date: Oct 2016
Posts: 5
Rep Power: 10
SavinoMartino is on a distinguished road
Hello everyone,
I'm trying to do some post-processing on data obtained with OpenFOAM. In particular, I need to compare the results of a LES with that obtained with a RANS, visualizing the difference between the two pressure fields. Both simulations have the same STL geometry, the only difference is that the LES simulation used a finer mesh.
From what I understand, the fist step is mapping the fields between the two domains using the mapFields utility. I already did it with the following line:
Code:
mapFields ../RANS -mapMethod direct -fields '(p)' -consistent
Now, I'm a little bit confused about the output. In fact, mapFields simply overwrite the LES pressure field, substituting it with a new one completely identical to the previous one (at least that's how it looks if I visualize it in ParaView).
So the question is: what exactly the mapFields utility do? What output is it supposed to give? And how can I perfom the difference between the two fields starting from it?
I'm using OpenFOAM 2.3.0.

Thanks everyone,
SM
SavinoMartino is offline   Reply With Quote

Old   March 28, 2017, 11:52
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
I don't see why you would map for postprocessing. It's intended use is for preprocessing.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   March 28, 2017, 12:00
Default
  #3
New Member
 
Savino Martino
Join Date: Oct 2016
Posts: 5
Rep Power: 10
SavinoMartino is on a distinguished road
I already run my case, so I can't do it in preprocessing. From what I understand, mapping the fields is the only way to visualize the punctual difference between the two fields which have different meshes. Am I wrong?
SavinoMartino is offline   Reply With Quote

Old   March 28, 2017, 13:01
Default
  #4
Member
 
Ricky
Join Date: Jul 2014
Location: Germany
Posts: 78
Rep Power: 12
kera is on a distinguished road
Quote:
Originally Posted by SavinoMartino View Post
I'm trying to do some post-processing on data obtained with OpenFOAM. In particular, I need to compare the results of a LES with that obtained with a RANS, visualizing the difference between the two pressure fields. Both simulations have the same STL geometry, the only difference is that the LES simulation used a finer mesh.
From what I understand, the fist step is mapping the fields between the two domains using the mapFields utility. I already did it with the following line:
Code:
mapFields ../RANS -mapMethod direct -fields '(p)' -consistent
Like Anton said "mapFields" is used as a pre-processing tool rather than for post-processing.


Quote:
Originally Posted by SavinoMartino View Post

So the question is: what exactly the mapFields utility do? What output is it supposed to give?
"mapFields" is used to initialize the fields from one simulation case to the other (for say as an initial guess for your next simulation --> refer to "incompressible/pimpleDyMFoam/wingMotion tutorial to get an idea) at least that's what I used it for long ago.

Quote:
Originally Posted by SavinoMartino View Post
Now, I'm a little bit confused about the output. In fact, mapFields simply overwrite the LES pressure field, substituting it with a new one completely identical to the previous one (at least that's how it looks if I visualize it in ParaView).
So don't be confused with your output. It did exactly what it was suppose to do (i.e., mapped/initialized your pressure field from your RANS simulation case to your LES case).


Quote:
Originally Posted by SavinoMartino View Post
And how can I perfom the difference between the two fields starting from it?
I am not sure what kind of differences you are looking for, but you can also use "sample", "probeLocations" and other utilities which are packed with OpenFOAM and can be used even after your simulations are done.

Regards,
Ricky
__________________
If it is easy, then something is fishy!

Last edited by kera; March 29, 2017 at 05:12.
kera is offline   Reply With Quote

Old   March 28, 2017, 13:29
Default
  #5
New Member
 
Savino Martino
Join Date: Oct 2016
Posts: 5
Rep Power: 10
SavinoMartino is on a distinguished road
Quote:
Originally Posted by kera View Post
I am not sure what kind of differences you are looking for, but you can also use "sample", "probLocations" and other utilities which are packed with OpenFOAM and can be used even after your simulations are done.
Thanks a lot for your reply, now I'm less confused about mapFields.
I want to show the difference in results between LES and RANS simulations. For example, I want to produce a figure that shows the difference in values of pressure produced by RANS and LES. In short, what I need to visualize is abs(p_LES - p_RANS) in the whole domain.
The STL geometry is the same but the meshes are different, so a simple subtraction with foamCalc gives an error.
At this point, is it possible to do that?
SavinoMartino is offline   Reply With Quote

Old   March 29, 2017, 04:15
Default
  #6
Member
 
Ricky
Join Date: Jul 2014
Location: Germany
Posts: 78
Rep Power: 12
kera is on a distinguished road
Quote:
Originally Posted by SavinoMartino View Post
Thanks a lot for your reply, now I'm less confused about mapFields.
I want to show the difference in results between LES and RANS simulations. For example, I want to produce a figure that shows the difference in values of pressure produced by RANS and LES. In short, what I need to visualize is abs(p_LES - p_RANS) in the whole domain.
The STL geometry is the same but the meshes are different, so a simple subtraction with foamCalc gives an error.
At this point, is it possible to do that?
For starters you could use "probesDict" select arbitrary locations or locations where you think your flow is of significance in your simulation domain and execute by using command
Code:
probeLocations
(use the same "probesDict" for both of your simulations), a postProcessing folder is created in your case directory after the execution of the command, where you can find the data of specified fields. Depending on how you want to convey your results you can plot them and with a little bit of python programming or EXCEL sheet (which ever you feel is convenient for you) you can also calculate the %error as you wanted.

Regards,
Ricky
__________________
If it is easy, then something is fishy!
kera is offline   Reply With Quote

Old   March 29, 2017, 11:59
Default
  #7
New Member
 
Savino Martino
Join Date: Oct 2016
Posts: 5
Rep Power: 10
SavinoMartino is on a distinguished road
Quote:
Originally Posted by kera View Post
For starters you could use "probesDict" select arbitrary locations or locations where you think your flow is of significance in your simulation domain and execute by using command
Code:
probeLocations
(use the same "probesDict" for both of your simulations), a postProcessing folder is created in your case directory after the execution of the command, where you can find the data of specified fields. Depending on how you want to convey your results you can plot them and with a little bit of python programming or EXCEL sheet (which ever you feel is convenient for you) you can also calculate the %error as you wanted.

Regards,
Ricky
Thanks Ricky,
if I understand well, probeLocations will show the data of specific chosen points in my domain. The fact is that even if I put hundreds of probes, it will be only single points of my domain.
I want rather to produce a figure which show the difference in the whole domain, with a color map that highlights the parts where the difference is greater. I try to explain myself with an example; in the attached image a slice of my domain is shown: let's say that the green parts are where the difference is greater while in the blue parts the difference is small. I'm looking for something like this.

Thanks againg,
SM
Attached Images
File Type: png Confronto_k_01.png (18.5 KB, 44 views)
SavinoMartino is offline   Reply With Quote

Old   March 29, 2017, 12:06
Default
  #8
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

Just rename your RANS p file to pRANS and map that one to the LES folder (or vice versa). Than do the foamCalc between p and pRANS. You may need to have a dummy pRANS file in the LES folder to start with, not sure.

Regards,
Tom
SavinoMartino likes this.
tomf is offline   Reply With Quote

Old   March 29, 2017, 12:21
Default
  #9
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Tom, can you quantify the error that mapFields introduces? IIRC it's not terribly accurate (see e.g. http://forum.cad.de/foren/ubb/upload.../Mapfields.png).
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   March 29, 2017, 13:07
Default
  #10
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi Anton,

I am not sure if that is possible. I just thought about a method that would at least work within the context of the question, i.e. map a field without overwriting another field.

Another option would be to rerun the RANS simulation on the LES mesh, which would at least provide a 1:1 comparison without the errors you mention. It may be a big calculation effort, but surely not as much as the LES run.

Regards,
Tom
tomf is offline   Reply With Quote

Old   March 30, 2017, 12:07
Default
  #11
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
What I would recommend is mapping the LES result to the RANS mesh, as you would be working with more information. I wouldn't use mapFields (due to aforementioned problems), but Paraview or another postprocessor.
SavinoMartino likes this.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   March 31, 2017, 07:32
Smile Solved
  #12
New Member
 
Savino Martino
Join Date: Oct 2016
Posts: 5
Rep Power: 10
SavinoMartino is on a distinguished road
Thanks guys,
with your contribution I finally managed to solve my problem. To do that, I needed to change my OpenFOAM version: previously I was using 2.3.0, now I use 2.2.1.

I summarize the steps I followed for future users:

- As suggested by akidess map the LES field on the RANS mesh, in order to work with more informations;
- Move into your RANS case folder and create a 'dummy' folder named 0.1 (say we want to map at time 0.1s) and rename the original '0.1' folder as 0.1.org. Into the dummy folder you have to put only the uniform/time.gz file of the original one;
- In the RANS case modify the controlDict with startFrom-->startTime and startTime-->0.1;
- from the RANS case folder I run the code:
Code:
 mapFields -mapMethod mapNearest -consistent ../RANS/
this create the mapped fields into the dummy folder;
- Now if you want to compute the difference rename the mapped fields into the dummy folder as U_LES.gz, p_LES.gz, etc...(you also need to change the 'object' line into the header of the file otherwise Paraview will not recognize the new name), copy the RANS fields from the 0.1.org folder and do the difference with Paraview (Calculator filter) or foamCalc.

This worked on OpenFOAM 2.2.1, but I only managed to correctly map the velocity field. The pressure field was badly mapped (maybe this fact is related to warnings I received when mapFields run, these warnings I suppose are related to face tet errors in the mesh).

Regards,
Savino Martino
SavinoMartino is offline   Reply With Quote

Old   October 17, 2017, 18:24
Default mapFields Hangs
  #13
Member
 
Sugajen
Join Date: Jan 2012
Location: Tempe, USA
Posts: 52
Rep Power: 14
Sugajen is on a distinguished road
Hi all,

I am facing a problem with mapFields. I have a finer mesh which needs to be mapped from a coarser mesh for the same geometry. The finer mesh has different names for exact patches so I created a mapFieldsDict as well. When I do mapFields using this command,
Code:
mapFields -sourceTime latestTime <location>
it stops at this point and does not progress further.
Code:
Source mesh:12577020           Target Mesh:100616160
It does not throw any error but simply is not proceeding any further. I tried using parallel too but no luck. Any ideas on where I am going wrong ?

thanks,
Sugajen
Sugajen is offline   Reply With Quote

Reply

Tags
comparison, mapfields, openfoam 2.3.0, postprocessing, subtracting fields


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
[swak4Foam] outputTime in Swak function immortality OpenFOAM Community Contributions 20 October 6, 2022 13:08
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 07:16
RNG diverged during the analysis the flow over a multi element airfoil, why? s.m OpenFOAM Running, Solving & CFD 0 August 5, 2013 09:39
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
lift and drag on ship superstructures vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 13:30


All times are GMT -4. The time now is 11:02.