|
[Sponsors] |
July 23, 2021, 15:47 |
Post Process of negative time steps folders
|
#1 |
New Member
Marco
Join Date: Jul 2021
Posts: 4
Rep Power: 4 |
Hi everyone,
I have a pretty straightforward question. Due to how the solver works, the solutions of a case i am running are stored in folder going from -180 to 540, with a time step of 2. This is due to the fact that the name of the folders doesn't indicate the time but the crank angle of an engine. When I try to post process, I can smoothly achieve my results for the positive angles (from 0 to 540) but I can't for the negative ones, since OF tells me: Code:
Cannot find file "faces" in directory "polyMesh" in times "-150" down to constant I attach a picture of the directories I have in my case. Thank you! |
|
July 28, 2021, 12:21 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14 |
A simple solution would be to write a bash script to rename each of the folders, adding say 1000 to the folder number. Your time folders would then all be positive and would retain their correct order.
It's made slightly harder by the fact that bash is picky about filenames starting with a "-", but here's a script you could use: For example: Code:
#!/bin/bash for oldFolder in $(ls); do if [[ $oldFolder =~ ^[+-]?[0-9]+$ ]]; then #check if folder name is an integer newFolder=$(expr $oldFolder + 1000) mv -- $oldFolder $newFolder fi done |
|
July 28, 2021, 12:24 |
|
#3 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14 |
Can I suggest that if you are going to try this, do a "dry run" first by getting it to print the mv command to screen, rather than to actually execute it. You can then check that the syntax is right. For example change
Code:
mv -- $oldFolder $newFolder Code:
echo mv -- $oldFolder $newFolder |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
laplacianFoam with source term | Herwig | OpenFOAM Running, Solving & CFD | 17 | November 19, 2019 13:47 |
Stuck in a Rut- interDyMFoam! | xoitx | OpenFOAM Running, Solving & CFD | 14 | March 25, 2016 07:09 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
InterFoam negative alpha | karasa03 | OpenFOAM | 7 | December 12, 2013 03:41 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 07:56 |