Skip to content

Commit

Permalink
Removed local directory in test_openfoam
Browse files Browse the repository at this point in the history
  • Loading branch information
qiqi committed Oct 15, 2016
1 parent 3442a29 commit 61605c6
Showing 1 changed file with 31 additions and 35 deletions.
66 changes: 31 additions & 35 deletions tests/test_pisofoam4_restart_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,41 @@
#sys.path.append(os.path.join(my_path, '..'))

test_path = os.path.join(my_path, 'test_autonomous_system', 'openfoam4')
foam_path = os.path.join(my_path, '../tools/openfoam4/pisoFoam')
tool_path = os.path.join(my_path, '../tools/openfoam4/scripts')

test_one_step = '''
rm -rf one_step
mkdir one_step
cp -r ../../data/pisofoam_restart/0 one_step
cp -r ../../data/pisofoam_restart/constant one_step
cp -r ../../data/pisofoam_restart/system one_step
cd one_step
sed -i -e "s/endTime 1;/endTime 2;/g" system/controlDict
decomposePar > out0
mpiexec -np 2 ../../../../tools/openfoam4/pisoFoam/pisoFoam -parallel > out
reconstructPar > out1
cp 2/*.gz .
gunzip *.gz
cd ..
'''.strip()
rm -rf {0}/one_step
mkdir {0}/one_step
cp -r {0}/../../data/pisofoam_restart/0 {0}/one_step
cp -r {0}/../../data/pisofoam_restart/constant {0}/one_step
cp -r {0}/../../data/pisofoam_restart/system {0}/one_step
sed -i -e "s/endTime 1;/endTime 2;/g" {0}/one_step/system/controlDict
decomposePar -case {0}/one_step > {0}/one_step/out0
mpiexec -np 2 {1}/pisoFoam -parallel -case {0}/one_step > {0}/one_step/out
reconstructPar -case {0}/one_step > {0}/one_step/out1
cp {0}/one_step/2/*.gz {0}/one_step
gunzip {0}/one_step/*.gz
'''.strip().format(test_path, foam_path)

test_two_steps = '''
rm -rf two_steps
mkdir two_steps
mkdir two_steps/step_1
cp -r ../../data/pisofoam_restart/0 two_steps/step_1
mkdir two_steps/step_2
gzip two_steps/step_1/0/*
cp -r ../../data/pisofoam_restart/constant two_steps/step_1
cp -r ../../data/pisofoam_restart/system two_steps/step_1
cd two_steps/step_1
decomposePar > out0
mpiexec -np 2 ../../../../../tools/openfoam4/pisoFoam/pisoFoam -parallel > out
cd ../..
mpiexec -np 2 python ../../../tools/openfoam4/scripts/foam_to_h5.py two_steps/step_1 1 two_steps/1.hdf5
mpiexec -np 2 python ../../../tools/openfoam4/scripts/h5_to_foam.py two_steps/step_1 two_steps/1.hdf5 two_steps/step_2 0
cd two_steps/step_2
mpiexec -np 2 ../../../../../tools/openfoam4/pisoFoam/pisoFoam -parallel > out
reconstructPar > out1
cp 1/*.gz ..
gunzip ../*.gz
cd ../..
'''.strip()
rm -rf {0}/two_steps
mkdir {0}/two_steps
mkdir {0}/two_steps/step_1
cp -r {0}/../../data/pisofoam_restart/0 two_steps/step_1
mkdir {0}/two_steps/step_2
gzip {0}/two_steps/step_1/0/*
cp -r {0}/../../data/pisofoam_restart/constant {0}/two_steps/step_1
cp -r {0}/../../data/pisofoam_restart/system {0}/two_steps/step_1
decomposePar -case {0}/two_steps/step_1 > {0}/two_steps/step_1/out0
mpiexec -np 2 {1}/pisoFoam -parallel -case {0}/two_steps/step_1 > {0}/two_steps/step_1/out
mpiexec -np 2 python {2}/foam_to_h5.py {0}/two_steps/step_1 1 {0}/two_steps/1.hdf5
mpiexec -np 2 python {2}/h5_to_foam.py two_steps/step_1 {0}/two_steps/1.hdf5 {0}/two_steps/step_2 0
mpiexec -np 2 {1}/pisoFoam -parallel -case {0}/two_steps/step_2 > {0}/two_steps/step_2/out
reconstructPar -case {0}/two_steps/step_2 > {0}/two_steps/step_2/out1
cp {0}/two_steps/step_2/1/*.gz {0}/two_steps/step_2
gunzip {0}/two_steps/step_2/*.gz
'''.strip().format(test_path, foam_path, tool_path)

compare = '''
diff one_step/U two_steps/
Expand Down

0 comments on commit 61605c6

Please sign in to comment.