CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [SOWFA] Allrun script problem (https://www.cfd-online.com/Forums/openfoam-community-contributions/166308-allrun-script-problem.html)

mohsen.boojari February 6, 2016 13:30

Allrun script problem
 
Hi

I have a test case and don't know how to run it. because it has another script file instead of Allrun. it has too many commands and I don't know which one should I execute First.
can anyone help me?

here is the script file :

Quote:

#!/bin/bash
#
# Instructions for new CyEnce Cluster users:
# To use this script:
# 1) Save this script as a file named myscript on share
# 2) On share, Issue
# qsub myscript to submit the job
# Use qstat -a to see job status,
# Use qdel jobname to delete one of your jobs
# jobnames are of the form 1234.share

###########################################
# Output goes to file BATCH_OUTPUT.
# Error output goes to file BATCH_ERRORS.
# If you want the output to go to another file, change BATCH_OUTPUT
# or BATCH_ERRORS in the following lines to the full path of that file.

#PBS -o BATCH_OUTPUT
#PBS -e BATCH_ERRORS

#PBS -lnodes=8:ppn=16:compute,walltime=30:00:00

# Change to directory from which qsub command was issued
cd $PBS_O_WORKDIR
#cd work/Run_SOWFA
source ~/.bashrc

# Run the solver up to 12000 s (parallel)
# Function for refining the mesh globally in parallel.
refineMeshByCellSet()
{
for i in `seq 1 $1`;
do
echo "LEVEL $i REFINEMENT"
echo " selecting cells to refine..."
topoSet > log.toposet.$i 2>&1

echo " refining cells..."
refineHexMesh -overwrite domain > log.refineHexMesh.$i 2>&1
shift
done
}

# Make the mesh using blockMesh (serial)
echo "BUILDING THE MESH WITH blockMesh..."
blockMesh > log.blockMesh 2>&1
cp system/controlDict.1 system/controlDict
# Get rid of any initial files and replace with 0.original files (serial)
rm -rf 0
cp -rf 0.original 0
# Refine the mesh and solution files (enter number of refinement levels) (parallel)
#refineMeshByCellSet 1
#initialize the solution files (parallel)
echo "INITIALIZING THE FLOW FIELD..."
#setFieldsABL > log.setFieldsABL 2>&1
echo "DECOMPOSING THE DOMAIN WITH decomposePar..."
setFieldsABL2 > log.setFieldsABL 2>&1
decomposePar -cellDist -force > log.decomposePar 2>&1
echo "RUNNING THE SOLVER, PART 1..."

#mpirun -np 128 ABLSolver -parallel > log.ABLPisoSolver.1 2>&1
# Run the solver starting at 12000 s up to 14000s, saving planes of inflow
# data on the south and west boundaries every time step to be used as
# boundary conditions for the wind plant case. (parallel)
echo "RUNNING THE SOLVER, PART 2..."
#cp system/controlDict.2 system/controlDict

mpirun -np 128 ABLSolver -parallel > log.ABLSolver 2>&1
cp system/controlDict.2 system/controlDict

mpirun -np 128 ABLSolver -parallel > log.ABLSolver 2>&1

zfaraday February 7, 2016 20:20

Hi Mohsen,

One question, why do you want to run manually your case? It seems to be a large case run in a cluster using 128 nodes run it with the script!

What the script does is
  • stuff related to distributed run in a cluster. I haven't ever run a case in a cluster, so I'm not aware of what is beeing done at this point...
  • to create the base mesh with blockMesh.
  • copy the content within controlDict.1 into controlDict in order to use the time control settings contained in it.
  • reset the boundary and initial conditions contained in the "0.original" directory.
  • refine the mesh by means of the use of the function "refineMeshByCellSet()" created previously (it won't be performed since it is commented).
  • set initial values for the fields selected within some set cells/faces through a dictionary.
  • decompose the case according to the specification written in its corresponding dictionary.
  • run the solver twice; the first run is developed using the information of controlDict.1 and the second one with the information contained in the controlDict.2 file.

Maybe what is causing your confusion are the first lines, if this is the case, I can't help you... However, each step is commented (#) so you can have an idea of what is going on...

Maybe you don't understand the function "refineMeshByCellSet()", if so, I can help you. First, you have to tell the function the level of refinement (1 in this case) in the call to the function. Then the function runs topoSet in order to create the cellSets to be refined, afterwards it is refined with refineHexMesh. It is done as many times as you specify in the call.

Having said that, I recommend you to just run the script and let it flow! Hope it helps.

Best regards,

Alex


All times are GMT -4. The time now is 05:26.