12 USE v3_utilities,
ONLY:
assert
16 USE nscalingtools,
ONLY: startglobrow, endglobrow
17 USE utilities,
ONLY: gradienthalf, to_half_mesh
58 SUBROUTINE update_pres
59 USE timer_mod,
ONLY: time_update_pres
61 USE quantities,
ONLY: gvsupumnsf => fsupumnsf, gvsupvmnsf => fsupvmnsf, &
62 gvsupumncf => fsupumncf, gvsupvmncf => fsupvmncf
63 USE utilities,
ONLY: set_bndy_fouier_m0, m0
73 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: jvsupuijh
74 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: jvsupvijh
75 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: workij1
76 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: workij2
77 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: workij3
78 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: workmn4
79 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: workmn5
80 REAL (dp),
DIMENSION(:,:,:),
ALLOCATABLE :: vgradph
86 LOGICAL,
PARAMETER :: l_upwind = .false.
90 nsmin = max(1, startglobrow - 1)
91 nsmax = min(ns, endglobrow + 1)
96 ALLOCATE(workij1(ntheta,nzeta,nsmin:nsmax),
97 workij2(ntheta,nzeta,nsmin:nsmax),
98 workij3(ntheta,nzeta,nsmin:nsmax),
99 vgradph(ntheta,nzeta,nsmin:nsmax), stat=istat)
100 CALL assert_eq(0, istat,
'Allocation1 failed in update_pres')
102 ALLOCATE(workmn4(0:mpol,-ntor:ntor,nsmin:nsmax),
103 workmn5(0:mpol,-ntor:ntor,nsmin:nsmax))
104 CALL assert_eq(0, istat,
'Allocation2 failed in update_pres')
106 ALLOCATE (jvsupuijh(ntheta,nzeta,nsmin:nsmax),
107 jvsupvijh(ntheta,nzeta,nsmin:nsmax), stat=istat)
108 CALL assert_eq(0, istat,
'Allocation3 failed in update_pres')
111 CALL to_half_mesh(jvsupuijf, jvsupuijh)
112 CALL to_half_mesh(jvsupvijf, jvsupvijh)
116 workij1 = pijf0_ds(:,:,nsmin:nsmax)*jvsupsijf(:,:,nsmin:nsmax)
117 CALL to_half_mesh(workij1, vgradph)
119 + jvsupuijh(:,:,nsmin:nsmax)*pijh0_du(:,:,nsmin:nsmax)
120 + jvsupvijh(:,:,nsmin:nsmax)*pijh0_dv(:,:,nsmin:nsmax)
123 workij2(:,:,nsmin:nsmax) = jvsupsijf(:,:,nsmin:nsmax)
125 IF (nsmin .EQ. 1)
THEN
130 CALL gradienthalf(workij1, workij2)
133 CALL to_half_mesh(gvsupumnsf, workmn4)
134 CALL to_half_mesh(gvsupvmnsf, workmn5)
136 CALL set_bndy_fouier_m0(workmn4,
f_sin)
137 CALL set_bndy_fouier_m0(workmn5,
f_sin)
144 CALL to_half_mesh(gvsupumncf, workmn4)
145 CALL to_half_mesh(gvsupvmncf, workmn5)
147 CALL set_bndy_fouier_m0(workmn4,
f_cos)
148 CALL set_bndy_fouier_m0(workmn5,
f_cos)
151 workij2(:,:,nsmin:nsmax),
154 workij3(:,:,nsmin:nsmax),
158 nsmin = max(2, startglobrow)
162 workij1(:,:,nsmin:nsmax) = gamma*pijh0(:,:,nsmin:nsmax)
163 * (workij1(:,:,nsmin:nsmax) +
164 workij2(:,:,nsmin:nsmax) +
165 workij3(:,:,nsmin:nsmax))
170 workij1(:,:,nsmin:nsmax) = -vgradph(:,:,nsmin:nsmax)
171 - workij1(:,:,nsmin:nsmax)
175 djpmnch(:,:,nsmin:nsmax),
f_cos)
176 djpmnch(:,:,nsmin:nsmax) =
delta_t*djpmnch(:,:,nsmin:nsmax)
179 djpmnsh(:,:,nsmin:nsmax),
f_sin)
180 djpmnsh(:,:,nsmin:nsmax) =
delta_t*djpmnsh(:,:,nsmin:nsmax)
183 IF (startglobrow .eq. 1)
THEN
185 djpmnch(m0,:,1) = djpmnch(m0,:,2)
189 djpmnsh(m0,:,1) = djpmnsh(m0,:,2)
193 DEALLOCATE(workij1, workij2, workij3, vgradph)
194 DEALLOCATE(workmn4, workmn5)
197 time_update_pres = time_update_pres + (toff - ton)
199 END SUBROUTINE update_pres