1 | !WRF:MEDIATION_LAYER:SOLVER |
---|
2 | ! |
---|
3 | |
---|
4 | SUBROUTINE solve_exp ( grid & |
---|
5 | ! |
---|
6 | #include "exp_dummy_args.inc" |
---|
7 | ! |
---|
8 | ) |
---|
9 | |
---|
10 | USE module_exp |
---|
11 | |
---|
12 | |
---|
13 | ! Driver layer modules |
---|
14 | USE module_domain |
---|
15 | USE module_configure |
---|
16 | USE module_driver_constants |
---|
17 | USE module_machine |
---|
18 | USE module_tiles |
---|
19 | USE module_dm |
---|
20 | ! Mediation layer modules |
---|
21 | ! Registry generated module |
---|
22 | USE module_state_description |
---|
23 | |
---|
24 | IMPLICIT NONE |
---|
25 | |
---|
26 | ! Subroutine interface block. |
---|
27 | |
---|
28 | ! Input data. |
---|
29 | |
---|
30 | TYPE(domain) , TARGET :: grid |
---|
31 | |
---|
32 | ! Definitions of dummy arguments to solve |
---|
33 | #include <exp_dummy_decl.inc> |
---|
34 | |
---|
35 | ! WRF state bcs |
---|
36 | TYPE (grid_config_rec_type) :: config_flags |
---|
37 | |
---|
38 | ! WRF state data |
---|
39 | |
---|
40 | ! Local data |
---|
41 | |
---|
42 | INTEGER :: k_start , k_end |
---|
43 | INTEGER :: ids , ide , jds , jde , kds , kde , & |
---|
44 | ims , ime , jms , jme , kms , kme , & |
---|
45 | ips , ipe , jps , jpe , kps , kpe |
---|
46 | INTEGER :: ij , iteration |
---|
47 | INTEGER :: im , num_3d_m , ic , num_3d_c |
---|
48 | INTEGER :: loop |
---|
49 | INTEGER :: ijds, ijde |
---|
50 | INTEGER :: idum1, idum2 |
---|
51 | |
---|
52 | ! storage for tendencies and decoupled state (generated from Registry) |
---|
53 | #include <exp_i1_decl.inc> |
---|
54 | |
---|
55 | #ifdef DEREF_KLUDGE |
---|
56 | ! see http://www.mmm.ucar.edu/wrf/WG2/topics/deref_kludge.htm |
---|
57 | INTEGER :: sm31 , em31 , sm32 , em32 , sm33 , em33 |
---|
58 | INTEGER :: sm31x, em31x, sm32x, em32x, sm33x, em33x |
---|
59 | INTEGER :: sm31y, em31y, sm32y, em32y, sm33y, em33y |
---|
60 | #endif |
---|
61 | #include "deref_kludge.h" |
---|
62 | |
---|
63 | #define COPY_IN |
---|
64 | #include <exp_scalar_derefs.inc> |
---|
65 | #ifdef DM_PARALLEL |
---|
66 | # define REGISTER_I1 |
---|
67 | # include <exp_data_calls.inc> |
---|
68 | #endif |
---|
69 | |
---|
70 | CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags ) |
---|
71 | ! this sets up the P_* indices into the moisture and chem arrays |
---|
72 | CALL set_scalar_indices_from_config ( grid%id , idum1 , idum2 ) |
---|
73 | |
---|
74 | ! De-reference dimension information stored in the grid data structure. |
---|
75 | |
---|
76 | ! ikj model kij model |
---|
77 | |
---|
78 | ids = grid%sd31 ! grid%sd32 |
---|
79 | ide = grid%ed31 ! grid%ed32 |
---|
80 | jds = grid%sd33 ! grid%sd33 |
---|
81 | jde = grid%ed33 ! grid%ed33 |
---|
82 | kds = grid%sd32 ! grid%sd31 |
---|
83 | kde = grid%ed32 ! grid%ed31 |
---|
84 | |
---|
85 | ims = grid%sm31 ! grid%sm32 |
---|
86 | ime = grid%em31 ! grid%em32 |
---|
87 | jms = grid%sm33 ! grid%sm33 |
---|
88 | jme = grid%em33 ! grid%em33 |
---|
89 | kms = grid%sm32 ! grid%sm31 |
---|
90 | kme = grid%em32 ! grid%em31 |
---|
91 | |
---|
92 | ips = grid%sp31 ! grid%sp32 |
---|
93 | ipe = grid%ep31 ! grid%ep32 |
---|
94 | jps = grid%sp33 ! grid%sp33 |
---|
95 | jpe = grid%ep33 ! grid%ep33 |
---|
96 | kps = grid%sp32 ! grid%sp31 |
---|
97 | kpe = grid%ep32 ! grid%ep31 |
---|
98 | |
---|
99 | k_start = grid%sd32 ! grid%sd31 |
---|
100 | k_end = grid%ed32 ! grid%ed31 |
---|
101 | |
---|
102 | ijds = min(ids, jds) |
---|
103 | ijde = max(ide, jde) |
---|
104 | |
---|
105 | ! Compute these starting and stopping locations for each tile and number of tiles. |
---|
106 | |
---|
107 | CALL set_tiles ( grid , ids , ide , jds , jde , ips , ipe , jps , jpe ) |
---|
108 | |
---|
109 | ! end of "magic"; start of experimental solver; just a goofy relaxation |
---|
110 | |
---|
111 | ! Halo exchange on x_1 for relaxation operator in model layer subroutine |
---|
112 | ! relax_1_into_2 |
---|
113 | |
---|
114 | #ifdef DM_PARALLEL |
---|
115 | # include "HALO_EXP_A.inc" |
---|
116 | #endif |
---|
117 | |
---|
118 | ! Simple 4 pt average of x_1 into x_2 |
---|
119 | |
---|
120 | !$OMP PARALLEL DO & |
---|
121 | !$OMP PRIVATE ( ij ) |
---|
122 | DO ij = 1 , grid%num_tiles |
---|
123 | CALL wrf_debug ( 200 , ' call relax_1_into_2' ) |
---|
124 | CALL relax_1_into_2 ( x_1, x_2, & |
---|
125 | ids, ide, jds, jde, kds, kde, & |
---|
126 | ims, ime, jms, jme, kms, kme, & |
---|
127 | grid%i_start(ij), grid%i_end(ij), & |
---|
128 | grid%j_start(ij), grid%j_end(ij), & |
---|
129 | k_start, k_end ) |
---|
130 | END DO |
---|
131 | !$OMP END PARALLEL DO |
---|
132 | |
---|
133 | ! Update x_1 for next go 'round |
---|
134 | |
---|
135 | !$OMP PARALLEL DO & |
---|
136 | !$OMP PRIVATE ( ij ) |
---|
137 | DO ij = 1 , grid%num_tiles |
---|
138 | CALL wrf_debug ( 200 , ' call copy_2_into_1' ) |
---|
139 | CALL copy_2_into_1 ( x_2, x_1, & |
---|
140 | ids, ide, jds, jde, kds, kde, & |
---|
141 | ims, ime, jms, jme, kms, kme, & |
---|
142 | grid%i_start(ij), grid%i_end(ij), & |
---|
143 | grid%j_start(ij), grid%j_end(ij), & |
---|
144 | k_start, k_end ) |
---|
145 | END DO |
---|
146 | !$OMP END PARALLEL DO |
---|
147 | |
---|
148 | #define COPY_OUT |
---|
149 | #include <exp_scalar_derefs.inc> |
---|
150 | |
---|
151 | RETURN |
---|
152 | |
---|
153 | END SUBROUTINE solve_exp |
---|
154 | |
---|