1 | |
---|
2 | ! $Id: ??? $ |
---|
3 | |
---|
4 | MODULE cmp_seri_mod |
---|
5 | !====================================================================== |
---|
6 | ! to check if the x_seri vaariables have changed |
---|
7 | |
---|
8 | !====================================================================== |
---|
9 | |
---|
10 | REAL,SAVE,ALLOCATABLE :: u_prev(:,:), v_prev(:,:), ql_prev(:,:), & |
---|
11 | qs_prev(:,:), q_prev(:,:), t_prev(:,:) |
---|
12 | !$OMP THREADPRIVATE(u_prev, v_prev, ql_prev, qs_prev, q_prev, t_prev) |
---|
13 | |
---|
14 | CONTAINS |
---|
15 | |
---|
16 | SUBROUTINE init_cmp_seri |
---|
17 | !====================================================================== |
---|
18 | |
---|
19 | !====================================================================== |
---|
20 | |
---|
21 | !====================================================================== |
---|
22 | ! Declarations |
---|
23 | !====================================================================== |
---|
24 | USE dimphy, ONLY: klon, klev |
---|
25 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, q_seri, & |
---|
26 | t_seri |
---|
27 | |
---|
28 | IMPLICIT NONE |
---|
29 | ! Local : |
---|
30 | !-------- |
---|
31 | logical, save :: first=.TRUE. |
---|
32 | !$OMP THREADPRIVATE(first) |
---|
33 | |
---|
34 | !====================================================================== |
---|
35 | |
---|
36 | IF (first) THEN |
---|
37 | ALLOCATE(u_prev(klon,klev)) |
---|
38 | ALLOCATE(v_prev(klon,klev)) |
---|
39 | ALLOCATE(ql_prev(klon,klev)) |
---|
40 | ALLOCATE(qs_prev(klon,klev)) |
---|
41 | ALLOCATE(q_prev(klon,klev)) |
---|
42 | ALLOCATE(t_prev(klon,klev)) |
---|
43 | first=.FALSE. |
---|
44 | endif |
---|
45 | ! store current values of x_seri variables |
---|
46 | u_prev(:,:) =u_seri(:,:) |
---|
47 | v_prev(:,:) =v_seri(:,:) |
---|
48 | ql_prev(:,:)=ql_seri(:,:) |
---|
49 | qs_prev(:,:)=qs_seri(:,:) |
---|
50 | t_prev(:,:) =t_seri(:,:) |
---|
51 | q_prev(:,:) =q_seri(:,:) |
---|
52 | |
---|
53 | END SUBROUTINE init_cmp_seri |
---|
54 | |
---|
55 | !====================================================================== |
---|
56 | |
---|
57 | !====================================================================== |
---|
58 | SUBROUTINE cmp_seri(iflag,text) |
---|
59 | |
---|
60 | USE dimphy, ONLY: klon, klev |
---|
61 | USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, q_seri, & |
---|
62 | t_seri |
---|
63 | USE lmdz_print_control, ONLY: prt_level |
---|
64 | IMPLICIT NONE |
---|
65 | ! Arguments : |
---|
66 | !------------ |
---|
67 | INTEGER iflag |
---|
68 | CHARACTER*(*) text |
---|
69 | ! Local : |
---|
70 | !-------- |
---|
71 | INTEGER i, k |
---|
72 | REAL du_seri(klon,klev), dv_seri(klon,klev), dql_seri(klon,klev), & |
---|
73 | dqs_seri(klon,klev), dq_seri(klon,klev), dt_seri(klon,klev) |
---|
74 | LOGICAL t_differ, u_differ, v_differ, ql_differ, qs_differ, q_differ |
---|
75 | LOGICAL any_differ |
---|
76 | |
---|
77 | any_differ = .FALSE. |
---|
78 | |
---|
79 | dt_seri(:,:)=t_seri(:,:)-t_prev(:,:) |
---|
80 | IF (any(t_seri/=t_prev)) THEN |
---|
81 | IF ( .NOT. any_differ ) write (*,*) "In cmp_seri, after ",text |
---|
82 | write (*,*) '*** t_seri has changed',minval(dt_seri),maxval(dt_seri) |
---|
83 | t_differ=.TRUE. |
---|
84 | any_differ = .TRUE. |
---|
85 | ELSE |
---|
86 | t_differ=.FALSE. |
---|
87 | END IF |
---|
88 | |
---|
89 | dq_seri(:,:)=q_seri(:,:)-q_prev(:,:) |
---|
90 | IF (any(q_seri/=q_prev)) THEN |
---|
91 | IF ( .NOT. any_differ ) write (*,*) "In cmp_seri, after ",text |
---|
92 | write (*,*) '*** q_seri has changed',minval(dq_seri),maxval(dq_seri) |
---|
93 | q_differ=.TRUE. |
---|
94 | any_differ = .TRUE. |
---|
95 | ELSE |
---|
96 | q_differ=.FALSE. |
---|
97 | END IF |
---|
98 | |
---|
99 | dql_seri(:,:)=ql_seri(:,:)-ql_prev(:,:) |
---|
100 | IF (any(ql_seri/=ql_prev)) THEN |
---|
101 | IF ( .NOT. any_differ ) write (*,*) "In cmp_seri, after ",text |
---|
102 | write (*,*) '*** ql_seri has changed',minval(dql_seri),maxval(dql_seri) |
---|
103 | ql_differ=.TRUE. |
---|
104 | any_differ = .TRUE. |
---|
105 | ELSE |
---|
106 | ql_differ=.FALSE. |
---|
107 | END IF |
---|
108 | |
---|
109 | dqs_seri(:,:)=qs_seri(:,:)-qs_prev(:,:) |
---|
110 | IF (any(qs_seri/=qs_prev)) THEN |
---|
111 | IF ( .NOT. any_differ ) write (*,*) "In cmp_seri, after ",text |
---|
112 | write (*,*) '*** qs_seri has changed',minval(dqs_seri),maxval(dqs_seri) |
---|
113 | qs_differ=.TRUE. |
---|
114 | any_differ = .TRUE. |
---|
115 | ELSE |
---|
116 | qs_differ=.FALSE. |
---|
117 | END IF |
---|
118 | |
---|
119 | du_seri(:,:)=u_seri(:,:)-u_prev(:,:) |
---|
120 | IF (any(u_seri/=u_prev)) THEN |
---|
121 | IF ( .NOT. any_differ ) write (*,*) "In cmp_seri, after ",text |
---|
122 | write (*,*) '*** u_seri has changed',minval(du_seri),maxval(du_seri) |
---|
123 | u_differ=.TRUE. |
---|
124 | any_differ = .TRUE. |
---|
125 | ELSE |
---|
126 | u_differ=.FALSE. |
---|
127 | END IF |
---|
128 | |
---|
129 | dv_seri(:,:)=v_seri(:,:)-v_prev(:,:) |
---|
130 | IF (any(v_seri/=v_prev)) THEN |
---|
131 | IF ( .NOT. any_differ ) write (*,*) "In cmp_seri, after ",text |
---|
132 | write (*,*) '*** v_seri has changed',minval(dv_seri),maxval(dv_seri) |
---|
133 | v_differ=.TRUE. |
---|
134 | any_differ = .TRUE. |
---|
135 | ELSE |
---|
136 | v_differ=.FALSE. |
---|
137 | END IF |
---|
138 | |
---|
139 | IF (any_differ) THEN |
---|
140 | IF (iflag >= 2 .AND. prt_level >= 5) THEN |
---|
141 | i=1 |
---|
142 | DO k = 1, klev |
---|
143 | WRITE(*,'(i3,6e14.6)')k, t_seri(i,k)-t_prev(i,k), u_seri(i,k)-u_prev(i,k), & |
---|
144 | v_seri(i,k)-v_prev(i,k), ql_seri(i,k)-ql_prev(i,k),& |
---|
145 | qs_seri(i,k)-qs_prev(i,k), q_seri(i,k)-q_prev(i,k) |
---|
146 | ENDDO |
---|
147 | END IF |
---|
148 | else |
---|
149 | write (*,*) 'No change for any xxx_seri after ',text |
---|
150 | end if |
---|
151 | |
---|
152 | END SUBROUTINE cmp_seri |
---|
153 | |
---|
154 | END MODULE cmp_seri_mod |
---|
155 | |
---|