|
[Sponsors] |
March 7, 2021, 14:59 |
Running subfolder applications in Allrun
|
#1 |
New Member
Santi Parera
Join Date: Jul 2019
Location: BARCELONA
Posts: 26
Rep Power: 7 |
Hey there,
I'm trying to make automatic my simulation by using the Allrun script. My simulation is so simmilar to the tutorial "propeller" so I'm changing just few things. The fact is that my geometry has to be scaled because the 3D software outputs milimeters as meters... "surfaceConvert" is the command and has to be executed from case/constant/triSurface subfolder. So my question is how we explain to Allrun from where it has to execute the commands as the rest of the commands have to be executed from the main case directory. Thanks. |
|
March 7, 2021, 16:57 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
The Allrun script is just a shell script, and you can navigate around the directories just like you would from the command line. When you run the Allrun (shell) script, it is just the same as inputting the same command at the command prompt. So, for example, you could have:
Code:
cd subfolder1 <execute some commands in this subfolder> cd .. <execute some more commands in this subfolder> |
|
March 8, 2021, 15:30 |
|
#3 | |
New Member
Santi Parera
Join Date: Jul 2019
Location: BARCELONA
Posts: 26
Rep Power: 7 |
Quote:
Thank you, I realised quickly... Now I have another problem. Commands do execute one after one, but this does not happen with logs... At first I tried without the "if" conditions and the same... It seems all the logs are requested to be writed at the same time so that the first that enters gets written, but not the others. I don't know so much the use of "runApplication" before each command. This is also happening with "blockMesh" and "rotateMesh" commands. Thanks. |
||
March 8, 2021, 15:47 |
|
#4 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
Bear in mind that the redirect ">" overwrites the contents of the file, if it is already existing. If you want to append to the log file, then use ">>" instead of ">" ... that might be your problem?
|
|
March 8, 2021, 15:57 |
|
#5 | |
New Member
Santi Parera
Join Date: Jul 2019
Location: BARCELONA
Posts: 26
Rep Power: 7 |
Quote:
But the problem is that from this script I expect 3 scaled geometry files and 3 logs or 1 log containing scaling processof the 3 geometry files. What I get is 3 scaled geometry files and just one log containing random information of one of 3 geometry files. |
||
March 8, 2021, 16:29 |
|
#6 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
Maybe I am being stupid (I am tired), but I am struggling to see what your code is doing. First up, take this line:
Code:
if surfaceConvert rotor.stl rotor_scaled.stl -clean -scale 0.01 > /dev/null 2>&1 > log.surfaceConvert Code:
> /dev/null Also, as discussed, if you want to see the log file data from each time surfaceConvert is run, you want to change the line into something like the following: Code:
if surfaceConvert rotor.stl rotor_scaled.stl -clean -scale 0.01 >> log.surfaceConvert 2>&1 Code:
if ls; then echo "true"; else echo "false"; fi |
|
March 9, 2021, 14:46 |
|
#7 | |
New Member
Santi Parera
Join Date: Jul 2019
Location: BARCELONA
Posts: 26
Rep Power: 7 |
Quote:
Thank you so much, now it works well. One thing I do not understand is that if I navigate to the installation directory of OpenFOAM I can see that "surfaceConvert", "blockMesh" and "rotateMesh" are applications. Now why I have to execute blockMesh with "runApplication" and not with surfaceConvert?? This is the code I have now: Code:
#!/bin/sh cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # - scaling cd constant/triSurface/ surfaceConvert ROTOR.stl ROTOR_SCALED.stl -clean -scale 0.01 >> log.surfaceConvert 2>&1 surfaceConvert TURBINA.stl TURBINA_SCALED.stl -clean -scale 0.01 >> log.surfaceConvert 2>&1 surfaceConvert REACTOR.stl REACTOR_SCALED.stl -clean -scale 0.01 >> log.surfaceConvert 2>&1 # - meshing cd ../.. cd system/ m4 blockMeshDict.m4 > blockMeshDict cd .. runApplication blockMesh >> log.blockMesh 2>&1 runApplication rotateMesh '(0 0 1)' '(0 1 0)' >> log.rotateMesh 2>&1 This also happens with "rotateMesh" |
||
March 9, 2021, 16:18 |
|
#8 | ||||
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14 |
Quote:
Quote:
Quote:
Code:
surfaceConvert ROTOR.stl ROTOR_SCALED.stl -clean -scale 0.01 >> log.surfaceConvert 2>&1 Code:
surfaceConvert ROTOR.stl ROTOR_SCALED.stl -clean -scale 0.01 > log.surfaceConvert 2>&1 Quote:
Code:
runApplication -overwrite blockMesh Good luck my friend! |
|||||
Tags |
allrun, directory, surfaceconvert |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hypersonic Sim (running at Mach 7): floating point exception has occurred | bungusbeefcake | STAR-CCM+ | 10 | March 31, 2015 07:59 |
CFX11 + Fortran compiler ? | Mohan | CFX | 20 | March 30, 2011 19:56 |
Suse10 FoamX problem | frank178 | OpenFOAM Installation | 6 | January 14, 2010 05:18 |
Statically Compiling OpenFOAM Issues | herzfeldd | OpenFOAM Installation | 21 | January 6, 2009 10:38 |
Kubuntu uses dash breaks All scripts in tutorials | platopus | OpenFOAM Bugs | 8 | April 15, 2008 08:52 |