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

View paraFoam fields while running? (or else restarting?)

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By HPE
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 21, 2020, 18:00
Talking View paraFoam fields while running? (or else restarting?)
  #1
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Hello Everyone: I'm learning OF on a small infiniband cluster, and my reactingFoam runs are quite long - I was wondering if there's a way to use paraFoam to view intermediate fields during the run (to look for spatial convergence) or else an easy way to stop the run then restart the run if spatial convergence is not complete.


I'm using an ./Allrun script:

Code:
#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
#------------------------------------------------------------------------------

# Application name
application=$(getApplication)

echo $application

rm -f 0/T
cp 0/T.orig 0/T

runApplication chemkinToFoam \
               chemkin/grimech30.dat chemkin/thermo30.dat chemkin/transportProperties \
               constant/reactionsGRI constant/thermo.compressibleGasGRI

runApplication blockMesh
runApplication setFields
runApplication decomposePar -force
runParallel $application
runApplication reconstructPar
Thank you very much!
Patricia
pattim is offline   Reply With Quote

Old   August 21, 2020, 18:39
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Hi,

- You may want to probe some field values in the field of interest as a function of time/iteration or monitoring residuals instead of visually assesing the convergence by looking at flow quantities, which would be a bit tedious, and misleading.
- Having said that, you can use sample and/or runTimePostProcessing utilities to output various cross-sections as VTK format, and visualise them while the case running.
- You can also execute paraFoam/ParaView on a running case as far as the time directories that you visualise are not deleted (e.g. by purgeWrite).

Hope these would give some indicators.
HPE is offline   Reply With Quote

Old   August 21, 2020, 19:04
Default
  #3
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Thank you very much, HPE - This gives me some ideas to look at. It seemed to me this would be an easy thing to find with an interwebs search, but it turned out not.

I think it best (most comprehensive?) to be able to restart any run in the event that it didn't run long enough, but I haven't yet found how to do that for an arbitrary run. I probably don't know what term to use (in OF jargon) for a restart run, so searches aren't working yet.

Quote:
Originally Posted by HPE View Post
Hi,

- You may want to probe some field values in the field of interest as a function of time/iteration or monitoring residuals instead of visually assesing the convergence by looking at flow quantities, which would be a bit tedious, and misleading.
- Having said that, you can use sample and/or runTimePostProcessing utilities to output various cross-sections as VTK format, and visualise them while the case running.
- You can also execute paraFoam/ParaView on a running case as far as the time directories that you visualise are not deleted (e.g. by purgeWrite).

Hope these would give some indicators.
pattim is offline   Reply With Quote

Old   August 21, 2020, 19:07
Default
  #4
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
- Note also that you can view the decomposed fields in ParaView without reconstructing them by using OpenFOAM's reconstructPar or redistributePar, if that was the pain.
HPE is offline   Reply With Quote

Old   August 21, 2020, 19:19
Default
  #5
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Quote:
Originally Posted by HPE View Post
- Note also that you can view the decomposed fields in ParaView without reconstructing them by using OpenFOAM's reconstructPar or redistributePar, if that was the pain.

Wow! Great! That worked really well. My runs take hours - but I just opened another terminal and ran reconstructPar, and then could use paraFoam to view the progress of the solution. I didn't realize that would work w/o interfering with runParallel. Excellent!! Thank you.
pattim is offline   Reply With Quote

Old   August 22, 2020, 02:53
Default
  #6
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
- Yes you can do that as well. But what I meant: you dont even need to execute reconstructPar. A parallel and running case can be visualised directly: Just before hit the 'Apply' button, one of the settings can be selected from the left panel. When I open my computer, I will try to upload a screenshot (writing via my phone now).

Good luck.
Tobermory likes this.
HPE is offline   Reply With Quote

Old   August 23, 2020, 07:50
Default
  #7
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
pattim - HPE means that on later versions of paraView there is an option to read directly from the decomposed data files instead of the reconstructed files. When you open up the case in paraview, and before you hit Apply to accept, check in the Properties pane on the left, above the Mesh Regions part and just below the Skip Zero Time check box. There may be some drop down menu options there, including "Case Type" at the top - if so, then change from the default "Reconstructed case" to "Decomposed Case".

Note, I don't have this feature on my old linux paraview 5.4 build, but it is there on my Win10 paraview 5.8.1 build, so it is likely to be a recent addition. i.e. you may need to update your paraview installation to use this feature.
HPE likes this.
Tobermory is offline   Reply With Quote

Old   August 23, 2020, 08:30
Default
  #8
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Thank you very much Tobermory - and my apologies for writing in somewhat unclear manner - I usually write smt via my phone - that's why it happens.

Thank you!
HPE is offline   Reply With Quote

Old   August 23, 2020, 08:34
Default
  #9
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
No problem HPE - your post was clear and helpful, it's just that I only tripped across this option by mistake, recently, when I installed paraView on my Win10 PC ... I hadn't realised that I need to update my linux installation to catch up! It's possible that the OP may be in the same boat.
Tobermory is offline   Reply With Quote

Old   August 24, 2020, 16:46
Default
  #10
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Thank you everyone - this is working very well for me. As an additional question - my computer crashed after working 12 hours on a solution (see first post for how I ran it). Is there a way to restart reactingFoam after a system crash or else when one must implement after safely halting with Alt-PrintScr-R-E-I-S-U-B?
Thank You!!
pattim is offline   Reply With Quote

Old   August 24, 2020, 18:20
Default
  #11
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
Yes - sure you can, providing that you wrote out some intermediate solutions. In your controlDict file, change the startFrom line to:

Code:
startFrom  latestTime;
and when you run again, it will start from the last save that you did (you may want to review your writeInterval setting in controlDict to see if it suits your purpose). You'll need to change your run script though ... I usually make a AllrunAgain script for this purpose. In your case it might look like the following:

Code:
#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
#------------------------------------------------------------------------------

# Application name
application=$(getApplication)

echo $application

#  You should not need the following lines
#rm -f 0/T
#cp 0/T.orig 0/T

#runApplication chemkinToFoam \
               chemkin/grimech30.dat chemkin/thermo30.dat #chemkin/transportProperties \
               constant/reactionsGRI constant/thermo.compressibleGasGRI

#runApplication blockMesh
#runApplication setFields

#shouldd not need this either since the intermediate save will still be there in decomposed state
#runApplication decomposePar -force


#the -append flag adds to your previous run log, which is useful; else use a -overwrite flag
runParallel -append $application
runApplication -append reconstructPar
Good luck!
Tobermory is offline   Reply With Quote

Old   August 25, 2020, 12:43
Default
  #12
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Thank you very much - that worked perfectly, even after halting reactingFoam with ctrl-C. Interestingly, "latestTime" seems to be a default now in controlDict. Since the time "0" is present often by default, that seems to work, so it wasn't necessary to modify controlDict.

Thanks!!
Patricia


Quote:
Originally Posted by Tobermory View Post
Yes - sure you can, providing that you wrote out some intermediate solutions. In your controlDict file, change the startFrom line to:

Code:
startFrom  latestTime;
and when you run again, it will start from the last save that you did (you may want to review your writeInterval setting in controlDict to see if it suits your purpose). You'll need to change your run script though ... I usually make a AllrunAgain script for this purpose. In your case it might look like the following:
<...>
Good luck!
pattim is offline   Reply With Quote

Old   August 25, 2020, 12:52
Default
  #13
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Running reconstructPar followed by paraFoam works well, but I noticed some odd behavior. The U and T files don't always get reset to small text files in the "0" directory, even after issuing ./Allclean - they look like they contain binary information. I'm wondering if this is a 'bug' triggered by either viewing a non-reconstructPar'd solution or else something else I'm doing wrong (like not having all the cells add up to a mass fraction = 1.00)? It appears OF is run by a lot of scriptlets ("tools," etc.) and maybe one of these crashes while leaving the solver running just fine? (just guessing here!!)

Quote:
Originally Posted by Tobermory View Post
pattim - HPE means that on later versions of paraView there is an option to read directly from the decomposed data files instead of the reconstructed files. When you open up the case in paraview, and before you hit Apply to accept, check in the Properties pane on the left, above the Mesh Regions part and just below the Skip Zero Time check box. There may be some drop down menu options there, including "Case Type" at the top - if so, then change from the default "Reconstructed case" to "Decomposed Case".

Note, I don't have this feature on my old linux paraview 5.4 build, but it is there on my Win10 paraview 5.8.1 build, so it is likely to be a recent addition. i.e. you may need to update your paraview installation to use this feature.
pattim is offline   Reply With Quote

Old   August 25, 2020, 13:24
Default
  #14
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14
Tobermory will become famous soon enough
Excellent - I am glad that worked for you. For the 0/ folder contents, remember I did comment out the lines

Code:
#rm -f 0/T
#cp 0/T.orig 0/T
in the adapted Allrun script that I suggested, so the 0 folder will remain as is, i.e. with the results of the earlier setFields operation. You should still have the 0.org folder though, with the slim ascii text files. If you want to reset back to a complete new start, you can always execute the above commands manually.

Agreed about the script files - getting your head around how to use those effectively can make your life a whole lot easier.
Tobermory is offline   Reply With Quote

Old   August 26, 2020, 22:05
Default
  #15
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Quote:
Originally Posted by Tobermory View Post
Excellent - I am glad that worked for you. For the 0/ folder contents, remember I did comment out the lines

Code:
#rm -f 0/T
#cp 0/T.orig 0/T
in the adapted Allrun script that I suggested, so the 0 folder will remain as is, i.e. with the results of the earlier setFields operation. You should still have the 0.org folder though, with the slim ascii text files. If you want to reset back to a complete new start, you can always execute the above commands manually.

Agreed about the script files - getting your head around how to use those effectively can make your life a whole lot easier.
Thanks again - I think the problem I saw seeing is unrelated to paraFoam - some part of the solver was crashing. Some irregular BC was involved but the solver seemed to run OK.
pattim is offline   Reply With Quote

Reply

Tags
intermediate fields, restarting


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
[OpenFOAM.org] paraFoam Fatal Error upon run Gallienus OpenFOAM Installation 2 April 14, 2020 20:23
[OpenFOAM] ParaFoam - Aborted (core dumped) Rasmusiwersen ParaView 0 October 15, 2019 03:40
[OpenFOAM.org] Mac OS X 10.11 and OpenFOAM 3.0: Error when running ParaFoam with "command not found" hua OpenFOAM Installation 9 February 11, 2016 00:45
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 10:15
[OpenFOAM] paraFoam, problem loading 'volume fields' bigphil ParaView 0 April 29, 2009 10:36


All times are GMT -4. The time now is 13:50.