LAHARS-MODEL  0.1
templategithubproject
geometry_2d.f90
Go to the documentation of this file.
1 !*********************************************************************
3 !
6 !*********************************************************************
7 MODULE geometry_2d
8 
9  USE parameters_2d, ONLY : verbose_level
10 
11  IMPLICIT NONE
12 
14  REAL*8, ALLOCATABLE :: x_comp(:)
15 
17  REAL*8, ALLOCATABLE :: x_stag(:)
18 
20  REAL*8, ALLOCATABLE :: y_comp(:)
21 
23  REAL*8, ALLOCATABLE :: y_stag(:)
24 
26  REAL*8, ALLOCATABLE :: b_stag_x(:,:)
27 
29  REAL*8, ALLOCATABLE :: b_stag_y(:,:)
30 
32  REAL*8, ALLOCATABLE :: b_nw(:,:)
33 
35  REAL*8, ALLOCATABLE :: b_ne(:,:)
36 
38  REAL*8, ALLOCATABLE :: b_sw(:,:)
39 
41  REAL*8, ALLOCATABLE :: b_se(:,:)
42 
44  REAL*8, ALLOCATABLE :: b_ver(:,:)
45 
47  REAL*8, ALLOCATABLE :: b_cent(:,:)
48 
50  REAL*8, ALLOCATABLE :: b_prime_x(:,:)
51 
53  REAL*8, ALLOCATABLE :: b_prime_y(:,:)
54 
56  REAL*8, ALLOCATABLE :: grid_output(:,:)
57 
59  REAL*8, ALLOCATABLE :: grav_surf(:,:)
60 
62  REAL*8, ALLOCATABLE :: curv_xy(:,:)
63 
64  REAL*8, ALLOCATABLE :: topography_profile(:,:,:)
65 
67 
68  REAL*8 :: dx
69  REAL*8 :: x0
70  REAL*8 :: xn
71  REAL*8 :: dy
72  REAL*8 :: y0
73  REAL*8 :: yn
74  REAL*8 :: dx2
75  REAL*8 :: dy2
76  INTEGER :: comp_cells_x
77  INTEGER :: comp_interfaces_x
78  INTEGER :: comp_cells_y
79  INTEGER :: comp_interfaces_y
80  REAL*8 :: cell_size
81 
82 CONTAINS
83 
84  !*********************************************************************
86  !
89  !*********************************************************************
90 
91  SUBROUTINE init_grid
92 
94 
95  IMPLICIT none
96 
97  INTEGER j,k
98 
101 
102  ALLOCATE( x_comp(comp_cells_x) )
103  ALLOCATE( x_stag(comp_interfaces_x) )
104  ALLOCATE( y_comp(comp_cells_y) )
105  ALLOCATE( y_stag(comp_interfaces_y) )
106 
107  ALLOCATE( b_cent(comp_cells_x,comp_cells_y) )
108  ALLOCATE( b_prime_x(comp_cells_x,comp_cells_y) )
109  ALLOCATE( b_prime_y(comp_cells_x,comp_cells_y) )
113 
114  ALLOCATE( b_nw(comp_cells_x,comp_cells_y) )
115  ALLOCATE( b_ne(comp_cells_x,comp_cells_y) )
116  ALLOCATE( b_sw(comp_cells_x,comp_cells_y) )
117  ALLOCATE( b_se(comp_cells_x,comp_cells_y) )
118 
120 
121  ALLOCATE( grav_surf(comp_cells_x,comp_cells_y) )
122 
123  IF ( comp_cells_x .GT. 1 ) THEN
124 
125  dx = cell_size
126 
127  ELSE
128 
129  dx = 1.d0
130 
131  END IF
132 
133 
134  IF ( comp_cells_y .GT. 1 ) THEN
135 
136  dy = cell_size
137 
138  ELSE
139 
140  dy = 1.d0
141 
142  END IF
143 
144  xn = x0 + comp_cells_x * dx
145  yn = y0 + comp_cells_y * dy
146 
147  dx2 = dx / 2.d0
148  dy2 = dy / 2.d0
149 
150  ! eps_sing = MIN( dx ** 4.D0,dy ** 4.D0 )
151  eps_sing=min(min( dx ** 4.d0,dy ** 4.d0 ),1.d-20)
152 
153  IF ( verbose_level .GE. 1 ) WRITE(*,*) 'eps_sing = ',eps_sing
154 
155  x_comp(1) = x0 + 0.5d0 * dx
156  x_stag(1) = x0
157  y_comp(1) = y0 + 0.5d0 * dy
158  y_stag(1) = y0
159 
160  ! if topography is defined in file .inp we do a rescaling
161  IF ( .NOT.topography_demfile ) THEN
162 
163  topography_profile(1,:,:) = x0 + ( xn - x0 ) * topography_profile(1,:,:)
164 
165  topography_profile(2,:,:) = y0 + ( yn - y0 ) * topography_profile(2,:,:)
166 
167  b_ver(1,1) = topography_profile(3,1,1)
168 
169  WRITE(*,*) 'topography_profile(3,:,:)',topography_profile(3,:,:)
170 
171  ! bottom row
172  DO j=1,comp_cells_x
173 
174  x_stag(j+1) = x_stag(j) + dx
175 
176  IF( k .EQ. comp_cells_y ) THEN
177 
178  ! right-bottom vertex
180 
181  ELSE
182 
183  CALL interp_1d_scalar( topography_profile(1,:,1) , &
184  topography_profile(3,:,1) , x_stag(j+1) , b_ver(j+1,1) )
185 
186  ENDIF
187 
188  b_stag_y(j,1)=0.5*(b_ver(j+1,1)+b_ver(j,1))
189 
190  ENDDO
191 
192  ! left column
193  DO k=1,comp_cells_y
194 
195  y_stag(k+1) = y_stag(k) + dy
196 
197  IF ( k .EQ. comp_cells_y ) THEN
198 
199  ! left-top vertex
201 
202  ELSE
203 
204  CALL interp_1d_scalar( topography_profile(2,1,:) , &
205  topography_profile(3,1,:) , y_stag(k+1) , b_ver(1,k+1) )
206 
207  ENDIF
208 
209  b_stag_x(1,k)=0.5*(b_ver(1,k+1)+b_ver(1,k))
210 
211  ENDDO
212 
213  ! all the other cells
214  DO j = 1,comp_cells_x
215 
216  x_comp(j) = 0.5 * ( x_stag(j) + x_stag(j+1) )
217 
218  DO k = 1,comp_cells_y
219 
220  y_comp(k) = 0.5 * ( y_stag(k) + y_stag(k+1) )
221 
222  ! right column
223  IF ( j.EQ.comp_cells_x .AND. k.NE.comp_cells_y ) THEN
224 
225  CALL interp_1d_scalar( &
228  y_stag(k+1) , b_ver(j+1,k+1) )
229 
230  ! top row
231  ELSEIF ( j.NE.comp_cells_x .AND. k.EQ.comp_cells_y ) THEN
232 
233  CALL interp_1d_scalar( &
236  x_stag(j+1) , b_ver(j+1,k+1) )
237 
238  ! right-top vertex
239  ELSEIF ( j.EQ.comp_cells_x .AND. k.EQ.comp_cells_y ) THEN
240 
243 
244  ! internal cells
245  ELSE
246 
247  CALL interp_2d_scalar( topography_profile(1,:,:) , &
248  & topography_profile(2,:,:), topography_profile(3,:,:) , &
249  & x_stag(j+1), y_stag(k+1) , b_ver(j+1,k+1) )
250 
251  ENDIF
252 
253  ! Eq. 3.12 K&P
254  b_cent(j,k) = 0.25 * ( b_ver(j,k) + b_ver(j+1,k) + b_ver(j,k+1) &
255  + b_ver(j+1,k+1) )
256 
257  ! Eq. 3.13 K&P
258  b_stag_x(j+1,k) = 0.5d0 * (b_ver(j+1,k+1)+b_ver(j+1,k))
259 
260  ! Eq. 3.14 K&P
261  b_stag_y(j,k+1) = 0.5d0 * (b_ver(j+1,k+1)+b_ver(j,k+1))
262 
263  ! Second factor in RHS 1st Eq. 3.16 K&P
264  b_prime_x(j,k) = ( b_stag_x(j+1,k) - b_stag_x(j,k) ) / &
265  ( x_stag(j+1) - x_stag(j) )
266 
267  ! Second factor in RHS 2nd Eq. 3.16 K&P
268  b_prime_y(j,k) = ( b_stag_y(j,k+1) - b_stag_y(j,k) ) / &
269  ( y_stag(k+1) - y_stag(k) )
270 
271  IF ( verbose_level .GE. 2 ) THEN
272 
273  WRITE(*,*) topography_profile(1,:,:)
274  WRITE(*,*) topography_profile(2,:,:)
275  WRITE(*,*) topography_profile(3,:,:)
276  WRITE(*,*) x_stag(j+1) , y_stag(k+1) , b_stag_x(j+1,k) , &
277  b_stag_y(j,k+1) , x_comp(j) , y_comp(k) , b_cent(j,k) , &
278  b_ver(j+1,k+1) , b_prime_x(j,k) , b_prime_y(j,k)
279  READ(*,*)
280 
281  END IF
282 
283  END DO
284 
285  ENDDO
286 
287  ! topography from larger dem
288  ELSE
289 
290  DO j=1,comp_interfaces_x
291 
292  x_stag(j) = x0 + (j-1) * dx
293 
294  END DO
295 
296  DO k=1,comp_interfaces_y
297 
298  y_stag(k) = y0 + (k-1) * dy
299 
300  END DO
301 
302  DO j=1,comp_cells_x
303 
304  x_comp(j) = 0.5d0 * ( x_stag(j) + x_stag(j+1) )
305 
306  END DO
307 
308  DO k=1,comp_cells_y
309 
310  y_comp(k) = 0.5d0 * ( y_stag(k) + y_stag(k+1) )
311 
312  END DO
313 
314  DO j=1,comp_interfaces_x
315 
316  DO k=1,comp_interfaces_y
317 
318  CALL interp_2d_scalar( topography_profile(1,:,:) , &
319  topography_profile(2,:,:), topography_profile(3,:,:) , &
320  x_stag(j), y_stag(k) , b_ver(j,k) )
321 
322  END DO
323 
324  END DO
325 
326  DO j=1,comp_cells_x
327 
328  DO k=1,comp_interfaces_y
329 
330  ! Eq. 3.14 K&P
331  b_stag_y(j,k) = 0.5d0 * ( b_ver(j+1,k) + b_ver(j,k) )
332 
333  END DO
334 
335  END DO
336 
337  DO j=1,comp_interfaces_x
338 
339  DO k=1,comp_cells_y
340 
341  ! Eq. 3.13 K&P
342  b_stag_x(j,k) = 0.5d0 * ( b_ver(j,k+1) + b_ver(j,k) )
343 
344  END DO
345 
346  END DO
347 
348  DO j=1,comp_cells_x
349 
350  DO k=1,comp_cells_y
351 
352  ! Eq. 3.12 K&P
353  b_cent(j,k) = 0.25d0 * ( b_ver(j,k) + b_ver(j+1,k) + b_ver(j,k+1) &
354  + b_ver(j+1,k+1) )
355 
356  ! Second factor in RHS 1st Eq. 3.16 K&P
357  b_prime_x(j,k) = ( b_stag_x(j+1,k) - b_stag_x(j,k) ) / &
358  ( x_stag(j+1) - x_stag(j) )
359 
360  ! Second factor in RHS 2nd Eq. 3.16 K&P
361  b_prime_y(j,k) = ( b_stag_y(j,k+1) - b_stag_y(j,k) ) / &
362  ( y_stag(k+1) - y_stag(k) )
363 
364  END DO
365 
366  ENDDO
367 
368  ENDIF
369 
370  ! this coefficient is used when the the scalar dot between the normal to the
371  ! topography and gravity is computed
372  DO j = 1,comp_cells_x
373 
374  DO k=1,comp_cells_y
375 
376  grav_surf(j,k) = - ( 1.d0/ dsqrt( 1.d0 + b_prime_x(j,k)**2 &
377  + b_prime_y(j,k)**2) )
378 
379  ENDDO
380 
381  ENDDO
382 
383  END SUBROUTINE init_grid
384 
385  !---------------------------------------------------------------------------
387  !
395  !---------------------------------------------------------------------------
396 
397  SUBROUTINE interp_1d_scalar(x1, f1, x2, f2)
398  IMPLICIT NONE
399 
400  REAL*8, INTENT(IN), DIMENSION(:) :: x1, f1
401  REAL*8, INTENT(IN) :: x2
402  REAL*8, INTENT(OUT) :: f2
403  INTEGER :: n, n1x, t
404  REAL*8 :: grad , rel_pos
405 
406  n1x = SIZE(x1)
407 
408  !
409  ! ... locate the grid points near the topographic points
410  ! ... and interpolate linearly the profile
411  !
412  t = 1
413 
414  search:DO n = 1, n1x-1
415 
416  rel_pos = ( x2 - x1(n) ) / ( x1(n+1) - x1(n) )
417 
418  IF ( ( rel_pos .GE. 0.d0 ) .AND. ( rel_pos .LE. 1.d0 ) ) THEN
419 
420  grad = ( f1(n+1)-f1(n) ) / ( x1(n+1)-x1(n) )
421  f2 = f1(n) + ( x2-x1(n) ) * grad
422 
423  EXIT search
424 
425  ELSEIF ( rel_pos .LT. 0.d0 ) THEN
426 
427  f2 = f1(n)
428 
429  ELSE
430 
431  f2 = f1(n+1)
432 
433  END IF
434 
435  END DO search
436 
437  RETURN
438 
439  END SUBROUTINE interp_1d_scalar
440 
441  !---------------------------------------------------------------------------
443  !
453  !---------------------------------------------------------------------------
454 
455  SUBROUTINE interp_2d_scalar(x1, y1, f1, x2, y2, f2)
456  IMPLICIT NONE
457 
458  REAL*8, INTENT(IN), DIMENSION(:,:) :: x1, y1, f1
459  REAL*8, INTENT(IN) :: x2, y2
460  REAL*8, INTENT(OUT) :: f2
461 
462  INTEGER :: ix , iy
463  REAL*8 :: alfa_x , alfa_y
464 
465  IF ( size(x1,1) .GT. 1 ) THEN
466 
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) )
470 
471  ELSE
472 
473  ix = 1
474  alfa_x = 0.d0
475 
476  END IF
477 
478  IF ( size(x1,2) .GT. 1 ) THEN
479 
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) )
483 
484  ELSE
485 
486  iy = 1
487  alfa_y = 0.d0
488 
489  END IF
490 
491  IF ( size(x1,1) .EQ. 1 ) THEN
492 
493  f2 = alfa_y * f1(ix,iy) + ( 1.d0 - alfa_y ) * f1(ix,iy+1)
494 
495  ELSEIF ( size(x1,2) .EQ. 1 ) THEN
496 
497  f2 = alfa_x * f1(ix,iy) + ( 1.d0 - alfa_x ) * f1(ix+1,iy)
498 
499  ELSE
500 
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 ) &
503  * f1(ix+1,iy+1) )
504 
505  END IF
506 
507  END SUBROUTINE interp_2d_scalar
508 
509 
510  !---------------------------------------------------------------------------
512  !
523  !---------------------------------------------------------------------------
524 
525  SUBROUTINE interp_2d_scalarb(x1, y1, f1, x2, y2, f2)
526  IMPLICIT NONE
527 
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
532 
533  INTEGER :: ix , iy
534  REAL*8 :: alfa_x , alfa_y
535 
536  IF ( size(x1) .GT. 1 ) THEN
537 
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) )
541 
542  ELSE
543 
544  ix = 1
545  alfa_x = 0.d0
546 
547  END IF
548 
549  IF ( size(y1) .GT. 1 ) THEN
550 
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) )
554 
555  ELSE
556 
557  iy = 1
558  alfa_y = 0.d0
559 
560  END IF
561 
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
564 
565  f2 = 0.d0
566  RETURN
567 
568  END IF
569 
570 
571  IF ( size(x1) .EQ. 1 ) THEN
572 
573  f2 = alfa_y * f1(ix,iy) + ( 1.d0 - alfa_y ) * f1(ix,iy+1)
574 
575  ELSEIF ( size(y1) .EQ. 1 ) THEN
576 
577  f2 = alfa_x * f1(ix,iy) + ( 1.d0 - alfa_x ) * f1(ix+1,iy)
578 
579  ELSE
580 
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 ) &
583  * f1(ix+1,iy+1) )
584 
585  END IF
586 
587  RETURN
588 
589  END SUBROUTINE interp_2d_scalarb
590 
591 
592  !---------------------------------------------------------------------------
594  !
607  !---------------------------------------------------------------------------
608 
609  SUBROUTINE regrid_scalar(xin, yin, fin, xl, xr , yl, yr, fout)
610  IMPLICIT NONE
611 
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
616 
617  INTEGER :: ix , iy
618  INTEGER :: ix1 , ix2 , iy1 , iy2
619  REAL*8 :: alfa_x , alfa_y
620  REAL*8 :: dXin , dYin
621 
622  INTEGER nXin,nYin
623 
624  nxin = size(xin)-1
625  nyin = size(yin)-1
626 
627  dxin = xin(2) - xin(1)
628  dyin = yin(2) - yin(1)
629 
630  ix1 = max(1,ceiling( ( xl - xin(1) ) / dxin ))
631  ix2 = min(nxin,ceiling( ( xr -xin(1) ) / dxin )+1)
632 
633  iy1 = max(1,ceiling( ( yl - yin(1) ) / dyin ))
634  iy2 = min(nyin,ceiling( ( yr - yin(1) ) / dyin ) + 1)
635 
636  fout = 0.d0
637 
638  DO ix=ix1,ix2-1
639 
640  alfa_x = ( min(xr,xin(ix+1)) - max(xl,xin(ix)) ) / ( xr - xl )
641 
642  DO iy=iy1,iy2-1
643 
644  alfa_y = ( min(yr,yin(iy+1)) - max(yl,yin(iy)) ) / ( yr - yl )
645 
646  fout = fout + alfa_x * alfa_y * fin(ix,iy)
647 
648  END DO
649 
650  END DO
651 
652  END SUBROUTINE regrid_scalar
653 
654  !------------------------------------------------------------------------------
656  !
662  !------------------------------------------------------------------------------
663  REAL*8 FUNCTION topography_function(x,y)
664  IMPLICIT NONE
665 
666  REAL*8, INTENT(IN) :: x,y
667 
668  REAL*8, PARAMETER :: pig = 4.0*atan(1.0)
669  REAL*8, PARAMETER :: eps_dis = 1.d-8
670  REAL*8 :: a
671 
672  ! example 1D from Kurganov and Petrova 2007
673  !IF(y.LT.0.0)THEN
674  !
675  ! topography_function = 1.d0
676  !
677  !ELSEIF(y.GE.0.0.AND.y.LE.0.4)THEN
678  !
679  ! topography_function = COS(pig*y)**2
680  !
681  !ELSEIF(y.GT.0.4.AND.y.LE.0.5)THEN
682  !
683  ! topography_function = COS(pig*y)**2+0.25*(COS(10.0*pig*(y-0.5))+1)
684  !
685  !ELSEIF(y.GT.0.5.AND.y.LE.0.6)THEN
686  !
687  ! topography_function = 0.5*COS(pig*y)**4+0.25*(COS(10.0*pig*(y-0.5))+1)
688  !
689  !ELSEIF(y.GT.0.6.AND.y.LT.1.0-eps_dis)THEN
690  !
691  ! topography_function = 0.5*COS(pig*y)**4
692  !
693  !ELSEIF(y.GE.1.0-eps_dis.AND.y.LE.1.0+eps_dis)THEN
694  !
695  ! topography_function = 0.25
696  !
697  !ELSEIF(y.GT.1.0+eps_dis.AND.y.LE.1.5)THEN
698  !
699  ! topography_function = 0.25*SIN(2*pig*(y-1))
700  !
701  !ELSE
702  !
703  ! topography_function = 0.d0
704  !
705  !ENDIF
706 
707 
708  ! example 2D from Kurganov and Petrova 2007
709  IF(abs(y).LE.0.5.AND.x.LE.(y-1.0)/2.0)THEN
710 
711  a=y**2
712 
713  ELSEIF(abs(y).GT.0.5.AND.x.LE.(y-1.0)/2.0)THEN
714 
715  a=y**2+0.1*sin(pig*x)
716 
717  ELSE
718 
719  a=max(0.125,y**2+0.1*sin(pig*x))
720 
721  ENDIF
722 
723  topography_function=7.0/32.0*exp(-8.0*(x-0.3)**2-60.0*(y-0.1)**2)- &
724  & 1.0/8.0*exp(-30.0*(x+0.1)**2-90.0*(y+0.2)**2) + a
725 
726  END FUNCTION topography_function
727 
728 
729 END MODULE geometry_2d
real *8, dimension(:,:), allocatable b_prime_x
Topography slope (x direction) at the centers of the control volumes.
Definition: geometry_2d.f90:50
logical topography_demfile
Flag for uploading topography from a different file (topography_dem.asc)
real *8 dy
Control volumes size.
Definition: geometry_2d.f90:71
real *8, dimension(:), allocatable x_comp
Location of the centers (x) of the control volume of the domain.
Definition: geometry_2d.f90:14
real *8 y0
Bottom of the physical domain.
Definition: geometry_2d.f90:72
real *8, dimension(:,:), allocatable b_cent
Topography at the centers of the control volumes.
Definition: geometry_2d.f90:47
integer comp_cells_x
Number of control volumes x in the comp. domain.
Definition: geometry_2d.f90:76
real *8, dimension(:,:), allocatable grav_surf
gravity vector wrt surface coordinates for each cell
Definition: geometry_2d.f90:59
real *8, dimension(:), allocatable y_comp
Location of the centers (y) of the control volume of the domain.
Definition: geometry_2d.f90:20
integer n_topography_profile_y
Definition: geometry_2d.f90:66
Parameters.
real *8 dx
Control volumes size.
Definition: geometry_2d.f90:68
real *8, dimension(:,:), allocatable b_sw
Topography interpolated at the SW corner of the control volumes.
Definition: geometry_2d.f90:38
integer comp_cells_y
Number of control volumes y in the comp. domain.
Definition: geometry_2d.f90:78
real *8, dimension(:,:), allocatable curv_xy
curvature wrt mixed directions for each cell
Definition: geometry_2d.f90:62
subroutine regrid_scalar(xin, yin, fin, xl, xr, yl, yr, fout)
Scalar regrid (2D)
integer n_topography_profile_x
Definition: geometry_2d.f90:66
integer comp_interfaces_y
Number of interfaces (comp_cells_y+1)
Definition: geometry_2d.f90:79
real *8 xn
Right of the physical domain.
Definition: geometry_2d.f90:70
subroutine init_grid
Finite volume grid initialization.
Definition: geometry_2d.f90:92
real *8 yn
Top of the physical domain.
Definition: geometry_2d.f90:73
real *8 x0
Left of the physical domain.
Definition: geometry_2d.f90:69
real *8, dimension(:,:), allocatable b_ver
Topography at the vertices of the control volumes.
Definition: geometry_2d.f90:44
real *8, dimension(:,:), allocatable grid_output
Solution in ascii grid format (ESRI)
Definition: geometry_2d.f90:56
Grid module.
Definition: geometry_2d.f90:7
real *8 cell_size
Definition: geometry_2d.f90:80
real *8, dimension(:,:), allocatable b_stag_x
Topography at the boundaries (x) of the control volumes.
Definition: geometry_2d.f90:26
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.
Definition: geometry_2d.f90:35
integer verbose_level
real *8, dimension(:,:,:), allocatable topography_profile
Definition: geometry_2d.f90:64
real *8, dimension(:,:), allocatable b_prime_y
Topography slope (y direction) at the centers of the control volumes.
Definition: geometry_2d.f90:53
real *8, dimension(:,:), allocatable b_stag_y
Topography at the boundaries (y) of the control volumes.
Definition: geometry_2d.f90:29
real *8, dimension(:), allocatable x_stag
Location of the boundaries (x) of the control volumes of the domain.
Definition: geometry_2d.f90:17
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.
Definition: geometry_2d.f90:41
real *8 dx2
Half x Control volumes size.
Definition: geometry_2d.f90:74
real *8, dimension(:,:), allocatable b_nw
Topography interpolated at the NW corner of the control volumes.
Definition: geometry_2d.f90:32
integer comp_interfaces_x
Number of interfaces (comp_cells_x+1)
Definition: geometry_2d.f90:77
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.
Definition: geometry_2d.f90:23
subroutine interp_1d_scalar(x1, f1, x2, f2)
Scalar interpolation.
real *8 dy2
Half y Control volumes size.
Definition: geometry_2d.f90:75