123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- !#################################################################
- !
- !**** Global Atmospheric Tracer Model TM5
- !
- ! purpose
- ! -------
- ! Solves the tracer continuitiy equation on an eulerian grid for
- ! an arbitrary no. of tracers.
- ! Perform advection, vertical transport, emissions, chemistry, deposition, ....
- !
- ! interface
- ! ---------
- ! main program, which interfaces with OASIS3_MCT
- !
- ! reference
- ! ---------
- ! See the main website : www.phys.uu.nl/~tm5/
- !
- !#################################################################
- !
- #define TRACEBACK write (gol,'("in ",a," (",a,", line",i5,")")') rname, __FILE__, __LINE__; call goErr
- !
- #include "tm5.inc"
- !
- PROGRAM APPL_TM5
- use mod_oasis
- use GO, only : gol, goPr, goErr
- use TM5, only : TM5_Comm_Init, TM5_Comm_Done
- use TM5, only : TM5_Model_Init, TM5_Model_Run, TM5_Model_Done
- use TM5, only : comp_name, comp_id
- use partools, only : isRoot
- use mpi
-
- implicit none
-
- ! --- const ---------------------------------------
-
- character(len=*), parameter :: rname = 'appl_tm5'
-
- ! --- local ---------------------------------------
- integer :: status, icpl
- integer :: localComm, couplComm
- character(len=256) :: error_message
- ! --- begin ---------------------------------------
- !
- ! Initialise coupling
- !
- call oasis_init_comp( comp_id, comp_name, status )
- if (status/=OASIS_OK) then
- write (gol,'("from OASIS_INIT_COMP : ",i6)') status; call goErr
- TRACEBACK; call exit(1)
- end if
- !
- ! Setup communication
- !
- call oasis_get_localcomm( localComm, status )
- if (status/=OASIS_OK) then
- write (error_message,'("from OASIS_GET_LOCALCOMM : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
- ! Init tm5 internal communciation
- call TM5_Comm_Init( status, comm=localComm )
- if (status/=0) then
- write (error_message,'("from TM5_Comm_Init : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
- ! Coupling ommunicator
-
- !#ifdef parallel_cplng
- icpl=1
- !#else
- ! icpl=MPI_UNDEFINED
- ! if ( isRoot ) icpl=1
- !#endif
- call oasis_create_couplcomm(icpl, localComm, couplComm, status)
- if (status/=OASIS_OK) then
- write (error_message,'("from OASIS_CREATE_COUPLCOMM : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
- !
- ! Run model
- !
- call TM5_Model_Init( status )
- if (status/=0) then
- write (error_message,'("from TM5_Model_Init : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
-
- call TM5_Model_Run( status )
- if (status/=0) then
- write (error_message,'("from TM5_Model_Run : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
- call TM5_Model_Done( status )
- if (status/=0) then
- write (error_message,'("from TM5_Model_Done : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
- !
- ! End communication
- !
- call TM5_Comm_Done( status, comm=localComm )
- if (status/=0) then
- write (error_message,'("from TM5_Comm_Done : ",i6)') status; call goErr
- call oasis_abort( comp_id, rname, error_message )
- end if
- !
- ! End coupling
- !
- call oasis_terminate( status )
- if (status/=OASIS_OK) then
- write (gol,'("from OASIS_TERMINATE : ",i6)') status; call goErr
- TRACEBACK; call exit(1)
- end if
- end program appl_tm5
|