forked from NOAA-PSL/stochastic_physics
-
Notifications
You must be signed in to change notification settings - Fork 1
/
getcon_lag_stochy.f
89 lines (78 loc) · 2.65 KB
/
getcon_lag_stochy.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
!>@brief The module 'getcon_lag_stochy_mod' contains the subroute getcon_lag_stochy
module getcon_lag_stochy_mod
implicit none
contains
!>@brief The subroutine 'getcon_lag' calculates grid properties and domain decompostion for the gaussian grid
!>@details This code is taken from the legacy spectral GFS
subroutine getcon_lag_stochy(lats_nodes_a,global_lats_a,
& lats_nodes_h,global_lats_h_sn,
& lonsperlat,xhalo,yhalo)
use spectral_layout_mod, only : me,nodes,jcap,latg,latg2,lonf,
& colrad_a,sinlat_a,
& ipt_lats_node_h,lat1s_h,lats_dim_h,
& lats_node_h,lats_node_h_max,lon_dim_h
use setlats_lag_stochy_mod, only: setlats_lag_stochy
implicit none
!
integer yhalo,xhalo
!
integer, dimension(nodes) :: lats_nodes_a, lats_nodes_h
integer, dimension(latg) :: lonsperlat, global_lats_a
integer, dimension(latg+2*yhalo*nodes) :: global_lats_h_sn
!
integer i,j,l,n,lat,i1,i2,node,nodesio
integer, dimension(latg+2*yhalo*nodes) :: global_lats_h_ns
!
if (me == 0) print 100, jcap, me
100 format ('getcon_h jcap= ',i4,2x,'me=',i3)
do lat = 1, latg2
lonsperlat(latg+1-lat) = lonsperlat(lat)
end do
nodesio = nodes
! print*,'con_h me,nodes,nodesio = ',me,nodes,nodesio
call setlats_lag_stochy(lats_nodes_a,global_lats_a,
& lats_nodes_h,global_lats_h_ns,yhalo)
! reverse order for use in set_halos
i1 = 1
i2 = 0
do n=1,nodes
j = 0
i2 = i2 + lats_nodes_h(n)
do i=i1,i2
j = j + 1
global_lats_h_sn(i) = global_lats_h_ns(i2+1-j)
enddo
i1 = i2 + 1
enddo
830 format(10(i4,1x))
lats_dim_h = 0
do node=1,nodes
lats_dim_h = max(lats_dim_h, lats_nodes_h(node))
enddo
lats_node_h = lats_nodes_h(me+1)
lats_node_h_max = 0
do i=1,nodes
lats_node_h_max = max(lats_node_h_max, lats_nodes_h(i))
enddo
ipt_lats_node_h = 1
if ( me > 0 ) then
do node=1,me
ipt_lats_node_h = ipt_lats_node_h + lats_nodes_h(node)
enddo
endif
do j=1,latg2
sinlat_a(j) = cos(colrad_a(j))
enddo
do l=0,jcap
do lat = 1, latg2
if ( l <= min(jcap,lonsperlat(lat)/2) ) then
lat1s_h(l) = lat
go to 200
endif
end do
200 continue
end do
lon_dim_h = lonf + 1 + xhalo + xhalo !even/odd
return
end
end module getcon_lag_stochy_mod