ROMS
Loading...
Searching...
No Matches
roms.h
Go to the documentation of this file.
1 PROGRAM myroms
2!
3!git $Id$
4!================================================== Hernan G. Arango ===
5! Copyright (c) 2002-2025 The ROMS Group !
6! Licensed under a MIT/X style license !
7! See License_ROMS.md !
8!=======================================================================
9! !
10! Regional Ocean Model System (ROMS) !
11! !
12! Master program to execute ROMS drivers in ocean mode only !
13! without coupling (sequential or concurrent) to any atmospheric !
14! model. !
15! !
16! This ocean model solves the free surface, hydrostatic, primitive !
17! equations over variable topography using stretched terrain- !
18! following coordinates in the vertical and orthogonal curvilinear !
19! coordinates in the horizontal. !
20! !
21! Nonlinear Model Developers: !
22! !
23! Dr. Hernan G. Arango !
24! Institute of Marine and Coastal Sciences !
25! Rutgers University, New Brunswick, NJ, USA !
26! (arango@marine.rutgers.edu) !
27! !
28! Dr. Alexander F. Shchepetkin !
29! Institute of Geophysics and Planetary Physics !
30! UCLA, Los Angeles, CA, USA !
31! (alex@atmos.ucla.edu) !
32! !
33! Dr. John C. Warner !
34! U.S. Geological Survey !
35! Woods Hole, MA, USA !
36! (jcwarner@usgs.gov) !
37! !
38! Tangent linear and Adjoint Models and Algorithms Developers: !
39! !
40! Dr. Hernan G. Arango (arango@marine.rutgers.edu) !
41! Dr. Bruce Cornuelle (bcornuelle@ucsd.edu) !
42! Dr. Emanuele Di Lorenzo (edl@eas.gatech.edu) !
43! Dr. Arthur J. Miller (ajmiller@ucsd.edu) !
44! Dr. Andrew M. Moore (ammoore@ucsc.edu) !
45! Dr. Brian Powell (powellb@uscs.edu) !
46! !
47!=======================================================================
48!
49 USE mod_param
50 USE mod_parallel
51 USE mod_iounits
52 USE mod_scalars
53!
55!
57 USE roms_kernel_mod, ONLY : roms_run
59#if defined PIO_LIB && defined DISTRIBUTE
60 USE set_pio_mod, ONLY : finalize_pio
61#endif
62!
63 implicit none
64!
65! Local variable declarations.
66!
67 logical, save :: first
68
69 integer :: ng, myerror, provided, required
70
71#ifdef DISTRIBUTE
72# ifdef MPI
73!
74!-----------------------------------------------------------------------
75! Initialize distributed-memory MPI configuration.
76!-----------------------------------------------------------------------
77!
78# ifdef MULTI_THREAD
79 required=mpi_thread_multiple
80 CALL mpi_init_thread (required, provided, myerror)
81 IF (myerror.ne.0) THEN
82 print '(/,a)',' ROMS: Unable to initialize multi-threaded MPI'
83 exit_flag=6
84 END IF
85# else
86 CALL mpi_init (myerror)
87 IF (myerror.ne.0) THEN
88 print '(/,a)',' ROMS: Unable to initialize MPI'
89 exit_flag=6
90 END IF
91# endif
92!
93! Get rank of the local process in the group associated with the
94! comunicator.
95!
96 CALL mpi_comm_rank (mpi_comm_world, myrank, myerror)
97 IF (myerror.ne.0) THEN
98 print '(/,a)',' ROMS: Unable to inquire rank of local processor'
99 exit_flag=6
100 END IF
101# endif
102#endif
103!
104!-----------------------------------------------------------------------
105! Initialize ocean internal and external parameters and state
106! variables for all nested grids, if applicable.
107!-----------------------------------------------------------------------
108!
109 IF (exit_flag.eq.noerror) THEN
110 first=.true.
111 CALL roms_initialize (first)
112 END IF
113!
114!-----------------------------------------------------------------------
115! Time-step ocean model over all nested grids, if applicable, by the
116! specified time interval in seconds.
117!-----------------------------------------------------------------------
118!
119 IF (exit_flag.eq.noerror) THEN
120 run_time=0.0_r8
121 DO ng=1,ngrids
122 run_time=max(run_time, dt(ng)*ntimes(ng))
123 END DO
124 CALL roms_run (run_time)
125 END IF
126!
127!-----------------------------------------------------------------------
128! Terminate ocean model execution: flush and close all IO files.
129!-----------------------------------------------------------------------
130!
131 CALL roms_finalize
132#if defined PIO_LIB && defined DISTRIBUTE
133 CALL finalize_pio
134#endif
136#if defined DISTRIBUTE && defined MPI
137 CALL mpi_finalize (myerror)
138#endif
139!
140!-----------------------------------------------------------------------
141! If error, issue abort signal. It is expected that the Unix or POSIX
142! environment should handle this as a return errorcode from the ROMS
143! main to abort. It facilitates error handling in scripting.
144!-----------------------------------------------------------------------
145!
146!! IF ((exit_flag.ne.NoError).or.(blowup.ne.0)) STOP 911 ! F-2003
147 IF ((exit_flag.ne.noerror).or.(blowup.ne.0)) error stop ! F-2008
148!
149 END PROGRAM myroms
subroutine, public roms_deallocate_arrays
Definition mod_arrays.F:258
integer ngrids
Definition mod_param.F:113
integer, dimension(:), allocatable ntimes
real(dp), dimension(:), allocatable dt
integer blowup
integer exit_flag
real(dp) run_time
integer noerror
subroutine, public roms_finalize
Definition ad_roms.h:283
subroutine, public roms_run(runinterval)
Definition ad_roms.h:239
subroutine, public roms_initialize(first, mpicomm)
Definition ad_roms.h:52
subroutine, public finalize_pio
Definition set_pio.F:323
program myroms
Definition roms.h:1