merge standard release WRF/WPS V3.0.1.1 into wrffire
[wrffire.git] / wrfv2_fire / dyn_exp / module_initialize_exp.F
blob8796d39d30a7bc9785cfbb75095453d17a171b68
1 !IDEAL:MODEL_LAYER:INITIALIZATION
4 !  This MODULE holds the routines which are used to perform various initializations
5 !  for the individual domains.  
7 !  This MODULE CONTAINS the following routines:
9 !  initialize_field_test - 1. Set different fields to different constant
10 !                             values.  This is only a test.  If the correct
11 !                             domain is not found (based upon the "id")
12 !                             then a fatal error is issued.               
14 MODULE module_initialize
16    USE module_domain
17    USE module_state_description
18    USE module_model_constants
19    USE module_timing
20    USE module_configure
23 CONTAINS
25    SUBROUTINE init_domain_exp ( grid &
27 # include <exp_dummy_args.inc>
30    IMPLICIT NONE
32    !  Input data.
33    TYPE (domain), POINTER :: grid
35 # include <exp_dummy_decl.inc>
37    TYPE (grid_config_rec_type)              :: config_flags
39    !  Local data
40    INTEGER                             ::                       &
41                                   ids, ide, jds, jde, kds, kde, &
42                                   ims, ime, jms, jme, kms, kme, &
43                                   its, ite, jts, jte, kts, kte, &
44                                   i, j, k
46 #define COPY_IN
47 #include <exp_scalar_derefs.inc>
49    SELECT CASE ( model_data_order )
50          CASE ( DATA_ORDER_ZXY )
51    kds = grid%sd31 ; kde = grid%ed31 ;
52    ids = grid%sd32 ; ide = grid%ed32 ;
53    jds = grid%sd33 ; jde = grid%ed33 ;
55    kms = grid%sm31 ; kme = grid%em31 ;
56    ims = grid%sm32 ; ime = grid%em32 ;
57    jms = grid%sm33 ; jme = grid%em33 ;
59    kts = grid%sp31 ; kte = grid%ep31 ;   ! note that tile is entire patch
60    its = grid%sp32 ; ite = grid%ep32 ;   ! note that tile is entire patch
61    jts = grid%sp33 ; jte = grid%ep33 ;   ! note that tile is entire patch
62          CASE ( DATA_ORDER_XYZ )
63    ids = grid%sd31 ; ide = grid%ed31 ;
64    jds = grid%sd32 ; jde = grid%ed32 ;
65    kds = grid%sd33 ; kde = grid%ed33 ;
67    ims = grid%sm31 ; ime = grid%em31 ;
68    jms = grid%sm32 ; jme = grid%em32 ;
69    kms = grid%sm33 ; kme = grid%em33 ;
71    its = grid%sp31 ; ite = grid%ep31 ;   ! note that tile is entire patch
72    jts = grid%sp32 ; jte = grid%ep32 ;   ! note that tile is entire patch
73    kts = grid%sp33 ; kte = grid%ep33 ;   ! note that tile is entire patch
74          CASE ( DATA_ORDER_XZY )
75    ids = grid%sd31 ; ide = grid%ed31 ;
76    kds = grid%sd32 ; kde = grid%ed32 ;
77    jds = grid%sd33 ; jde = grid%ed33 ;
79    ims = grid%sm31 ; ime = grid%em31 ;
80    kms = grid%sm32 ; kme = grid%em32 ;
81    jms = grid%sm33 ; jme = grid%em33 ;
83    its = grid%sp31 ; ite = grid%ep31 ;   ! note that tile is entire patch
84    kts = grid%sp32 ; kte = grid%ep32 ;   ! note that tile is entire patch
85    jts = grid%sp33 ; jte = grid%ep33 ;   ! note that tile is entire patch
87    END SELECT
90    CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags )
92 ! set the boundaries of the X array
93     DO j = jts, jte
94       DO k = kts, kte
95         DO i = its, ite
96           IF ( i == ids .OR. i == ide-1 .OR. j == jds .OR. j == jde-1 ) THEN
97             x_1(i,k,j) = 1.
98             x_2(i,k,j) = 1.
99           ELSE
100             x_1(i,k,j) = 0.
101             x_2(i,k,j) = 0.
102           ENDIF
103         ENDDO
104       ENDDO
105     ENDDO
107 #define COPY_OUT
108 #include <exp_scalar_derefs.inc>
110    RETURN
112    END SUBROUTINE init_domain_exp
113    
114 !-------------------------------------------------------------------
115 ! this is a wrapper for the solver-specific init_domain routines.
116 ! Also dereferences the grid variables and passes them down as arguments.
117 ! This is crucial, since the lower level routines may do message passing
118 ! and this will get fouled up on machines that insist on passing down
119 ! copies of assumed-shape arrays (by passing down as arguments, the 
120 ! data are treated as assumed-size -- ie. f77 -- arrays and the copying
121 ! business is avoided).  Fie on the F90 designers.  Fie and a pox.
123    SUBROUTINE init_domain ( grid )
125    IMPLICIT NONE
127    !  Input data.
128    TYPE (domain), POINTER :: grid 
129    !  Local data.
130    INTEGER :: idum1, idum2
132 #ifdef DEREF_KLUDGE
133 !  see http://www.mmm.ucar.edu/wrf/WG2/topics/deref_kludge.htm
134    INTEGER     :: sm31 , em31 , sm32 , em32 , sm33 , em33
135    INTEGER     :: sm31x, em31x, sm32x, em32x, sm33x, em33x
136    INTEGER     :: sm31y, em31y, sm32y, em32y, sm33y, em33y
137 #endif
139 #include "deref_kludge.h"
141    CALL set_scalar_indices_from_config ( head_grid%id , idum1, idum2 )
143      CALL init_domain_exp( grid &
145 #include <actual_args.inc>
147                         )
149    END SUBROUTINE init_domain
151    SUBROUTINE init_module_initialize
152    END SUBROUTINE init_module_initialize
155 END MODULE module_initialize