Newer
Older
!MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
!-----------------------------------------------------------------
! Modifications:
! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
!-----------------------------------------------------------------
! ##############################
MODULE MODI_ADVEC_WENO_K_3_AUX
! ##############################
!
INTERFACE
!
SUBROUTINE ADVEC_WENO_K_3_UX(HLBCX,PSRC, PRUCT, PR)
!
USE MODE_ll
USE MODD_LUNIT
USE MODD_CONF
!
CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX ! X direction LBC type
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on U grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRUCT ! contrav. comp. on MASS GRID
!
! output source term
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PR
!---------------------------------------------------------------------------------
SUBROUTINE ADVEC_WENO_K_3_MX(HLBCX,PSRC, PRUCT, PR)
!
USE MODE_ll
USE MODD_LUNIT
USE MODD_CONF
!
CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX ! X direction LBC type
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on U grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRUCT ! contrav. comp. on MASS GRID
!
! output source term
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PR
!---------------------------------------------------------------------------------
SUBROUTINE ADVEC_WENO_K_3_VY(HLBCY,PSRC, PRVCT, PR)
!
USE MODE_ll
USE MODD_LUNIT
USE MODD_CONF
!
CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCY ! Y direction LBC type
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on U grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRVCT ! contrav. comp. on MASS GRID
!
!
! output source term
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PR
!---------------------------------------------------------------------------------
SUBROUTINE ADVEC_WENO_K_3_MY(HLBCY,PSRC, PRVCT, PR)
!
USE MODE_ll
USE MODD_LUNIT
USE MODD_CONF
!
CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCY ! Y direction LBC type
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on U grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRVCT ! contrav. comp. on MASS GRID
!
! output source term
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PR
!---------------------------------------------------------------------------------
!
FUNCTION WENO_K_3_WZ(PSRC, PRWCT) RESULT(PR)
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on W grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRWCT ! contrav. comp. on MASS GRID
!
! output source term
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)) :: PR
!
END FUNCTION WENO_K_3_WZ
!
!---------------------------------------------------------------------------------
!
FUNCTION WENO_K_3_MZ(PSRC, PRWCT) RESULT(PR)
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on MASS grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRWCT ! contrav. comp. on W grid
!
! output source term
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)) :: PR
!
END FUNCTION WENO_K_3_MZ
!
END INTERFACE
!
END MODULE MODI_ADVEC_WENO_K_3_AUX
!
!-----------------------------------------------------------------------------
!
! ############################################################
SUBROUTINE ADVEC_WENO_K_3_UX(HLBCX,PSRC, PRUCT, PR)
! ############################################################
!!
!!**** Computes PRUCT * PUT. Upstream fluxes of U in X direction.
!! Input PUT is on U Grid 'ie' (i,j,k) based on UGRID reference
!! Output PR is on mass Grid 'ie' (i+1/2,j,k) based on UGRID reference
!!
!! AUTHOR
!! ------
!! F. Visentin *CNRS/LA*
!!
!! MODIFICATIONS
!! -------------
!! T. Lunet 02/10/2014: Correction of periodic boudary conditions
!! Change of structure in order to adapt WENO to NHALOK
!! Suppression of second layer HALO pointers
!! Complete code documentation
!! J.Escobar : 25/09/2015 : WENO5 & JPHEXT <> 1
!! J.Escobar : 02/10/2015 : correction on CYCL/OPEN boundaries
!!
!-------------------------------------------------------------------------------
!
USE MODD_CONF
USE MODD_LUNIT
!
USE MODE_ll
use mode_msg
!
IMPLICIT NONE
!
!* 0.1 Declarations of dummy arguments :
!
CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX ! X direction LBC type
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on U grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRUCT ! contrav. comp. on MASS GRID
!
! output source term
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PR
!
!* 0.2 Declarations of local variables :
!
INTEGER :: IIB,IJB ! Begining useful area in x,y,z directions
INTEGER :: IIE,IJE ! End useful area in x,y,z directions
INTEGER :: IW,IE ! Physical boundary index
!
INTEGER:: ILUOUT,IRESP ! for prints
!
! intermediate reconstruction fluxes for positive wind case
!
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZFPOS1, ZFPOS2, ZFPOS3
!
! intermediate reconstruction fluxes for negative wind case
!
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZFNEG1, ZFNEG2, ZFNEG3
!
! smoothness indicators for positive wind case
!
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZBPOS1, ZBPOS2, ZBPOS3
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZBNEG1, ZBNEG2, ZBNEG3
!
! WENO non-normalized weights
!
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)) :: ZOMP1, ZOMP2, ZOMP3
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)) :: ZOMN1, ZOMN2, ZOMN3
!
! EPSILON for weno weights calculation
!
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
REAL, PARAMETER :: ZEPS = 1.0E-15
!
!-----------------------------------------------------------------------------
!* 0.3. COMPUTES THE DOMAIN DIMENSIONS
! ------------------------------
!
CALL GET_INDICE_ll(IIB,IJB,IIE,IJE)
!
!-------------------------------------------------------------------------------
!* 0.4. INITIALIZE THE FIELD
! ---------------------
!
PR(:,:,:) = 0.0
!
ZFPOS1 = 0.0
ZFPOS2 = 0.0
ZFPOS3 = 0.0
ZFNEG1 = 0.0
ZFNEG2 = 0.0
ZFNEG3 = 0.0
ZBPOS1 = 0.0
ZBPOS2 = 0.0
ZBPOS3 = 0.0
ZBNEG1 = 0.0
ZBNEG2 = 0.0
ZBNEG3 = 0.0
ZOMP1 = 0.0
ZOMP2 = 0.0
ZOMP3 = 0.0
ZOMN1 = 0.0
ZOMN2 = 0.0
ZOMN3 = 0.0
!
!-------------------------------------------------------------------------------
!* 1.1. Interior Fluxes
! ---------------------
IW=IIB
IE=IIE
!-------------------------------------------------------------------------------
! Flux calculation in the physical domain far enough from the boundary
! WENO scheme order 5, IW+1 -> IE-2
! Computation at the mass point on Ugrid u(i+1/2,j,k)
!-------------------------------------------------------------------------------
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
! ----- Positive fluxes -----
!
! First positive stencil, needs indices i-2, i-1, i
ZFPOS1(IW+1:IE-2,:,:) = 1./6. * (2.0*PSRC(IW-1:IE-4,:,:) - 7.0*PSRC(IW:IE-3,:,:) + 11.0*PSRC(IW+1:IE-2,:,:)) ! Flux
ZBPOS1(IW+1:IE-2,:,:) = 13./12. * ( PSRC(IW-1:IE-4,:,:) - 2.0*PSRC(IW:IE-3,:,:) + PSRC(IW+1:IE-2,:,:))**2 &
+ 1./4 * ( PSRC(IW-1:IE-4,:,:) - 4.0*PSRC(IW:IE-3,:,:) + 3.0* PSRC(IW+1:IE-2,:,:))**2 ! Smoothness indicator
ZOMP1(IW+1:IE-2,:,:) = 1./10. / (ZEPS + ZBPOS1(IW+1:IE-2,:,:))**2
!
! Second positive stencil, needs indices i-1, i, i+1
ZFPOS2(IW+1:IE-2,:,:) = 1./6. * (-1.0*PSRC(IW:IE-3,:,:) + 5.0*PSRC(IW+1:IE-2,:,:) + 2.0*PSRC(IW+2:IE-1,:,:))! Flux
ZBPOS2(IW+1:IE-2,:,:) = 13./12 * ( PSRC(IW:IE-3,:,:) - 2.0*PSRC(IW+1:IE-2,:,:) + PSRC(IW+2:IE-1,:,:))**2 &
+ 1./4 * ( PSRC(IW:IE-3,:,:) - PSRC(IW+2:IE-1,:,:))**2! Smoothness indicator
ZOMP2(IW+1:IE-2,:,:) = 3./5. / (ZEPS + ZBPOS2(IW+1:IE-2,:,:))**2
!
! Third positive stencil, needs indices i, i+1, i+2
ZFPOS3(IW+1:IE-2,:,:) = 1./6 * (2.0*PSRC(IW+1:IE-2,:,:) + 5.0*PSRC(IW+2:IE-1,:,:) - PSRC(IW+3:IE,:,:))! Flux
ZBPOS3(IW+1:IE-2,:,:) = 13./12 * (PSRC(IW+1:IE-2,:,:) - 2.0*PSRC(IW+2:IE-1,:,:) + PSRC(IW+3:IE,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW+1:IE-2,:,:) - 4.0*PSRC(IW+2:IE-1,:,:) + PSRC(IW+3:IE,:,:))**2! Smoothness indicator
ZOMP3(IW+1:IE-2,:,:) = 3./10. / (ZEPS + ZBPOS3(IW+1:IE-2,:,:))**2
!
! ----- Negative fluxes -----
!
! First negative stencil, needs indices i+1, i+2, i+3
ZFNEG1(IW+1:IE-2,:,:) = 1./6. * (11.0*PSRC(IW+2:IE-1,:,:) - 7.0*PSRC(IW+3:IE,:,:) + 2.0*PSRC(IW+4:IE+1,:,:)) ! Flux
ZBNEG1(IW+1:IE-2,:,:) = 13./12. * ( PSRC(IW+2:IE-1,:,:) - 2.0*PSRC(IW+3:IE,:,:) + PSRC(IW+4:IE+1,:,:))**2 &
+ 1./4 * (3.0* PSRC(IW+2:IE-1,:,:) - 4.0*PSRC(IW+3:IE,:,:) + PSRC(IW+4:IE+1,:,:))**2 ! Smoothness indicator
ZOMN1(IW+1:IE-2,:,:) = 1./10. / (ZEPS + ZBNEG1(IW+1:IE-2,:,:))**2
!
! Second negative stencil, needs indices i, i+1, i+2
ZFNEG2(IW+1:IE-2,:,:) = 1./6. * (2.0*PSRC(IW+1:IE-2,:,:) + 5.0*PSRC(IW+2:IE-1,:,:) - 1.0*PSRC(IW+3:IE,:,:))! Flux
ZBNEG2(IW+1:IE-2,:,:) = 13./12 * ( PSRC(IW+1:IE-2,:,:) - 2.0*PSRC(IW+2:IE-1,:,:) + PSRC(IW+3:IE,:,:))**2 &
+ 1./4 * ( PSRC(IW+1:IE-2,:,:) - PSRC(IW+3:IE,:,:))**2! Smoothness indicator
ZOMN2(IW+1:IE-2,:,:) = 3./5. / (ZEPS + ZBNEG2(IW+1:IE-2,:,:))**2! Non-normalized weight
!
! Third negative stencil, needs indices i-1, i, i+1
ZFNEG3(IW+1:IE-2,:,:) = 1./6 * (-1.0*PSRC(IW:IE-3,:,:) + 5.0*PSRC(IW+1:IE-2,:,:) + 2.0*PSRC(IW+2:IE-1,:,:))! Flux
ZBNEG3(IW+1:IE-2,:,:) = 13./12 * ( PSRC(IW:IE-3,:,:) - 2.0*PSRC(IW+1:IE-2,:,:) + PSRC(IW+2:IE-1,:,:))**2 &
+ 1./4 * ( PSRC(IW:IE-3,:,:) - 4.0*PSRC(IW+1:IE-2,:,:) + 3.0*PSRC(IW+2:IE-1,:,:))**2! Smoothness indicator
ZOMN3(IW+1:IE-2,:,:) = 3./10. / (ZEPS + ZBNEG3(IW+1:IE-2,:,:))**2! Non-normalized weight
!
!
! ----- Total flux -----
!
PR(IW+1:IE-2,:,:) = (ZOMP1(IW+1:IE-2,:,:)/(ZOMP1(IW+1:IE-2,:,:)+ZOMP2(IW+1:IE-2,:,:)+ZOMP3(IW+1:IE-2,:,:)) &
* ZFPOS1(IW+1:IE-2,:,:) + &
ZOMP2(IW+1:IE-2,:,:)/(ZOMP1(IW+1:IE-2,:,:)+ZOMP2(IW+1:IE-2,:,:)+ZOMP3(IW+1:IE-2,:,:)) &
* ZFPOS2(IW+1:IE-2,:,:) + &
ZOMP3(IW+1:IE-2,:,:)/(ZOMP1(IW+1:IE-2,:,:)+ZOMP2(IW+1:IE-2,:,:)+ZOMP3(IW+1:IE-2,:,:)) &
* ZFPOS3(IW+1:IE-2,:,:)) &
* (0.5+SIGN(0.5,PRUCT(IW+1:IE-2,:,:))) &
+ (ZOMN1(IW+1:IE-2,:,:)/(ZOMN1(IW+1:IE-2,:,:)+ZOMN2(IW+1:IE-2,:,:)+ZOMN3(IW+1:IE-2,:,:)) &
* ZFNEG1(IW+1:IE-2,:,:) &
+ ZOMN2(IW+1:IE-2,:,:)/(ZOMN1(IW+1:IE-2,:,:)+ZOMN2(IW+1:IE-2,:,:)+ZOMN3(IW+1:IE-2,:,:)) &
* ZFNEG2(IW+1:IE-2,:,:) &
+ ZOMN3(IW+1:IE-2,:,:)/(ZOMN1(IW+1:IE-2,:,:)+ZOMN2(IW+1:IE-2,:,:)+ZOMN3(IW+1:IE-2,:,:)) &
* ZFNEG3(IW+1:IE-2,:,:)) &
* (0.5-SIGN(0.5,PRUCT(IW+1:IE-2,:,:)))
!-------------------------------------------------------------------------------
!* 1.2. West border
! ---------------------
!!IF( LWEST_ll() .AND. .FALSE. ) THEN
IF( LWEST_ll() ) THEN
!-----------------------------------------------------------------------------
! West border is physical -- IW,IW-1
!-----------------------------------------------------------------------------
SELECT CASE (HLBCX(1)) ! X direction LBC type on left side
CASE ('CYCL')
!---------------------------------------------------------------------------
! Periodic boundary condition
!---------------------------------------------------------------------------
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
IF( LEAST_ll() .AND. .FALSE. ) THEN! East boundary is physical (monoproc)
!
! First positive stencil, needs indices i-2, i-1, i
ZFPOS1(IW,:,:) = 1./6. * (2.0*PSRC(IE,:,:) - 7.0*PSRC(IW-1,:,:) + 11.0*PSRC(IW,:,:))! Flux IW
ZFPOS1(IW-1,:,:) = 1./6. * (2.0*PSRC(IE-1,:,:) - 7.0*PSRC(IE,:,:) + 11.0*PSRC(IW-1,:,:))! Flux IW-1
ZBPOS1(IW,:,:) = 13./12. * (PSRC(IE,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW
ZBPOS1(IW-1,:,:) = 13./12. * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IW-1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + 3.0*PSRC(IW-1,:,:))**2 ! Smoothness indicator IW-1
ZOMP1(IW-1:IW,:,:) = 1./10. / (ZEPS + ZBPOS1(IW-1:IW,:,:))**2! Non-normalized weight IW,IW-1
!
! Second positive stencil, needs indices i-1, i, i+1
ZFPOS2(IW,:,:) = 1./6.* (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:))! Flux IW
ZFPOS2(IW-1,:,:) = 1./6.* (-1.0*PSRC(IE,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW-1
ZBPOS2(IW,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - PSRC(IW+1,:,:))**2! Smoothness indicator IW
ZBPOS2(IW-1,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - PSRC(IW,:,:))**2! Smoothness indicator IW-1
ZOMP2(IW-1:IW,:,:) = 3./5. / (ZEPS + ZBPOS2(IW-1:IW,:,:))**2! Non-normalized weight IW,IW-1
!
! Third negative stencil, needs indices i-1, i, i+1
ZFNEG3(IW,:,:) = 1./6 * (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:))! Flux IW
ZFNEG3(IW-1,:,:) = 1./6 * (-1.0*PSRC(IE,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:))! Flux IW-1
ZBNEG3(IW,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - 4.0*PSRC(IW,:,:) + 3.0*PSRC(IW+1,:,:))**2! Smoothness indicator IW
ZBNEG3(IW-1,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2! Smoothness indicator IW-1
ZOMN3(IW-1:IW,:,:) = 3./10. / (ZEPS + ZBNEG3(IW-1:IW,:,:))**2! Non-normalized weight IW,IW-1
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
ELSEIF(IW>3) THEN! East boundary is proc border, with minimum 3 HALO points on west side
!
! First positive stencil, needs indices i-2, i-1, i
ZFPOS1(IW,:,:) = 1./6. * (2.0*PSRC(IW-2,:,:) - 7.0*PSRC(IW-1,:,:) + 11.0*PSRC(IW,:,:))! Flux IW
ZFPOS1(IW-1,:,:) = 1./6. * (2.0*PSRC(IW-3,:,:) - 7.0*PSRC(IW-2,:,:) + 11.0*PSRC(IW-1,:,:))! Flux IW-1
ZBPOS1(IW,:,:) = 13./12. * (PSRC(IW-1,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW
ZBPOS1(IW-1,:,:) = 13./12. * (PSRC(IW-3,:,:) - 2.0*PSRC(IW-2,:,:) + PSRC(IW-1,:,:))**2 &
+ 1./4 * (PSRC(IW-3,:,:) - 4.0*PSRC(IW-2,:,:) + 3.0*PSRC(IW-1,:,:))**2 ! Smoothness indicator IW-1
ZOMP1(IW-1:IW,:,:) = 1./10. / (ZEPS + ZBPOS1(IW-1:IW,:,:))**2! Non-normalized weight IW,IW-1
!
! Second positive stencil, needs indices i-1, i, i+1
ZFPOS2(IW,:,:) = 1./6.* (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:))! Flux IW
ZFPOS2(IW-1,:,:) = 1./6.* (-1.0*PSRC(IW-2,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:))! Flux IW-1
ZBPOS2(IW,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - PSRC(IW+1,:,:))**2! Smoothness indicator IW
ZBPOS2(IW-1,:,:) = 13./12 * (PSRC(IW-2,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-2,:,:) - PSRC(IW,:,:))**2! Smoothness indicator IW-1
ZOMP2(IW-1:IW,:,:) = 3./5. / (ZEPS + ZBPOS2(IW-1:IW,:,:))**2! Non-normalized weight IW,IW-1
!
! Third negative stencil, needs indices i-1, i, i+1
ZFNEG3(IW,:,:) = 1./6 * (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:))! Flux IW
ZFNEG3(IW-1,:,:) = 1./6 * (-1.0*PSRC(IW-2,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW-1
ZBNEG3(IW,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - 4.0*PSRC(IW,:,:) + 3.0*PSRC(IW+1,:,:))**2 ! Smoothness indicator IW
ZBNEG3(IW-1,:,:) = 13./12 * (PSRC(IW-2,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-2,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW-1
ZOMN3(IW-1:IW,:,:) = 3./10. / (ZEPS + ZBNEG3(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
ELSE ! East boundary is proc border, with NHALO < 3 on west side
call Print_msg(NVERB_FATAL,'GEN','ADVEC_WENO_K_3_UX','WENO5/CYCL fluxes calculation needs JPHEXT (&NHALO) >= 3 on west side')
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
ENDIF
!
! Third positive stencil, needs indices i, i+1, i+2
ZFPOS3(IW,:,:) = 1./6 * (2.0*PSRC(IW,:,:) + 5.0*PSRC(IW+1,:,:) - PSRC(IW+2,:,:)) ! Flux IW
ZFPOS3(IW-1,:,:) = 1./6 * (2.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) - PSRC(IW+1,:,:)) ! Flux IW-1
ZBPOS3(IW,:,:) = 13./12 * ( PSRC(IW,:,:) - 2.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW,:,:) - 4.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 ! Smoothness indicator IW
ZBPOS3(IW-1,:,:) = 13./12 * ( PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW-1,:,:) - 4.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 ! Smoothness indicator IW-1
ZOMP3(IW-1:IW,:,:) = 3./10. / (ZEPS + ZBPOS3(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! First negative stencil, needs indices i+1, i+2, i+3
ZFNEG1(IW,:,:) = 1./6. * (11.0*PSRC(IW+1,:,:) - 7.0*PSRC(IW+2,:,:) + 2.0*PSRC(IW+3,:,:)) ! Flux IW
ZFNEG1(IW-1,:,:) = 1./6. * (11.0*PSRC(IW,:,:) - 7.0*PSRC(IW+1,:,:) + 2.0*PSRC(IW+2,:,:)) ! Flux IW-1
ZBNEG1(IW,:,:) = 13./12. * ( PSRC(IW+1,:,:) - 2.0*PSRC(IW+2,:,:) + PSRC(IW+3,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW+1,:,:) - 4.0*PSRC(IW+2,:,:) + PSRC(IW+3,:,:))**2 ! Smoothness indicator IW
ZBNEG1(IW-1,:,:) = 13./12. * ( PSRC(IW,:,:) - 2.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW,:,:) - 4.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 ! Smoothness indicator IW-1
ZOMN1(IW-1:IW,:,:) = 1./10. / (ZEPS + ZBNEG1(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! Second negative stencil, needs indices i, i+1, i+2
ZFNEG2(IW,:,:) = 1./6. * (2.0*PSRC(IW,:,:) + 5.0*PSRC(IW+1,:,:) - 1.0*PSRC(IW+2,:,:)) ! Flux IW
ZFNEG2(IW-1,:,:) = 1./6. * (2.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) - 1.0*PSRC(IW+1,:,:)) ! Flux IW-1
ZBNEG2(IW,:,:) = 13./12 * (PSRC(IW,:,:) - 2.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 &
+ 1./4 * (PSRC(IW,:,:) - PSRC(IW+2,:,:))**2 ! Smoothness indicator IW
ZBNEG2(IW-1,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - PSRC(IW+1,:,:))**2 ! Smoothness indicator IW-1
ZOMN2(IW-1:IW,:,:) = 3./5. / (ZEPS + ZBNEG2(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! ----- Total flux -----
!
PR(IW-1:IW,:,:) = ( ZOMP1(IW-1:IW,:,:)/(ZOMP1(IW-1:IW,:,:)+ZOMP2(IW-1:IW,:,:)+ZOMP3(IW-1:IW,:,:)) * ZFPOS1(IW-1:IW,:,:) &
+ ZOMP2(IW-1:IW,:,:)/(ZOMP1(IW-1:IW,:,:)+ZOMP2(IW-1:IW,:,:)+ZOMP3(IW-1:IW,:,:)) * ZFPOS2(IW-1:IW,:,:) &
+ ZOMP3(IW-1:IW,:,:)/(ZOMP1(IW-1:IW,:,:)+ZOMP2(IW-1:IW,:,:)+ZOMP3(IW-1:IW,:,:)) * ZFPOS3(IW-1:IW,:,:)) &
* (0.5+SIGN(0.5,PRUCT(IW-1:IW,:,:))) &
+ ( ZOMN1(IW-1:IW,:,:)/(ZOMN1(IW-1:IW,:,:)+ZOMN2(IW-1:IW,:,:)+ZOMN3(IW-1:IW,:,:)) * ZFNEG1(IW-1:IW,:,:) &
+ ZOMN2(IW-1:IW,:,:)/(ZOMN1(IW-1:IW,:,:)+ZOMN2(IW-1:IW,:,:)+ZOMN3(IW-1:IW,:,:)) * ZFNEG2(IW-1:IW,:,:) &
+ ZOMN3(IW-1:IW,:,:)/(ZOMN1(IW-1:IW,:,:)+ZOMN2(IW-1:IW,:,:)+ZOMN3(IW-1:IW,:,:)) * ZFNEG3(IW-1:IW,:,:)) &
* (0.5-SIGN(0.5,PRUCT(IW-1:IW,:,:)))
!
!
CASE ('OPEN','WALL','NEST')
!---------------------------------------------------------------------------
! Open, or Wall, or Nest boundary condition => WENO order reduction
!---------------------------------------------------------------------------
!
! WENO scheme order 1, IW-1
PR(IW-1,:,:) = PSRC(IW-1,:,:) * (0.5+SIGN(0.5,PRUCT(IW-1,:,:))) + &
PSRC(IW,:,:) * &
(0.5-SIGN(0.5,PRUCT(IW-1,:,:)))
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
! ! WENO scheme order 3, IW
ZFPOS1(IW,:,:) = 0.5 * (3.0*PSRC(IW,:,:) - PSRC(IW-1,:,:)) ! First positive flux
ZFPOS2(IW,:,:) = 0.5 * ( PSRC(IW,:,:) + PSRC(IW+1,:,:)) ! Second positive flux
ZBPOS1(IW,:,:) = (PSRC(IW,:,:) - PSRC(IW-1,:,:))**2 ! First positive smoothness indicator
ZBPOS2(IW,:,:) = (PSRC(IW+1,:,:) - PSRC(IW,:,:))**2 ! Second positive smoothness indicator
!
ZFNEG1(IW,:,:) = 0.5 * (3.0*PSRC(IW+1,:,:) - PSRC(IW+2,:,:)) ! First negative flux
ZFNEG2(IW,:,:) = 0.5 * ( PSRC(IW,:,:) + PSRC(IW+1,:,:)) ! Second negative flux
ZBNEG1(IW,:,:) = (PSRC(IW+1,:,:) - PSRC(IW+2,:,:))**2 ! First negative smoothness indicator
ZBNEG2(IW,:,:) = (PSRC(IW,:,:) - PSRC(IW+1,:,:))**2 ! Second negative smoothness indicator
!
ZOMP1(IW,:,:) = 1./3. / (ZEPS + ZBPOS1(IW,:,:))**2 ! First positive non-normalized weight
ZOMP2(IW,:,:) = 2./3. / (ZEPS + ZBPOS2(IW,:,:))**2 ! Second positive non-normalized weight
ZOMN1(IW,:,:) = 1./3. / (ZEPS + ZBNEG1(IW,:,:))**2 ! First negative non-normalized weight
ZOMN2(IW,:,:) = 2./3. / (ZEPS + ZBNEG2(IW,:,:))**2 ! Second negative non-normalized weight
!
PR(IW,:,:) = (ZOMN2(IW,:,:)/(ZOMN1(IW,:,:)+ZOMN2(IW,:,:)) * ZFNEG2(IW,:,:) + &
(ZOMN1(IW,:,:)/(ZOMN1(IW,:,:)+ZOMN2(IW,:,:)) * ZFNEG1(IW,:,:))) &
*(0.5-SIGN(0.5,PRUCT(IW,:,:))) + &
(ZOMP2(IW,:,:)/(ZOMP1(IW,:,:)+ZOMP2(IW,:,:)) * ZFPOS2(IW,:,:) + &
(ZOMP1(IW,:,:)/(ZOMP1(IW,:,:)+ZOMP2(IW,:,:)) * ZFPOS1(IW,:,:))) &
*(0.5+SIGN(0.5,PRUCT(IW,:,:))) ! Total flux
!
END SELECT ! SELECT CASE (HLBCX(1)) ! X direction LBC type on left side
!
ELSE
!-----------------------------------------------------------------------------
! West border is proc border -- IW,IW-1
!-----------------------------------------------------------------------------
!
IF (NHALO<3) THEN
call Print_msg(NVERB_FATAL,'GEN','ADVEC_WENO_K_3_UX','WENO5/west-int not parallelisable with NHALO < 3')
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
ELSEIF (NHALO>=3) THEN
!---------------------------------------------------------------------------
! NHALO >3 => WENO5 for all boundary points
!---------------------------------------------------------------------------
!
! ----- Positive fluxes -----
!
! First positive stencil, needs indices i-2, i-1, i
ZFPOS1(IW,:,:) = 1./6. * (2.0*PSRC(IW-2,:,:) - 7.0*PSRC(IW-1,:,:) + 11.0*PSRC(IW,:,:)) ! Flux IW
ZFPOS1(IW-1,:,:) = 1./6. * (2.0*PSRC(IW-3,:,:) - 7.0*PSRC(IW-2,:,:) + 11.0*PSRC(IW-1,:,:)) ! Flux IW-1
ZBPOS1(IW,:,:) = 13./12. * (PSRC(IW-2,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-2,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW
ZBPOS1(IW-1,:,:) = 13./12. * (PSRC(IW-3,:,:) - 2.0*PSRC(IW-2,:,:) + PSRC(IW-1,:,:))**2 &
+ 1./4 * (PSRC(IW-3,:,:) - 4.0*PSRC(IW-2,:,:) + 3.0*PSRC(IW-1,:,:))**2 ! Smoothness indicator IW-1
ZOMP1(IW-1:IW,:,:) = 1./10. / (ZEPS + ZBPOS1(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! Second positive stencil, needs indices i-1, i, i+1
ZFPOS2(IW,:,:) = 1./6.* (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:)) ! Flux IW
ZFPOS2(IW-1,:,:) = 1./6.* (-1.0*PSRC(IW-2,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW-1
ZBPOS2(IW,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - PSRC(IW+1,:,:))**2 ! Smoothness indicator IW
ZBPOS2(IW-1,:,:) = 13./12 * (PSRC(IW-2,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-2,:,:) - PSRC(IW,:,:))**2 ! Smoothness indicator IW-1
ZOMP2(IW-1:IW,:,:) = 3./5. / (ZEPS + ZBPOS2(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! Third positive stencil, needs indices i, i+1, i+2
ZFPOS3(IW,:,:) = 1./6 * (2.0*PSRC(IW,:,:) + 5.0*PSRC(IW+1,:,:) - PSRC(IW+2,:,:)) ! Flux IW
ZFPOS3(IW-1,:,:) = 1./6 * (2.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) - PSRC(IW+1,:,:)) ! Flux IW-1
ZBPOS3(IW,:,:) = 13./12 * ( PSRC(IW,:,:) - 2.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW,:,:) - 4.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 ! Smoothness indicator IW
ZBPOS3(IW-1,:,:) = 13./12 * ( PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW-1,:,:) - 4.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 ! Smoothness indicator IW-1
ZOMP3(IW-1:IW,:,:) = 3./10. / (ZEPS + ZBPOS3(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! ----- Negative fluxes -----
!
! First negative stencil, needs indices i+1, i+2, i+3
ZFNEG1(IW,:,:) = 1./6. * (11.0*PSRC(IW+1,:,:) - 7.0*PSRC(IW+2,:,:) + 2.0*PSRC(IW+3,:,:)) ! Flux IW
ZFNEG1(IW-1,:,:) = 1./6. * (11.0*PSRC(IW,:,:) - 7.0*PSRC(IW+1,:,:) + 2.0*PSRC(IW+2,:,:)) ! Flux IW-1
ZBNEG1(IW,:,:) = 13./12. * ( PSRC(IW+1,:,:) - 2.0*PSRC(IW+2,:,:) + PSRC(IW+3,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW+1,:,:) - 4.0*PSRC(IW+2,:,:) + PSRC(IW+3,:,:))**2 ! Smoothness indicator IW
ZBNEG1(IW-1,:,:) = 13./12. * ( PSRC(IW,:,:) - 2.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW,:,:) - 4.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 ! Smoothness indicator IW-1
ZOMN1(IW-1:IW,:,:) = 1./10. / (ZEPS + ZBNEG1(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! Second negative stencil, needs indices i, i+1, i+2
ZFNEG2(IW,:,:) = 1./6. * (2.0*PSRC(IW,:,:) + 5.0*PSRC(IW+1,:,:) - 1.0*PSRC(IW+2,:,:)) ! Flux IW
ZFNEG2(IW-1,:,:) = 1./6. * (2.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) - 1.0*PSRC(IW+1,:,:)) ! Flux IW-1
ZBNEG2(IW,:,:) = 13./12 * (PSRC(IW,:,:) - 2.0*PSRC(IW+1,:,:) + PSRC(IW+2,:,:))**2 &
+ 1./4 * (PSRC(IW,:,:) - PSRC(IW+2,:,:))**2 ! Smoothness indicator IW
ZBNEG2(IW-1,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - PSRC(IW+1,:,:))**2 ! Smoothness indicator IW-1
ZOMN2(IW-1:IW,:,:) = 3./5. / (ZEPS + ZBNEG2(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! Third negative stencil, needs indices i-1, i, i+1
ZFNEG3(IW,:,:) = 1./6 * (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:)) ! Flux IW
ZFNEG3(IW-1,:,:) = 1./6 * (-1.0*PSRC(IW-2,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW-1
ZBNEG3(IW,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - 4.0*PSRC(IW,:,:) + 3.0*PSRC(IW+1,:,:))**2 ! Smoothness indicator IW
ZBNEG3(IW-1,:,:) = 13./12 * (PSRC(IW-2,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-2,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW-1
ZOMN3(IW-1:IW,:,:) = 3./10. / (ZEPS + ZBNEG3(IW-1:IW,:,:))**2 ! Non-normalized weight IW,IW-1
!
! ----- Total flux -----
!
PR(IW-1:IW,:,:) = ( ZOMP1(IW-1:IW,:,:)/(ZOMP1(IW-1:IW,:,:)+ZOMP2(IW-1:IW,:,:)+ZOMP3(IW-1:IW,:,:)) * ZFPOS1(IW-1:IW,:,:) &
+ ZOMP2(IW-1:IW,:,:)/(ZOMP1(IW-1:IW,:,:)+ZOMP2(IW-1:IW,:,:)+ZOMP3(IW-1:IW,:,:)) * ZFPOS2(IW-1:IW,:,:) &
+ ZOMP3(IW-1:IW,:,:)/(ZOMP1(IW-1:IW,:,:)+ZOMP2(IW-1:IW,:,:)+ZOMP3(IW-1:IW,:,:)) * ZFPOS3(IW-1:IW,:,:)) &
* (0.5+SIGN(0.5,PRUCT(IW-1:IW,:,:))) &
+ ( ZOMN1(IW-1:IW,:,:)/(ZOMN1(IW-1:IW,:,:)+ZOMN2(IW-1:IW,:,:)+ZOMN3(IW-1:IW,:,:)) * ZFNEG1(IW-1:IW,:,:) &
+ ZOMN2(IW-1:IW,:,:)/(ZOMN1(IW-1:IW,:,:)+ZOMN2(IW-1:IW,:,:)+ZOMN3(IW-1:IW,:,:)) * ZFNEG2(IW-1:IW,:,:) &
+ ZOMN3(IW-1:IW,:,:)/(ZOMN1(IW-1:IW,:,:)+ZOMN2(IW-1:IW,:,:)+ZOMN3(IW-1:IW,:,:)) * ZFNEG3(IW-1:IW,:,:)) &
* (0.5-SIGN(0.5,PRUCT(IW-1:IW,:,:)))
END IF ! NHALO
END IF ! IF(LWEST_ll())
!-------------------------------------------------------------------------------
!* 1.3. East border
! ---------------------
!! IF( LEAST_ll() .AND. .FALSE. ) THEN
IF( LEAST_ll() ) THEN
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
!-----------------------------------------------------------------------------
! East border is physical -- IE-1,IE
!-----------------------------------------------------------------------------
SELECT CASE (HLBCX(2)) ! X direction LBC type on right side
!
CASE ('CYCL')
!---------------------------------------------------------------------------
! Periodic boundary condition
!---------------------------------------------------------------------------
!
IF (LWEST_ll() .AND. .FALSE. ) THEN ! West boundary is physical (monoproc)
!
! Third positive stencil, needs indices i, i+1, i+2
ZFPOS3(IE-1,:,:) = 1./6 * (2.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) - PSRC(IE+1,:,:)) ! Flux IE-1
ZFPOS3(IE,:,:) = 1./6 * (2.0*PSRC(IE,:,:) + 5.0*PSRC(IE+1,:,:) - PSRC(IW,:,:)) ! Flux IE
ZBPOS3(IE-1,:,:) = 13./12 * ( PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 ! Smoothness indicator IE-1
ZBPOS3(IE,:,:) = 13./12 * ( PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE,:,:) - 4.0*PSRC(IE+1,:,:) + PSRC(IW,:,:))**2 ! Smoothness indicator IE
ZOMP3(IE-1:IE,:,:) = 3./10. / (ZEPS + ZBPOS3(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! First negative stencil, needs indices i+1, i+2, i+3
ZFNEG1(IE-1,:,:) = 1./6. * (11.0*PSRC(IE,:,:) - 7.0*PSRC(IE+1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IE-1
ZFNEG1(IE,:,:) = 1./6. * (11.0*PSRC(IE+1,:,:) - 7.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:)) ! Flux IE
ZBNEG1(IE-1,:,:) = 13./12. * ( PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE,:,:) - 4.0*PSRC(IE+1,:,:) + PSRC(IW,:,:))**2 ! Smoothness indicator IE-1
ZBNEG1(IE,:,:) = 13./12. * ( PSRC(IE+1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE+1,:,:) - 4.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 ! Smoothness indicator IE
ZOMN1(IE-1:IE,:,:) = 1./10. / (ZEPS + ZBNEG1(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Second negative stencil, needs indices i, i+1, i+2
ZFNEG2(IE-1,:,:) = 1./6. * (2.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) - 1.0*PSRC(IE+1,:,:)) ! Flux IE-1
ZFNEG2(IE,:,:) = 1./6. * (2.0*PSRC(IE,:,:) + 5.0*PSRC(IE+1,:,:) - 1.0*PSRC(IW,:,:)) ! Flux IE
ZBNEG2(IE-1,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - PSRC(IE+1,:,:))**2 ! Smoothness indicator IE-1
ZBNEG2(IE,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - PSRC(IW,:,:))**2 ! Smoothness indicator IE
ZOMN2(IE-1:IE,:,:) = 3./5. / (ZEPS + ZBNEG2(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
ELSEIF(IE<=SIZE(PSRC,1)-3) THEN ! West boundary is proc border, with minimum 3 HALO points on east side
!
! Third positive stencil, needs indices i, i+1, i+2
ZFPOS3(IE-1,:,:) = 1./6 * (2.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) - PSRC(IE+1,:,:)) ! Flux IE-1
ZFPOS3(IE,:,:) = 1./6 * (2.0*PSRC(IE,:,:) + 5.0*PSRC(IE+1,:,:) - PSRC(IE+2,:,:)) ! Flux IE
ZBPOS3(IE-1,:,:) = 13./12 * ( PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 ! Smoothness indicator IE-1
ZBPOS3(IE,:,:) = 13./12 * ( PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE,:,:) - 4.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 ! Smoothness indicator IE
ZOMP3(IE-1:IE,:,:) = 3./10. / (ZEPS + ZBPOS3(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! First negative stencil, needs indices i+1, i+2, i+3
ZFNEG1(IE-1,:,:) = 1./6. * (11.0*PSRC(IE,:,:) - 7.0*PSRC(IE+1,:,:) + 2.0*PSRC(IE+2,:,:)) ! Flux IE-1
ZFNEG1(IE,:,:) = 1./6. * (11.0*PSRC(IE+1,:,:) - 7.0*PSRC(IE+2,:,:) + 2.0*PSRC(IE+3,:,:)) ! Flux IE
ZBNEG1(IE-1,:,:) = 13./12. * ( PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE,:,:) - 4.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 ! Smoothness indicator IE-1
ZBNEG1(IE,:,:) = 13./12. * ( PSRC(IE+1,:,:) - 2.0*PSRC(IE+2,:,:) + PSRC(IE+3,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE+1,:,:) - 4.0*PSRC(IE+2,:,:) + PSRC(IE+3,:,:))**2 ! Smoothness indicator IE
ZOMN1(IE-1:IE,:,:) = 1./10. / (ZEPS + ZBNEG1(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Second negative stencil, needs indices i, i+1, i+2
ZFNEG2(IE-1,:,:) = 1./6. * (2.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) - 1.0*PSRC(IE+1,:,:)) ! Flux IE-1
ZFNEG2(IE,:,:) = 1./6. * (2.0*PSRC(IE,:,:) + 5.0*PSRC(IE+1,:,:) - 1.0*PSRC(IE+2,:,:)) ! Flux IE
ZBNEG2(IE-1,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - PSRC(IE+1,:,:))**2 ! Smoothness indicator IE-1
ZBNEG2(IE,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - PSRC(IE+2,:,:))**2 ! Smoothness indicator IE
ZOMN2(IE-1:IE,:,:) = 3./5. / (ZEPS + ZBNEG2(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
ELSE ! West boundary is proc border, with NHALO < 3 on east side
call Print_msg(NVERB_FATAL,'GEN','ADVEC_WENO_K_3_UX','WENO5/CYCL fluxes calculation needs JPHEXT (&NHALO) >= 3 on east side')
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
ENDIF
!
! First positive stencil, needs indices i-2, i-1, i
ZFPOS1(IE-1,:,:) = 1./6. * (2.0*PSRC(IE-3,:,:) - 7.0*PSRC(IE-2,:,:) + 11.0*PSRC(IE-1,:,:)) ! Flux IE-1
ZFPOS1(IE,:,:) = 1./6. * (2.0*PSRC(IE-2,:,:) - 7.0*PSRC(IE-1,:,:) + 11.0*PSRC(IE,:,:)) ! Flux IE
ZBPOS1(IE-1,:,:) = 13./12. * (PSRC(IE-3,:,:) - 2.0*PSRC(IE-2,:,:) + PSRC(IE-1,:,:))**2 &
+ 1./4 * (PSRC(IE-3,:,:) - 4.0*PSRC(IE-2,:,:) + 3.0*PSRC(IE-1,:,:))**2 ! Smoothness indicator IE-1
ZBPOS1(IE,:,:) = 13./12. * (PSRC(IE-2,:,:) - 2.0*PSRC(IE-1,:,:) + PSRC(IE,:,:))**2 &
+ 1./4 * (PSRC(IE-2,:,:) - 4.0*PSRC(IE-1,:,:) + 3.0*PSRC(IE,:,:))**2 ! Smoothness indicator IE
ZOMP1(IE-1:IE,:,:) = 1./10. / (ZEPS + ZBPOS1(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Second positive stencil, needs indices i-1, i, i+1
ZFPOS2(IE-1,:,:) = 1./6. * (-1.0*PSRC(IE-2,:,:) + 5.0*PSRC(IE-1,:,:) + 2.0*PSRC(IE,:,:)) ! Flux IE-1
ZFPOS2(IE,:,:) = 1./6. * (-1.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) + 2.0*PSRC(IE+1,:,:)) ! Flux IE
ZBPOS2(IE-1,:,:) = 13./12 * (PSRC(IE-2,:,:) - 2.0*PSRC(IE-1,:,:) + PSRC(IE,:,:))**2 &
+ 1./4 * (PSRC(IE-2,:,:) - PSRC(IE,:,:))**2 ! Smoothness indicator IE-1
ZBPOS2(IE,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - PSRC(IE+1,:,:))**2 ! Smoothness indicator IE
ZOMP2(IE-1:IE,:,:) = 3./5. / (ZEPS + ZBPOS2(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Third negative stencil, needs indices i-1, i, i+1
ZFNEG3(IE-1,:,:) = 1./6 * (-1.0*PSRC(IE-2,:,:) + 5.0*PSRC(IE-1,:,:) + 2.0*PSRC(IE,:,:)) ! Flux IE-1
ZFNEG3(IE,:,:) = 1./6 * (-1.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) + 2.0*PSRC(IE+1,:,:)) ! Flux IE
ZBNEG3(IE-1,:,:) = 13./12 * (PSRC(IE-2,:,:) - 2.0*PSRC(IE-1,:,:) + PSRC(IE,:,:))**2 &
+ 1./4 * (PSRC(IE-2,:,:) - 4.0*PSRC(IE-1,:,:) + 3.0*PSRC(IE,:,:))**2 ! Smoothness indicator IE-1
ZBNEG3(IE,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + 3.0*PSRC(IE+1,:,:))**2 ! Smoothness indicator IE
ZOMN3(IE-1:IE,:,:) = 3./10. / (ZEPS + ZBNEG3(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! ----- Total flux -----
!
PR(IE-1:IE,:,:) = ( ZOMP1(IE-1:IE,:,:)/(ZOMP1(IE-1:IE,:,:)+ZOMP2(IE-1:IE,:,:)+ZOMP3(IE-1:IE,:,:)) * ZFPOS1(IE-1:IE,:,:) &
+ ZOMP2(IE-1:IE,:,:)/(ZOMP1(IE-1:IE,:,:)+ZOMP2(IE-1:IE,:,:)+ZOMP3(IE-1:IE,:,:)) * ZFPOS2(IE-1:IE,:,:) &
+ ZOMP3(IE-1:IE,:,:)/(ZOMP1(IE-1:IE,:,:)+ZOMP2(IE-1:IE,:,:)+ZOMP3(IE-1:IE,:,:)) * ZFPOS3(IE-1:IE,:,:)) &
* (0.5+SIGN(0.5,PRUCT(IE-1:IE,:,:))) &
+ ( ZOMN1(IE-1:IE,:,:)/(ZOMN1(IE-1:IE,:,:)+ZOMN2(IE-1:IE,:,:)+ZOMN3(IE-1:IE,:,:)) * ZFNEG1(IE-1:IE,:,:) &
+ ZOMN2(IE-1:IE,:,:)/(ZOMN1(IE-1:IE,:,:)+ZOMN2(IE-1:IE,:,:)+ZOMN3(IE-1:IE,:,:)) * ZFNEG2(IE-1:IE,:,:) &
+ ZOMN3(IE-1:IE,:,:)/(ZOMN1(IE-1:IE,:,:)+ZOMN2(IE-1:IE,:,:)+ZOMN3(IE-1:IE,:,:)) * ZFNEG3(IE-1:IE,:,:)) &
* (0.5-SIGN(0.5,PRUCT(IE-1:IE,:,:)))
!
!
CASE ('OPEN','WALL','NEST')
!---------------------------------------------------------------------------
! Open, or Wall, or Nest boundary condition => WENO order reduction
!---------------------------------------------------------------------------
!
! WENO scheme order 1, IE
PR(IE,:,:) = PSRC(IE,:,:) * (0.5+SIGN(0.5,PRUCT(IE,:,:))) + &
PSRC(IE+1,:,:) * &
(0.5-SIGN(0.5,PRUCT(IE,:,:)))
!
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
! ! WENO scheme order 3, IE-1
ZFPOS1(IE-1,:,:) = 0.5 * (3.0*PSRC(IE-1,:,:) - PSRC(IE-2,:,:)) ! First positive flux
ZFPOS2(IE-1,:,:) = 0.5 * ( PSRC(IE-1,:,:) + PSRC(IE,:,:)) ! Second positive flux
ZBPOS1(IE-1,:,:) = (PSRC(IE-1,:,:) - PSRC(IE-2,:,:))**2 ! First positive smoothness indicator
ZBPOS2(IE-1,:,:) = (PSRC(IE,:,:) - PSRC(IE-1,:,:))**2 ! Second positive smoothness indicator
!
ZFNEG1(IE-1,:,:) = 0.5 * (3.0*PSRC(IE,:,:) - PSRC(IE+1,:,:)) ! First negative flux
ZFNEG2(IE-1,:,:) = 0.5 * ( PSRC(IE-1,:,:) + PSRC(IE,:,:)) ! Second negative flux
ZBNEG1(IE-1,:,:) = (PSRC(IE,:,:) - PSRC(IE+1,:,:))**2 ! First negative smoothness indicator
ZBNEG2(IE-1,:,:) = (PSRC(IE-1,:,:) - PSRC(IE,:,:))**2 ! Second negative smoothness indicator
!
ZOMP1(IE-1,:,:) = 1./3. / (ZEPS + ZBPOS1(IE-1,:,:))**2 ! First positive non-normalized weight
ZOMP2(IE-1,:,:) = 2./3. / (ZEPS + ZBPOS2(IE-1,:,:))**2 ! Second positive non-normalized weight
ZOMN1(IE-1,:,:) = 1./3. / (ZEPS + ZBNEG1(IE-1,:,:))**2 ! First negative non-normalized weight
ZOMN2(IE-1,:,:) = 2./3. / (ZEPS + ZBNEG2(IE-1,:,:))**2 ! Second negative non-normalized weight
!
PR(IE-1,:,:) = (ZOMN2(IE-1,:,:)/(ZOMN1(IE-1,:,:)+ZOMN2(IE-1,:,:))*ZFNEG2(IE-1,:,:) + &
(ZOMN1(IE-1,:,:)/(ZOMN1(IE-1,:,:)+ZOMN2(IE-1,:,:))*ZFNEG1(IE-1,:,:))) &
*(0.5-SIGN(0.5,PRUCT(IE-1,:,:))) + &
(ZOMP2(IE-1,:,:)/(ZOMP1(IE-1,:,:)+ZOMP2(IE-1,:,:))*ZFPOS2(IE-1,:,:) + &
(ZOMP1(IE-1,:,:)/(ZOMP1(IE-1,:,:)+ZOMP2(IE-1,:,:))*ZFPOS1(IE-1,:,:))) &
* (0.5+SIGN(0.5,PRUCT(IE-1,:,:))) ! Total flux
!
END SELECT ! SELECT CASE (HLBCX(2)) ! X direction LBC type on right side
!
ELSE
!-----------------------------------------------------------------------------
! East border is proc border -- IE-1,IE
!-----------------------------------------------------------------------------
!
IF (NHALO<3) THEN
call Print_msg(NVERB_FATAL,'GEN','ADVEC_WENO_K_3_UX','WENO5/east-int not parallelisable with NHALO < 3')
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
ELSEIF (NHALO>=3) THEN
!---------------------------------------------------------------------------
! NHALO >= 3 => WENO5 for all boundary points
!---------------------------------------------------------------------------
!
! ----- Positive fluxes -----
!
! First positive stencil, needs indices i-2, i-1, i
ZFPOS1(IE-1,:,:) = 1./6. * (2.0*PSRC(IE-3,:,:) - 7.0*PSRC(IE-2,:,:) + 11.0*PSRC(IE-1,:,:)) ! Flux IE-1
ZFPOS1(IE,:,:) = 1./6. * (2.0*PSRC(IE-2,:,:) - 7.0*PSRC(IE-1,:,:) + 11.0*PSRC(IE,:,:)) ! Flux IE
ZBPOS1(IE-1,:,:) = 13./12. * (PSRC(IE-3,:,:) - 2.0*PSRC(IE-2,:,:) + PSRC(IE-1,:,:))**2 &
+ 1./4 * (PSRC(IE-3,:,:) - 4.0*PSRC(IE-2,:,:) + 3.0*PSRC(IE-1,:,:))**2 ! Smoothness indicator IE-1
ZBPOS1(IE,:,:) = 13./12. * (PSRC(IE-2,:,:) - 2.0*PSRC(IE-1,:,:) + PSRC(IE,:,:))**2 &
+ 1./4 * (PSRC(IE-2,:,:) - 4.0*PSRC(IE-1,:,:) + 3.0*PSRC(IE,:,:))**2 ! Smoothness indicator IE
ZOMP1(IE-1:IE,:,:) = 1./10. / (ZEPS + ZBPOS1(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Second positive stencil, needs indices i-1, i, i+1
ZFPOS2(IE-1,:,:) = 1./6. * (-1.0*PSRC(IE-2,:,:) + 5.0*PSRC(IE-1,:,:) + 2.0*PSRC(IE,:,:)) ! Flux IE-1
ZFPOS2(IE,:,:) = 1./6. * (-1.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) + 2.0*PSRC(IE+1,:,:)) ! Flux IE
ZBPOS2(IE-1,:,:) = 13./12 * (PSRC(IE-2,:,:) - 2.0*PSRC(IE-1,:,:) + PSRC(IE,:,:))**2 &
+ 1./4 * (PSRC(IE-2,:,:) - PSRC(IE,:,:))**2 ! Smoothness indicator IE-1
ZBPOS2(IE,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - PSRC(IE+1,:,:))**2 ! Smoothness indicator IE
ZOMP2(IE-1:IE,:,:) = 3./5. / (ZEPS + ZBPOS2(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Third positive stencil, needs indices i, i+1, i+2
ZFPOS3(IE-1,:,:) = 1./6 * (2.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) - PSRC(IE+1,:,:)) ! Flux IE-1
ZFPOS3(IE,:,:) = 1./6 * (2.0*PSRC(IE,:,:) + 5.0*PSRC(IE+1,:,:) - PSRC(IE+2,:,:)) ! Flux IE
ZBPOS3(IE-1,:,:) = 13./12 * ( PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 ! Smoothness indicator IE-1
ZBPOS3(IE,:,:) = 13./12 * ( PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE,:,:) - 4.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 ! Smoothness indicator IE
ZOMP3(IE-1:IE,:,:) = 3./10. / (ZEPS + ZBPOS3(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! ----- Negative fluxes -----
!
! First negative stencil, needs indices i+1, i+2, i+3
ZFNEG1(IE-1,:,:) = 1./6. * (11.0*PSRC(IE,:,:) - 7.0*PSRC(IE+1,:,:) + 2.0*PSRC(IE+2,:,:)) ! Flux IE-1
ZFNEG1(IE,:,:) = 1./6. * (11.0*PSRC(IE+1,:,:) - 7.0*PSRC(IE+2,:,:) + 2.0*PSRC(IE+3,:,:)) ! Flux IE
ZBNEG1(IE-1,:,:) = 13./12. * ( PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE,:,:) - 4.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 ! Smoothness indicator IE-1
ZBNEG1(IE,:,:) = 13./12. * ( PSRC(IE+1,:,:) - 2.0*PSRC(IE+2,:,:) + PSRC(IE+3,:,:))**2 &
+ 1./4 * (3.0*PSRC(IE+1,:,:) - 4.0*PSRC(IE+2,:,:) + PSRC(IE+3,:,:))**2 ! Smoothness indicator IE
ZOMN1(IE-1:IE,:,:) = 1./10. / (ZEPS + ZBNEG1(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Second negative stencil, needs indices i, i+1, i+2
ZFNEG2(IE-1,:,:) = 1./6. * (2.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) - 1.0*PSRC(IE+1,:,:)) ! Flux IE-1
ZFNEG2(IE,:,:) = 1./6. * (2.0*PSRC(IE,:,:) + 5.0*PSRC(IE+1,:,:) - 1.0*PSRC(IE+2,:,:)) ! Flux IE
ZBNEG2(IE-1,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - PSRC(IE+1,:,:))**2 ! Smoothness indicator IE-1
ZBNEG2(IE,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IE+1,:,:) + PSRC(IE+2,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - PSRC(IE+2,:,:))**2 ! Smoothness indicator IE
ZOMN2(IE-1:IE,:,:) = 3./5. / (ZEPS + ZBNEG2(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! Third negative stencil, needs indices i-1, i, i+1
ZFNEG3(IE-1,:,:) = 1./6 * (-1.0*PSRC(IE-2,:,:) + 5.0*PSRC(IE-1,:,:) + 2.0*PSRC(IE,:,:)) ! Flux IE-1
ZFNEG3(IE,:,:) = 1./6 * (-1.0*PSRC(IE-1,:,:) + 5.0*PSRC(IE,:,:) + 2.0*PSRC(IE+1,:,:)) ! Flux IE
ZBNEG3(IE-1,:,:) = 13./12 * (PSRC(IE-2,:,:) - 2.0*PSRC(IE-1,:,:) + PSRC(IE,:,:))**2 &
+ 1./4 * (PSRC(IE-2,:,:) - 4.0*PSRC(IE-1,:,:) + 3.0*PSRC(IE,:,:))**2 ! Smoothness indicator IE-1
ZBNEG3(IE,:,:) = 13./12 * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IE+1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + 3.0*PSRC(IE+1,:,:))**2 ! Smoothness indicator IE
ZOMN3(IE-1:IE,:,:) = 3./10. / (ZEPS + ZBNEG3(IE-1:IE,:,:))**2 ! Non-normalized weight IE-1,IE
!
! ----- Total flux -----
!
PR(IE-1:IE,:,:) = ( ZOMP1(IE-1:IE,:,:)/(ZOMP1(IE-1:IE,:,:)+ZOMP2(IE-1:IE,:,:)+ZOMP3(IE-1:IE,:,:)) * ZFPOS1(IE-1:IE,:,:) &
+ ZOMP2(IE-1:IE,:,:)/(ZOMP1(IE-1:IE,:,:)+ZOMP2(IE-1:IE,:,:)+ZOMP3(IE-1:IE,:,:)) * ZFPOS2(IE-1:IE,:,:) &
+ ZOMP3(IE-1:IE,:,:)/(ZOMP1(IE-1:IE,:,:)+ZOMP2(IE-1:IE,:,:)+ZOMP3(IE-1:IE,:,:)) * ZFPOS3(IE-1:IE,:,:)) &
* (0.5+SIGN(0.5,PRUCT(IE-1:IE,:,:))) &
+ ( ZOMN1(IE-1:IE,:,:)/(ZOMN1(IE-1:IE,:,:)+ZOMN2(IE-1:IE,:,:)+ZOMN3(IE-1:IE,:,:)) * ZFNEG1(IE-1:IE,:,:) &
+ ZOMN2(IE-1:IE,:,:)/(ZOMN1(IE-1:IE,:,:)+ZOMN2(IE-1:IE,:,:)+ZOMN3(IE-1:IE,:,:)) * ZFNEG2(IE-1:IE,:,:) &
+ ZOMN3(IE-1:IE,:,:)/(ZOMN1(IE-1:IE,:,:)+ZOMN2(IE-1:IE,:,:)+ZOMN3(IE-1:IE,:,:)) * ZFNEG3(IE-1:IE,:,:)) &
* (0.5-SIGN(0.5,PRUCT(IE-1:IE,:,:)))
!
END IF ! NHALO
!
END IF ! IF(LWEST_ll())
!-------------------------------------------------------------------------------
!
PR = PR * PRUCT ! Add contravariant flux
!
END SUBROUTINE ADVEC_WENO_K_3_UX
!
!------------------------------------------------------------------------------
!
! ############################################################
SUBROUTINE ADVEC_WENO_K_3_MX(HLBCX,PSRC, PRUCT, PR)
! ############################################################
!!
!!**** Computes PRUCT * PWT (or PRUCT * PVT). Upstream fluxes of W (or V)
!! variables in X direction.
!! Input PWT is on W Grid 'ie' (i,j,k) based on WGRID reference
!! Output PR is on mass Grid 'ie' (i-1/2,j,k) based on WGRID reference
!!
!! AUTHOR
!! ------
!! F. Visentin *CNRS/LA*
!!
!! MODIFICATIONS
!! -------------
!! T. Lunet 02/10/2014: Correction of periodic boudary conditions
!! Change of structure in order to adapt WENO to NHALOK
!! Suppression of second layer HALO pointers
!! Complete code documentation
!!
!------------------------------------------------------------------------------
!
USE MODD_CONF
USE MODD_LUNIT
!
USE MODE_ll
use mode_msg
!
IMPLICIT NONE
!
!* 0.1 Declarations of dummy arguments :
!
CHARACTER (LEN=4), DIMENSION(2), INTENT(IN) :: HLBCX ! X direction LBC type
!
REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRC ! variable on U grid at t
REAL, DIMENSION(:,:,:), INTENT(IN) :: PRUCT ! contrav. comp. on MASS GRID
!
! output source term
!
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PR
!
!* 0.2 Declarations of local variables :
!
INTEGER :: IIB,IJB ! Begining useful area in x,y,z directions
INTEGER :: IIE,IJE ! End useful area in x,y,z directions
INTEGER:: IW,IE ! Coordinate of third order diffusion area
!
INTEGER:: ILUOUT,IRESP ! for prints
!
! intermediate reconstruction fluxes for positive wind case
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZFPOS1, ZFPOS2, ZFPOS3
!
! intermediate reconstruction fluxes for negative wind case
!
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZFNEG1, ZFNEG2, ZFNEG3
!
! smoothness indicators for positive wind case
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZBPOS1, ZBPOS2, ZBPOS3
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)):: ZBNEG1, ZBNEG2, ZBNEG3
!
! WENO weights
!
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)) :: ZOMP1, ZOMP2, ZOMP3
REAL, DIMENSION(SIZE(PSRC,1),SIZE(PSRC,2),SIZE(PSRC,3)) :: ZOMN1, ZOMN2, ZOMN3
!
! EPSILON for weno weights calculation
!
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
REAL, PARAMETER :: ZEPS = 1.0E-15
!
!-------------------------------------------------------------------------------
!
!* 0.3. COMPUTES THE DOMAIN DIMENSIONS
! ------------------------------
!
CALL GET_INDICE_ll(IIB,IJB,IIE,IJE)
!
!-----------------------------------------------------------------------------
!
!* 0.4. INITIALIZE THE FIELD
! ---------------------
!
PR(:,:,:) = 0.0
!
ZFPOS1 = 0.0
ZFPOS2 = 0.0
ZFPOS3 = 0.0
ZFNEG1 = 0.0
ZFNEG2 = 0.0
ZFNEG3 = 0.0
ZBPOS1 = 0.0
ZBPOS2 = 0.0
ZBPOS3 = 0.0
ZBNEG1 = 0.0
ZBNEG2 = 0.0
ZBNEG3 = 0.0
ZOMP1 = 0.0
ZOMP2 = 0.0
ZOMP3 = 0.0
ZOMN1 = 0.0
ZOMN2 = 0.0
ZOMN3 = 0.0
!
!-------------------------------------------------------------------------------
!* 1.1. Interior Fluxes
! ---------------------
IW=IIB
IE=IIE
!-------------------------------------------------------------------------------
! Flux calculation in the physical domain far enough from the boundary
! WENO scheme order 5, IW+2 -> IE-1
! Computation at the mass point on Ugrid u(i-1/2,j,k)
!-------------------------------------------------------------------------------
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
! ----- Positive fluxes -----
!
! First positive stencil, needs indices i-3, i-2, i-1
ZFPOS1(IW+2:IE-1,:,:) = 1./6. * (2.0*PSRC(IW-1:IE-4,:,:) - 7.0*PSRC(IW:IE-3,:,:) + 11.0*PSRC(IW+1:IE-2,:,:)) ! Flux
ZBPOS1(IW+2:IE-1,:,:) = 13./12. * ( PSRC(IW-1:IE-4,:,:) - 2.0*PSRC(IW:IE-3,:,:) + PSRC(IW+1:IE-2,:,:))**2 &
+ 1./4 * ( PSRC(IW-1:IE-4,:,:) - 4.0*PSRC(IW:IE-3,:,:) + 3.0* PSRC(IW+1:IE-2,:,:))**2 ! Smoothness indicator
ZOMP1(IW+2:IE-1,:,:) = 1./10. / (ZEPS + ZBPOS1(IW+2:IE-1,:,:))**2 ! Non-normalized weight
!
! Second positive stencil, needs indices i-2, i-1, i
ZFPOS2(IW+2:IE-1,:,:) = 1./6. * (-1.0*PSRC(IW:IE-3,:,:) + 5.0*PSRC(IW+1:IE-2,:,:) + 2.0*PSRC(IW+2:IE-1,:,:)) ! Flux
ZBPOS2(IW+2:IE-1,:,:) = 13./12 * ( PSRC(IW:IE-3,:,:) - 2.0*PSRC(IW+1:IE-2,:,:) + PSRC(IW+2:IE-1,:,:))**2 &
+ 1./4 * ( PSRC(IW:IE-3,:,:) - PSRC(IW+2:IE-1,:,:))**2 ! Smoothness indicator
ZOMP2(IW+2:IE-1,:,:) = 3./5. / (ZEPS + ZBPOS2(IW+2:IE-1,:,:))**2 ! Non-normalized weight
!
! Third positive stencil, needs indices i-1, i, i+1
ZFPOS3(IW+2:IE-1,:,:) = 1./6 * (2.0*PSRC(IW+1:IE-2,:,:) + 5.0*PSRC(IW+2:IE-1,:,:) - PSRC(IW+3:IE,:,:)) ! Flux
ZBPOS3(IW+2:IE-1,:,:) = 13./12 * ( PSRC(IW+1:IE-2,:,:) - 2.0*PSRC(IW+2:IE-1,:,:) + PSRC(IW+3:IE,:,:))**2 &
+ 1./4 * (3.0*PSRC(IW+1:IE-2,:,:) - 4.0*PSRC(IW+2:IE-1,:,:) + PSRC(IW+3:IE,:,:))**2 ! Smoothness indicator
ZOMP3(IW+2:IE-1,:,:) = 3./10. / (ZEPS + ZBPOS3(IW+2:IE-1,:,:))**2 ! Non-normalized weight
!
! ----- Negative fluxes -----
!
! First negative stencil, needs indices i, i+1, i+2
ZFNEG1(IW+2:IE-1,:,:) = 1./6. * (11.0*PSRC(IW+2:IE-1,:,:) - 7.0*PSRC(IW+3:IE,:,:) + 2.0*PSRC(IW+4:IE+1,:,:)) ! Flux
ZBNEG1(IW+2:IE-1,:,:) = 13./12. * ( PSRC(IW+2:IE-1,:,:) - 2.0*PSRC(IW+3:IE,:,:) + PSRC(IW+4:IE+1,:,:))**2 &
+ 1./4 * (3.0* PSRC(IW+2:IE-1,:,:) - 4.0*PSRC(IW+3:IE,:,:) + PSRC(IW+4:IE+1,:,:))**2 ! Smoothness indicator
ZOMN1(IW+2:IE-1,:,:) = 1./10. / (ZEPS + ZBNEG1(IW+2:IE-1,:,:))**2 ! Non-normalized weight
!
! Second negative stencil, needs indices i-1, i, i+1
ZFNEG2(IW+2:IE-1,:,:) = 1./6. * (2.0*PSRC(IW+1:IE-2,:,:) + 5.0*PSRC(IW+2:IE-1,:,:) - 1.0*PSRC(IW+3:IE,:,:)) ! Flux
ZBNEG2(IW+2:IE-1,:,:) = 13./12 * ( PSRC(IW+1:IE-2,:,:) - 2.0*PSRC(IW+2:IE-1,:,:) + PSRC(IW+3:IE,:,:))**2 &
+ 1./4 * ( PSRC(IW+1:IE-2,:,:) - PSRC(IW+3:IE,:,:))**2 ! Smoothness indicator
ZOMN2(IW+2:IE-1,:,:) = 3./5. / (ZEPS + ZBNEG2(IW+2:IE-1,:,:))**2 ! Non-normalized weight
!
! Third negative stencil, needs indices i-2, i-1, i
ZFNEG3(IW+2:IE-1,:,:) = 1./6 * (-1.0*PSRC(IW:IE-3,:,:) + 5.0*PSRC(IW+1:IE-2,:,:) + 2.0*PSRC(IW+2:IE-1,:,:)) ! Flux
ZBNEG3(IW+2:IE-1,:,:) = 13./12 * ( PSRC(IW:IE-3,:,:) - 2.0*PSRC(IW+1:IE-2,:,:) + PSRC(IW+2:IE-1,:,:))**2 &
+ 1./4 * ( PSRC(IW:IE-3,:,:) - 4.0*PSRC(IW+1:IE-2,:,:) + 3.0*PSRC(IW+2:IE-1,:,:))**2 ! Smoothness indicator
ZOMN3(IW+2:IE-1,:,:) = 3./10. / (ZEPS + ZBNEG3(IW+2:IE-1,:,:))**2 ! Non-normalized weight
!
!
! ----- Total flux -----
!
PR(IW+2:IE-1,:,:) = (ZOMP1(IW+2:IE-1,:,:)/(ZOMP1(IW+2:IE-1,:,:)+ZOMP2(IW+2:IE-1,:,:)+ZOMP3(IW+2:IE-1,:,:)) &
* ZFPOS1(IW+2:IE-1,:,:) + &
ZOMP2(IW+2:IE-1,:,:)/(ZOMP1(IW+2:IE-1,:,:)+ZOMP2(IW+2:IE-1,:,:)+ZOMP3(IW+2:IE-1,:,:)) &
* ZFPOS2(IW+2:IE-1,:,:) + &
ZOMP3(IW+2:IE-1,:,:)/(ZOMP1(IW+2:IE-1,:,:)+ZOMP2(IW+2:IE-1,:,:)+ZOMP3(IW+2:IE-1,:,:)) &
* ZFPOS3(IW+2:IE-1,:,:)) &
* (0.5+SIGN(0.5,PRUCT(IW+2:IE-1,:,:))) &
+ (ZOMN1(IW+2:IE-1,:,:)/(ZOMN1(IW+2:IE-1,:,:)+ZOMN2(IW+2:IE-1,:,:)+ZOMN3(IW+2:IE-1,:,:)) &
* ZFNEG1(IW+2:IE-1,:,:) &
+ ZOMN2(IW+2:IE-1,:,:)/(ZOMN1(IW+2:IE-1,:,:)+ZOMN2(IW+2:IE-1,:,:)+ZOMN3(IW+2:IE-1,:,:)) &
* ZFNEG2(IW+2:IE-1,:,:) &
+ ZOMN3(IW+2:IE-1,:,:)/(ZOMN1(IW+2:IE-1,:,:)+ZOMN2(IW+2:IE-1,:,:)+ZOMN3(IW+2:IE-1,:,:)) &
* ZFNEG3(IW+2:IE-1,:,:)) &
* (0.5-SIGN(0.5,PRUCT(IW+2:IE-1,:,:)))
!-------------------------------------------------------------------------------
!* 1.2. West border
! ---------------------
!! IF( LWEST_ll() .AND. .FALSE. ) THEN
IF( LWEST_ll() ) THEN
!-----------------------------------------------------------------------------
! West border is physical -- IW+1,IW
!-----------------------------------------------------------------------------
SELECT CASE (HLBCX(1)) ! X direction LBC type on left side
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
CASE ('CYCL')
!---------------------------------------------------------------------------
! Periodic boundary condition
!---------------------------------------------------------------------------
!
IF(LEAST_ll() .AND. .FALSE. ) THEN ! East border is physical
!
! First positive stencil, needs indices i-3, i-2, i-1
ZFPOS1(IW+1,:,:) = 1./6. * (2.0*PSRC(IE,:,:) - 7.0*PSRC(IW-1,:,:) + 11.0*PSRC(IW,:,:)) ! Flux IW+1
ZFPOS1(IW,:,:) = 1./6. * (2.0*PSRC(IE-1,:,:) - 7.0*PSRC(IE,:,:) + 11.0*PSRC(IW-1,:,:)) ! Flux IW
ZBPOS1(IW+1,:,:) = 13./12. * (PSRC(IE,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW+1
ZBPOS1(IW,:,:) = 13./12. * (PSRC(IE-1,:,:) - 2.0*PSRC(IE,:,:) + PSRC(IW-1,:,:))**2 &
+ 1./4 * (PSRC(IE-1,:,:) - 4.0*PSRC(IE,:,:) + 3.0*PSRC(IW-1,:,:))**2 ! Smoothness indicator IW
ZOMP1(IW:IW+1,:,:) = 1./10. / (ZEPS + ZBPOS1(IW:IW+1,:,:))**2 ! Non-normalized weight IW+1,IW
!
! Second positive stencil, needs indices i-2, i-1, i
ZFPOS2(IW+1,:,:) = 1./6.* (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:)) ! Flux IW+1
ZFPOS2(IW,:,:) = 1./6.* (-1.0*PSRC(IE,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW
ZBPOS2(IW+1,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - PSRC(IW+1,:,:))**2 ! Smoothness indicator IW+1
ZBPOS2(IW,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - PSRC(IW,:,:))**2 ! Smoothness indicator IW
ZOMP2(IW:IW+1,:,:) = 3./5. / (ZEPS + ZBPOS2(IW:IW+1,:,:))**2 ! Non-normalized weight IW+1,IW
!
! Third negative stencil, needs indices i-2, i-1, i
ZFNEG3(IW+1,:,:) = 1./6 * (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:)) ! Flux IW+1
ZFNEG3(IW,:,:) = 1./6 * (-1.0*PSRC(IE,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW
ZBNEG3(IW+1,:,:) = 13./12 * (PSRC(IW-1,:,:) - 2.0*PSRC(IW,:,:) + PSRC(IW+1,:,:))**2 &
+ 1./4 * (PSRC(IW-1,:,:) - 4.0*PSRC(IW,:,:) + 3.0*PSRC(IW+1,:,:))**2 ! Smoothness indicator IW+1
ZBNEG3(IW,:,:) = 13./12 * (PSRC(IE,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IE,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW
ZOMN3(IW:IW+1,:,:) = 3./10. / (ZEPS + ZBNEG3(IW:IW+1,:,:))**2 ! Non-normalized weight IW+1,IW
!
ELSEIF(IW>3) THEN ! East boundary is proc border, with minimum 3 HALO points on west side
!
! First positive stencil, needs indices i-3, i-2, i-1
ZFPOS1(IW+1,:,:) = 1./6. * (2.0*PSRC(IW-2,:,:) - 7.0*PSRC(IW-1,:,:) + 11.0*PSRC(IW,:,:)) ! Flux IW+1
ZFPOS1(IW,:,:) = 1./6. * (2.0*PSRC(IW-3,:,:) - 7.0*PSRC(IW-2,:,:) + 11.0*PSRC(IW-1,:,:)) ! Flux IW
ZBPOS1(IW+1,:,:) = 13./12. * (PSRC(IW-2,:,:) - 2.0*PSRC(IW-1,:,:) + PSRC(IW,:,:))**2 &
+ 1./4 * (PSRC(IW-2,:,:) - 4.0*PSRC(IW-1,:,:) + 3.0*PSRC(IW,:,:))**2 ! Smoothness indicator IW+1
ZBPOS1(IW,:,:) = 13./12. * (PSRC(IW-3,:,:) - 2.0*PSRC(IW-2,:,:) + PSRC(IW-1,:,:))**2 &
+ 1./4 * (PSRC(IW-3,:,:) - 4.0*PSRC(IW-2,:,:) + 3.0*PSRC(IW-1,:,:))**2 ! Smoothness indicator IW
ZOMP1(IW:IW+1,:,:) = 1./10. / (ZEPS + ZBPOS1(IW:IW+1,:,:))**2 ! Non-normalized weight IW+1,IW
!
! Second positive stencil, needs indices i-2, i-1, i
ZFPOS2(IW+1,:,:) = 1./6.* (-1.0*PSRC(IW-1,:,:) + 5.0*PSRC(IW,:,:) + 2.0*PSRC(IW+1,:,:)) ! Flux IW+1
ZFPOS2(IW,:,:) = 1./6.* (-1.0*PSRC(IW-2,:,:) + 5.0*PSRC(IW-1,:,:) + 2.0*PSRC(IW,:,:)) ! Flux IW