Skip to content

Commit

Permalink
updates run scripts to run xmeshfem2D and xspecfem2D from bin/ direct…
Browse files Browse the repository at this point in the history
…ories (as 3D versions do)
  • Loading branch information
danielpeter committed Feb 9, 2019
1 parent 68e521f commit 2420819
Show file tree
Hide file tree
Showing 31 changed files with 229 additions and 143 deletions.
16 changes: 10 additions & 6 deletions EXAMPLES/BENCHIE_water_PVC/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ rm -rf OUTPUT_FILES/*
cd $currentdir

# links executables
# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp DATA/Par_file OUTPUT_FILES/
Expand All @@ -37,13 +41,13 @@ if [ "$NPROC" -eq 1 ]; then
echo
echo "running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
else
# This is a MPI simulation
echo
echo "running mesher on $NPROC processors..."
echo
mpirun -np $NPROC ./xmeshfem2D
mpirun -np $NPROC ./bin/xmeshfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand All @@ -54,13 +58,13 @@ if [ "$NPROC" -eq 1 ]; then
echo
echo "running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
else
# This is a MPI simulation
echo
echo "running solver on $NPROC processors..."
echo
mpirun -np $NPROC ./xspecfem2D
mpirun -np $NPROC ./bin/xspecfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand Down
21 changes: 13 additions & 8 deletions EXAMPLES/Gmsh_example_Stacey_MPI/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ rm -rf OUTPUT_FILES/*
cd $currentdir

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp DATA/Par_file OUTPUT_FILES/
Expand All @@ -37,13 +40,13 @@ if [ "$NPROC" -eq 1 ]; then
echo
echo "running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
else
# This is a MPI simulation
echo
echo "running mesher on $NPROC processors..."
echo
mpirun -np $NPROC ./xmeshfem2D
mpirun -np $NPROC ./bin/xmeshfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand All @@ -54,13 +57,13 @@ if [ "$NPROC" -eq 1 ]; then
echo
echo "running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
else
# This is a MPI simulation
echo
echo "running solver on $NPROC processors..."
echo
mpirun -np $NPROC ./xspecfem2D
mpirun -np $NPROC ./bin/xspecfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand All @@ -69,10 +72,12 @@ if [[ $? -ne 0 ]]; then exit 1; fi
cp DATA/*SOURCE* DATA/*STATIONS* OUTPUT_FILES

# check mesh
cd bin/
rm -f xcheck_quality_external_mesh
ln -s ../../bin/xcheck_quality_external_mesh
ln -s ../../../bin/xcheck_quality_external_mesh
cd ../

./xcheck_quality_external_mesh <<EOF
./bin/xcheck_quality_external_mesh <<EOF
3
EOF
# checks exit code
Expand Down
8 changes: 4 additions & 4 deletions EXAMPLES/Industrial_Format_SEP/interpolate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ program main_interpolate

! runs mesher
print *,'call xmeshfem2d'
call system('./xmeshfem2D > OUTPUT_FILES/output_mesher.step_1.txt')
call system('./bin/xmeshfem2D > OUTPUT_FILES/output_mesher.step_1.txt')

! runs first forward simulation to generate new specfem files
print *,'call xspecfem2d'
write(num,'(i2.2)') nproc
call system('mpirun -np ' //num//' ./xspecfem2D > OUTPUT_FILES/output_solver.step_1.txt')
call system('mpirun -np ' //num//' ./bin/xspecfem2D > OUTPUT_FILES/output_solver.step_1.txt')

print *
print *, '************ Setting up new simulation ************ '
Expand All @@ -243,7 +243,7 @@ program main_interpolate

! runs mesher
print *,'call xmeshfem2d'
call system('./xmeshfem2D')
call system('./bin/xmeshfem2D')

! scaling model values
if (SCALE_FROM_VP) then
Expand Down Expand Up @@ -282,7 +282,7 @@ program main_interpolate

! runs forward simulation
print *,'call xspecfem2d'
call system('mpirun -np ' //num//' ./xspecfem2D ')
call system('mpirun -np ' //num//' ./bin/xspecfem2D ')

end program main_interpolate

Expand Down
12 changes: 8 additions & 4 deletions EXAMPLES/Industrial_Format_SEP/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@ mkdir -p OUTPUT_FILES
rm -rf OUTPUT_FILES/*

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../


echo
echo "compiling xinterpolate..."
echo
$f90 $flags -o xinterpolate interpolate.f90
$f90 $flags -o bin/xinterpolate interpolate.f90
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

# runs database generation and forward simulations needed
echo
echo "running interpolation..."
echo
./xinterpolate
./bin/xinterpolate
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ fi
cd $currentdir

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp -f DATA/Par_file OUTPUT_FILES
Expand All @@ -44,15 +47,15 @@ cp -f DATA/SOURCE OUTPUT_FILES
echo
echo " running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

# runs simulation
echo
echo " running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

Expand Down
13 changes: 8 additions & 5 deletions EXAMPLES/Rayleigh_wave_no_crack/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ mkdir -p OUTPUT_FILES
rm -rf OUTPUT_FILES/*

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp DATA/Par_file OUTPUT_FILES/
Expand All @@ -36,7 +39,7 @@ NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 | cut -d \# -f 1 | tr -d ' '`
echo
echo " running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

Expand All @@ -45,12 +48,12 @@ if [ "$NPROC" -eq 1 ]; then # This is a serial simulation
echo
echo " Running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
else # This is a MPI simulation
echo
echo " Running solver on $NPROC processors..."
echo
mpirun -np $NPROC ./xspecfem2D
mpirun -np $NPROC ./bin/xspecfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand Down
13 changes: 8 additions & 5 deletions EXAMPLES/Rayleigh_wave_with_crack/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ mkdir -p OUTPUT_FILES
rm -rf OUTPUT_FILES/*

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp DATA/Par_file OUTPUT_FILES/
Expand All @@ -36,7 +39,7 @@ NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 | cut -d \# -f 1 | tr -d ' '`
echo
echo " running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

Expand All @@ -45,12 +48,12 @@ if [ "$NPROC" -eq 1 ]; then # This is a serial simulation
echo
echo " Running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
else # This is a MPI simulation
echo
echo " Running solver on $NPROC processors..."
echo
mpirun -np $NPROC ./xspecfem2D
mpirun -np $NPROC ./bin/xspecfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand Down
11 changes: 7 additions & 4 deletions EXAMPLES/Tape2007/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ cd ../
cd $currentdir

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp DATA/Par_file OUTPUT_FILES/
Expand All @@ -61,7 +64,7 @@ fi
echo
echo "running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

Expand All @@ -70,7 +73,7 @@ if [[ $? -ne 0 ]]; then exit 1; fi
echo
echo "running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi

Expand Down
15 changes: 9 additions & 6 deletions EXAMPLES/Tape2007_kernel/run_this_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ fi
cd $currentdir

# links executables
mkdir -p bin
cd bin/
rm -f xmeshfem2D xspecfem2D
ln -s ../../bin/xmeshfem2D
ln -s ../../bin/xspecfem2D
ln -s ../../../bin/xmeshfem2D
ln -s ../../../bin/xspecfem2D
cd ../

# stores setup
cp DATA/Par_file OUTPUT_FILES/
Expand All @@ -44,13 +47,13 @@ if [ "$NPROC" -eq 1 ]; then
echo
echo "running mesher..."
echo
./xmeshfem2D
./bin/xmeshfem2D
else
# This is a MPI simulation
echo
echo "running mesher on $NPROC processors..."
echo
mpirun -np $NPROC ./xmeshfem2D
mpirun -np $NPROC ./bin/xmeshfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand All @@ -61,13 +64,13 @@ if [ "$NPROC" -eq 1 ]; then
echo
echo "running solver..."
echo
./xspecfem2D
./bin/xspecfem2D
else
# This is a MPI simulation
echo
echo "running solver on $NPROC processors..."
echo
mpirun -np $NPROC ./xspecfem2D
mpirun -np $NPROC ./bin/xspecfem2D
fi
# checks exit code
if [[ $? -ne 0 ]]; then exit 1; fi
Expand Down
Loading

0 comments on commit 2420819

Please sign in to comment.