forked from wrf-model/WRF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop_based_y_shift_code.h
137 lines (136 loc) · 6.95 KB
/
loop_based_y_shift_code.h
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
p => grid%head_statevars%next
DO WHILE ( ASSOCIATED( p ) )
IF ( p%ProcOrient .NE. 'X' .AND. p%ProcOrient .NE. 'Y' ) THEN
IF ( INDEX(TRIM(p%Stagger),'Y') .GT. 0 ) THEN
jpf = MIN(jpe,jde)
ELSE
jpf = MIN(jpe,jde-1)
ENDIF
IF ( p%Ndim .EQ. 2 ) THEN
IF ( p%MemoryOrder(1:1) .EQ. 'X' .AND. p%MemoryOrder(2:2) .EQ. 'Y' ) THEN
IF ( p%Type .EQ. 'r' ) THEN
IF ( SIZE(p%rfield_2d,1)*SIZE(p%rfield_2d,2) .GT. 1 ) THEN
p%rfield_2d(ims:ime,jps:jpf) = p%rfield_2d(ims:ime,jps+py:jpf+py)
ENDIF
ELSE IF ( p%Type .EQ. 'd' ) THEN
IF ( SIZE(p%dfield_2d,1)*SIZE(p%dfield_2d,2) .GT. 1 ) THEN
p%dfield_2d(ims:ime,jps:jpf) = p%dfield_2d(ims:ime,jps+py:jpf+py)
ENDIF
ELSE IF ( p%Type .EQ. 'i' ) THEN
IF ( SIZE(p%ifield_2d,1)*SIZE(p%ifield_2d,2) .GT. 1 ) THEN
p%ifield_2d(ims:ime,jps:jpf) = p%ifield_2d(ims:ime,jps+py:jpf+py)
ENDIF
ELSE IF ( p%Type .EQ. 'l' ) THEN
IF ( SIZE(p%lfield_2d,1)*SIZE(p%lfield_2d,2) .GT. 1 ) THEN
p%lfield_2d(ims:ime,jps:jpf) = p%lfield_2d(ims:ime,jps+py:jpf+py)
ENDIF
ENDIF
ENDIF
ELSE IF ( p%Ndim .EQ. 3 ) THEN
IF ( p%MemoryOrder(1:1) .EQ. 'X' .AND. p%MemoryOrder(3:3) .EQ. 'Y' ) THEN
IF ( p%Type .EQ. 'r' ) THEN
IF ( SIZE(p%rfield_3d,1)*SIZE(p%rfield_3d,3) .GT. 1 ) THEN
p%rfield_3d(ims:ime,:,jps:jpf) = p%rfield_3d(ims:ime,:,jps+py:jpf+py)
ENDIF
ELSE IF ( p%Type .EQ. 'd' ) THEN
IF ( SIZE(p%dfield_3d,1)*SIZE(p%dfield_3d,3) .GT. 1 ) THEN
p%dfield_3d(ims:ime,:,jps:jpf) = p%dfield_3d(ims:ime,:,jps+py:jpf+py)
ENDIF
ELSE IF ( p%Type .EQ. 'i' ) THEN
IF ( SIZE(p%ifield_3d,1)*SIZE(p%ifield_3d,3) .GT. 1 ) THEN
p%ifield_3d(ims:ime,:,jps:jpf) = p%ifield_3d(ims:ime,:,jps+py:jpf+py)
ENDIF
ELSE IF ( p%Type .EQ. 'l' ) THEN
CALL wrf_error_fatal( '3D logical arrays cannot be shifted for moving nests' )
ENDIF
ELSE IF ( p%MemoryOrder(1:2) .EQ. 'XY' ) THEN
IF ( p%Type .EQ. 'r' ) THEN
IF ( SIZE(p%rfield_3d,1)*SIZE(p%rfield_3d,2) .GT. 1 ) THEN
p%rfield_3d(ims:ime,jps:jpf,:) = p%rfield_3d(ims:ime,jps+py:jpf+py,:)
ENDIF
ELSE IF ( p%Type .EQ. 'd' ) THEN
IF ( SIZE(p%dfield_3d,1)*SIZE(p%dfield_3d,2) .GT. 1 ) THEN
p%dfield_3d(ims:ime,jps:jpf,:) = p%dfield_3d(ims:ime,jps+py:jpf+py,:)
ENDIF
ELSE IF ( p%Type .EQ. 'i' ) THEN
IF ( SIZE(p%ifield_3d,1)*SIZE(p%ifield_3d,2) .GT. 1 ) THEN
p%ifield_3d(ims:ime,jps:jpf,:) = p%ifield_3d(ims:ime,jps+py:jpf+py,:)
ENDIF
ELSE IF ( p%Type .EQ. 'l' ) THEN
CALL wrf_error_fatal( '3D logical arrays cannot be shifted for moving nests' )
ENDIF
ENDIF
ELSE IF ( p%Ndim .EQ. 4 ) THEN
IF ( p%MemoryOrder(1:1) .EQ. 'X' .AND. p%MemoryOrder(3:3) .EQ. 'Y' ) THEN
IF ( p%Type .EQ. 'r' ) THEN
IF ( SIZE(p%rfield_4d,1)*SIZE(p%rfield_4d,3) .GT. 1 ) THEN
IF ( p%scalar_array ) THEN
DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id)
p%rfield_4d(ims:ime,:,jps:jpf,itrace) = p%rfield_4d(ims:ime,:,jps+py:jpf+py,itrace)
ENDDO
ELSE
p%rfield_4d(ims:ime,:,jps:jpf,:) = p%rfield_4d(ims:ime,:,jps+py:jpf+py,:)
ENDIF
ENDIF
ELSE IF ( p%Type .EQ. 'd' ) THEN
IF ( SIZE(p%dfield_4d,1)*SIZE(p%dfield_4d,3) .GT. 1 ) THEN
IF ( p%scalar_array ) THEN
DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id)
p%dfield_4d(ims:ime,:,jps:jpf,itrace) = p%dfield_4d(ims:ime,:,jps+py:jpf+py,itrace)
ENDDO
ELSE
p%dfield_4d(ims:ime,:,jps:jpf,:) = p%dfield_4d(ims:ime,:,jps+py:jpf+py,:)
ENDIF
ENDIF
ELSE IF ( p%Type .EQ. 'i' ) THEN
IF ( SIZE(p%ifield_4d,1)*SIZE(p%ifield_4d,3) .GT. 1 ) THEN
IF ( p%scalar_array ) THEN
DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id)
p%ifield_4d(ims:ime,:,jps:jpf,itrace) = p%ifield_4d(ims:ime,:,jps+py:jpf+py,itrace)
ENDDO
ELSE
p%ifield_4d(ims:ime,:,jps:jpf,:) = p%ifield_4d(ims:ime,:,jps+py:jpf+py,:)
ENDIF
ENDIF
ELSE IF ( p%Type .EQ. 'l' ) THEN
CALL wrf_error_fatal( '4D logical arrays cannot be shifted for moving nests' )
ENDIF
ELSE IF ( p%MemoryOrder(1:2) .EQ. 'XY' ) THEN
IF ( p%Type .EQ. 'r' ) THEN
IF ( SIZE(p%rfield_4d,1)*SIZE(p%rfield_4d,2) .GT. 1 ) THEN
IF ( p%scalar_array ) THEN
DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id)
p%rfield_4d(ims:ime,jps:jpf,:,itrace) = p%rfield_4d(ims:ime,jps+py:jpf+py,:,itrace)
ENDDO
ELSE
p%rfield_4d(ims:ime,jps:jpf,:,:) = p%rfield_4d(ims:ime,jps+py:jpf+py,:,:)
ENDIF
ENDIF
ELSE IF ( p%Type .EQ. 'd' ) THEN
IF ( SIZE(p%dfield_4d,1)*SIZE(p%dfield_4d,2) .GT. 1 ) THEN
IF ( p%scalar_array ) THEN
DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id)
p%dfield_4d(ims:ime,jps:jpf,:,itrace) = p%dfield_4d(ims:ime,jps+py:jpf+py,:,itrace)
ENDDO
ELSE
p%dfield_4d(ims:ime,jps:jpf,:,:) = p%dfield_4d(ims:ime,jps+py:jpf+py,:,:)
ENDIF
ENDIF
ELSE IF ( p%Type .EQ. 'i' ) THEN
IF ( SIZE(p%ifield_4d,1)*SIZE(p%ifield_4d,2) .GT. 1 ) THEN
IF ( p%scalar_array ) THEN
DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id)
p%ifield_4d(ims:ime,jps:jpf,:,itrace) = p%ifield_4d(ims:ime,jps+py:jpf+py,:,itrace)
ENDDO
ELSE
p%ifield_4d(ims:ime,jps:jpf,:,:) = p%ifield_4d(ims:ime,jps+py:jpf+py,:,:)
ENDIF
ENDIF
ELSE IF ( p%Type .EQ. 'l' ) THEN
CALL wrf_error_fatal( '4D logical arrays cannot be shifted for moving nests' )
ENDIF
ENDIF
ENDIF
ENDIF
p => p%next
ENDDO