32 REAL*8,
ALLOCATABLE ::
b_nw(:,:)
35 REAL*8,
ALLOCATABLE ::
b_ne(:,:)
38 REAL*8,
ALLOCATABLE ::
b_sw(:,:)
41 REAL*8,
ALLOCATABLE ::
b_se(:,:)
44 REAL*8,
ALLOCATABLE ::
b_ver(:,:)
153 IF ( verbose_level .GE. 1 )
WRITE(*,*)
'eps_sing = ',
eps_sing 271 IF ( verbose_level .GE. 2 )
THEN 400 REAL*8,
INTENT(IN),
DIMENSION(:) :: x1, f1
401 REAL*8,
INTENT(IN) :: x2
402 REAL*8,
INTENT(OUT) :: f2
404 REAL*8 :: grad , rel_pos
414 search:
DO n = 1, n1x-1
416 rel_pos = ( x2 - x1(n) ) / ( x1(n+1) - x1(n) )
418 IF ( ( rel_pos .GE. 0.d0 ) .AND. ( rel_pos .LE. 1.d0 ) )
THEN 420 grad = ( f1(n+1)-f1(n) ) / ( x1(n+1)-x1(n) )
421 f2 = f1(n) + ( x2-x1(n) ) * grad
425 ELSEIF ( rel_pos .LT. 0.d0 )
THEN 458 REAL*8,
INTENT(IN),
DIMENSION(:,:) :: x1, y1, f1
459 REAL*8,
INTENT(IN) :: x2, y2
460 REAL*8,
INTENT(OUT) :: f2
463 REAL*8 :: alfa_x , alfa_y
465 IF (
size(x1,1) .GT. 1 )
THEN 467 ix = floor( ( x2 - x1(1,1) ) / ( x1(2,1) - x1(1,1) ) ) + 1
468 ix = min( ix ,
SIZE(x1,1)-1 )
469 alfa_x = ( x1(ix+1,1) - x2 ) / ( x1(ix+1,1) - x1(ix,1) )
478 IF (
size(x1,2) .GT. 1 )
THEN 480 iy = floor( ( y2 - y1(1,1) ) / ( y1(1,2) - y1(1,1) ) ) + 1
481 iy = min( iy ,
SIZE(x1,2)-1 )
482 alfa_y = ( y1(1,iy+1) - y2 ) / ( y1(1,iy+1) - y1(1,iy) )
491 IF (
size(x1,1) .EQ. 1 )
THEN 493 f2 = alfa_y * f1(ix,iy) + ( 1.d0 - alfa_y ) * f1(ix,iy+1)
495 ELSEIF (
size(x1,2) .EQ. 1 )
THEN 497 f2 = alfa_x * f1(ix,iy) + ( 1.d0 - alfa_x ) * f1(ix+1,iy)
501 f2 = alfa_x * ( alfa_y * f1(ix,iy) + ( 1.d0 - alfa_y ) * f1(ix,iy+1) ) &
502 + ( 1.d0 - alfa_x ) * ( alfa_y * f1(ix+1,iy) + ( 1.d0 - alfa_y ) &
528 REAL*8,
INTENT(IN),
DIMENSION(:) :: x1, y1
529 REAL*8,
INTENT(IN),
DIMENSION(:,:) :: f1
530 REAL*8,
INTENT(IN) :: x2, y2
531 REAL*8,
INTENT(OUT) :: f2
534 REAL*8 :: alfa_x , alfa_y
536 IF (
size(x1) .GT. 1 )
THEN 538 ix = floor( ( x2 - x1(1) ) / ( x1(2) - x1(1) ) ) + 1
539 ix = max(0,min( ix ,
SIZE(x1)-1 ))
540 alfa_x = ( x1(ix+1) - x2 ) / ( x1(ix+1) - x1(ix) )
549 IF (
size(y1) .GT. 1 )
THEN 551 iy = floor( ( y2 - y1(1) ) / ( y1(2) - y1(1) ) ) + 1
552 iy = max(1,min( iy ,
SIZE(y1)-1 ))
553 alfa_y = ( y1(iy+1) - y2 ) / ( y1(iy+1) - y1(iy) )
562 IF ( ( alfa_x .LT. 0.d0 ) .OR. ( alfa_x .GT. 1.d0 ) &
563 .OR. ( alfa_y .LT. 0.d0 ) .OR. ( alfa_y .GT. 1.d0 ) )
THEN 571 IF (
size(x1) .EQ. 1 )
THEN 573 f2 = alfa_y * f1(ix,iy) + ( 1.d0 - alfa_y ) * f1(ix,iy+1)
575 ELSEIF (
size(y1) .EQ. 1 )
THEN 577 f2 = alfa_x * f1(ix,iy) + ( 1.d0 - alfa_x ) * f1(ix+1,iy)
581 f2 = alfa_x * ( alfa_y * f1(ix,iy) + ( 1.d0 - alfa_y ) * f1(ix,iy+1) ) &
582 + ( 1.d0 - alfa_x ) * ( alfa_y * f1(ix+1,iy) + ( 1.d0 - alfa_y ) &
609 SUBROUTINE regrid_scalar(xin, yin, fin, xl, xr , yl, yr, fout)
612 REAL*8,
INTENT(IN),
DIMENSION(:) :: xin, yin
613 REAL*8,
INTENT(IN),
DIMENSION(:,:) :: fin
614 REAL*8,
INTENT(IN) :: xl, xr , yl , yr
615 REAL*8,
INTENT(OUT) :: fout
618 INTEGER :: ix1 , ix2 , iy1 , iy2
619 REAL*8 :: alfa_x , alfa_y
620 REAL*8 :: dXin , dYin
627 dxin = xin(2) - xin(1)
628 dyin = yin(2) - yin(1)
630 ix1 = max(1,ceiling( ( xl - xin(1) ) / dxin ))
631 ix2 = min(nxin,ceiling( ( xr -xin(1) ) / dxin )+1)
633 iy1 = max(1,ceiling( ( yl - yin(1) ) / dyin ))
634 iy2 = min(nyin,ceiling( ( yr - yin(1) ) / dyin ) + 1)
640 alfa_x = ( min(xr,xin(ix+1)) - max(xl,xin(ix)) ) / ( xr - xl )
644 alfa_y = ( min(yr,yin(iy+1)) - max(yl,yin(iy)) ) / ( yr - yl )
646 fout = fout + alfa_x * alfa_y * fin(ix,iy)
666 REAL*8,
INTENT(IN) :: x,y
668 REAL*8,
PARAMETER :: pig = 4.0*atan(1.0)
669 REAL*8,
PARAMETER :: eps_dis = 1.d-8
709 IF(abs(y).LE.0.5.AND.x.LE.(y-1.0)/2.0)
THEN 713 ELSEIF(abs(y).GT.0.5.AND.x.LE.(y-1.0)/2.0)
THEN 715 a=y**2+0.1*sin(pig*x)
719 a=max(0.125,y**2+0.1*sin(pig*x))
724 & 1.0/8.0*exp(-30.0*(x+0.1)**2-90.0*(y+0.2)**2) + a
real *8, dimension(:,:), allocatable b_prime_x
Topography slope (x direction) at the centers of the control volumes.
logical topography_demfile
Flag for uploading topography from a different file (topography_dem.asc)
real *8 dy
Control volumes size.
real *8, dimension(:), allocatable x_comp
Location of the centers (x) of the control volume of the domain.
real *8 y0
Bottom of the physical domain.
real *8, dimension(:,:), allocatable b_cent
Topography at the centers of the control volumes.
integer comp_cells_x
Number of control volumes x in the comp. domain.
real *8, dimension(:,:), allocatable grav_surf
gravity vector wrt surface coordinates for each cell
real *8, dimension(:), allocatable y_comp
Location of the centers (y) of the control volume of the domain.
integer n_topography_profile_y
real *8 dx
Control volumes size.
real *8, dimension(:,:), allocatable b_sw
Topography interpolated at the SW corner of the control volumes.
integer comp_cells_y
Number of control volumes y in the comp. domain.
real *8, dimension(:,:), allocatable curv_xy
curvature wrt mixed directions for each cell
subroutine regrid_scalar(xin, yin, fin, xl, xr, yl, yr, fout)
Scalar regrid (2D)
integer n_topography_profile_x
integer comp_interfaces_y
Number of interfaces (comp_cells_y+1)
real *8 xn
Right of the physical domain.
subroutine init_grid
Finite volume grid initialization.
real *8 yn
Top of the physical domain.
real *8 x0
Left of the physical domain.
real *8, dimension(:,:), allocatable b_ver
Topography at the vertices of the control volumes.
real *8, dimension(:,:), allocatable grid_output
Solution in ascii grid format (ESRI)
real *8, dimension(:,:), allocatable b_stag_x
Topography at the boundaries (x) of the control volumes.
real *8 function topography_function(x, y)
Topography function.
real *8, dimension(:,:), allocatable b_ne
Topography interpolated at the NE corner of the control volumes.
real *8, dimension(:,:,:), allocatable topography_profile
real *8, dimension(:,:), allocatable b_prime_y
Topography slope (y direction) at the centers of the control volumes.
real *8, dimension(:,:), allocatable b_stag_y
Topography at the boundaries (y) of the control volumes.
real *8, dimension(:), allocatable x_stag
Location of the boundaries (x) of the control volumes of the domain.
subroutine interp_2d_scalarb(x1, y1, f1, x2, y2, f2)
Scalar interpolation (2D)
subroutine interp_2d_scalar(x1, y1, f1, x2, y2, f2)
Scalar interpolation (2D)
real *8, dimension(:,:), allocatable b_se
Topography interpolated at the SE corner of the control volumes.
real *8 dx2
Half x Control volumes size.
real *8, dimension(:,:), allocatable b_nw
Topography interpolated at the NW corner of the control volumes.
integer comp_interfaces_x
Number of interfaces (comp_cells_x+1)
real *8 eps_sing
parameter for desingularization
real *8, dimension(:), allocatable y_stag
Location of the boundaries (x) of the control volumes of the domain.
subroutine interp_1d_scalar(x1, f1, x2, f2)
Scalar interpolation.
real *8 dy2
Half y Control volumes size.