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 |
|
|
! |
37 |
|
|
if (first) then |
38 |
|
|
ALLOCATE(u_prev(klon,klev)) |
39 |
|
|
ALLOCATE(v_prev(klon,klev)) |
40 |
|
|
ALLOCATE(ql_prev(klon,klev)) |
41 |
|
|
ALLOCATE(qs_prev(klon,klev)) |
42 |
|
|
ALLOCATE(q_prev(klon,klev)) |
43 |
|
|
ALLOCATE(t_prev(klon,klev)) |
44 |
|
|
first=.false. |
45 |
|
|
endif |
46 |
|
|
! store current values of x_seri variables |
47 |
|
|
u_prev(:,:) =u_seri(:,:) |
48 |
|
|
v_prev(:,:) =v_seri(:,:) |
49 |
|
|
ql_prev(:,:)=ql_seri(:,:) |
50 |
|
|
qs_prev(:,:)=qs_seri(:,:) |
51 |
|
|
t_prev(:,:) =t_seri(:,:) |
52 |
|
|
q_prev(:,:) =q_seri(:,:) |
53 |
|
|
|
54 |
|
|
END SUBROUTINE init_cmp_seri |
55 |
|
|
|
56 |
|
|
!====================================================================== |
57 |
|
|
! |
58 |
|
|
!====================================================================== |
59 |
|
|
SUBROUTINE cmp_seri(iflag,text) |
60 |
|
|
! |
61 |
|
|
USE dimphy, ONLY: klon, klev |
62 |
|
|
USE phys_local_var_mod, ONLY: u_seri, v_seri, ql_seri, qs_seri, q_seri, & |
63 |
|
|
t_seri |
64 |
|
|
USE print_control_mod, ONLY: prt_level |
65 |
|
|
IMPLICIT none |
66 |
|
|
! Arguments : |
67 |
|
|
!------------ |
68 |
|
|
integer iflag |
69 |
|
|
CHARACTER*(*) text |
70 |
|
|
! Local : |
71 |
|
|
!-------- |
72 |
|
|
integer i, k |
73 |
|
|
real du_seri(klon,klev), dv_seri(klon,klev), dql_seri(klon,klev), & |
74 |
|
|
dqs_seri(klon,klev), dq_seri(klon,klev), dt_seri(klon,klev) |
75 |
|
|
logical t_differ, u_differ, v_differ, ql_differ, qs_differ, q_differ |
76 |
|
|
logical any_differ |
77 |
|
|
! |
78 |
|
|
any_differ = .false. |
79 |
|
|
! |
80 |
|
|
dt_seri(:,:)=t_seri(:,:)-t_prev(:,:) |
81 |
|
|
IF (any(t_seri/=t_prev)) then |
82 |
|
|
if ( .not. any_differ ) write (*,*) "In cmp_seri, after ",text |
83 |
|
|
write (*,*) '*** t_seri has changed',minval(dt_seri),maxval(dt_seri) |
84 |
|
|
t_differ=.true. |
85 |
|
|
any_differ = .true. |
86 |
|
|
ELSE |
87 |
|
|
t_differ=.false. |
88 |
|
|
END IF |
89 |
|
|
! |
90 |
|
|
dq_seri(:,:)=q_seri(:,:)-q_prev(:,:) |
91 |
|
|
IF (any(q_seri/=q_prev)) then |
92 |
|
|
if ( .not. any_differ ) write (*,*) "In cmp_seri, after ",text |
93 |
|
|
write (*,*) '*** q_seri has changed',minval(dq_seri),maxval(dq_seri) |
94 |
|
|
q_differ=.true. |
95 |
|
|
any_differ = .true. |
96 |
|
|
ELSE |
97 |
|
|
q_differ=.false. |
98 |
|
|
END IF |
99 |
|
|
! |
100 |
|
|
dql_seri(:,:)=ql_seri(:,:)-ql_prev(:,:) |
101 |
|
|
IF (any(ql_seri/=ql_prev)) then |
102 |
|
|
if ( .not. any_differ ) write (*,*) "In cmp_seri, after ",text |
103 |
|
|
write (*,*) '*** ql_seri has changed',minval(dql_seri),maxval(dql_seri) |
104 |
|
|
ql_differ=.true. |
105 |
|
|
any_differ = .true. |
106 |
|
|
ELSE |
107 |
|
|
ql_differ=.false. |
108 |
|
|
END IF |
109 |
|
|
! |
110 |
|
|
dqs_seri(:,:)=qs_seri(:,:)-qs_prev(:,:) |
111 |
|
|
IF (any(qs_seri/=qs_prev)) then |
112 |
|
|
if ( .not. any_differ ) write (*,*) "In cmp_seri, after ",text |
113 |
|
|
write (*,*) '*** qs_seri has changed',minval(dqs_seri),maxval(dqs_seri) |
114 |
|
|
qs_differ=.true. |
115 |
|
|
any_differ = .true. |
116 |
|
|
ELSE |
117 |
|
|
qs_differ=.false. |
118 |
|
|
END IF |
119 |
|
|
! |
120 |
|
|
du_seri(:,:)=u_seri(:,:)-u_prev(:,:) |
121 |
|
|
IF (any(u_seri/=u_prev)) then |
122 |
|
|
if ( .not. any_differ ) write (*,*) "In cmp_seri, after ",text |
123 |
|
|
write (*,*) '*** u_seri has changed',minval(du_seri),maxval(du_seri) |
124 |
|
|
u_differ=.true. |
125 |
|
|
any_differ = .true. |
126 |
|
|
ELSE |
127 |
|
|
u_differ=.false. |
128 |
|
|
END IF |
129 |
|
|
! |
130 |
|
|
dv_seri(:,:)=v_seri(:,:)-v_prev(:,:) |
131 |
|
|
IF (any(v_seri/=v_prev)) then |
132 |
|
|
if ( .not. any_differ ) write (*,*) "In cmp_seri, after ",text |
133 |
|
|
write (*,*) '*** v_seri has changed',minval(dv_seri),maxval(dv_seri) |
134 |
|
|
v_differ=.true. |
135 |
|
|
any_differ = .true. |
136 |
|
|
ELSE |
137 |
|
|
v_differ=.false. |
138 |
|
|
END IF |
139 |
|
|
! |
140 |
|
|
if (any_differ) then |
141 |
|
|
IF (iflag >= 2 .and. prt_level >= 5) then |
142 |
|
|
i=1 |
143 |
|
|
DO k = 1, klev |
144 |
|
|
write(*,'(i3,6e14.6)')k, t_seri(i,k)-t_prev(i,k), u_seri(i,k)-u_prev(i,k), & |
145 |
|
|
v_seri(i,k)-v_prev(i,k), ql_seri(i,k)-ql_prev(i,k),& |
146 |
|
|
qs_seri(i,k)-qs_prev(i,k), q_seri(i,k)-q_prev(i,k) |
147 |
|
|
ENDDO |
148 |
|
|
END IF |
149 |
|
|
else |
150 |
|
|
write (*,*) 'No change for any xxx_seri after ',text |
151 |
|
|
end if |
152 |
|
|
|
153 |
|
|
END SUBROUTINE cmp_seri |
154 |
|
|
|
155 |
|
|
END MODULE cmp_seri_mod |
156 |
|
|
|