-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpas_atm_time_integration.F
2705 lines (2390 loc) · 140 KB
/
mpas_atm_time_integration.F
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!KGEN-generated Fortran source file
!Generated at : 2017-07-10 21:23:06
!KGEN version : 0.7.1
! Copyright (c) 2013, Los Alamos National Security, LLC (LANS)
! and the University Corporation for Atmospheric Research (UCAR).
!
! Unless noted otherwise source code is licensed under the BSD license.
! Additional copyright and license information can be found in the LICENSE file
! distributed with this code, or at http://mpas-dev.github.com/license.html
!
module atm_time_integration
USE mpas_kind_types
! Added only clause to keep xlf90 from getting confused from the overloaded abs intrinsic in mpas_timekeeping
USE mpas_atm_iau
USE kgen_utils_mod, ONLY: kgen_dp, kgen_array_sumcheck
USE tprof_mod, ONLY: tstart, tstop, tnull, tprnt
USE kgen_utils_mod, ONLY: check_t, kgen_init_check, CHECK_IDENTICAL, CHECK_IN_TOL, CHECK_OUT_TOL
USE kgen_utils_mod, ONLY: check_t, kgen_init_check, CHECK_IDENTICAL, CHECK_IN_TOL, CHECK_OUT_TOL
! Used to store physics tendencies for dynamics variables
real (kind=RKIND), allocatable, dimension(:,:) :: tend_ru_physics, tend_rtheta_physics, tend_rho_physics
! Used in compute_dyn_tend
real (kind=RKIND), allocatable, dimension(:,:) :: qtot
real (kind=RKIND), allocatable, dimension(:,:) :: delsq_theta, delsq_w, delsq_divergence
real (kind=RKIND), allocatable, dimension(:,:) :: delsq_u
! real (kind=RKIND), allocatable, dimension(:,:) :: delsq_circulation ! no longer used -> removed
real (kind=RKIND), allocatable, dimension(:,:) :: delsq_vorticity
real (kind=RKIND), allocatable, dimension(:,:) :: dpdz
! Used in atm_advance_scalars
! Used in atm_advance_scalars_mono
! Used in compute_solve_diagnostics
PUBLIC kr_externs_in_atm_time_integration
PUBLIC kr_externs_out_atm_time_integration
PUBLIC atm_compute_dyn_tend
REAL(KIND=rkind), allocatable, dimension(:,:) :: kgenref_delsq_theta, kgenref_delsq_w, kgenref_delsq_divergence
REAL(KIND=rkind), allocatable, dimension(:,:) :: kgenref_delsq_u
REAL(KIND=rkind), allocatable, dimension(:,:) :: kgenref_delsq_vorticity
REAL(KIND=rkind), allocatable, dimension(:,:) :: kgenref_dpdz
PUBLIC kv_externs_atm_time_integration
contains
SUBROUTINE atm_compute_dyn_tend(kgen_unit, kgen_elapsed_time, kgen_isverified, nvertlevels, rk_step, dt, cellstart, cellend, &
&vertexstart, vertexend, edgestart, edgeend, cellsolvestart, cellsolveend, vertexsolvestart, vertexsolveend, edgesolvestart, &
&edgesolveend)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Compute height and normal wind tendencies, as well as diagnostic variables
!
! Input: state - current model state
! mesh - grid metadata
! diag - some grid diagnostics
!
! Output: tend - tendencies: tend_u, tend_w, tend_theta and tend_rho
! these are all coupled-variable tendencies.
! various other quantities in diag: Smagorinsky eddy viscosity
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
USE kgen_utils_mod, ONLY: kgen_dp, kgen_array_sumcheck
USE kgen_utils_mod, ONLY: check_t, kgen_init_check, CHECK_IDENTICAL, CHECK_IN_TOL, CHECK_OUT_TOL
USE kgen_utils_mod, ONLY: kgen_perturb_real
IMPLICIT NONE
!
! Dummy arguments
!
INTEGER, INTENT(INOUT) :: nvertlevels
INTEGER, INTENT(INOUT) :: rk_step
REAL(KIND=rkind), INTENT(INOUT) :: dt
INTEGER, INTENT(INOUT) :: cellstart, cellend, vertexstart, vertexend, edgestart, edgeend
INTEGER, INTENT(INOUT) :: cellsolvestart, cellsolveend, vertexsolvestart, vertexsolveend, edgesolvestart, edgesolveend
!
! Local variables
!
INTEGER, pointer :: ncells, nedges, nvertices, ncellssolve, nedgessolve, vertexdegree, maxedges, maxedges2
INTEGER, pointer :: moist_start, moist_end, num_scalars
REAL(KIND=rkind), dimension(:), pointer :: fedge, dvedge, dcedge, invdcedge, invdvedge, invareacell, invareatriangle, &
&meshscalingdel2, meshscalingdel4
REAL(KIND=rkind), dimension(:,:), pointer :: weightsonedge, zgrid, rho_edge, rho_zz, ru, u, v, tend_u, divergence, &
&vorticity, ke, pv_edge, theta_m, rw, tend_rho, rt_diabatic_tend, tend_theta, tend_w, w, cqw, rb, rr, pp, pressure_b, zz, &
&zxu, cqu, h_divergence, kdiff, edgesoncell_sign, edgesonvertex_sign, rw_save, ru_save
REAL(KIND=rkind), dimension(:,:), pointer :: theta_m_save
REAL(KIND=rkind), dimension(:,:), pointer :: exner
REAL(KIND=rkind), dimension(:,:), pointer :: rr_save
REAL(KIND=rkind), dimension(:,:), pointer :: tend_rtheta_adv
REAL(KIND=rkind), dimension(:,:), pointer :: rthdynten
REAL(KIND=rkind), dimension(:,:,:), pointer :: scalars
REAL(KIND=rkind), dimension(:,:), pointer :: tend_u_euler, tend_w_euler, tend_theta_euler
REAL(KIND=rkind), dimension(:,:,:), pointer :: deriv_two
INTEGER, dimension(:,:), pointer :: cellsonedge, verticesonedge, edgesoncell, edgesonedge, cellsoncell, edgesonvertex
INTEGER, dimension(:), pointer :: nedgesoncell, nedgesonedge
REAL(KIND=rkind), dimension(:), pointer :: latcell, latedge, angleedge, u_init
INTEGER, dimension(:,:), pointer :: advcellsforedge
INTEGER, dimension(:), pointer :: nadvcellsforedge
REAL(KIND=rkind), dimension(:,:), pointer :: adv_coefs, adv_coefs_3rd
REAL(KIND=rkind), dimension(:), pointer :: rdzu, rdzw, fzm, fzp, qv_init
REAL(KIND=rkind), dimension(:,:), pointer :: t_init
REAL(KIND=rkind), pointer :: cf1, cf2, cf3
REAL(KIND=rkind), pointer :: r_earth
REAL(KIND=rkind), dimension(:,:), pointer :: ur_cell, vr_cell
REAL(KIND=rkind), dimension(:,:), pointer :: defc_a, defc_b
REAL(KIND=rkind), dimension(:,:), pointer :: tend_w_pgf, tend_w_buoy
REAL(KIND=rkind), pointer :: coef_3rd_order, c_s
LOGICAL, pointer :: config_mix_full
CHARACTER(LEN=strkind), pointer :: config_horiz_mixing
REAL(KIND=rkind), pointer :: config_del4u_div_factor
REAL(KIND=rkind), pointer :: config_h_theta_eddy_visc4
REAL(KIND=rkind), pointer :: config_h_mom_eddy_visc4
REAL(KIND=rkind), pointer :: config_visc4_2dsmag
REAL(KIND=rkind), pointer :: config_len_disp
REAL(KIND=rkind), pointer :: config_h_mom_eddy_visc2, config_v_mom_eddy_visc2
REAL(KIND=rkind), pointer :: config_h_theta_eddy_visc2, config_v_theta_eddy_visc2
INTEGER, INTENT(IN) :: kgen_unit
REAL(KIND=kgen_dp), INTENT(OUT) :: kgen_elapsed_time
LOGICAL, INTENT(OUT) :: kgen_isverified
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
INTEGER :: kgenref_nvertlevels
INTEGER, pointer :: kgenref_ncells
INTEGER, pointer :: kgenref_nedges
INTEGER, pointer :: kgenref_nvertices
INTEGER, pointer :: kgenref_ncellssolve
INTEGER, pointer :: kgenref_nedgessolve
INTEGER, pointer :: kgenref_vertexdegree
INTEGER, pointer :: kgenref_maxedges
INTEGER, pointer :: kgenref_maxedges2
INTEGER, pointer :: kgenref_num_scalars
INTEGER, pointer :: kgenref_moist_start
INTEGER, pointer :: kgenref_moist_end
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_fedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_dvedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_dcedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_invdcedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_invdvedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_invareacell
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_invareatriangle
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_meshscalingdel2
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_meshscalingdel4
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_weightsonedge
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_zgrid
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rho_edge
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rho_zz
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_ru
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_u
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_v
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_u
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_divergence
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_vorticity
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_ke
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_pv_edge
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_theta_m
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rw
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_rho
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rt_diabatic_tend
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_theta
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_w
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_w
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_cqw
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rb
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rr
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_pp
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_pressure_b
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_zz
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_zxu
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_cqu
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_h_divergence
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_kdiff
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_edgesoncell_sign
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_edgesonvertex_sign
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rw_save
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_ru_save
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_theta_m_save
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_exner
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rr_save
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_rtheta_adv
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_rthdynten
REAL(KIND=rkind), pointer, dimension(:,:,:) :: kgenref_scalars
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_u_euler
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_w_euler
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_theta_euler
REAL(KIND=rkind), pointer, dimension(:,:,:) :: kgenref_deriv_two
INTEGER, pointer, dimension(:,:) :: kgenref_cellsonedge
INTEGER, pointer, dimension(:,:) :: kgenref_verticesonedge
INTEGER, pointer, dimension(:,:) :: kgenref_edgesoncell
INTEGER, pointer, dimension(:,:) :: kgenref_edgesonedge
INTEGER, pointer, dimension(:,:) :: kgenref_cellsoncell
INTEGER, pointer, dimension(:,:) :: kgenref_edgesonvertex
INTEGER, pointer, dimension(:) :: kgenref_nedgesoncell
INTEGER, pointer, dimension(:) :: kgenref_nedgesonedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_latcell
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_latedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_angleedge
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_u_init
INTEGER, pointer, dimension(:,:) :: kgenref_advcellsforedge
INTEGER, pointer, dimension(:) :: kgenref_nadvcellsforedge
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_adv_coefs
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_adv_coefs_3rd
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_rdzu
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_rdzw
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_fzm
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_fzp
REAL(KIND=rkind), pointer, dimension(:) :: kgenref_qv_init
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_t_init
REAL(KIND=rkind), pointer :: kgenref_cf1
REAL(KIND=rkind), pointer :: kgenref_cf2
REAL(KIND=rkind), pointer :: kgenref_cf3
REAL(KIND=rkind), pointer :: kgenref_r_earth
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_ur_cell
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_vr_cell
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_defc_a
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_defc_b
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_w_pgf
REAL(KIND=rkind), pointer, dimension(:,:) :: kgenref_tend_w_buoy
REAL(KIND=rkind), pointer :: kgenref_coef_3rd_order
REAL(KIND=rkind), pointer :: kgenref_c_s
LOGICAL, pointer :: kgenref_config_mix_full
CHARACTER(LEN=strkind), pointer :: kgenref_config_horiz_mixing
REAL(KIND=rkind), pointer :: kgenref_config_del4u_div_factor
REAL(KIND=rkind), pointer :: kgenref_config_h_theta_eddy_visc4
REAL(KIND=rkind), pointer :: kgenref_config_h_mom_eddy_visc4
REAL(KIND=rkind), pointer :: kgenref_config_visc4_2dsmag
REAL(KIND=rkind), pointer :: kgenref_config_len_disp
REAL(KIND=rkind), pointer :: kgenref_config_h_mom_eddy_visc2
REAL(KIND=rkind), pointer :: kgenref_config_v_mom_eddy_visc2
REAL(KIND=rkind), pointer :: kgenref_config_h_theta_eddy_visc2
REAL(KIND=rkind), pointer :: kgenref_config_v_theta_eddy_visc2
TYPE(check_t) :: check_status
INTEGER*8 :: kgen_intvar, kgen_start_clock, kgen_stop_clock, kgen_rate_clock
INTEGER, PARAMETER :: kgen_maxiter = 1
!
! rthdynten is currently associated with packages, and if those packages
! are not active at run-time, we need to produce an rthdynten array for
! use in the atm_compute_dyn_tend_work routine
!
!$KGEN begin_callsite atm_compute_dyn_tend_work
!local input variables
CALL kr_atm_compute_dyn_tend_integer___ptr(ncells, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(nedges, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(nvertices, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(ncellssolve, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(nedgessolve, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(vertexdegree, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(maxedges, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(maxedges2, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(num_scalars, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(moist_start, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(moist_end, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(fedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(dvedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(dcedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(invdcedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(invdvedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(invareacell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(invareatriangle, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(meshscalingdel2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(meshscalingdel4, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(weightsonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(zgrid, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rho_edge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rho_zz, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(ru, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(u, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(v, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_u, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(divergence, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(vorticity, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(ke, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(pv_edge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(theta_m, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rw, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_rho, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rt_diabatic_tend, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_theta, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_w, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(w, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(cqw, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rb, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rr, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(pp, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(pressure_b, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(zz, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(zxu, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(cqu, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(h_divergence, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kdiff, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(edgesoncell_sign, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(edgesonvertex_sign, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rw_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(ru_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(theta_m_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(exner, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rr_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_rtheta_adv, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(rthdynten, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim3_ptr(scalars, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_u_euler, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_w_euler, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_theta_euler, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim3_ptr(deriv_two, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(cellsonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(verticesonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(edgesoncell, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(edgesonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(cellsoncell, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(edgesonvertex, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim1_ptr(nedgesoncell, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim1_ptr(nedgesonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(latcell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(latedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(angleedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(u_init, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(advcellsforedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim1_ptr(nadvcellsforedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(adv_coefs, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(adv_coefs_3rd, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(rdzu, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(rdzw, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(fzm, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(fzp, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(qv_init, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(t_init, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(cf1, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(cf2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(cf3, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(r_earth, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(ur_cell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(vr_cell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(defc_a, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(defc_b, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_w_pgf, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(tend_w_buoy, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(coef_3rd_order, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(c_s, kgen_unit)
CALL kr_atm_compute_dyn_tend_logical___ptr(config_mix_full, kgen_unit)
CALL kr_atm_compute_dyn_tend_character_strkind__ptr(config_horiz_mixing, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_del4u_div_factor, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_h_theta_eddy_visc4, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_h_mom_eddy_visc4, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_visc4_2dsmag, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_len_disp, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_h_mom_eddy_visc2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_v_mom_eddy_visc2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_h_theta_eddy_visc2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(config_v_theta_eddy_visc2, kgen_unit)
!extern output variables
CALL kr_externs_out_atm_time_integration(kgen_unit)
!local output variables
READ (UNIT = kgen_unit) kgenref_nvertlevels
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_ncells, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_nedges, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_nvertices, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_ncellssolve, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_nedgessolve, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_vertexdegree, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_maxedges, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_maxedges2, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_num_scalars, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_moist_start, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___ptr(kgenref_moist_end, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_fedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_dvedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_dcedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_invdcedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_invdvedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_invareacell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_invareatriangle, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_meshscalingdel2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_meshscalingdel4, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_weightsonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_zgrid, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rho_edge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rho_zz, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_ru, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_u, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_v, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_u, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_divergence, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_vorticity, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_ke, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_pv_edge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_theta_m, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rw, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_rho, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rt_diabatic_tend, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_theta, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_w, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_w, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_cqw, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rb, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rr, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_pp, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_pressure_b, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_zz, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_zxu, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_cqu, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_h_divergence, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_kdiff, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_edgesoncell_sign, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_edgesonvertex_sign, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rw_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_ru_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_theta_m_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_exner, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rr_save, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_rtheta_adv, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_rthdynten, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim3_ptr(kgenref_scalars, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_u_euler, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_w_euler, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_theta_euler, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim3_ptr(kgenref_deriv_two, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_cellsonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_verticesonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_edgesoncell, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_edgesonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_cellsoncell, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_edgesonvertex, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim1_ptr(kgenref_nedgesoncell, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim1_ptr(kgenref_nedgesonedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_latcell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_latedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_angleedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_u_init, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim2_ptr(kgenref_advcellsforedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_integer___dim1_ptr(kgenref_nadvcellsforedge, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_adv_coefs, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_adv_coefs_3rd, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_rdzu, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_rdzw, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_fzm, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_fzp, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(kgenref_qv_init, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_t_init, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_cf1, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_cf2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_cf3, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_r_earth, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_ur_cell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_vr_cell, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_defc_a, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_defc_b, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_w_pgf, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(kgenref_tend_w_buoy, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_coef_3rd_order, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_c_s, kgen_unit)
CALL kr_atm_compute_dyn_tend_logical___ptr(kgenref_config_mix_full, kgen_unit)
CALL kr_atm_compute_dyn_tend_character_strkind__ptr(kgenref_config_horiz_mixing, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_del4u_div_factor, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_h_theta_eddy_visc4, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_h_mom_eddy_visc4, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_visc4_2dsmag, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_len_disp, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_h_mom_eddy_visc2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_v_mom_eddy_visc2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_h_theta_eddy_visc2, kgen_unit)
CALL kr_atm_compute_dyn_tend_real__rkind_ptr(kgenref_config_v_theta_eddy_visc2, kgen_unit)
!Uncomment following call statement to turn on perturbation experiment.
!Adjust perturbation value and/or kind parameter if required.
!CALL kgen_perturb_real( your_variable, 1.0E-15_8 )
!call to kgen kernel
call atm_compute_dyn_tend_work(nCells, nEdges, nVertices, nVertLevels, &
nCellsSolve, nEdgesSolve, vertexDegree, maxEdges, maxEdges2, num_scalars, moist_start, moist_end, &
fEdge, dvEdge, dcEdge, invDcEdge, invDvEdge, invAreaCell, invAreaTriangle, meshScalingDel2, meshScalingDel4, &
weightsOnEdge, zgrid, rho_edge, rho_zz, ru, u, v, tend_u, &
divergence, vorticity, ke, pv_edge, theta_m, rw, tend_rho, &
rt_diabatic_tend, tend_theta, tend_w, w, cqw, rb, rr, pp, pressure_b, zz, zxu, cqu, &
h_divergence, kdiff, edgesOnCell_sign, edgesOnVertex_sign, rw_save, ru_save, &
theta_m_save, exner, rr_save, scalars, tend_u_euler, tend_w_euler, tend_theta_euler, deriv_two, &
cellsOnEdge, verticesOnEdge, edgesOnCell, edgesOnEdge, cellsOnCell, edgesOnVertex, nEdgesOnCell, nEdgesOnEdge, &
latCell, latEdge, angleEdge, u_init, advCellsForEdge, nAdvCellsForEdge, adv_coefs, adv_coefs_3rd, &
rdzu, rdzw, fzm, fzp, qv_init, t_init, cf1, cf2, cf3, r_earth, ur_cell, vr_cell, defc_a, defc_b, &
tend_w_pgf, tend_w_buoy, coef_3rd_order, c_s, config_mix_full, config_horiz_mixing, config_del4u_div_factor, &
config_h_mom_eddy_visc2, config_v_mom_eddy_visc2, config_h_theta_eddy_visc2, config_v_theta_eddy_visc2, &
config_h_theta_eddy_visc4, config_h_mom_eddy_visc4, config_visc4_2dsmag, config_len_disp, rk_step, dt, &
tend_rtheta_adv, rthdynten, &
cellStart, cellEnd, vertexStart, vertexEnd, edgeStart, edgeEnd, &
cellSolveStart, cellSolveEnd, vertexSolveStart, vertexSolveEnd, edgeSolveStart, edgeSolveEnd)
!$KGEN end_callsite atm_compute_dyn_tend_work
!verify init
CALL kgen_init_check(check_status, tolerance=1.D-10, verboseLevel=1)
!extern verify variables
CALL kv_externs_atm_time_integration(check_status)
!local verify variables
CALL kv_atm_compute_dyn_tend_integer__("nvertlevels", check_status, nvertlevels, kgenref_nvertlevels)
CALL kv_atm_compute_dyn_tend_integer___ptr("nedges", check_status, nedges, kgenref_nedges)
CALL kv_atm_compute_dyn_tend_integer___ptr("vertexdegree", check_status, vertexdegree, kgenref_vertexdegree)
CALL kv_atm_compute_dyn_tend_integer___ptr("maxedges2", check_status, maxedges2, kgenref_maxedges2)
CALL kv_atm_compute_dyn_tend_integer___ptr("nvertices", check_status, nvertices, kgenref_nvertices)
CALL kv_atm_compute_dyn_tend_integer___ptr("ncellssolve", check_status, ncellssolve, kgenref_ncellssolve)
CALL kv_atm_compute_dyn_tend_integer___ptr("nedgessolve", check_status, nedgessolve, kgenref_nedgessolve)
CALL kv_atm_compute_dyn_tend_integer___ptr("maxedges", check_status, maxedges, kgenref_maxedges)
CALL kv_atm_compute_dyn_tend_integer___ptr("ncells", check_status, ncells, kgenref_ncells)
CALL kv_atm_compute_dyn_tend_integer___ptr("moist_start", check_status, moist_start, kgenref_moist_start)
CALL kv_atm_compute_dyn_tend_integer___ptr("moist_end", check_status, moist_end, kgenref_moist_end)
CALL kv_atm_compute_dyn_tend_integer___ptr("num_scalars", check_status, num_scalars, kgenref_num_scalars)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("invareacell", check_status, invareacell, kgenref_invareacell)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("invdcedge", check_status, invdcedge, kgenref_invdcedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("fedge", check_status, fedge, kgenref_fedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("meshscalingdel4", check_status, meshscalingdel4, &
&kgenref_meshscalingdel4)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("invdvedge", check_status, invdvedge, kgenref_invdvedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("meshscalingdel2", check_status, meshscalingdel2, &
&kgenref_meshscalingdel2)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("dcedge", check_status, dcedge, kgenref_dcedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("dvedge", check_status, dvedge, kgenref_dvedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("invareatriangle", check_status, invareatriangle, &
&kgenref_invareatriangle)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("pv_edge", check_status, pv_edge, kgenref_pv_edge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("edgesonvertex_sign", check_status, edgesonvertex_sign, &
&kgenref_edgesonvertex_sign)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("vorticity", check_status, vorticity, kgenref_vorticity)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("zz", check_status, zz, kgenref_zz)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("zgrid", check_status, zgrid, kgenref_zgrid)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("ru", check_status, ru, kgenref_ru)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("pp", check_status, pp, kgenref_pp)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rw", check_status, rw, kgenref_rw)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rr", check_status, rr, kgenref_rr)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_u", check_status, tend_u, kgenref_tend_u)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_w", check_status, tend_w, kgenref_tend_w)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rt_diabatic_tend", check_status, rt_diabatic_tend, &
&kgenref_rt_diabatic_tend)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("edgesoncell_sign", check_status, edgesoncell_sign, &
&kgenref_edgesoncell_sign)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("zxu", check_status, zxu, kgenref_zxu)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rb", check_status, rb, kgenref_rb)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("cqw", check_status, cqw, kgenref_cqw)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("cqu", check_status, cqu, kgenref_cqu)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("kdiff", check_status, kdiff, kgenref_kdiff)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("h_divergence", check_status, h_divergence, kgenref_h_divergence)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("divergence", check_status, divergence, kgenref_divergence)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("ru_save", check_status, ru_save, kgenref_ru_save)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("pressure_b", check_status, pressure_b, kgenref_pressure_b)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_rho", check_status, tend_rho, kgenref_tend_rho)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_theta", check_status, tend_theta, kgenref_tend_theta)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("weightsonedge", check_status, weightsonedge, kgenref_weightsonedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rho_edge", check_status, rho_edge, kgenref_rho_edge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("ke", check_status, ke, kgenref_ke)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("theta_m", check_status, theta_m, kgenref_theta_m)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rho_zz", check_status, rho_zz, kgenref_rho_zz)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("u", check_status, u, kgenref_u)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("w", check_status, w, kgenref_w)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("v", check_status, v, kgenref_v)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rw_save", check_status, rw_save, kgenref_rw_save)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("theta_m_save", check_status, theta_m_save, kgenref_theta_m_save)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("exner", check_status, exner, kgenref_exner)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rr_save", check_status, rr_save, kgenref_rr_save)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_rtheta_adv", check_status, tend_rtheta_adv, &
&kgenref_tend_rtheta_adv)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("rthdynten", check_status, rthdynten, kgenref_rthdynten)
CALL kv_atm_compute_dyn_tend_real__rkind_dim3_ptr("scalars", check_status, scalars, kgenref_scalars)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_u_euler", check_status, tend_u_euler, kgenref_tend_u_euler)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_theta_euler", check_status, tend_theta_euler, &
&kgenref_tend_theta_euler)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_w_euler", check_status, tend_w_euler, kgenref_tend_w_euler)
CALL kv_atm_compute_dyn_tend_real__rkind_dim3_ptr("deriv_two", check_status, deriv_two, kgenref_deriv_two)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("edgesonvertex", check_status, edgesonvertex, kgenref_edgesonvertex)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("edgesoncell", check_status, edgesoncell, kgenref_edgesoncell)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("cellsonedge", check_status, cellsonedge, kgenref_cellsonedge)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("cellsoncell", check_status, cellsoncell, kgenref_cellsoncell)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("edgesonedge", check_status, edgesonedge, kgenref_edgesonedge)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("verticesonedge", check_status, verticesonedge, kgenref_verticesonedge)
CALL kv_atm_compute_dyn_tend_integer___dim1_ptr("nedgesonedge", check_status, nedgesonedge, kgenref_nedgesonedge)
CALL kv_atm_compute_dyn_tend_integer___dim1_ptr("nedgesoncell", check_status, nedgesoncell, kgenref_nedgesoncell)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("u_init", check_status, u_init, kgenref_u_init)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("angleedge", check_status, angleedge, kgenref_angleedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("latcell", check_status, latcell, kgenref_latcell)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("latedge", check_status, latedge, kgenref_latedge)
CALL kv_atm_compute_dyn_tend_integer___dim2_ptr("advcellsforedge", check_status, advcellsforedge, kgenref_advcellsforedge)
CALL kv_atm_compute_dyn_tend_integer___dim1_ptr("nadvcellsforedge", check_status, nadvcellsforedge, &
&kgenref_nadvcellsforedge)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("adv_coefs", check_status, adv_coefs, kgenref_adv_coefs)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("adv_coefs_3rd", check_status, adv_coefs_3rd, kgenref_adv_coefs_3rd)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("qv_init", check_status, qv_init, kgenref_qv_init)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("fzp", check_status, fzp, kgenref_fzp)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("rdzu", check_status, rdzu, kgenref_rdzu)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("fzm", check_status, fzm, kgenref_fzm)
CALL kv_atm_compute_dyn_tend_real__rkind_dim1_ptr("rdzw", check_status, rdzw, kgenref_rdzw)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("t_init", check_status, t_init, kgenref_t_init)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("cf2", check_status, cf2, kgenref_cf2)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("cf3", check_status, cf3, kgenref_cf3)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("cf1", check_status, cf1, kgenref_cf1)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("r_earth", check_status, r_earth, kgenref_r_earth)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("vr_cell", check_status, vr_cell, kgenref_vr_cell)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("ur_cell", check_status, ur_cell, kgenref_ur_cell)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("defc_b", check_status, defc_b, kgenref_defc_b)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("defc_a", check_status, defc_a, kgenref_defc_a)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_w_buoy", check_status, tend_w_buoy, kgenref_tend_w_buoy)
CALL kv_atm_compute_dyn_tend_real__rkind_dim2_ptr("tend_w_pgf", check_status, tend_w_pgf, kgenref_tend_w_pgf)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("c_s", check_status, c_s, kgenref_c_s)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("coef_3rd_order", check_status, coef_3rd_order, kgenref_coef_3rd_order)
CALL kv_atm_compute_dyn_tend_logical___ptr("config_mix_full", check_status, config_mix_full, kgenref_config_mix_full)
CALL kv_atm_compute_dyn_tend_character_strkind__ptr("config_horiz_mixing", check_status, config_horiz_mixing, &
&kgenref_config_horiz_mixing)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_del4u_div_factor", check_status, config_del4u_div_factor, &
&kgenref_config_del4u_div_factor)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_h_theta_eddy_visc4", check_status, config_h_theta_eddy_visc4, &
&kgenref_config_h_theta_eddy_visc4)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_h_mom_eddy_visc4", check_status, config_h_mom_eddy_visc4, &
&kgenref_config_h_mom_eddy_visc4)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_visc4_2dsmag", check_status, config_visc4_2dsmag, &
&kgenref_config_visc4_2dsmag)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_len_disp", check_status, config_len_disp, kgenref_config_len_disp)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_v_mom_eddy_visc2", check_status, config_v_mom_eddy_visc2, &
&kgenref_config_v_mom_eddy_visc2)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_h_mom_eddy_visc2", check_status, config_h_mom_eddy_visc2, &
&kgenref_config_h_mom_eddy_visc2)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_h_theta_eddy_visc2", check_status, config_h_theta_eddy_visc2, &
&kgenref_config_h_theta_eddy_visc2)
CALL kv_atm_compute_dyn_tend_real__rkind_ptr("config_v_theta_eddy_visc2", check_status, config_v_theta_eddy_visc2, &
&kgenref_config_v_theta_eddy_visc2)
WRITE (*, *) ""
IF (check_status%verboseLevel > 0) THEN
WRITE (*, *) "Number of output-type variables: ", check_status%numTotal
WRITE (*, *) "Number of identical variables: ", check_status%numIdentical
WRITE (*, *) "Number of non-identical variables within tolerance: ", check_status%numInTol
WRITE (*, *) "Number of non-identical variables out of tolerance: ", check_status%numOutTol
WRITE (*, *) "Tolerance: ", check_status%tolerance
END IF
WRITE (*, *) ""
IF (check_status%numOutTol > 0) THEN
WRITE (*, *) "Verification FAILED"
check_status%Passed = .FALSE.
kgen_isverified = .FALSE.
ELSE
WRITE (*, *) "Verification PASSED"
check_status%Passed = .TRUE.
kgen_isverified = .TRUE.
END IF
WRITE (*, *) ""
!Measuring elapsed time. Please increase the value of kgen_maxiter to get improve timing measurment resolution.
! CALL SYSTEM_CLOCK(kgen_start_clock, kgen_rate_clock)
! DO kgen_intvar = 1, kgen_maxiter
! call atm_compute_dyn_tend_work(nCells, nEdges, nVertices, nVertLevels, &
! nCellsSolve, nEdgesSolve, vertexDegree, maxEdges, maxEdges2, num_scalars, moist_start, moist_end, &
! fEdge, dvEdge, dcEdge, invDcEdge, invDvEdge, invAreaCell, invAreaTriangle, meshScalingDel2, meshScalingDel4, &
! weightsOnEdge, zgrid, rho_edge, rho_zz, ru, u, v, tend_u, &
! divergence, vorticity, ke, pv_edge, theta_m, rw, tend_rho, &
! rt_diabatic_tend, tend_theta, tend_w, w, cqw, rb, rr, pp, pressure_b, zz, zxu, cqu, &
! h_divergence, kdiff, edgesOnCell_sign, edgesOnVertex_sign, rw_save, ru_save, &
! theta_m_save, exner, rr_save, scalars, tend_u_euler, tend_w_euler, tend_theta_euler, deriv_two, &
! cellsOnEdge, verticesOnEdge, edgesOnCell, edgesOnEdge, cellsOnCell, edgesOnVertex, nEdgesOnCell, nEdgesOnEdge, &
! latCell, latEdge, angleEdge, u_init, advCellsForEdge, nAdvCellsForEdge, adv_coefs, adv_coefs_3rd, &
! rdzu, rdzw, fzm, fzp, qv_init, t_init, cf1, cf2, cf3, r_earth, ur_cell, vr_cell, defc_a, defc_b, &
! tend_w_pgf, tend_w_buoy, coef_3rd_order, c_s, config_mix_full, config_horiz_mixing, config_del4u_div_factor, &
! config_h_mom_eddy_visc2, config_v_mom_eddy_visc2, config_h_theta_eddy_visc2, config_v_theta_eddy_visc2, &
! config_h_theta_eddy_visc4, config_h_mom_eddy_visc4, config_visc4_2dsmag, config_len_disp, rk_step, dt, &
! tend_rtheta_adv, rthdynten, &
! cellStart, cellEnd, vertexStart, vertexEnd, edgeStart, edgeEnd, &
! cellSolveStart, cellSolveEnd, vertexSolveStart, vertexSolveEnd, edgeSolveStart, edgeSolveEnd)
! END DO
! CALL SYSTEM_CLOCK(kgen_stop_clock, kgen_rate_clock)
! kgen_elapsed_time = 1.0e6*(kgen_stop_clock - kgen_start_clock)/REAL(kgen_rate_clock*kgen_maxiter)
! WRITE (*, *) "atm_compute_dyn_tend_work : Time per call (usec): ", kgen_elapsed_time
CONTAINS
!read state subroutine for kr_atm_compute_dyn_tend_integer___ptr
SUBROUTINE kr_atm_compute_dyn_tend_integer___ptr(var, kgen_unit, printvar)
INTEGER, INTENT(INOUT), POINTER :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
ALLOCATE (var)
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_integer___ptr
!read state subroutine for kr_atm_compute_dyn_tend_real__rkind_dim1_ptr
SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_dim1_ptr(var, kgen_unit, printvar)
REAL(KIND=rkind), INTENT(INOUT), POINTER, DIMENSION(:) :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
INTEGER :: idx1
INTEGER, DIMENSION(2,1) :: kgen_bound
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
READ (UNIT = kgen_unit) kgen_array_sum
READ (UNIT = kgen_unit) kgen_bound(1, 1)
READ (UNIT = kgen_unit) kgen_bound(2, 1)
ALLOCATE (var(kgen_bound(1,1):kgen_bound(2,1)))
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
CALL kgen_array_sumcheck(printvar, kgen_array_sum, REAL(SUM(var, mask=(var .eq. var)), 8), .TRUE.)
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
ELSE
CALL kgen_array_sumcheck("UNKNOWN", kgen_array_sum, REAL(SUM(var, mask=(var .eq. var)), 8), .TRUE.)
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_dim1_ptr
!read state subroutine for kr_atm_compute_dyn_tend_real__rkind_dim2_ptr
SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_dim2_ptr(var, kgen_unit, printvar)
REAL(KIND=rkind), INTENT(INOUT), POINTER, DIMENSION(:,:) :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
INTEGER :: idx1, idx2
INTEGER, DIMENSION(2,2) :: kgen_bound
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
READ (UNIT = kgen_unit) kgen_array_sum
READ (UNIT = kgen_unit) kgen_bound(1, 1)
READ (UNIT = kgen_unit) kgen_bound(2, 1)
READ (UNIT = kgen_unit) kgen_bound(1, 2)
READ (UNIT = kgen_unit) kgen_bound(2, 2)
ALLOCATE (var(kgen_bound(1,1):kgen_bound(2,1), kgen_bound(1,2):kgen_bound(2,2)))
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
CALL kgen_array_sumcheck(printvar, kgen_array_sum, REAL(SUM(var, mask=(var .eq. var)), 8), .TRUE.)
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
ELSE
CALL kgen_array_sumcheck("UNKNOWN", kgen_array_sum, REAL(SUM(var, mask=(var .eq. var)), 8), .TRUE.)
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_dim2_ptr
!read state subroutine for kr_atm_compute_dyn_tend_real__rkind_dim3_ptr
SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_dim3_ptr(var, kgen_unit, printvar)
REAL(KIND=rkind), INTENT(INOUT), POINTER, DIMENSION(:,:,:) :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
INTEGER :: idx1, idx2, idx3
INTEGER, DIMENSION(2,3) :: kgen_bound
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
READ (UNIT = kgen_unit) kgen_array_sum
READ (UNIT = kgen_unit) kgen_bound(1, 1)
READ (UNIT = kgen_unit) kgen_bound(2, 1)
READ (UNIT = kgen_unit) kgen_bound(1, 2)
READ (UNIT = kgen_unit) kgen_bound(2, 2)
READ (UNIT = kgen_unit) kgen_bound(1, 3)
READ (UNIT = kgen_unit) kgen_bound(2, 3)
ALLOCATE (var(kgen_bound(1,1):kgen_bound(2,1), kgen_bound(1,2):kgen_bound(2,2), kgen_bound(1,3):kgen_bound(2,3)))
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
CALL kgen_array_sumcheck(printvar, kgen_array_sum, REAL(SUM(var, mask=(var .eq. var)), 8), .TRUE.)
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
ELSE
CALL kgen_array_sumcheck("UNKNOWN", kgen_array_sum, REAL(SUM(var, mask=(var .eq. var)), 8), .TRUE.)
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_dim3_ptr
!read state subroutine for kr_atm_compute_dyn_tend_integer___dim2_ptr
SUBROUTINE kr_atm_compute_dyn_tend_integer___dim2_ptr(var, kgen_unit, printvar)
INTEGER, INTENT(INOUT), POINTER, DIMENSION(:,:) :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
INTEGER :: idx1, idx2
INTEGER, DIMENSION(2,2) :: kgen_bound
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
READ (UNIT = kgen_unit) kgen_array_sum
READ (UNIT = kgen_unit) kgen_bound(1, 1)
READ (UNIT = kgen_unit) kgen_bound(2, 1)
READ (UNIT = kgen_unit) kgen_bound(1, 2)
READ (UNIT = kgen_unit) kgen_bound(2, 2)
ALLOCATE (var(kgen_bound(1,1):kgen_bound(2,1), kgen_bound(1,2):kgen_bound(2,2)))
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
CALL kgen_array_sumcheck(printvar, kgen_array_sum, REAL(SUM(var), 8), .TRUE.)
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
ELSE
CALL kgen_array_sumcheck("UNKNOWN", kgen_array_sum, REAL(SUM(var), 8), .TRUE.)
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_integer___dim2_ptr
!read state subroutine for kr_atm_compute_dyn_tend_integer___dim1_ptr
SUBROUTINE kr_atm_compute_dyn_tend_integer___dim1_ptr(var, kgen_unit, printvar)
INTEGER, INTENT(INOUT), POINTER, DIMENSION(:) :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
INTEGER :: idx1
INTEGER, DIMENSION(2,1) :: kgen_bound
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
READ (UNIT = kgen_unit) kgen_array_sum
READ (UNIT = kgen_unit) kgen_bound(1, 1)
READ (UNIT = kgen_unit) kgen_bound(2, 1)
ALLOCATE (var(kgen_bound(1,1):kgen_bound(2,1)))
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
CALL kgen_array_sumcheck(printvar, kgen_array_sum, REAL(SUM(var), 8), .TRUE.)
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
ELSE
CALL kgen_array_sumcheck("UNKNOWN", kgen_array_sum, REAL(SUM(var), 8), .TRUE.)
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_integer___dim1_ptr
!read state subroutine for kr_atm_compute_dyn_tend_real__rkind_ptr
SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_ptr(var, kgen_unit, printvar)
REAL(KIND=rkind), INTENT(INOUT), POINTER :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
ALLOCATE (var)
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_real__rkind_ptr
!read state subroutine for kr_atm_compute_dyn_tend_logical___ptr
SUBROUTINE kr_atm_compute_dyn_tend_logical___ptr(var, kgen_unit, printvar)
LOGICAL, INTENT(INOUT), POINTER :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
ALLOCATE (var)
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_logical___ptr
!read state subroutine for kr_atm_compute_dyn_tend_character_strkind__ptr
SUBROUTINE kr_atm_compute_dyn_tend_character_strkind__ptr(var, kgen_unit, printvar)
CHARACTER(LEN=strkind), INTENT(INOUT), POINTER :: var
INTEGER, INTENT(IN) :: kgen_unit
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: printvar
LOGICAL :: kgen_istrue
REAL(KIND=8) :: kgen_array_sum
READ (UNIT = kgen_unit) kgen_istrue
IF (kgen_istrue) THEN
IF (ASSOCIATED( var )) THEN
NULLIFY (var)
END IF
ALLOCATE (var)
READ (UNIT = kgen_unit) var
IF (PRESENT( printvar )) THEN
WRITE (*, *) "** KGEN DEBUG: " // printvar // "**" // NEW_LINE("A"), var
END IF
END IF
END SUBROUTINE kr_atm_compute_dyn_tend_character_strkind__ptr
!verify state subroutine for kv_atm_compute_dyn_tend_integer__
RECURSIVE SUBROUTINE kv_atm_compute_dyn_tend_integer__(varname, check_status, var, kgenref_var)
CHARACTER(LEN=*), INTENT(IN) :: varname
TYPE(check_t), INTENT(INOUT) :: check_status
INTEGER, INTENT(IN) :: var, kgenref_var
INTEGER :: check_result
LOGICAL :: is_print = .FALSE.
integer :: diff
check_status%numTotal = check_status%numTotal + 1
IF (var == kgenref_var) THEN
check_status%numIdentical = check_status%numIdentical + 1
IF (check_status%verboseLevel > 1) THEN
WRITE (*, *) trim(adjustl(varname)), " is IDENTICAL."
END IF
check_result = CHECK_IDENTICAL
ELSE
diff = ABS(var - kgenref_var)
IF (diff <= check_status%tolerance) THEN
check_status%numInTol = check_status%numInTol + 1
IF (check_status%verboseLevel > 0) THEN
WRITE (*, *) trim(adjustl(varname)), " is NOT IDENTICAL(within tolerance)."
END IF
check_result = CHECK_IN_TOL
ELSE
check_status%numOutTol = check_status%numOutTol + 1
IF (check_status%verboseLevel > 0) THEN
WRITE (*, *) trim(adjustl(varname)), " is NOT IDENTICAL(out of tolerance)."
END IF
check_result = CHECK_OUT_TOL
END IF
END IF
IF (check_result == CHECK_IDENTICAL) THEN
IF (check_status%verboseLevel > 2) THEN
WRITE (*, *) "Difference is ", 0
WRITE (*, *) ""
END IF
ELSE IF (check_result == CHECK_OUT_TOL) THEN
IF (check_status%verboseLevel > 0) THEN
WRITE (*, *) "Difference is ", diff
WRITE (*, *) ""
END IF
ELSE IF (check_result == CHECK_IN_TOL) THEN
IF (check_status%verboseLevel > 1) THEN
WRITE (*, *) "Difference is ", diff
WRITE (*, *) ""
END IF
END IF
END SUBROUTINE kv_atm_compute_dyn_tend_integer__
!verify state subroutine for kv_atm_compute_dyn_tend_integer___ptr
RECURSIVE SUBROUTINE kv_atm_compute_dyn_tend_integer___ptr(varname, check_status, var, kgenref_var)
CHARACTER(LEN=*), INTENT(IN) :: varname
TYPE(check_t), INTENT(INOUT) :: check_status
INTEGER, pointer, INTENT(IN) :: var, kgenref_var