|
[Sponsors] |
OpenFOAM v2306 save OpenFOAM fields under custom paths other than time directories |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 18, 2023, 14:38 |
OpenFOAM v2306 save OpenFOAM fields under custom paths other than time directories
|
#1 |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
Hi,
I am using OpenFOAM v2306. I wonder if there is a function object that can do the following:
There are some function objects that can save the the fields already in other formats such as vtk under a custom path. But that's something else because it is not guaranteed that you can convert these fields back to the native OpenFOAM format. Why? Imagine this scenario: You are running a simulation on an HPC system in a filesystem that deletes files every 20 days and you have a very limited storage on it, so you must use purgeWrite to write only, say, the last three time steps. But on the other hand you have another location on the HPC system where you can save permanently your files but you are not allowed to run simulations on it. Now, if OpenFOAM allows somehow via a function object, an easy way to write the fields in OpenFOAM file format but under a different path that would be very convenient. I can then use purgeWrite to save only the last 2 or 3 time steps but I am saving the fields to another location for backup. Is this already possible to do in OpenFOAM without some ugly workarounds?
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
|
December 19, 2023, 04:30 |
|
#2 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,199
Rep Power: 27 |
I don't think there is a function object doing what you want out of the box, but you could use the systemCall function object to execute shell commands or a script in order to move data where you want.
https://develop.openfoam.com/Develop...ref_type=heads Regards, Yann |
|
December 19, 2023, 04:41 |
|
#3 | |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
Quote:
Thank you very much for your suggestion. I have used systemCall many times, but unfortuantely I consider it for this specific task of saving openfoam files, under the category of "ugly workarounds" since it is not reliable. What I consider as ugly workaround as well is the use of "coded" function object because it is hard to maintain. I prefer to use simple function objects that simply work and do a very specific task well. I do really hope the writeObjects function object implements a new keyword, something like "directory" that allows specifying the output path of the written fields.
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
||
December 19, 2023, 04:51 |
|
#4 | ||
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,199
Rep Power: 27 |
Quote:
Quote:
But maybe you can try suggesting a feature request in the bug tracker. |
|||
December 19, 2023, 08:13 |
|
#5 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 736
Rep Power: 14 |
You could come at it from a different direction ... instead of trying to do it within the OF run, you could launch a shell script that spends most of its time sleeping, but once an hour, say, it wakes up, checks for files older than e.g. 1 day and then moves them to your safe space. You'll find that shell commands find and sleep will help here. Then, you just need to launch this shell script along side your OpenFOAM run ... indeed it can run on any server that has rw access to the two file systems - it doesn't have to run on the HPC server.
|
|
December 19, 2023, 09:33 |
|
#6 | |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
This is because it will come with a plethora of issues: you need to run shell scripts, which does not feel native. Also I usually use Windows version of OpenFOAM, you can imagine how tricky it becomes to write shell scripts and ensure they will run correctly. In the script you must ensure to handle all the writing correctly: the write interval, the restarting of the simulation, ...... things become increasingly complex without justification. A simple control behind a function object will abstract away all these issues.
Quote:
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
||
December 19, 2023, 09:40 |
|
#7 | |
Senior Member
ONESP-RO
Join Date: Feb 2021
Location: Somwhere on Planet Earth
Posts: 127
Rep Power: 5 |
Quote:
Unfortunately, as I stated above, I have thought about using shell scripts but I find them not suitable, due to the complexity required to handle many scenarios. Using an external shell is not obvious, how do you ensure it will keep running for long time? even if I use tmux, this is not guaranteed and I will find myself doing sysadmin tasks that are beyond my skills. Another trick is to use coded function object, creating duplicate fields from references of the existing fields, hardcoding the custom path. This probably much better than using a shell script but I personally tend to keep things simple. That's why I am looking for a simple solution.
__________________
Don't keep making the same mistakes. Try to make new mistakes. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field | lakeat | OpenFOAM Community Contributions | 58 | December 23, 2021 03:36 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
time step directories naming issue | Andrea_85 | OpenFOAM | 3 | April 3, 2014 09:38 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |