-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitstat.47288706
278 lines (262 loc) · 11.4 KB
/
gitstat.47288706
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
status is -------------
On branch cam_energy_analysis
Your branch is up to date with 'origin/cam_energy_analysis'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: physics/cam/check_energy.F90
modified: physics/cam/physics_types.F90
modified: physics/cam/physpkg.F90
Untracked files:
(use "git add <file>..." to include in what will be committed)
../config_machines.xml_
atmos_phys/
gitstat.47273935
gitstat.47288706
no changes added to commit (use "git add" and/or "git commit -a")
branch is -------------
* cam_energy_analysis
master
diffs are -------------
diff --git a/src/physics/cam/check_energy.F90 b/src/physics/cam/check_energy.F90
index 1124b3f5..9d6bab2d 100644
--- a/src/physics/cam/check_energy.F90
+++ b/src/physics/cam/check_energy.F90
@@ -2165,9 +2165,9 @@ end subroutine check_energy_get_integrals
integer :: ncol ! number of active columns
integer :: lchnk ! chunk index
- real(r8) :: te(pcols,begchunk:endchunk,3)
+ real(r8) :: te(pcols,begchunk:endchunk,7)
! total energy of input/output states (copy)
- real(r8) :: te_glob(3) ! global means of total energy
+ real(r8) :: te_glob(7) ! global means of total energy
real(r8), pointer :: teout(:)
!-----------------------------------------------------------------------
@@ -2182,11 +2182,19 @@ end subroutine check_energy_get_integrals
te(:ncol,lchnk,2) = teout(1:ncol)
! surface pressure for heating rate
te(:ncol,lchnk,3) = state(lchnk)%pint(:ncol,pver+1)
+
+
+ te(:ncol,lchnk,4) = state(lchnk)%tebefore_dme(:ncol)
+ te(:ncol,lchnk,5) = state(lchnk)%teafter_dme(:ncol)
+ te(:ncol,lchnk,6) = state(lchnk)%cpterme(:ncol)
+ te(:ncol,lchnk,7) = state(lchnk)%cptermp(:ncol)
+
+
end do
! Compute global means of input and output energies and of
! surface pressure for heating rate (assume uniform ptop)
- call gmean(te, te_glob, 3)
+ call gmean(te, te_glob, 7)
if (begchunk .le. endchunk) then
teinp_glob = te_glob(1)
@@ -2200,6 +2208,14 @@ end subroutine check_energy_get_integrals
if (masterproc) then
write(iulog,'(1x,a9,1x,i8,4(1x,e25.17))') "nstep, te", nstep, teinp_glob, teout_glob, heat_glob, psurf_glob
+
+ !make it easier to grep
+ !tebefore - teafter
+ write(iulog,'(1x,a9,1x,i8,1(1x,e25.17))') "npwstep", nstep,(te_glob(4)-te_glob(5))/dtime
+ !cptermE, cptermP
+ write(iulog,'(1x,a22,1x,i8,2(1x,e25.17))') "ncpstep,e,p", nstep,te_glob(6),te_glob(7)
+
+
end if
else
heat_glob = 0._r8
diff --git a/src/physics/cam/physics_types.F90 b/src/physics/cam/physics_types.F90
index 07be3b3d..199ebcc2 100644
--- a/src/physics/cam/physics_types.F90
+++ b/src/physics/cam/physics_types.F90
@@ -98,6 +98,7 @@ module physics_types
zi ! geopotential height above surface at interfaces (m)
real(r8), dimension(:),allocatable :: &
+ tebefore_dme, teafter_dme, cpterme, cptermp, &
te_ini, &! vertically integrated total (kinetic + static) energy of initial state
te_cur, &! vertically integrated total (kinetic + static) energy of current state
tw_ini, &! vertically integrated total water of initial state
@@ -552,6 +553,19 @@ contains
varname="state%te_ini", msg=msg)
call shr_assert_in_domain(state%te_cur(:ncol), is_nan=.false., &
varname="state%te_cur", msg=msg)
+
+
+ call shr_assert_in_domain(state%cpterme(:ncol), is_nan=.false., &
+ varname="state%cpterme", msg=msg)
+ call shr_assert_in_domain(state%cptermp(:ncol), is_nan=.false., &
+ varname="state%cptermp", msg=msg)
+ call shr_assert_in_domain(state%tebefore_dme(:ncol), is_nan=.false., &
+ varname="state%tebefore", msg=msg)
+ call shr_assert_in_domain(state%teafter_dme(:ncol), is_nan=.false., &
+ varname="state%teafter", msg=msg)
+
+
+
call shr_assert_in_domain(state%tw_ini(:ncol), is_nan=.false., &
varname="state%tw_ini", msg=msg)
call shr_assert_in_domain(state%tw_cur(:ncol), is_nan=.false., &
@@ -626,6 +640,20 @@ contains
varname="state%te_ini", msg=msg)
call shr_assert_in_domain(state%te_cur(:ncol), lt=posinf_r8, gt=neginf_r8, &
varname="state%te_cur", msg=msg)
+
+
+
+ call shr_assert_in_domain(state%cpterme(:ncol), lt=posinf_r8, gt=neginf_r8, &
+ varname="state%cpterme", msg=msg)
+ call shr_assert_in_domain(state%cptermp(:ncol), lt=posinf_r8, gt=neginf_r8, &
+ varname="state%cptermp", msg=msg)
+ call shr_assert_in_domain(state%tebefore_dme(:ncol), lt=posinf_r8, gt=neginf_r8, &
+ varname="state%tebefore", msg=msg)
+ call shr_assert_in_domain(state%teafter_dme(:ncol), lt=posinf_r8, gt=neginf_r8,&
+ varname="state%teafter", msg=msg)
+
+
+
call shr_assert_in_domain(state%tw_ini(:ncol), lt=posinf_r8, gt=neginf_r8, &
varname="state%tw_ini", msg=msg)
call shr_assert_in_domain(state%tw_cur(:ncol), lt=posinf_r8, gt=neginf_r8, &
@@ -1316,8 +1344,16 @@ end subroutine physics_ptend_copy
state_out%phis(i) = state_in%phis(i)
state_out%te_ini(i) = state_in%te_ini(i)
state_out%te_cur(i) = state_in%te_cur(i)
+
+ state_out%cpterme(i) = state_in%cpterme(i)
+ state_out%cptermp(i) = state_in%cptermp(i)
+ state_out%tebefore_dme(i) = state_in%tebefore_dme(i)
+ state_out%teafter_dme(i) = state_in%teafter_dme(i)
+
state_out%tw_ini(i) = state_in%tw_ini(i)
state_out%tw_cur(i) = state_in%tw_cur(i)
+
+!og ignore this
#define te_analysis
#ifdef te_analysis
state_out%te_ini_diag(i,:) = state_in%te_ini_diag(i,:)
@@ -1614,6 +1650,18 @@ subroutine physics_state_alloc(state,lchnk,psetcols)
allocate(state%te_cur(psetcols), stat=ierr)
if ( ierr /= 0 ) call endrun('physics_state_alloc error: allocation error for state%te_cur')
+
+ allocate(state%cpterme(psetcols), stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_alloc error: allocation error for state%te_cur')
+ allocate(state%cptermp(psetcols), stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_alloc error: allocation error for state%te_cur')
+ allocate(state%tebefore_dme(psetcols), stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_alloc error: allocation error for state%te_cur')
+ allocate(state%teafter_dme(psetcols), stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_alloc error: allocation error for state%te_cur')
+
+
+
allocate(state%tw_ini(psetcols), stat=ierr)
if ( ierr /= 0 ) call endrun('physics_state_alloc error: allocation error for state%tw_ini')
@@ -1683,6 +1731,14 @@ subroutine physics_state_alloc(state,lchnk,psetcols)
state%te_cur(:) = inf
state%tw_ini(:) = inf
state%tw_cur(:) = inf
+
+
+ state%cptermp(:) = 0.0
+ state%cpterme(:) = 0.0
+ state%tebefore_dme(:) = 0.0
+ state%teafter_dme(:) = 0.0
+
+
#define te_analysis
#ifdef te_analysis
state%te_ini_diag(:,:) = inf
@@ -1793,6 +1849,19 @@ subroutine physics_state_dealloc(state)
deallocate(state%te_cur, stat=ierr)
if ( ierr /= 0 ) call endrun('physics_state_dealloc error: deallocation error for state%te_cur')
+
+
+ deallocate(state%cpterme, stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_dealloc error: deallocation error for state%te_cur')
+ deallocate(state%cptermp, stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_dealloc error: deallocation error for state%te_cur')
+ deallocate(state%tebefore_dme, stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_dealloc error: deallocation error for state%te_cur')
+ deallocate(state%teafter_dme, stat=ierr)
+ if ( ierr /= 0 ) call endrun('physics_state_dealloc error: deallocation error for state%te_cur')
+
+
+
deallocate(state%tw_ini, stat=ierr)
if ( ierr /= 0 ) call endrun('physics_state_dealloc error: deallocation error for state%tw_ini')
diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90
index 62fbece3..614c876c 100644
--- a/src/physics/cam/physpkg.F90
+++ b/src/physics/cam/physpkg.F90
@@ -1785,6 +1785,9 @@ contains
tmp_cldliq(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq)
tmp_cldice(:ncol,:pver) = state%q(:ncol,:pver,ixcldice)
+
+!PL code and output
+#if 0
! For not 'FV', physics_dme_adjust is called for energy diagnostic purposes only. So, save off tracers
if (.not.dycore_is('FV').and.&
(hist_fld_active('SE_pAM').or.hist_fld_active('KE_pAM').or.hist_fld_active('WV_pAM').or.&
@@ -1816,6 +1819,53 @@ contains
state%pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver)
state%ps(:ncol) = tmp_ps(:ncol)
end if
+#endif
+
+
+
+#undef ADDCP
+!#define ADDCP
+
+!OG remove cp terms from TE
+!orig, tbot, tbot
+ state%cpterme(:ncol) = cpair * state%t(:ncol,pver) * cam_in%cflx(:ncol,1)
+ state%cptermp(:ncol) = 1000.0 * cpair * state%t(:ncol,pver) * (cam_out%precl(:ncol) + cam_out%precc(:ncol) )
+#ifdef ADDCP
+!take CP term out of te_cur
+ state%te_cur(:ncol) = state%te_cur(:ncol) - state%cptermp(:ncol)*ztodt &
+ + state%cpterme(:ncol)*ztodt
+#endif
+
+!OG this is to show that fixer is approx. DME adjust
+#if 1
+ if (.not.dycore_is('FV')) then
+!first 7 is enough?
+ tmp_trac(:ncol,:pver,:pcnst) = state%q(:ncol,:pver,:pcnst)
+ tmp_pdel(:ncol,:pver) = state%pdel(:ncol,:pver)
+ tmp_ps(:ncol) = state%ps(:ncol)
+
+ if (dycore_is('SE')) call set_dry_to_wet(state)
+
+!save current TE
+ state%tebefore_dme(:ncol) = state%te_cur(:ncol)
+
+ call physics_dme_adjust(state, tend, qini, ztodt)
+
+!recompute TE, it also prob computes tw or something else
+!assume that tw and anything else does not affect run
+ call check_energy_chng(state, tend, "drymass__", nstep, ztodt, zero, zero, zero, zero)
+ state%teafter_dme(:ncol) = state%te_cur(:ncol)
+
+!reverse TE to TE before pressure adjustment
+!comment this line when discarding PW, to show that the dycore is small
+ state%te_cur(:ncol) = state%tebefore_dme(:ncol)
+
+ state%q(:ncol,:pver,:pcnst) = tmp_trac(:ncol,:pver,:pcnst)
+ state%pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver)
+ state%ps(:ncol) = tmp_ps(:ncol)
+ end if
+#endif
+
if (dycore_is('LR')) then
last 10 commits are -------------
89e964597ea07e5da6191f5038d1b3e487a45b7d fix various bugs and start cleaning up ncl scripts
cf6dd3965e28a5b0248cfbdd4f9b32edc35c9e77 add diagnostic scripts
5a5280ede2688e42f2c569756729a717fa202a93 add new diagnostics
998186e96b00e3b18803a4dcf5a2e409e8aec8ae moving energy diagnostic code to cam6_3_28. Add scripts to my_scripts directory
1ee4f1ad101ae59f2f9872b5e2aeeb0e2484cb9d stable configuration
d60228c85c5c6bd590a47ed41bf2d11990110bfb merge branch cam_development from pel fork
75080a9ebef7b5b371423e804058e5cb21e9bb70 Merge pull request #107 from Katetc/mg_move_to_external
67e865e9a815954b7c8287769799c09ae6d1e3a2 Merge pull request #134 from jtruesdal/scam130
5127458be92b2024229505017729b602ab012231 Merge pull request #135 from nusbaume/ghub_issue_close_action
e2cffd7dd568209ca4984922401ddc71978feb63 Merge pull request #83 from nusbaume/ghub_issue_close_action