[cig-commits] r14164 - in seismo/3D/SPECFEM3D_GLOBE/branches/pluggable: . MODELS/3D/citcoms_isotropic_no_crust

leif at geodynamics.org leif at geodynamics.org
Thu Feb 26 17:49:14 PST 2009


Author: leif
Date: 2009-02-26 17:49:14 -0800 (Thu, 26 Feb 2009)
New Revision: 14164

Added:
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/model_plugin_support.f90
Modified:
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/citcoms_isotropic_no_crust/citcoms_isotropic_no_crust.f90
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in
   seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90
Log:
Added model plugin support API.


Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/citcoms_isotropic_no_crust/citcoms_isotropic_no_crust.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/citcoms_isotropic_no_crust/citcoms_isotropic_no_crust.f90	2009-02-27 01:05:10 UTC (rev 14163)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/MODELS/3D/citcoms_isotropic_no_crust/citcoms_isotropic_no_crust.f90	2009-02-27 01:49:14 UTC (rev 14164)
@@ -168,13 +168,12 @@
   integer NPROC_XI, NPROC_ETA, NCHUNKS
   integer NPROC
 
-  ! the variables in the common block are for read only
-  common /for_citcoms1/ NPROC_XI, NPROC_ETA, NCHUNKS
-
   !---------------------------------------------------------
   
   ! find out the domain docomposition scheme
   call MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ier)
+  call get_nchunks(NCHUNKS)
+  call get_nproc(NPROC_XI, NPROC_ETA)
 
   NPROC = NPROC_XI * NPROC_ETA
 
@@ -206,7 +205,7 @@
   integer, intent(in) :: ichunk, iproc_xi, iproc_eta
   double precision, dimension(4) :: x, y, z
 
-  ! local variables (some come from common blocks)
+  ! local variables
   double precision, dimension(NGNOD) :: xelm, yelm, zelm, offset_x, offset_y, offset_z
   double precision ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD
   double precision, dimension(NDIM,NDIM) :: rotation_matrix
@@ -218,11 +217,12 @@
   ! topology of the elements
   integer, dimension(NGNOD) :: iaddx, iaddy, iaddz
 
-  ! the variables in the common block are for read only
-  common /for_citcoms1/ NPROC_XI, NPROC_ETA, NCHUNKS
-  common /for_citcoms2/ ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD
-  common /for_citcoms3/ rotation_matrix
 
+  call get_nchunks(NCHUNKS)
+  call get_nproc(NPROC_XI, NPROC_ETA)
+  call get_angular_width_in_radians(ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD)
+  call get_rotation_matrix(rotation_matrix)
+
   !
   ! create a big element near the surface that covers the entire slice surface
   !

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in	2009-02-27 01:05:10 UTC (rev 14163)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/Makefile.in	2009-02-27 01:49:14 UTC (rev 14164)
@@ -108,6 +108,7 @@
 	$O/make_ellipticity.o \
 	$O/make_gravity.o \
 	$O/memory_eval.o \
+	$O/model_plugin_support.o \
 	$O/moho_stretching.o \
 	$O/netlib_specfun_erf.o \
 	$O/prem_common.o \
@@ -463,6 +464,9 @@
 $O/add_topography.o: constants.h $S/add_topography.f90
 	${FCCOMPILE_CHECK} -c -o $O/add_topography.o ${FCFLAGS_f90} $S/add_topography.f90
 
+$O/model_plugin_support.o: constants.h $S/model_plugin_support.f90
+	${FCCOMPILE_CHECK} -c -o $O/model_plugin_support.o ${FCFLAGS_f90} $S/model_plugin_support.f90
+
 $O/moho_stretching.o: constants.h $S/moho_stretching.f90
 	${FCCOMPILE_CHECK} -c -o $O/moho_stretching.o ${FCFLAGS_f90} $S/moho_stretching.f90
 

Modified: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90	2009-02-27 01:05:10 UTC (rev 14163)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/meshfem3D.f90	2009-02-27 01:49:14 UTC (rev 14164)
@@ -380,11 +380,6 @@
   logical :: CUT_SUPERBRICK_XI,CUT_SUPERBRICK_ETA
   integer, dimension(MAX_NUM_REGIONS) :: NGLOB1D_RADIAL_TEMP
 
-  ! parameters for passing information to citcoms mantle model
-  common /for_citcoms1/ NPROC_XI, NPROC_ETA, NCHUNKS
-  common /for_citcoms2/ ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD
-  common /for_citcoms3/ rotation_matrix
-
 ! ************** PROGRAM STARTS HERE **************
 
 ! initialize the MPI communicator and start the NPROCTOT MPI processes.
@@ -868,6 +863,10 @@
 
   if(ELLIPTICITY) call make_ellipticity(nspl,rspl,espl,espl2,ONE_CRUST)
 
+  call init_model_plugin_support(NCHUNKS, NPROC_XI, NPROC_ETA, &
+       ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD, &
+       rotation_matrix)
+
   call bcast_model(myrank, trim(LOCAL_PATH))
 
   call read_3d_mantle_model()

Added: seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/model_plugin_support.f90
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/model_plugin_support.f90	                        (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/branches/pluggable/model_plugin_support.f90	2009-02-27 01:49:14 UTC (rev 14164)
@@ -0,0 +1,118 @@
+!=====================================================================
+!
+!          S p e c f e m 3 D  G l o b e  V e r s i o n  4 . 0
+!          --------------------------------------------------
+!
+!          Main authors: Dimitri Komatitsch and Jeroen Tromp
+!    Seismological Laboratory, California Institute of Technology, USA
+!             and University of Pau / CNRS / INRIA, France
+! (c) California Institute of Technology and University of Pau / CNRS / INRIA
+!                            February 2008
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along
+! with this program; if not, write to the Free Software Foundation, Inc.,
+! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+!
+!=====================================================================
+
+
+module model_plugin_support_module
+
+  include "constants.h"
+
+  type model_plugin_support_variables
+     integer NCHUNKS, NPROC_XI, NPROC_ETA
+     double precision ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD
+     double precision, dimension(NDIM,NDIM) :: rotation_matrix
+  end type model_plugin_support_variables
+
+  type (model_plugin_support_variables) vars
+
+end module model_plugin_support_module
+
+
+subroutine get_nchunks(NCHUNKS)
+
+  use model_plugin_support_module
+  implicit none
+
+  integer NCHUNKS
+
+  NCHUNKS = vars%NCHUNKS
+
+end subroutine get_nchunks
+
+
+subroutine get_nproc(NPROC_XI, NPROC_ETA)
+
+  use model_plugin_support_module
+  implicit none
+
+  integer NPROC_XI, NPROC_ETA
+
+  NPROC_XI = vars%NPROC_XI
+  NPROC_ETA = vars%NPROC_ETA
+
+end subroutine get_nproc
+
+
+subroutine get_angular_width_in_radians(ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD)
+
+  use model_plugin_support_module
+  implicit none
+
+  double precision ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD
+
+  ANGULAR_WIDTH_XI_RAD = vars%ANGULAR_WIDTH_XI_RAD
+  ANGULAR_WIDTH_ETA_RAD = vars%ANGULAR_WIDTH_ETA_RAD
+
+end subroutine get_angular_width_in_radians
+
+
+subroutine get_rotation_matrix(rotation_matrix)
+
+  use model_plugin_support_module
+  implicit none
+
+  double precision, dimension(NDIM,NDIM) :: rotation_matrix
+
+  rotation_matrix = vars%rotation_matrix
+
+end subroutine get_rotation_matrix
+
+
+!---------------------------------------------------------------------
+! private
+
+subroutine init_model_plugin_support(NCHUNKS, NPROC_XI, NPROC_ETA, &
+     ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD, &
+     rotation_matrix)
+
+  use model_plugin_support_module
+  implicit none
+
+  integer NCHUNKS, NPROC_XI, NPROC_ETA
+  double precision ANGULAR_WIDTH_XI_RAD, ANGULAR_WIDTH_ETA_RAD
+  double precision, dimension(NDIM,NDIM) :: rotation_matrix
+
+  vars%NCHUNKS = NCHUNKS
+
+  vars%NPROC_XI = NPROC_XI
+  vars%NPROC_ETA = NPROC_ETA
+
+  vars%ANGULAR_WIDTH_XI_RAD = ANGULAR_WIDTH_XI_RAD
+  vars%ANGULAR_WIDTH_ETA_RAD = ANGULAR_WIDTH_ETA_RAD
+
+  vars%rotation_matrix = rotation_matrix
+
+end subroutine init_model_plugin_support



More information about the CIG-COMMITS mailing list