forked from NOAA-GFDL/GFDL_atmos_cubed_sphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_cases.F90
7978 lines (6987 loc) · 258 KB
/
test_cases.F90
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
!***********************************************************************
!* GNU Lesser General Public License
!*
!* This file is part of the FV3 dynamical core.
!*
!* The FV3 dynamical core is free software: you can redistribute it
!* and/or modify it under the terms of the
!* GNU Lesser General Public License as published by the
!* Free Software Foundation, either version 3 of the License, or
!* (at your option) any later version.
!*
!* The FV3 dynamical core is distributed in the hope that it will be
!* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
!* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!* See the GNU General Public License for more details.
!*
!* You should have received a copy of the GNU Lesser General Public
!* License along with the FV3 dynamical core.
!* If not, see <http://www.gnu.org/licenses/>.
!***********************************************************************
module test_cases_mod
use constants_mod, only: cnst_radius=>radius, pi=>pi_8, cnst_omega=>omega, grav, kappa, rdgas, cp_air, rvgas
use fv_arrays_mod, only: radius, omega ! scaled for small earth
use init_hydro_mod, only: p_var, hydro_eq, hydro_eq_ext
use fv_mp_mod, only: is_master, &
domain_decomp, fill_corners, XDir, YDir, &
mp_stop, mp_reduce_sum, mp_reduce_max, mp_gather
use fv_grid_utils_mod, only: cubed_to_latlon, great_circle_dist, mid_pt_sphere, &
ptop_min, inner_prod, get_latlon_vector, get_unit_vect2, &
g_sum, latlon2xyz, cart_to_latlon, make_eta_level, f_p, project_sphere_v
use fv_surf_map_mod, only: surfdrv
use fv_grid_tools_mod, only: todeg, missing, spherical_to_cartesian
use fv_eta_mod, only: compute_dz_L32, compute_dz_L101, set_hybrid_z, gw_1d, &
hybrid_z_dz
use mpp_mod, only: mpp_error, FATAL, mpp_root_pe, mpp_broadcast, mpp_sum, mpp_sync
use mpp_mod, only: stdlog, input_nml_file
use fms_mod, only: check_nml_error
use mpp_domains_mod, only: mpp_update_domains, domain2d
use mpp_parameter_mod, only: AGRID_PARAM=>AGRID,CGRID_NE_PARAM=>CGRID_NE, &
SCALAR_PAIR
use fv_sg_mod, only: qsmith
use fv_diagnostics_mod, only: prt_maxmin, ppme, eqv_pot, qcly0, is_ideal_case
use mpp_mod, only: mpp_pe, mpp_chksum, stdout
use fv_arrays_mod, only: fv_grid_type, fv_flags_type, fv_grid_bounds_type, R_GRID
use tracer_manager_mod, only: get_tracer_index
use field_manager_mod, only: MODEL_ATMOS
implicit none
private
!!! A NOTE ON TEST CASES
!!! If you have a DRY test case with no physics, be sure to set adiabatic = .TRUE. in your runscript.
!!!! This is especially important for nonhydrostatic cases in which delz will be initialized with the
!!!! virtual temperature effect.
! Test Case Number (cubed-sphere domain)
! SHALLOW WATER TESTS:
! -1 = Divergence conservation test
! 0 = Idealized non-linear deformational flow
! 1 = Cosine Bell advection (not implemented)
! 2 = Zonal geostrophically balanced flow
! 3 = non-rotating potential flow
! 4 = Tropical cyclones (merger of Rankine vortices)
! 5 = Zonal geostrophically balanced flow over an isolated mountain, with or without wind
! 6 = Rossby Wave number 4
! 7 = Barotropic instability
! 8 = "Soliton" propagation twin-vortex along equator
! 9 = Bates and Li (1997, Atmos.-Ocn.) polar vortex
! THREE-DIMENSIONAL TESTS
! 10 = hydrostatically balanced 3D test with idealized mountain
! 11 = Use this for cold starting the climate model with USGS terrain
! 12 = Jablonowski & Williamson Baroclinic test case (Steady State)
! 13 = Jablonowski & Williamson Baroclinic test case Perturbation
! -13 = DCMIP 2016 J&W BC Wave, with perturbation
! 14 = Use this for cold starting the Aqua-planet model
! 15 = Small Earth density current
! 16 = 3D hydrostatic non-rotating Gravity waves
! 17 = 3D hydrostatic rotating Inertial Gravity waves (case 6-3-0)
! 18 = 3D mountain-induced Rossby wave
! 19 = As in 15 but without rotation
! 20 = 3D non-hydrostatic lee vortices; non-rotating (small planet)
! 21 = 3D non-hydrostatic lee vortices; rotating (small planet)
! 30 = Super-Cell storm, curved hodograph, centered at OKC, no rotation
! 31 = Super-Cell storm, curved hodograph, centered at OKC, with rotation
! 32 = Super-Cell storm, straight hodograph, centered at OKC, no rotation
! 33 = HIWPP Schar mountain waves, Ridge mountain (M1)
! 34 = HIWPP Schar mountain waves, Circular mountain (M2)
! 35 = HIWPP Schar mountain waves, Circular mountain with shear (M3)
! 36 = HIWPP Super_Cell; no perturbation
! 37 = HIWPP Super_Cell; with the prescribed thermal
! 44 = Lock-exchange on the sphere; atm at rest with no mountain
! 45 = 3D Soliton
! 51 = 3D tracer advection (deformational nondivergent flow)
! 52 = Resting atmosphere over topography
! 55 = TC
! -55 = DCMIP 2016 TC test
! 101 = 3D non-hydrostatic Large-Eddy-Simulation (LES) with hybrid_z IC
!! Doubly-periodic tests (THREE-DIMENSIONAL)
! 1 = Pure advection (not implemented)
! 2 = Resting flow over a 1.5 km mountain
! 14 = Aqua-plane with hydro_eq sounding and optional warm bubble
! (sfc = 300 K, 200 K 250 mb tropopause)
! 15 = Warm bubble in isothermal atmosphere
! 16 = Cold bubble in isothermal atmosphere
! 17 = Symmetric Supercell
! 18 = Asymmetric supercell with M. Toy quarter-circle hodograph
! 19 = LJZ update to 17 with Cetrone-Houze marine sounding
! and several bubble and sounding options
! 101 = LES with isothermal atmosphere (not implemented)
integer :: sphum, theta_d
real(kind=R_GRID), parameter :: one = 1.d0
integer :: test_case = 11
logical :: bubble_do = .false.
logical :: no_wind = .false.
logical :: gaussian_dt = .false.
logical :: do_marine_sounding = .false.
real :: dt_amp = 2.1
real :: alpha = 0.0
integer :: Nsolitons = 2
real :: soliton_size = 750.e3, soliton_Umax = 50.
logical :: checker_tr
real :: small_earth_scale = 1.0
real :: umean = 0.0
! Case 0 parameters
real :: p0_c0 = 3.0
real :: rgamma = 5.0
real :: lat0 = pi/2.0 !pi/4.8
real :: lon0 = 0.0 !pi-0.8
! pi_shift moves the initial location of the cosine bell for Case 1
real, parameter :: pi_shift = 0.0 !3.0*pi/4.
! -1:null_op, 0:All-Grids, 1:C-Grid, 2:D-Grid, 3:A-Grid, 4:A-Grid then Rotate, 5:D-Grid with unit vectors then Rotate
integer, parameter :: initWindsCase0 =-1
integer, parameter :: initWindsCase1 = 1
integer, parameter :: initWindsCase2 = 5
integer, parameter :: initWindsCase5 = 5
integer, parameter :: initWindsCase6 =-1
integer, parameter :: initWindsCase9 =-1
real, allocatable, dimension(:) :: pz0, zz0
integer :: tracer_test, wind_field
! Ubar = initial wind speed parameter
real :: Ubar, Vbar
! gh0 = initial surface height parameter
real :: gh0
! case 9 parameters
real , allocatable :: case9_B(:,:)
real :: AofT(2)
! Validating fields used in statistics
real , allocatable :: phi0(:,:,:) ! Validating Field
real , allocatable :: ua0(:,:,:) ! Validating U-Wind
real , allocatable :: va0(:,:,:) ! Validating V-Windfms_io_exit, get_tile_string, &
real , allocatable :: gh_table(:), lats_table(:)
logical :: gh_initialized = .false.
! Initial Conservation statistics ; total mass ; enstrophy ; energy
real :: tmass_orig
real :: tvort_orig
real :: tener_orig
integer, parameter :: interpOrder = 1
public :: pz0, zz0
public :: read_namelist_test_case_nml, alpha, test_case
public :: init_case
public :: case9_forcing1, case9_forcing2, case51_forcing
public :: init_double_periodic
public :: checker_tracers
public :: radius, omega, small_earth_scale
INTERFACE mp_update_dwinds
MODULE PROCEDURE mp_update_dwinds_2d
MODULE PROCEDURE mp_update_dwinds_3d
END INTERFACE
contains
!-------------------------------------------------------------------------------
! vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv !
!
! init_winds :: initialize the winds
!
subroutine init_winds(UBar, u,v,ua,va,uc,vc, defOnGrid, npx, npy, ng, ndims, nregions, bounded_domain, gridstruct, domain, tile, bd)
! defOnGrid = -1:null_op, 0:All-Grids, 1:C-Grid, 2:D-Grid, 3:A-Grid, 4:A-Grid then Rotate, 5:D-Grid with unit vectors then Rotate
type(fv_grid_bounds_type), intent(IN) :: bd
real , intent(INOUT) :: UBar
real , intent(INOUT) :: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1)
real , intent(INOUT) :: v(bd%isd:bd%ied+1,bd%jsd:bd%jed )
real , intent(INOUT) :: uc(bd%isd:bd%ied+1,bd%jsd:bd%jed )
real , intent(INOUT) :: vc(bd%isd:bd%ied ,bd%jsd:bd%jed+1)
real , intent(INOUT) :: ua(bd%isd:bd%ied ,bd%jsd:bd%jed )
real , intent(INOUT) :: va(bd%isd:bd%ied ,bd%jsd:bd%jed )
integer, intent(IN) :: defOnGrid
integer, intent(IN) :: npx, npy
integer, intent(IN) :: ng
integer, intent(IN) :: ndims
integer, intent(IN) :: nregions
logical, intent(IN) :: bounded_domain
type(fv_grid_type), intent(IN), target :: gridstruct
type(domain2d), intent(INOUT) :: domain
integer, intent(IN) :: tile
real(kind=R_GRID) :: p1(2), p2(2), p3(2), p4(2), pt(2)
real(kind=R_GRID) :: e1(3), e2(3), ex(3), ey(3)
real :: dist, r, r0
integer :: i,j,k,n
real :: utmp, vtmp
real :: psi_b(bd%isd:bd%ied+1,bd%jsd:bd%jed+1), psi(bd%isd:bd%ied,bd%jsd:bd%jed), psi1, psi2
integer :: is2, ie2, js2, je2
real(kind=R_GRID), pointer, dimension(:,:,:) :: agrid, grid
real, pointer, dimension(:,:) :: area, rarea, fC, f0
real(kind=R_GRID), pointer, dimension(:,:,:) :: ee1, ee2, en1, en2
real(kind=R_GRID), pointer, dimension(:,:,:,:) :: ew, es
real, pointer, dimension(:,:) :: dx,dy, dxa,dya, rdxa, rdya, dxc,dyc
logical, pointer :: cubed_sphere, latlon
logical, pointer :: have_south_pole, have_north_pole
integer, pointer :: ntiles_g
real, pointer :: acapN, acapS, globalarea
integer :: is, ie, js, je
integer :: isd, ied, jsd, jed
grid => gridstruct%grid_64
agrid=> gridstruct%agrid_64
area => gridstruct%area
rarea => gridstruct%rarea
fC => gridstruct%fC
f0 => gridstruct%f0
ee1 => gridstruct%ee1
ee2 => gridstruct%ee2
ew => gridstruct%ew
es => gridstruct%es
en1 => gridstruct%en1
en2 => gridstruct%en2
dx => gridstruct%dx
dy => gridstruct%dy
dxa => gridstruct%dxa
dya => gridstruct%dya
rdxa => gridstruct%rdxa
rdya => gridstruct%rdya
dxc => gridstruct%dxc
dyc => gridstruct%dyc
cubed_sphere => gridstruct%cubed_sphere
latlon => gridstruct%latlon
have_south_pole => gridstruct%have_south_pole
have_north_pole => gridstruct%have_north_pole
ntiles_g => gridstruct%ntiles_g
acapN => gridstruct%acapN
acapS => gridstruct%acapS
globalarea => gridstruct%globalarea
is = bd%is
ie = bd%ie
js = bd%js
je = bd%je
isd = bd%isd
ied = bd%ied
jsd = bd%jsd
jed = bd%jed
if (bounded_domain) then
is2 = is-2
ie2 = ie+2
js2 = js-2
je2 = je+2
else
is2 = is
ie2 = ie
js2 = js
je2 = je
end if
200 format(i4.4,'x',i4.4,'x',i4.4,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14)
psi(:,:) = 1.e25
psi_b(:,:) = 1.e25
do j=jsd,jed
do i=isd,ied
psi(i,j) = (-1.0 * Ubar * radius *( sin(agrid(i,j,2)) *cos(alpha) - &
cos(agrid(i,j,1))*cos(agrid(i,j,2))*sin(alpha) ) )
enddo
enddo
call mpp_update_domains( psi, domain )
do j=jsd,jed+1
do i=isd,ied+1
psi_b(i,j) = (-1.0 * Ubar * radius *( sin(grid(i,j,2)) *cos(alpha) - &
cos(grid(i,j,1))*cos(grid(i,j,2))*sin(alpha) ) )
enddo
enddo
if ( (cubed_sphere) .and. (defOnGrid==0) ) then
do j=js,je+1
do i=is,ie
dist = dx(i,j)
vc(i,j) = (psi_b(i+1,j)-psi_b(i,j))/dist
if (dist==0) vc(i,j) = 0.
enddo
enddo
do j=js,je
do i=is,ie+1
dist = dy(i,j)
uc(i,j) = -1.0*(psi_b(i,j+1)-psi_b(i,j))/dist
if (dist==0) uc(i,j) = 0.
enddo
enddo
call mpp_update_domains( uc, vc, domain, gridtype=CGRID_NE_PARAM)
call fill_corners(uc, vc, npx, npy, VECTOR=.true., CGRID=.true.)
do j=js,je
do i=is,ie+1
dist = dxc(i,j)
v(i,j) = (psi(i,j)-psi(i-1,j))/dist
if (dist==0) v(i,j) = 0.
enddo
enddo
do j=js,je+1
do i=is,ie
dist = dyc(i,j)
u(i,j) = -1.0*(psi(i,j)-psi(i,j-1))/dist
if (dist==0) u(i,j) = 0.
enddo
enddo
call mp_update_dwinds(u, v, npx, npy, domain, bd)
do j=js,je
do i=is,ie
psi1 = 0.5*(psi(i,j)+psi(i,j-1))
psi2 = 0.5*(psi(i,j)+psi(i,j+1))
dist = dya(i,j)
ua(i,j) = -1.0 * (psi2 - psi1) / (dist)
if (dist==0) ua(i,j) = 0.
psi1 = 0.5*(psi(i,j)+psi(i-1,j))
psi2 = 0.5*(psi(i,j)+psi(i+1,j))
dist = dxa(i,j)
va(i,j) = (psi2 - psi1) / (dist)
if (dist==0) va(i,j) = 0.
enddo
enddo
elseif ( (cubed_sphere) .and. (defOnGrid==1) ) then
do j=js,je+1
do i=is,ie
dist = dx(i,j)
vc(i,j) = (psi_b(i+1,j)-psi_b(i,j))/dist
if (dist==0) vc(i,j) = 0.
enddo
enddo
do j=js,je
do i=is,ie+1
dist = dy(i,j)
uc(i,j) = -1.0*(psi_b(i,j+1)-psi_b(i,j))/dist
if (dist==0) uc(i,j) = 0.
enddo
enddo
call mpp_update_domains( uc, vc, domain, gridtype=CGRID_NE_PARAM)
call fill_corners(uc, vc, npx, npy, VECTOR=.true., CGRID=.true.)
call ctoa(uc,vc,ua,va,dx, dy, dxc,dyc,dxa,dya,npx,npy,ng, bd)
call atod(ua,va,u ,v ,dxa, dya,dxc,dyc,npx,npy,ng, bounded_domain, domain, bd)
! call d2a2c(npx,npy,1, is,ie, js,je, ng, u(isd,jsd),v(isd,jsd), &
! ua(isd,jsd),va(isd,jsd), uc(isd,jsd),vc(isd,jsd))
elseif ( (cubed_sphere) .and. (defOnGrid==2) ) then
do j=js2,je2
do i=is2,ie2+1
dist = dxc(i,j)
v(i,j) = (psi(i,j)-psi(i-1,j))/dist
if (dist==0) v(i,j) = 0.
enddo
enddo
do j=js2,je2+1
do i=is2,ie2
dist = dyc(i,j)
u(i,j) = -1.0*(psi(i,j)-psi(i,j-1))/dist
if (dist==0) u(i,j) = 0.
enddo
enddo
call mp_update_dwinds(u, v, npx, npy, domain, bd)
call dtoa( u, v,ua,va,dx,dy,dxa,dya,dxc,dyc,npx,npy,ng, bd)
call atoc(ua,va,uc,vc,dx,dy,dxa,dya,npx,npy,ng, bounded_domain, domain, bd)
elseif ( (cubed_sphere) .and. (defOnGrid==3) ) then
do j=js,je
do i=is,ie
psi1 = 0.5*(psi(i,j)+psi(i,j-1))
psi2 = 0.5*(psi(i,j)+psi(i,j+1))
dist = dya(i,j)
ua(i,j) = -1.0 * (psi2 - psi1) / (dist)
if (dist==0) ua(i,j) = 0.
psi1 = 0.5*(psi(i,j)+psi(i-1,j))
psi2 = 0.5*(psi(i,j)+psi(i+1,j))
dist = dxa(i,j)
va(i,j) = (psi2 - psi1) / (dist)
if (dist==0) va(i,j) = 0.
enddo
enddo
call mpp_update_domains( ua, va, domain, gridtype=AGRID_PARAM)
call atod(ua,va, u, v,dxa, dya,dxc,dyc,npx,npy,ng, bounded_domain, domain, bd)
call atoc(ua,va,uc,vc,dx,dy,dxa,dya,npx,npy,ng, bounded_domain,domain, bd)
elseif ( (latlon) .or. (defOnGrid==4) ) then
do j=js,je
do i=is,ie
ua(i,j) = Ubar * ( COS(agrid(i,j,2))*COS(alpha) + &
SIN(agrid(i,j,2))*COS(agrid(i,j,1))*SIN(alpha) )
va(i,j) = -Ubar * SIN(agrid(i,j,1))*SIN(alpha)
call mid_pt_sphere(grid(i,j,1:2), grid(i,j+1,1:2), p1)
call mid_pt_sphere(grid(i,j,1:2), grid(i+1,j,1:2), p2)
call mid_pt_sphere(grid(i+1,j,1:2), grid(i+1,j+1,1:2), p3)
call mid_pt_sphere(grid(i,j+1,1:2), grid(i+1,j+1,1:2), p4)
if (cubed_sphere) call rotate_winds(ua(i,j), va(i,j), p1,p2,p3,p4, agrid(i,j,1:2), 2, 1)
psi1 = 0.5*(psi(i,j)+psi(i,j-1))
psi2 = 0.5*(psi(i,j)+psi(i,j+1))
dist = dya(i,j)
if ( (tile==1) .and.(i==1) ) print*, ua(i,j), -1.0 * (psi2 - psi1) / (dist)
enddo
enddo
call mpp_update_domains( ua, va, domain, gridtype=AGRID_PARAM)
call atod(ua,va, u, v,dxa, dya,dxc,dyc,npx,npy,ng, bounded_domain, domain, bd)
call atoc(ua,va,uc,vc,dx,dy,dxa,dya,npx,npy,ng, bounded_domain, domain, bd)
elseif ( (latlon) .or. (defOnGrid==5) ) then
! SJL mods:
! v-wind:
do j=js2,je2
do i=is2,ie2+1
p1(:) = grid(i ,j ,1:2)
p2(:) = grid(i,j+1 ,1:2)
call mid_pt_sphere(p1, p2, pt)
call get_unit_vect2 (p1, p2, e2)
call get_latlon_vector(pt, ex, ey)
utmp = Ubar * ( COS(pt(2))*COS(alpha) + &
SIN(pt(2))*COS(pt(1))*SIN(alpha) )
vtmp = -Ubar * SIN(pt(1))*SIN(alpha)
v(i,j) = utmp*inner_prod(e2,ex) + vtmp*inner_prod(e2,ey)
enddo
enddo
! D grid u-wind:
do j=js2,je2+1
do i=is2,ie2
p1(:) = grid(i ,j ,1:2)
p2(:) = grid(i+1,j ,1:2)
call mid_pt_sphere(p1, p2, pt)
call get_unit_vect2 (p1, p2, e1)
call get_latlon_vector(pt, ex, ey)
utmp = Ubar * ( COS(pt(2))*COS(alpha) + &
SIN(pt(2))*COS(pt(1))*SIN(alpha) )
vtmp = -Ubar * SIN(pt(1))*SIN(alpha)
u(i,j) = utmp*inner_prod(e1,ex) + vtmp*inner_prod(e1,ey)
enddo
enddo
call mp_update_dwinds(u, v, npx, npy, domain, bd)
call dtoa( u, v,ua,va,dx,dy,dxa,dya,dxc,dyc,npx,npy,ng, bd)
call atoc(ua,va,uc,vc,dx,dy,dxa,dya,npx,npy,ng, bounded_domain, domain, bd)
else
!print*, 'Choose an appropriate grid to define the winds on'
!stop
endif
end subroutine init_winds
!
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ !
!-------------------------------------------------------------------------------
!-------------------------------------------------------------------------------
! vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv !
!
! init_case :: initialize the Williamson test cases:
! case 1 (2-D advection of a cosine bell)
! case 2 (Steady State Zonal Geostrophic Flow)
! case 5 (Steady State Zonal Geostrophic Flow over Mountain)
! case 6 (Rossby Wave-4 Case)
! case 9 (Stratospheric Vortex Breaking Case)
!
subroutine init_case(u,v,w,pt,delp,q,phis, ps,pe,peln,pk,pkz, uc,vc, ua,va, ak, bk, &
gridstruct, flagstruct, npx, npy, npz, ng, ncnst, nwat, ndims, nregions, &
dry_mass, mountain, moist_phys, hydrostatic, hybrid_z, delz, ze0, adiabatic, &
ks, npx_global, ptop, domain_in, tile_in, bd)
type(fv_grid_bounds_type), intent(IN) :: bd
real , intent(INOUT) :: u(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
real , intent(INOUT) :: v(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
real , intent(INOUT) :: w(bd%isd: ,bd%jsd: ,1:)
real , intent(INOUT) :: pt(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
real , intent(INOUT) :: delp(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
real , intent(INOUT) :: q(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz, ncnst)
real , intent(INOUT) :: phis(bd%isd:bd%ied ,bd%jsd:bd%jed )
real , intent(INOUT) :: ps(bd%isd:bd%ied ,bd%jsd:bd%jed )
real , intent(INOUT) :: pe(bd%is-1:bd%ie+1,npz+1,bd%js-1:bd%je+1)
real , intent(INOUT) :: pk(bd%is:bd%ie ,bd%js:bd%je ,npz+1)
real , intent(INOUT) :: peln(bd%is :bd%ie ,npz+1 ,bd%js:bd%je)
real , intent(INOUT) :: pkz(bd%is:bd%ie ,bd%js:bd%je ,npz )
real , intent(INOUT) :: uc(bd%isd:bd%ied+1,bd%jsd:bd%jed ,npz)
real , intent(INOUT) :: vc(bd%isd:bd%ied ,bd%jsd:bd%jed+1,npz)
real , intent(INOUT) :: ua(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
real , intent(INOUT) :: va(bd%isd:bd%ied ,bd%jsd:bd%jed ,npz)
real , intent(inout) :: delz(bd%is:,bd%js:,1:)
real , intent(inout) :: ze0(bd%is:,bd%js:,1:)
real , intent(inout) :: ak(npz+1)
real , intent(inout) :: bk(npz+1)
integer, intent(IN) :: npx, npy, npz
integer, intent(IN) :: ng, ncnst, nwat
integer, intent(IN) :: ndims
integer, intent(IN) :: nregions
real, intent(IN) :: dry_mass
logical, intent(IN) :: mountain
logical, intent(IN) :: moist_phys
logical, intent(IN) :: hydrostatic
logical, intent(IN) :: hybrid_z
logical, intent(IN) :: adiabatic
integer, intent(IN) :: ks
type(fv_grid_type), target :: gridstruct
type(fv_flags_type), target, intent(IN) :: flagstruct
integer, intent(IN) :: npx_global
integer, intent(IN), target :: tile_in
real, intent(INOUT) :: ptop
type(domain2d), intent(IN), target :: domain_in
real :: tmp(1-ng:npx +ng,1-ng:npy +ng,1:nregions)
real :: tmp1(1 :npx ,1 :npy ,1:nregions)
real(kind=R_GRID) :: p0(2) ! Temporary Point
real(kind=R_GRID) :: p0e(2) ! Temporary Point
real(kind=R_GRID) :: p0w(2) ! Temporary Point
real(kind=R_GRID) :: p1(2) ! Temporary Point
real(kind=R_GRID) :: p2(2) ! Temporary Point
real(kind=R_GRID) :: p3(2) ! Temporary Point
real(kind=R_GRID) :: p4(2) ! Temporary Point
real(kind=R_GRID) :: pa(2) ! Temporary Point
real(kind=R_GRID) :: pb(2) ! Temporary Point
real(kind=R_GRID) :: pcen(2) ! Temporary Point
real(kind=R_GRID) :: e1(3), e2(3), e3(3), ex(3), ey(3)
real :: dist, r, r1, r2, r0, omg, A, B, C
integer :: i,j,k,nreg,z,zz
integer :: i0,j0,n0, nt
real :: utmp,vtmp,ftmp
real :: rk
integer, parameter :: jm = 5761
real :: ll_phi(jm)
real :: ll_u(jm)
real :: ll_j(jm)
real :: cose(jm)
real :: sine(jm)
real :: cosp(jm)
real :: ddeg, deg, DDP, DP, ph5
real :: myB, myC, yy
integer :: jj,jm1
real :: Vtx, p, w_p
real :: x1,y1,z1,x2,y2,z2,ang
integer :: initWindsCase
real :: dummy
real :: ftop
real :: v1,v2
real :: m=1
real :: n=1
real :: L1_norm
real :: L2_norm
real :: Linf_norm
real :: pmin, pmin1
real :: pmax, pmax1
real :: grad(bd%isd:bd%ied ,bd%jsd:bd%jed,2)
real :: div0(bd%isd:bd%ied ,bd%jsd:bd%jed )
real :: vor0(bd%isd:bd%ied ,bd%jsd:bd%jed )
real :: divg(bd%isd:bd%ied ,bd%jsd:bd%jed )
real :: vort(bd%isd:bd%ied ,bd%jsd:bd%jed )
real :: ztop, rgrav, p00, pturb, zmid, pk0, t00
real :: dz1(npz), ppt(npz)
real :: ze1(npz+1), pe1(npz+1)
integer :: nlon,nlat
character(len=80) :: oflnm, hgtflnm
integer :: is2, ie2, js2, je2
real :: psi(bd%isd:bd%ied,bd%jsd:bd%jed)
real :: psi_b(bd%isd:bd%ied+1,bd%jsd:bd%jed+1)
real :: psi1, psi2
! Baroclinic Test Case 12
real :: eta(npz), eta_0, eta_s, eta_t
real :: eta_v(npz), press, anti_rot
real :: T_0, T_mean, delta_T, lapse_rate, n2, zeta, s0
real :: pt1,pt2,pt3,pt4,pt5,pt6, pt7, pt8, pt9, u1, pt0
real :: uu1, uu2, uu3, vv1, vv2, vv3
! real wbuffer(npx+1,npz)
! real sbuffer(npy+1,npz)
real wbuffer(npy+2,npz)
real sbuffer(npx+2,npz)
real :: gz(bd%isd:bd%ied,bd%jsd:bd%jed,npz+1), zt, zdist
real :: zvir
integer :: Cl, Cl2
! Super-Cell
real :: us0 = 30.
real, dimension(npz):: pk1, ts1, qs1, uz1, zs1, dudz
real:: zm, zc
real(kind=R_GRID):: pp0(2) ! center position
!Test case 35
real:: cs_m3
!Test case 51
real :: omega0, k_cell, z0, H, px
real :: d1, d2, p1p(2), rt, s
real :: wind_alpha, period, h0, rm, zp3(3), dz3(3), k0, lp
!Test case 55
real, dimension(npz+1) :: pe0, gz0, ue, ve, we, pte, qe
real :: d, cor, exppr, exppz, gamma, Ts0, q00, exponent, ztrop, height, zp, rp
real :: qtrop, ttrop, zq1, zq2
real :: dum, dum1, dum2, dum3, dum4, dum5, dum6, ptmp, uetmp, vetmp
real :: pe_u(bd%is:bd%ie,npz+1,bd%js:bd%je+1)
real :: pe_v(bd%is:bd%ie+1,npz+1,bd%js:bd%je)
real :: ps_u(bd%is:bd%ie,bd%js:bd%je+1)
real :: ps_v(bd%is:bd%ie+1,bd%js:bd%je)
real :: dz, zetam
real(kind=R_GRID), pointer, dimension(:,:,:) :: agrid, grid
real(kind=R_GRID), pointer, dimension(:,:) :: area
real, pointer, dimension(:,:) :: rarea, fC, f0
real(kind=R_GRID), pointer, dimension(:,:,:) :: ee1, ee2, en1, en2
real(kind=R_GRID), pointer, dimension(:,:,:,:) :: ew, es
real, pointer, dimension(:,:) :: dx,dy, dxa,dya, rdxa, rdya, dxc,dyc
logical, pointer :: cubed_sphere, latlon
type(domain2d), pointer :: domain
integer, pointer :: tile
logical, pointer :: have_south_pole, have_north_pole
integer, pointer :: ntiles_g
real, pointer :: acapN, acapS, globalarea
integer :: is, ie, js, je
integer :: isd, ied, jsd, jed
is = bd%is
ie = bd%ie
js = bd%js
je = bd%je
isd = bd%isd
ied = bd%ied
jsd = bd%jsd
jed = bd%jed
grid => gridstruct%grid_64
agrid=> gridstruct%agrid_64
area => gridstruct%area_64
rarea => gridstruct%rarea
fC => gridstruct%fC
f0 => gridstruct%f0
ee1 => gridstruct%ee1
ee2 => gridstruct%ee2
ew => gridstruct%ew
es => gridstruct%es
en1 => gridstruct%en1
en2 => gridstruct%en2
dx => gridstruct%dx
dy => gridstruct%dy
dxa => gridstruct%dxa
dya => gridstruct%dya
rdxa => gridstruct%rdxa
rdya => gridstruct%rdya
dxc => gridstruct%dxc
dyc => gridstruct%dyc
cubed_sphere => gridstruct%cubed_sphere
latlon => gridstruct%latlon
domain => domain_in
tile => tile_in
have_south_pole => gridstruct%have_south_pole
have_north_pole => gridstruct%have_north_pole
ntiles_g => gridstruct%ntiles_g
acapN => gridstruct%acapN
acapS => gridstruct%acapS
globalarea => gridstruct%globalarea
if (gridstruct%bounded_domain) then
is2 = isd
ie2 = ied
js2 = jsd
je2 = jed
else
is2 = is
ie2 = ie
js2 = js
je2 = je
end if
pe(:,:,:) = 0.0
pt(:,:,:) = 1.0
f0(:,:) = huge(dummy)
fC(:,:) = huge(dummy)
do j=jsd,jed+1
do i=isd,ied+1
fC(i,j) = 2.*omega*( -1.*cos(grid(i,j,1))*cos(grid(i,j,2))*sin(alpha) + &
sin(grid(i,j,2))*cos(alpha) )
enddo
enddo
do j=jsd,jed
do i=isd,ied
f0(i,j) = 2.*omega*( -1.*cos(agrid(i,j,1))*cos(agrid(i,j,2))*sin(alpha) + &
sin(agrid(i,j,2))*cos(alpha) )
enddo
enddo
call mpp_update_domains( f0, domain )
if (cubed_sphere) call fill_corners(f0, npx, npy, YDir)
delp(isd:is-1,jsd:js-1,1:npz)=0.
delp(isd:is-1,je+1:jed,1:npz)=0.
delp(ie+1:ied,jsd:js-1,1:npz)=0.
delp(ie+1:ied,je+1:jed,1:npz)=0.
#if defined(SW_DYNAMICS)
select case (test_case)
case(-2)
case(-1)
Ubar = (2.0*pi*radius)/(12.0*86400.0)
gh0 = 2.94e4
phis = 0.0
do j=js,je
do i=is,ie
delp(i,j,1) = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(agrid(i ,j ,1))*cos(agrid(i ,j ,2))*sin(alpha) + &
sin(agrid(i ,j ,2))*cos(alpha) ) ** 2.0
enddo
enddo
call init_winds(UBar, u,v,ua,va,uc,vc, 1, npx, npy, ng, ndims, nregions, gridstruct%bounded_domain, gridstruct, domain, tile,bd)
! Test Divergence operator at cell centers
do j=js,je
do i=is,ie
divg(i,j) = (rarea(i,j)) * ( (uc(i+1,j,1)*dy(i+1,j) - uc(i,j,1)*dy(i,j)) + &
(vc(i,j+1,1)*dx(i,j+1) - vc(i,j,1)*dx(i,j)) )
if ( (tile==1) .and. (i==1) ) write(*,200) i,j,tile, divg(i,j), uc(i,j,1), uc(i+1,j,1), vc(i,j,1), vc(i,j+1,1)
enddo
enddo
! Test Vorticity operator at cell centers
do j=js,je
do i=is,ie
vort(i,j) = (rarea(i,j)) * ( (v(i+1,j,1)*dy(i+1,j) - v(i,j,1)*dy(i,j)) - &
(u(i,j+1,1)*dx(i,j+1) - u(i,j,1)*dx(i,j)) )
enddo
enddo
div0(:,:) = 1.e-20
! call mpp_update_domains( div0, domain )
! call mpp_update_domains( vor0, domain )
! call mpp_update_domains( divg, domain )
! call mpp_update_domains( vort, domain )
200 format(i4.4,'x',i4.4,'x',i4.4,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14,' ',e21.14)
201 format(' ',A,e21.14,' ',e21.14)
202 format(' ',A,i4.4,'x',i4.4,'x',i4.4)
if ( is_master() ) then
write(*,*) ' Error Norms of Analytical Divergence field C-Winds initialized'
write(*,201) 'Divergence MAX error : ', pmax
write(*,201) 'Divergence MIN error : ', pmin
write(*,201) 'Divergence L1_norm : ', L1_norm
write(*,201) 'Divergence L2_norm : ', L2_norm
write(*,201) 'Divergence Linf_norm : ', Linf_norm
endif
call init_winds(UBar, u,v,ua,va,uc,vc, 3, npx, npy, ng, ndims, nregions, gridstruct%bounded_domain, gridstruct, domain, tile, bd)
! Test Divergence operator at cell centers
do j=js,je
do i=is,ie
divg(i,j) = (rarea(i,j)) * ( (uc(i+1,j,1)*dy(i+1,j) - uc(i,j,1)*dy(i,j)) + &
(vc(i,j+1,1)*dx(i,j+1) - vc(i,j,1)*dx(i,j)) )
if ( (tile==1) .and. (i==1) ) write(*,200) i,j,tile, divg(i,j), uc(i,j,1), uc(i+1,j,1), vc(i,j,1), vc(i,j+1,1)
enddo
enddo
! Test Vorticity operator at cell centers
do j=js,je
do i=is,ie
vort(i,j) = (rarea(i,j)) * ( (v(i+1,j,1)*dy(i+1,j) - v(i,j,1)*dy(i,j)) - &
(u(i,j+1,1)*dx(i,j+1) - u(i,j,1)*dx(i,j)) )
enddo
enddo
ua0 = ua
va0 = va
div0(:,:) = 1.e-20
if ( is_master() ) then
write(*,*) ' Error Norms of Analytical Divergence field A-Winds initialized'
write(*,201) 'Divergence MAX error : ', pmax
write(*,201) 'Divergence MIN error : ', pmin
write(*,201) 'Divergence L1_norm : ', L1_norm
write(*,201) 'Divergence L2_norm : ', L2_norm
write(*,201) 'Divergence Linf_norm : ', Linf_norm
endif
call init_winds(UBar, u,v,ua,va,uc,vc, 2, npx, npy, ng, ndims, nregions, gridstruct%bounded_domain, gridstruct, domain, tile, bd)
!call d2a2c(npx,npy,1, is,ie, js,je, ng, u(isd,jsd,1),v(isd,jsd,1), &
! ua(isd,jsd,1),va(isd,jsd,1), uc(isd,jsd,1),vc(isd,jsd,1))
! Test Divergence operator at cell centers
do j=js,je
do i=is,ie
divg(i,j) = (rarea(i,j)) * ( (uc(i+1,j,1)*dy(i+1,j) - uc(i,j,1)*dy(i,j)) + &
(vc(i,j+1,1)*dx(i,j+1) - vc(i,j,1)*dx(i,j)) )
if ( (tile==1) .and. ((i==1) .or.(i==npx-1)) ) write(*,200) i,j,tile, divg(i,j), uc(i,j,1), uc(i+1,j,1), vc(i,j,1), vc(i,j+1,1)
enddo
enddo
! Test Vorticity operator at cell centers
do j=js,je
do i=is,ie
vort(i,j) = (rarea(i,j)) * ( (v(i+1,j,1)*dy(i+1,j) - v(i,j,1)*dy(i,j)) - &
(u(i,j+1,1)*dx(i,j+1) - u(i,j,1)*dx(i,j)) )
enddo
enddo
div0(:,:) = 1.e-20
if ( is_master() ) then
write(*,*) ' Error Norms of Analytical Divergence field D-Winds initialized'
write(*,201) 'Divergence MAX error : ', pmax
write(*,201) 'Divergence MIN error : ', pmin
write(*,201) 'Divergence L1_norm : ', L1_norm
write(*,201) 'Divergence L2_norm : ', L2_norm
write(*,201) 'Divergence Linf_norm : ', Linf_norm
endif
call mp_stop()
stop
case(0)
do j=jsd,jed
do i=isd,ied
x1 = agrid(i,j,1)
y1 = agrid(i,j,2)
z1 = radius
p = p0_c0 * cos(y1)
Vtx = ((3.0*SQRT(2.0))/2.0) * (( 1.0/cosh(p) )**2.0) * tanh(p)
w_p = 0.0
if (p /= 0.0) w_p = Vtx/p
delp(i,j,1) = 1.0 - tanh( (p/rgamma) * sin(x1 - w_p*0.0) )
ua(i,j,1) = w_p*(sin(lat0)*cos(agrid(i,j,2)) + cos(lat0)*cos(agrid(i,j,1) - lon0)*sin(agrid(i,j,2)))
va(i,j,1) = w_p*cos(lat0)*sin(agrid(i,j,1) - lon0)
ua(i,j,1) = ua(i,j,1)*radius/86400.0
va(i,j,1) = va(i,j,1)*radius/86400.0
call mid_pt_sphere(grid(i,j,1:2), grid(i,j+1,1:2), p1)
call mid_pt_sphere(grid(i,j,1:2), grid(i+1,j,1:2), p2)
call mid_pt_sphere(grid(i+1,j,1:2), grid(i+1,j+1,1:2), p3)
call mid_pt_sphere(grid(i,j+1,1:2), grid(i+1,j+1,1:2), p4)
if (cubed_sphere) call rotate_winds(ua(i,j,1),va(i,j,1), p1,p2,p3,p4, agrid(i,j,1:2), 2, 1)
enddo
enddo
call mpp_update_domains( ua, va, domain, gridtype=AGRID_PARAM)
call atod(ua,va, u, v,dxa, dya,dxc,dyc,npx,npy,ng, gridstruct%bounded_domain, domain, bd)
call mp_update_dwinds(u, v, npx, npy, npz, domain, bd)
call atoc(ua,va,uc,vc,dx,dy,dxa,dya,npx,npy,ng, gridstruct%bounded_domain, domain, bd)
call mpp_update_domains( uc, vc, domain, gridtype=CGRID_NE_PARAM)
call fill_corners(uc, vc, npx, npy, npz, VECTOR=.true., CGRID=.true.)
initWindsCase=initWindsCase0
case(1)
Ubar = (2.0*pi*radius)/(12.0*86400.0)
gh0 = 1.0
phis = 0.0
r0 = radius/3. !RADIUS radius/3.
p1(1) = pi/2. + pi_shift
p1(2) = 0.
do j=jsd,jed
do i=isd,ied
p2(1) = agrid(i,j,1)
p2(2) = agrid(i,j,2)
r = great_circle_dist( p1, p2, radius )
if (r < r0) then
delp(i,j,1) = phis(i,j) + gh0*0.5*(1.0+cos(PI*r/r0))
else
delp(i,j,1) = phis(i,j)
endif
enddo
enddo
initWindsCase=initWindsCase1
case(2)
gh0 = 1.0e-6
r0 = radius/3. !RADIUS radius/3.
p1(2) = 35./180.*pi !0.
p1(1) = pi/4.!pi/2.
do j=jsd,jed
do i=isd,ied
p2(1) = agrid(i,j,1)
p2(2) = agrid(i,j,2)
r = great_circle_dist( p1, p2, radius )
if (r < r0 .and. .not.( abs(p1(2)-p2(2)) < 1./18. .and. p2(1)-p1(1) < 5./36.)) then
q(i,j,1,1) = gh0
else
q(i,j,1,1) = 0.
endif
enddo
enddo
Ubar = (2.0*pi*radius)/(12.0*86400.0)
gh0 = 2.94e4
phis = 0.0
do j=js2,je2
do i=is2,ie2
! do j=jsd,jed
! do i=isd,ied
#ifdef FIVE_AVG
pt5 = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(agrid(i ,j ,1))*cos(agrid(i ,j ,2))*sin(alpha) + &
sin(agrid(i ,j ,2))*cos(alpha) ) ** 2.0
pt1 = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(grid(i ,j ,1))*cos(grid(i ,j ,2))*sin(alpha) + &
sin(grid(i ,j ,2))*cos(alpha) ) ** 2.0
pt2 = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(grid(i+1,j ,1))*cos(grid(i+1,j ,2))*sin(alpha) + &
sin(grid(i+1,j ,2))*cos(alpha) ) ** 2.0
pt3 = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(grid(i+1,j+1,1))*cos(grid(i+1,j+1,2))*sin(alpha) + &
sin(grid(i+1,j+1,2))*cos(alpha) ) ** 2.0
pt4 = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(grid(i,j+1,1))*cos(grid(i,j+1,2))*sin(alpha) + &
sin(grid(i,j+1,2))*cos(alpha) ) ** 2.0
delp(i,j,1) = (0.25*(pt1+pt2+pt3+pt4) + 3.*pt5) / 4.
#else
delp(i,j,1) = gh0 - (radius*omega*Ubar + (Ubar*Ubar)/2.) * &
( -1.*cos(agrid(i ,j ,1))*cos(agrid(i ,j ,2))*sin(alpha) + &
sin(agrid(i ,j ,2))*cos(alpha) ) ** 2.0
#endif FIVE_AVG
enddo
enddo
initWindsCase=initWindsCase2
case(3)
!----------------------------
! Non-rotating potential flow
!----------------------------
if (no_wind) then
ubar = 0.
else
ubar = 40.
endif
gh0 = 1.0e3 * grav
phis = 0.0
r0 = radius/3. !RADIUS radius/3.
p1(1) = pi*1.5
p1(2) = 0.
do j=jsd,jed
do i=isd,ied
p2(1) = agrid(i,j,1)
p2(2) = agrid(i,j,2)
r = great_circle_dist( p1, p2, radius )
if (r < r0) then
delp(i,j,1) = phis(i,j) + gh0*0.5*(1.0+cos(PI*r/r0))
else