[cig-commits] r13386 - in seismo/3D/SPECFEM3D_GLOBE/branches/pluggable: . MODELS/3D/Montagner MODELS/3D/blank MODELS/3D/none MODELS/3D/s20rts MODELS/3D/s29ea MODELS/3D/s362ani MODELS/3D/s362ani/common MODELS/3D/s362ani_prem MODELS/3D/s362iso MODELS/3D/s362wmani MODELS/3D/transversely_isotropic_prem_plus_3D_crust_2.0 MODELS/crustal/crust2.0 MODELS/crustal/none
leif at geodynamics.org
leif at geodynamics.org
Mon Nov 24 15:14:32 PST 2008
Author: leif
Date: 2008-11-24 15:14:32 -0800 (Mon, 24 Nov 2008)
New Revision: 13386
Modified:
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/Montagner/anisotropic_mantle_model.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/blank/my_mantle_model.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/none/mantle_model_none.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s20rts/mantle_model.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s29ea/s29ea.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/common/s362ani_common.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/s362ani.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani_prem/s362ani_prem.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362iso/s362iso.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362wmani/s362wmani.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/transversely_isotropic_prem_plus_3D_crust_2.0/prem_plus_crust.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/crust2.0/crustal_model.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/none/crustal_model_none.f90
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/bcast_model.c
seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90
Log:
Changed Fortran code to use generic model data broadcasting routine.
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/Montagner/anisotropic_mantle_model.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/Montagner/anisotropic_mantle_model.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/Montagner/anisotropic_mantle_model.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -85,21 +85,12 @@
!--------------------------------------------------------------------
- subroutine read_3d_mantle_model(myrank)
+ subroutine read_3d_mantle_model()
- use aniso_mantle_model_module
implicit none
- include 'mpif.h'
- include "constants.h"
- integer myrank,ier
-
! the variables read are declared and stored in structure AMM_V
- if(myrank == 0) call read_aniso_mantle_model()
-! broadcast the information read on the master to the nodes
- call MPI_BCAST(AMM_V%npar1,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(AMM_V%beta,14*34*37*73,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(AMM_V%pro,47,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+ call read_aniso_mantle_model()
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/blank/my_mantle_model.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/blank/my_mantle_model.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/blank/my_mantle_model.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -81,12 +81,10 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
-
! Insert code to read data files here.
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/none/mantle_model_none.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/none/mantle_model_none.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/none/mantle_model_none.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -25,9 +25,8 @@
!
!=====================================================================
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
end subroutine read_3d_mantle_model
subroutine iso_mantle_model(radius,theta,phi, &
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s20rts/mantle_model.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s20rts/mantle_model.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s20rts/mantle_model.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -75,27 +75,14 @@
!---------------------------
- subroutine read_3d_mantle_model(myrank)
+ subroutine read_3d_mantle_model()
- use mantle_model_module
implicit none
- include 'mpif.h'
- include "constants.h"
- integer myrank,ier
+ call read_smooth_moho()
- call read_smooth_moho
-
! the variables read are declared and stored in structure D3MM_V
- if(myrank == 0) call read_mantle_model()
-! broadcast the information read on the master to the nodes
- call MPI_BCAST(D3MM_V%dvs_a,(NK+1)*(NS+1)*(NS+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(D3MM_V%dvs_b,(NK+1)*(NS+1)*(NS+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(D3MM_V%dvp_a,(NK+1)*(NS+1)*(NS+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(D3MM_V%dvp_b,(NK+1)*(NS+1)*(NS+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(D3MM_V%spknt,NK+1,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(D3MM_V%qq0,(NK+1)*(NK+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(D3MM_V%qq,3*(NK+1)*(NK+1),MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
+ call read_mantle_model()
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s29ea/s29ea.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s29ea/s29ea.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s29ea/s29ea.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -52,14 +52,12 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
+ call read_s362ani_mantle_model('@THIS_DIR@/S2.9EA')
- call read_s362ani_mantle_model(myrank,'@THIS_DIR@/S2.9EA')
-
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/common/s362ani_common.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/common/s362ani_common.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/common/s362ani_common.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -879,40 +879,16 @@
end subroutine rd3dmodl
- subroutine read_s362ani_mantle_model(myrank,modeldef)
+ subroutine read_s362ani_mantle_model(modeldef)
- use s362ani_module
implicit none
- include 'mpif.h'
- include "constants.h"
- integer myrank,ier
character(len=*) modeldef
- call read_smooth_moho
+ call read_smooth_moho()
- if(myrank == 0) call read_model_s362ani(modeldef)
- call MPI_BCAST(numker,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(numhpa,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(ihpa,1,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(lmxhpa,maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(itypehpa,maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(ihpakern,maxker,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(numcoe,maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(ivarkern,maxker,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(itpspl,maxcoe*maxhpa,MPI_INTEGER,0,MPI_COMM_WORLD,ier)
+ call read_model_s362ani(modeldef)
- call MPI_BCAST(xlaspl,maxcoe*maxhpa,MPI_REAL,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(xlospl,maxcoe*maxhpa,MPI_REAL,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(radspl,maxcoe*maxhpa,MPI_REAL,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(coe,maxcoe*maxker,MPI_REAL,0,MPI_COMM_WORLD,ier)
-
- call MPI_BCAST(hsplfl,80*maxhpa,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(dskker,40*maxker,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(kerstr,80,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(refmdl,80,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(varstr,40*maxker,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
-
end subroutine read_s362ani_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/s362ani.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/s362ani.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani/s362ani.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -52,14 +52,12 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
+ call read_s362ani_mantle_model('@THIS_DIR@/S362ANI')
- call read_s362ani_mantle_model(myrank,'@THIS_DIR@/S362ANI')
-
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani_prem/s362ani_prem.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani_prem/s362ani_prem.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362ani_prem/s362ani_prem.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -52,14 +52,12 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
+ call read_s362ani_mantle_model('@THIS_DIR@/S362ANI_PREM')
- call read_s362ani_mantle_model(myrank,'@THIS_DIR@/S362ANI_PREM')
-
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362iso/s362iso.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362iso/s362iso.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362iso/s362iso.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -52,14 +52,12 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
+ call read_s362ani_mantle_model('@THIS_DIR@/S362ANI')
- call read_s362ani_mantle_model(myrank,'@THIS_DIR@/S362ANI')
-
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362wmani/s362wmani.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362wmani/s362wmani.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/s362wmani/s362wmani.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -52,14 +52,12 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
+ call read_s362ani_mantle_model('@THIS_DIR@/S362WMANI')
- call read_s362ani_mantle_model(myrank,'@THIS_DIR@/S362WMANI')
-
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/transversely_isotropic_prem_plus_3D_crust_2.0/prem_plus_crust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/transversely_isotropic_prem_plus_3D_crust_2.0/prem_plus_crust.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/transversely_isotropic_prem_plus_3D_crust_2.0/prem_plus_crust.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -52,12 +52,10 @@
end subroutine get_model_properties
-subroutine read_3d_mantle_model(myrank)
+subroutine read_3d_mantle_model()
implicit none
- integer myrank
-
end subroutine read_3d_mantle_model
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/crust2.0/crustal_model.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/crust2.0/crustal_model.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/crust2.0/crustal_model.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -58,24 +58,12 @@
!---------------------------
- subroutine read_crust(myrank)
+ subroutine read_crust()
- use crustal_model_module
implicit none
- include 'mpif.h'
- include "constants.h"
- integer myrank,ier
-
! the variables read are declared and stored in structure CM_V
- if(myrank == 0) call read_crustal_model()
-! broadcast the information read on the master to the nodes
- call MPI_BCAST(CM_V%thlr,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(CM_V%velocp,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(CM_V%velocs,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(CM_V%dens,NKEYS_CRUST*NLAYERS_CRUST,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(CM_V%abbreviation,NCAP_CRUST*NCAP_CRUST,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
- call MPI_BCAST(CM_V%code,2*NKEYS_CRUST,MPI_CHARACTER,0,MPI_COMM_WORLD,ier)
+ call read_crustal_model()
end subroutine read_crust
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/none/crustal_model_none.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/none/crustal_model_none.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/crustal/none/crustal_model_none.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -25,12 +25,10 @@
!
!=====================================================================
-subroutine read_crust(myrank)
+subroutine read_crust()
implicit none
- integer myrank
-
stop 'CRUSTAL is true, but there is no crust defined!'
end subroutine read_crust
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in 2008-11-24 23:14:32 UTC (rev 13386)
@@ -61,6 +61,7 @@
$O/assemble_MPI_vector.o \
$O/attenuation_model.o \
$O/auto_ner.o \
+ $O/bcast_model.o \
$O/calc_jacobian.o \
$O/calendar.o \
$O/comp_source_spectrum.o \
@@ -552,6 +553,9 @@
$O/write_c_binary.o: $S/write_c_binary.c config.h
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $O/write_c_binary.o $S/write_c_binary.c
+$O/bcast_model.o: $S/bcast_model.c config.h
+ mpicc $(CPPFLAGS) $(CFLAGS) -c -o $O/bcast_model.o $S/bcast_model.c
+
$O/add_missing_nodes.o: constants.h $S/add_missing_nodes.f90
${FCCOMPILE_CHECK} -c -o $O/add_missing_nodes.o ${FCFLAGS_f90} $S/add_missing_nodes.f90
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/bcast_model.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/bcast_model.c 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/bcast_model.c 2008-11-24 23:14:32 UTC (rev 13386)
@@ -10,17 +10,21 @@
#include <fcntl.h>
#include <unistd.h>
+#include "config.h"
+
static char wd[150], modelDir[150];
-void bcast_model(int rank, char *scratchDir) {
- int fd;
+void FC_FUNC_(bcast_model, BCAST_MODEL)(int *pRank, char *scratchDir, int *scratchDirLen) {
+ int fd, rank;
struct stat statBuf;
int size;
char *data;
int status;
+ rank = *pRank;
+
/* Save the working directory (which is on the shared filesystem)
for future reference. */
if (!getcwd(wd, sizeof(wd))) {
@@ -66,7 +70,7 @@
}
/* Create and enter the model directory. */
- sprintf(modelDir, "%s/model-%d", scratchDir, rank);
+ sprintf(modelDir, "%.*s/model-%d", *scratchDirLen, scratchDir, rank);
if (mkdir(modelDir, 0777) == -1) {
perror("mkdir");
MPI_Abort(MPI_COMM_WORLD, 1);
@@ -104,14 +108,14 @@
/* Stay in the model directory, ready to read files. */
}
-void enter_model_dir() {
+void FC_FUNC_(enter_model_dir, ENTER_MODEL_DIR)() {
if (chdir(modelDir) == -1) {
perror("chdir");
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
-void leave_model_dir() {
+void FC_FUNC_(leave_model_dir, LEAVE_MODEL_DIR)() {
if (chdir(wd) == -1) {
perror("chdir");
MPI_Abort(MPI_COMM_WORLD, 1);
Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90 2008-11-24 20:34:09 UTC (rev 13385)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90 2008-11-24 23:14:32 UTC (rev 13386)
@@ -857,12 +857,16 @@
endif
if(ELLIPTICITY) call make_ellipticity(nspl,rspl,espl,espl2,ONE_CRUST)
- call read_3d_mantle_model(myrank)
+ call bcast_model(myrank, LOCAL_PATH)
+ call read_3d_mantle_model()
+
if(CRUSTAL) then
- call read_crust(myrank)
+ call read_crust()
endif
+ call leave_model_dir()
+
if(ANISOTROPIC_INNER_CORE) then
if(myrank == 0) call read_aniso_inner_core_model
! one should add an MPI_BCAST here if one adds a read_aniso_inner_core_model subroutine
More information about the CIG-COMMITS
mailing list