Skip to content

Commit 7ed08f9

Browse files
committed
IMPORTANT BUG FIX: a subtle issue introduced by the flexible data rotation I/O (Liu Zhongyin) which resulted in errors reading multiple data types. No longer a problem.
1 parent 307d1c4 commit 7ed08f9

3 files changed

Lines changed: 105 additions & 12 deletions

File tree

f90/3D_MT/DataIO.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ subroutine read_Z_list(allData,cfile)
804804
case(Full_Impedance,Off_Diagonal_Impedance,Full_Vertical_Components)
805805
read(ioDat,'(a)',iostat=ios) tmpline
806806

807-
if (ios /= 0) then
807+
if ((ios /= 0) .or. (tmpline(1:1)=='#')) then
808808
backspace(ioDat)
809809
exit
810810
end if
@@ -877,7 +877,7 @@ subroutine read_Z_list(allData,cfile)
877877
case(Full_Interstation_TF)
878878
read(ioDat,'(a)',iostat=ios) tmpline
879879

880-
if (ios /= 0) then
880+
if ((ios /= 0) .or. (tmpline(1:1)=='#')) then
881881
backspace(ioDat)
882882
exit
883883
end if
@@ -958,7 +958,7 @@ subroutine read_Z_list(allData,cfile)
958958
case(Off_Diagonal_Rho_Phase,Phase_Tensor)
959959
read(ioDat,'(a)',iostat=ios) tmpline
960960

961-
if (ios /= 0) then
961+
if ((ios /= 0) .or. (tmpline(1:1)=='#')) then
962962
backspace(ioDat)
963963
exit
964964
end if

f90/CONFIG/Configure.3D_MT.USGS.Yeti

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ INV_dir="INV"
1313
if [ $2 = "debug" ]; then
1414
# Debug configuration
1515
perl fmkmf.pl -f90 mpiifort \
16-
-opt '-O0 -w -std03 -fp-stack-check -g -traceback' \
17-
-mpi '-cpp -DMPI' \
16+
-opt '-O0 -w -std03 -fp-stack-check -g -traceback -ffree-line-length-none' \
17+
-mpi '-fpp -DMPI' \
1818
-o './objs/3D_MT/IFortDebugMPI' \
1919
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
20-
-lp '/opt/intel/composer_xe_2015/mkl/lib/intel64' \
20+
-lp '-L${MKLROOT}/lib/intel64' \
2121
-p .:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$MT_path_dir \
2222
Mod3DMT.f90 > $1
2323

@@ -28,7 +28,7 @@ perl fmkmf.pl -f90 mpifort \
2828
-mpi '-cpp -DMPI' \
2929
-o './objs/3D_MT/GFortranDebugMPI' \
3030
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
31-
-lp '/opt/intel/composer_xe_2015/mkl/lib/intel64' \
31+
-lp '-L${MKLROOT}/lib/intel64' \
3232
-p .:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$MT_path_dir \
3333
Mod3DMT.f90 > $1
3434
sed -i.bak 's/-module $(OBJDIR)\./--sysroot=$(OBJDIR)\./g' $1 # override the default
@@ -37,22 +37,22 @@ rm $1.bak
3737
elif [ $2 = "release" ]; then
3838
# Release configuration
3939
perl fmkmf.pl -f90 mpiifort \
40-
-opt '-O2 -w -std03 -fp-stack-check -g -traceback -mavx' \
41-
-mpi '-cpp' \
40+
-opt '-O2 -w -std03 -fp-stack-check -g -traceback -mavx -ffree-line-length-none' \
41+
-mpi '-fpp' \
4242
-o './objs/3D_MT/IFortRelease' \
4343
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
44-
-lp '/opt/intel/composer_xe_2015/mkl/lib/intel64' \
44+
-lp '${MKLROOT}/lib/intel64' \
4545
-p .:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$MT_path_dir \
4646
Mod3DMT.f90 > $1
4747

4848
else
4949
# MPI configuration (main release option)
5050
perl fmkmf.pl -f90 mpiifort \
51-
-opt '-O2 -w -std03 -fp-stack-check -g -traceback -mavx' \
51+
-opt '-O2 -w -std03 -fp-stack-check -g -traceback -mavx -ffree-line-length-none' \
5252
-mpi '-cpp -DMPI' \
5353
-o './objs/3D_MT/IFortReleaseMPI' \
5454
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
55-
-lp '/opt/intel/composer_xe_2015/mkl/lib/intel64' \
55+
-lp '${MKLROOT}/lib/intel64' \
5656
-p .:MPI:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$MT_path_dir \
5757
Mod3DMT.f90 > $1
5858
fi

f90/CONFIG/Configure.SP2.USGS.Yeti

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/sh
2+
if [ $# -le 1 ]; then
3+
echo 1>&2 Usage: $0 Makefile [debug|gfortran|release|MPI] [spherical]
4+
exit 127
5+
fi
6+
if [ -e $1 ]; then
7+
rm $1
8+
fi
9+
10+
MT_path_dir="3D_MT:3D_MT/DICT:3D_MT/modelParam:3D_MT/FWD:3D_MT/FWD/Mod2d:3D_MT/ioMod"
11+
SP_path_dir="3D_MT/FWD_SP2:3D_MT/SP_Topology"
12+
INV_dir="INV"
13+
14+
if [ $2 = "debug" ]; then
15+
# Debug configuration
16+
perl fmkmf.pl -f90 mpiifort \
17+
-opt '-O0 -w -std03 -fp-stack-check -g -traceback -ffree-line-length-none' \
18+
-mpi '-fpp -DMPI' \
19+
-o './objs/3D_MT/IFortDebugMPI_SP2' \
20+
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
21+
-lp '-L${MKLROOT}/lib/intel64' \
22+
-p .:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$SP_path_dir:$MT_path_dir \
23+
Mod3DMT.f90 > $1
24+
25+
elif [ $2 = "gfortran" ]; then
26+
# Release configuration
27+
perl fmkmf.pl -f90 mpifort \
28+
-opt '-O0 -g -ffree-line-length-none' \
29+
-mpi '-cpp -DMPI' \
30+
-o './objs/3D_MT/GFortranDebugMPI_SP2' \
31+
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
32+
-lp '-L${MKLROOT}/lib/intel64' \
33+
-p .:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$SP_path_dir:$MT_path_dir \
34+
Mod3DMT.f90 > $1
35+
sed -i.bak 's/-module $(OBJDIR)\./--sysroot=$(OBJDIR)\./g' $1 # override the default
36+
rm $1.bak
37+
38+
elif [ $2 = "release" ]; then
39+
# Release configuration
40+
perl fmkmf.pl -f90 mpiifort \
41+
-opt '-O2 -w -std03 -fp-stack-check -g -traceback -mavx -ffree-line-length-none' \
42+
-mpi '-fpp' \
43+
-o './objs/3D_MT/IFortRelease_SP2' \
44+
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
45+
-lp '${MKLROOT}/lib/intel64' \
46+
-p .:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$SP_path_dir:$MT_path_dir \
47+
Mod3DMT.f90 > $1
48+
49+
else
50+
# MPI configuration (main release option)
51+
perl fmkmf.pl -f90 mpiifort \
52+
-opt '-O2 -w -std03 -fp-stack-check -g -traceback -mavx -ffree-line-length-none' \
53+
-mpi '-cpp -DMPI' \
54+
-o './objs/3D_MT/IFortReleaseMPI_SP2' \
55+
-l '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -qopenmp -parallel' \
56+
-lp '${MKLROOT}/lib/intel64' \
57+
-p .:MPI:$INV_dir:LAPACK:SENS:UTILS:FIELDS/FiniteDiff3D:$SP_path_dir:$MT_path_dir \
58+
Mod3DMT.f90 > $1
59+
fi
60+
61+
if [ $# -le 2 ]; then
62+
sed -i .bak 's/\/Mod3DMT/\/Mod3DMT_SP2/g' $1
63+
echo 1>&2 Cartesian version of the makefile ready to use.
64+
exit
65+
fi
66+
67+
if [ $3 = "spherical" ]; then
68+
sed -i .bak 's/IFort/IFortS/g' $1
69+
sed -i .bak 's/GridCalc\./GridCalcS\./g' $1
70+
sed -i .bak 's/boundary_ws\./boundary_wsS\./g' $1
71+
sed -i .bak 's/MetricElements_CSG\./MetricElements_SSG\./g' $1
72+
sed -i .bak 's/3DMT /3DMT_SP2_sph /g' $1
73+
sed -i .bak 's/3DMT:/3DMT_SP2_sph:/g' $1
74+
if [ $2 == "debug" ]; then
75+
sed -i .bak 's/Mod3DMT /Mod3DMTs_SP2_dbg /g' $1
76+
elif [ $2 == "release" ]; then
77+
sed -i .bak 's/Mod3DMT /Mod3DMTs_SP2 /g' $1
78+
else
79+
sed -i .bak 's/Mod3DMT /Mod3DMTs_SP2_MPI /g' $1
80+
fi
81+
rm $1.bak
82+
echo 1>&2 Spherical version of the makefile ready to use.
83+
else
84+
if [ $2 == "debug" ]; then
85+
sed -i .bak 's/\/Mod3DMT/\/Mod3DMT_SP2_dbg/g' $1
86+
elif [ $2 == "release" ]; then
87+
sed -i .bak 's/\/Mod3DMT/\/Mod3DMT_SP2/g' $1
88+
else
89+
sed -i .bak 's/\/Mod3DMT/\/Mod3DMT_SP2_MPI/g' $1
90+
fi
91+
rm $1.bak
92+
echo 1>&2 Cartesian version of the makefile ready to use.
93+
fi

0 commit comments

Comments
 (0)