! +-======-+ ! Copyright (c) 2003-2007 United States Government as represented by ! the Admistrator of the National Aeronautics and Space Administration. ! All Rights Reserved. ! ! THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, ! REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN ! COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS ! REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). ! THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN ! INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR ! REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, ! DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED ! HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE ! RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. ! ! Government Agency: National Aeronautics and Space Administration ! Government Agency Original Software Designation: GSC-15354-1 ! Government Agency Original Software Title: GEOS-5 GCM Modeling Software ! User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov ! Government Agency Point of Contact for Original Software: ! Dale Hithon, SRA Assistant, (301) 286-2691 ! ! +-======-+ ! $Id: GEOSgcm.F90,v 1.106 2013-04-01 18:02:50 atrayano Exp $ ! ********************************************************************* ! ***** Main Program **** ! ***** Finite-Volume Dynamical Core (Lin/Rood) **** ! ***** Forced by GEOS5 Physics **** ! ********************************************************************* #define I_AM_MAIN #include "MAPL_Generic.h" Program GEOS5_Main use MAPL_Mod #ifdef USE_GCS use GEOS_GcsGridCompMod, only: ROOT_SetServices => SetServices #else use GEOS_GcmGridCompMod, only: ROOT_SetServices => SetServices #endif #ifdef __INTEL_COMPILER use ifport #endif use m_inpak90 implicit none include "mpif.h" !EOP !EOC integer :: STATUS character(len=18) :: Iam="GEOS5_Main" integer :: ensemble_comm integer :: myRank,nProc,mycolor logical :: runens character(len=6) :: dirname integer :: nensembles, ensemble_size inquire(file="ensemble_setup.rc",exist=runens) if (runens) then call mpi_init(status) VERIFY_(STATUS) call mpi_comm_size(MPI_COMM_WORLD,nProc,status) VERIFY_(STATUS) call mpi_comm_rank(MPI_COMM_WORLD,myRank,status) VERIFY_(STATUS) if (myrank ==0) then call i90_loadf("ensemble_setup.rc",status) VERIFY_(STATUS) call i90_label("N_ENSEMBLES:",status) VERIFY_(STATUS) nensembles = i90_gint(status) VERIFY_(STATUS) call i90_label("ENSEMBLE_SIZE:",status) VERIFY_(STATUS) ensemble_size = i90_gint(status) call i90_release endif call MPI_BCAST(nensembles, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, status) VERIFY_(STATUS) call MPI_BCAST(ensemble_size, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, status) VERIFY_(STATUS) ASSERT_(nProc == (ensemble_size*nensembles) ) mycolor = myRank/ensemble_size call mpi_comm_split(MPI_COMM_WORLD,mycolor,myRank,ensemble_comm,status) VERIFY_(STATUS) write(dirname,"(A3,I0.3)")"mem",mycolor+1 status = chdir(dirname) VERIFY_(STATUS) call MAPL_CAP(ROOT_SetServices, FinalFile='EGRESS', CommIn=ensemble_comm, rc=STATUS) VERIFY_(STATUS) call mpi_finalize(status) VERIFY_(STATUS) else call MAPL_CAP(ROOT_SetServices, FinalFile='EGRESS', rc=STATUS) VERIFY_(STATUS) end if call exit(0) end Program GEOS5_Main !EOC