LAHARS-MODEL  0.1
templategithubproject
constitutive_2d.f90
Go to the documentation of this file.
1 !********************************************************************************
3 !********************************************************************************
5 
6  USE parameters_2d, ONLY : n_eqns , n_vars
10  USE parameters_2d, ONLY : sed_vol_perc
11 
12  IMPLICIT none
13 
14  LOGICAL, ALLOCATABLE :: implicit_flag(:)
15 
16  CHARACTER(LEN=20) :: phase1_name
17  CHARACTER(LEN=20) :: phase2_name
18 
19  COMPLEX*16 :: h
20  COMPLEX*16 :: u
21  COMPLEX*16 :: v
22  COMPLEX*16 :: t
23  COMPLEX*16 :: alphas
24  COMPLEX*16 :: rho_m
25 
27  REAL*8 :: grav
28 
30  REAL*8 :: mu
31  REAL*8 :: xi
32 
34  REAL*8 :: tau
35 
37  REAL*8 :: t_env
38 
40  REAL*8 :: rad_coeff
41 
43  REAL*8 :: frict_coeff
44 
46  REAL*8 :: rho
47 
49  REAL*8 :: t_ref
50 
52  REAL*8 :: nu_ref
53 
55  REAL*8 :: visc_par
56 
58  REAL*8 :: emme
59 
61  REAL*8 :: c_p
62 
65 
67  REAL*8 :: exp_area_fract
68 
70  REAL*8, PARAMETER :: sbconst = 5.67d-8
71 
73  REAL*8 :: emissivity
74 
76  REAL*8 :: enne
77 
79  REAL*8 :: t_ground
80 
83 
84  !--- Lahars rheology model parameters
85 
87  REAL*8 :: alpha2
88 
90  REAL*8 :: beta2
91 
93  REAL*8 :: alpha1
94 
96  REAL*8 :: beta1
97 
99  REAL*8 :: kappa
100 
102  REAL*8 :: n_td
103 
105  REAL*8 :: rho_w
106 
108  REAL*8 :: rho_s
109 
111  REAL*8 :: settling_vel
112 
114  REAL*8 :: erosion_coeff
115 
116 
117 CONTAINS
118 
119  !******************************************************************************
121  !
125  !******************************************************************************
126 
127  SUBROUTINE init_problem_param
129  USE parameters_2d, ONLY : n_nh
130 
131  ALLOCATE( implicit_flag(n_eqns) )
132 
133  implicit_flag(1:n_eqns) = .false.
134  implicit_flag(2) = .true.
135  implicit_flag(3) = .true.
136 
137  IF ( solid_transport_flag ) THEN
138 
139  IF ( temperature_flag ) implicit_flag(5) = .true.
140 
141  ELSE
142 
143  IF ( temperature_flag ) implicit_flag(4) = .true.
144 
145  END IF
146 
147  n_nh = count( implicit_flag )
148 
149  END SUBROUTINE init_problem_param
150 
151  !******************************************************************************
153  !
161  !******************************************************************************
162 
163  SUBROUTINE phys_var(r_qj,c_qj)
164 
165  USE complexify
166  USE parameters_2d, ONLY : eps_sing
167  IMPLICIT none
168 
169  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
170  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
171 
172  COMPLEX*16 :: qj(n_vars)
173 
174  IF ( present(c_qj) ) THEN
175 
176  qj = c_qj
177 
178  ELSE
179 
180  qj = dcmplx(r_qj)
181 
182  END IF
183 
184  h = qj(1)
185 
186  IF ( solid_transport_flag ) THEN
187 
188  IF ( dble( h ) .GT. 1.d-25 ) THEN
189 
190  alphas = qj(4) / h
191 
192  IF ( temperature_flag ) t = qj(5) / h
193 
194  ELSE
195 
196  alphas = dsqrt(2.d0) * h * qj(4) / cdsqrt( h**4 + eps_sing )
197 
198  IF ( temperature_flag ) THEN
199 
200  t = dsqrt(2.d0) * h * qj(5) / cdsqrt( h**4 + eps_sing )
201 
202  END IF
203 
204  END IF
205 
206  rho_m = ( dcmplx(1.d0,0.d0) - alphas ) * rho_w + alphas * rho_s
207 
208  ELSE
209 
210  IF ( temperature_flag ) THEN
211 
212  IF ( dble( h ) .GT. 1.d-25 ) THEN
213 
214  t = qj(4) / h
215 
216  ELSE
217 
218  t = dsqrt(2.d0) * h * qj(4) / cdsqrt( h**4 + eps_sing )
219 
220  END IF
221 
222  END IF
223 
224  alphas = dcmplx(0.d0,0.d0)
225  rho_m = dcmplx(1.d0,0.d0)
226 
227  END IF
228 
229  IF ( dble( h ) .GT. eps_sing ** 0.25d0 ) THEN
230 
231  u = qj(2) / ( rho_m * h )
232 
233  v = qj(3) / ( rho_m * h )
234 
235  ELSE
236 
237  u = dsqrt(2.d0) * h * ( qj(2) / rho_m ) / cdsqrt( h**4 + eps_sing )
238 
239  v = dsqrt(2.d0) * h * ( qj(3) / rho_m ) / cdsqrt( h**4 + eps_sing )
240 
241  END IF
242 
243  RETURN
244 
245  END SUBROUTINE phys_var
246 
247  !******************************************************************************
249  !
259  !******************************************************************************
260 
261  SUBROUTINE eval_local_speeds_x(qj,vel_min,vel_max)
262 
263  IMPLICIT none
264 
265  REAL*8, INTENT(IN) :: qj(n_vars)
266 
267  REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
268 
269  CALL phys_var(r_qj = qj)
270 
271  vel_min(1:n_eqns) = dble(u) - dsqrt( grav * dble(h) )
272  vel_max(1:n_eqns) = dble(u) + dsqrt( grav * dble(h) )
273 
274  END SUBROUTINE eval_local_speeds_x
275 
276  !******************************************************************************
278  !
288  !******************************************************************************
289 
290  SUBROUTINE eval_local_speeds_y(qj,vel_min,vel_max)
291 
292  IMPLICIT none
293 
294  REAL*8, INTENT(IN) :: qj(n_vars)
295  REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
296 
297  CALL phys_var(r_qj = qj)
298 
299  vel_min(1:n_eqns) = dble(v) - dsqrt( grav * dble(h) )
300  vel_max(1:n_eqns) = dble(v) + dsqrt( grav * dble(h) )
301 
302  END SUBROUTINE eval_local_speeds_y
303 
304  !******************************************************************************
306  !
320  !******************************************************************************
321 
322  SUBROUTINE qc_to_qp(qc,B,qp)
323 
324  IMPLICIT none
325 
326  REAL*8, INTENT(IN) :: qc(n_vars)
327  REAL*8, INTENT(IN) :: B
328  REAL*8, INTENT(OUT) :: qp(n_vars)
329 
330  CALL phys_var(r_qj = qc)
331 
332  ! It is important to have as reconstructed variable at the interfaces
333  ! the total height h+B, instead of h. Only in this way, when the topography
334  ! is not flat and the free surface is horizontal (steady condition), the
335  ! latter is kept flat by the reconstruction and the solution is stable.
336  qp(1) = dble(h+b)
337  qp(2) = dble(u)
338  qp(3) = dble(v)
339 
340  IF ( solid_transport_flag ) THEN
341 
342  qp(4) = dble(alphas)
343 
344  IF ( temperature_flag ) qp(5) = dble(t)
345 
346  ELSE
347 
348  IF ( temperature_flag ) qp(4) = dble(t)
349 
350  END IF
351 
352 
353  END SUBROUTINE qc_to_qp
354 
355  !******************************************************************************
357  !
369  !******************************************************************************
370 
371  SUBROUTINE qp_to_qc(qp,B,qc)
372 
373  USE complexify
374  IMPLICIT none
375 
376  REAL*8, INTENT(IN) :: qp(n_vars)
377  REAL*8, INTENT(IN) :: B
378  REAL*8, INTENT(OUT) :: qc(n_vars)
379 
380  REAL*8 :: r_h
381  REAL*8 :: r_u
382  REAL*8 :: r_v
383  REAL*8 :: r_T
384  REAL*8 :: r_rho_m
385  REAL*8 :: r_alphas
386 
387  r_h = qp(1) - b
388  r_u = qp(2)
389  r_v = qp(3)
390 
391 
392  qc(1) = r_h
393 
394  IF ( solid_transport_flag ) THEN
395 
396  r_alphas = qp(4)
397  qc(4) = r_h * r_alphas
398 
399  IF ( temperature_flag ) THEN
400 
401  r_t = qp(5)
402  qc(5) = r_h * r_t
403 
404  END IF
405 
406  ! TO BE REMOVED
407  ! r_alphas = sed_vol_perc/100.D0
408 
409  r_rho_m = r_alphas * rho_s + ( 1.d0 - r_alphas ) * rho_w
410 
411  ELSE
412 
413  IF ( temperature_flag ) THEN
414 
415  r_t = qp(4)
416  qc(4) = r_h * r_t
417 
418  END IF
419 
420  r_alphas = 0.d0
421  r_rho_m = 1.d0
422 
423  END IF
424 
425  qc(2) = r_h * r_rho_m * r_u
426  qc(3) = r_h * r_rho_m * r_v
427 
428 
429  END SUBROUTINE qp_to_qc
430 
431  !******************************************************************************
433  !
448  !******************************************************************************
449 
450  SUBROUTINE qc_to_qc2(qc,B,qc2)
451 
452  IMPLICIT none
453 
454  REAL*8, INTENT(IN) :: qc(n_vars)
455  REAL*8, INTENT(IN) :: B
456  REAL*8, INTENT(OUT) :: qc2(n_vars)
457 
458  qc2(1) = qc(1) + b
459  qc2(2:n_vars) = qc(2:n_vars)
460 
461  END SUBROUTINE qc_to_qc2
462 
463  !******************************************************************************
465  !
477  !******************************************************************************
478 
479  SUBROUTINE qc2_to_qc(qc2,B,qc)
480 
481  IMPLICIT none
482 
483  REAL*8, INTENT(IN) :: qc2(n_vars)
484  REAL*8, INTENT(IN) :: B
485  REAL*8, INTENT(OUT) :: qc(n_vars)
486 
487  REAL*8 :: qc_temp(n_vars)
488 
489  REAL*8 :: r_h
490  REAL*8 :: r_u
491  REAL*8 :: r_v
492  REAL*8 :: r_alphas
493  REAL*8 :: r_T
494  REAL*8 :: r_rho_m
495 
496  qc_temp(1) = qc2(1) - b
497  qc_temp(2:n_vars) = qc2(2:n_vars)
498 
499  ! Desingularization
500  CALL phys_var(r_qj = qc_temp)
501 
502  r_h = dble(h)
503  r_u = dble(u)
504  r_v = dble(v)
505  r_alphas = dble(alphas)
506 
507  ! TO BE REMOVED
508  ! r_alphas = sed_vol_perc/100.D0
509 
510  IF ( solid_transport_flag ) THEN
511 
512  r_rho_m = dble(rho_m)
513 
514  ELSE
515 
516  r_rho_m = 1.d0
517 
518  END IF
519 
520  qc(1) = r_h
521  qc(2) = r_h * r_rho_m * r_u
522  qc(3) = r_h * r_rho_m * r_v
523 
524  IF ( solid_transport_flag ) THEN
525 
526  qc(4) = r_h * r_alphas
527 
528  IF ( temperature_flag ) THEN
529 
530  r_t = dble(t)
531  qc(5) = r_h * r_t
532 
533  END IF
534 
535  ELSE
536 
537  IF ( temperature_flag ) THEN
538 
539  r_t = dble(t)
540  qc(4) = r_h * r_t
541 
542  END IF
543 
544  END IF
545 
546  END SUBROUTINE qc2_to_qc
547 
548 
549  !******************************************************************************
551  !
560  !******************************************************************************
561 
562  SUBROUTINE eval_fluxes(c_qj,r_qj,c_flux,r_flux,dir)
563 
564  USE complexify
565  IMPLICIT none
566 
567  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
568  COMPLEX*16, INTENT(OUT), OPTIONAL :: c_flux(n_eqns)
569  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
570  REAL*8, INTENT(OUT), OPTIONAL :: r_flux(n_eqns)
571  INTEGER, INTENT(IN) :: dir
572 
573  COMPLEX*16 :: qj(n_vars)
574  COMPLEX*16 :: flux(n_eqns)
575  COMPLEX*16 :: h_temp , u_temp , v_temp
576  COMPLEX*16 :: alphas_temp , rho_m_temp
577 
578  INTEGER :: i
579 
580  IF ( present(c_qj) .AND. present(c_flux) ) THEN
581 
582  qj = c_qj
583 
584  ELSEIF ( present(r_qj) .AND. present(r_flux) ) THEN
585 
586  DO i = 1,n_vars
587 
588  qj(i) = dcmplx( r_qj(i) )
589 
590  END DO
591 
592  ELSE
593 
594  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
595  stop
596 
597  END IF
598 
599  h_temp = qj(1)
600 
601  pos_thick:IF ( dble(h_temp) .NE. 0.d0 ) THEN
602 
603  IF ( solid_transport_flag ) THEN
604 
605  alphas_temp = qj(4) / h_temp
606 
607  ! TO BE REMOVED
608  ! alphas_temp = DCMPLX(sed_vol_perc/100.D0,0.D0)
609 
610  rho_m_temp = alphas_temp * rho_s + ( dcmplx(1.d0,0.d0) &
611  - alphas_temp ) * rho_w
612 
613  ELSE
614 
615  alphas_temp = dcmplx( 0.d0 , 0.d0 )
616  rho_m_temp = dcmplx(1.d0,0.d0)
617 
618  END IF
619 
620  IF ( dir .EQ. 1 ) THEN
621 
622  ! Velocity in x-direction
623  u_temp = qj(2) / ( h_temp * rho_m_temp )
624 
625  ! Volumetric flux in x-direction: h*u
626  flux(1) = qj(2) / rho_m_temp
627 
628  ! x-momentum flux in x-direction + hydrostatic pressure term
629  flux(2) = rho_m_temp * h_temp * u_temp**2 + &
630  0.5d0 * rho_m_temp * grav * h_temp**2
631 
632  ! y-momentum flux in x-direction: rho*h*v*u
633  flux(3) = u_temp * qj(3)
634 
635  IF ( solid_transport_flag ) THEN
636 
637  ! Volumetric flux of solid in x-direction: h * alphas * u
638  flux(4) = u_temp * qj(4)
639 
640  ! Solid flux can't be larger than total flux
641  IF ( flux(4) / flux(1) .GT. 1.d0 ) flux(4) = flux(1)
642 
643  ! Temperature flux in x-direction: U*T*h
644  IF ( temperature_flag ) flux(5) = u_temp * qj(5)
645 
646  ELSE
647 
648  ! Temperature flux in x-direction: U*T*h
649  IF ( temperature_flag ) flux(4) = u_temp * qj(4)
650 
651  END IF
652 
653  ELSEIF ( dir .EQ. 2 ) THEN
654 
655  ! flux G (derivated wrt y in the equations)
656 
657  v_temp = qj(3) / ( h_temp * rho_m_temp )
658 
659  flux(1) = qj(3) / rho_m_temp
660 
661  flux(2) = v_temp * qj(2)
662 
663  flux(3) = rho_m_temp * h_temp * v_temp**2 + &
664  0.5d0 * rho_m_temp * grav * h_temp**2
665 
666  IF ( solid_transport_flag ) THEN
667 
668  flux(4) = v_temp * qj(4)
669 
670  ! Solid flux can't be larger than total flux
671  IF ( flux(4) / flux(1) .GT. 1.d0 ) flux(4) = flux(1)
672 
673  ! Temperature flux in y-direction: V*T*h
674  IF ( temperature_flag ) flux(5) = v_temp * qj(5)
675 
676  ELSE
677 
678  ! Temperature flux in y-direction: V*T*h
679  IF ( temperature_flag ) flux(4) = v_temp * qj(4)
680 
681  END IF
682 
683  END IF
684 
685  ELSE
686 
687  flux(1:n_eqns) = 0.d0
688 
689  ENDIF pos_thick
690 
691  !WRITE(*,*) 'flux',DBLE(flux)
692  !WRITE(*,*) 'qj',DBLE(qj)
693  !WRITE(*,*) 'Bj',Bj
694  !WRITE(*,*) 'rho_m_temp , h_temp', REAL(rho_m_temp) , REAL(h_temp)
695  !READ(*,*)
696 
697  IF ( present(c_qj) .AND. present(c_flux) ) THEN
698 
699  c_flux = flux
700 
701  ELSEIF ( present(r_qj) .AND. present(r_flux) ) THEN
702 
703  r_flux = dble( flux )
704 
705  END IF
706 
707  END SUBROUTINE eval_fluxes
708 
709  !******************************************************************************
711  !
721  !******************************************************************************
722 
723  SUBROUTINE eval_nonhyperbolic_terms( c_qj , c_nh_term_impl , r_qj , &
724  r_nh_term_impl )
726  USE complexify
727 
728  IMPLICIT NONE
729 
730  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
731 
732  COMPLEX*16, INTENT(OUT), OPTIONAL :: c_nh_term_impl(n_eqns)
733  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
734  REAL*8, INTENT(OUT), OPTIONAL :: r_nh_term_impl(n_eqns)
735 
736  COMPLEX*16 :: qj(n_vars)
737 
738  COMPLEX*16 :: nh_term(n_eqns)
739 
740  COMPLEX*16 :: relaxation_term(n_eqns)
741 
742  COMPLEX*16 :: forces_term(n_eqns)
743 
744  INTEGER :: i
745 
746  COMPLEX*16 :: mod_vel
747 
748  COMPLEX*16 :: gamma
749 
750  REAL*8 :: radiative_coeff
751 
752  COMPLEX*16 :: radiative_term
753 
754  REAL*8 :: convective_coeff
755 
756  COMPLEX*16 :: convective_term
757 
758  COMPLEX*16 :: conductive_coeff , conductive_term
759 
760  REAL*8 :: thermal_diffusivity
761 
762  REAL*8 :: h_threshold
763 
764  !--- Lahars rheology model variables
765 
767  COMPLEX*8 :: fluid_visc
768 
770  COMPLEX*8 :: s_f
771 
773  COMPLEX*8 :: s_v
774 
776  COMPLEX*8 :: s_td
777 
778 
779  IF ( temperature_flag ) THEN
780 
781  IF ( ( thermal_conductivity .GT. 0.d0 ) .OR. ( emme .GT. 0.d0 ) ) THEN
782 
783  h_threshold = 1.d-10
784 
785  ELSE
786 
787  h_threshold = 0.d0
788 
789  END IF
790 
791  END IF
792 
793 
794  IF ( present(c_qj) .AND. present(c_nh_term_impl) ) THEN
795 
796  qj = c_qj
797 
798  ELSEIF ( present(r_qj) .AND. present(r_nh_term_impl) ) THEN
799 
800  DO i = 1,n_vars
801 
802  qj(i) = dcmplx( r_qj(i) )
803 
804  END DO
805 
806  ELSE
807 
808  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
809  stop
810 
811  END IF
812 
813  ! initialize and evaluate the relaxation terms
814  relaxation_term(1:n_eqns) = dcmplx(0.d0,0.d0)
815 
816  ! initialize and evaluate the forces terms
817  forces_term(1:n_eqns) = dcmplx(0.d0,0.d0)
818 
819  IF (rheology_flag) THEN
820 
821  CALL phys_var(c_qj = qj)
822 
823  mod_vel = cdsqrt( u**2 + v**2 )
824 
825  ! Voellmy Salm rheology
826  IF ( rheology_model .EQ. 1 ) THEN
827 
828  IF ( dble(mod_vel) .NE. 0.d0 ) THEN
829 
830  ! IMPORTANT: grav3_surv is always negative
831  forces_term(2) = forces_term(2) - rho_m * ( u / mod_vel ) * &
832  ( grav / xi ) * mod_vel ** 2
833 
834  forces_term(3) = forces_term(3) - rho_m * ( v / mod_vel ) * &
835  ( grav / xi ) * mod_vel ** 2
836 
837  ENDIF
838 
839  ! Plastic rheology
840  ELSEIF ( rheology_model .EQ. 2 ) THEN
841 
842  IF ( dble(mod_vel) .NE. 0.d0 ) THEN
843 
844  forces_term(2) = forces_term(2) - rho_m * tau * (u/mod_vel)
845 
846  forces_term(3) = forces_term(3) - rho_m * tau * (v/mod_vel)
847 
848  ENDIF
849 
850  ! Temperature dependent rheology
851  ELSEIF ( rheology_model .EQ. 3 ) THEN
852 
853  IF ( dble(h) .GT. h_threshold ) THEN
854 
855  ! Equation 6 from Costa & Macedonio, 2005
856  gamma = 3.d0 * nu_ref / h * cdexp( - visc_par * ( t - t_ref ) )
857 
858  ELSE
859 
860  ! Equation 6 from Costa & Macedonio, 2005
861  gamma = 3.d0 * nu_ref / h_threshold * cdexp( - visc_par &
862  * ( t - t_ref ) )
863 
864  END IF
865 
866  IF ( dble(mod_vel) .NE. 0.d0 ) THEN
867 
868  ! Last R.H.S. term in equation 2 from Costa & Macedonio, 2005
869  forces_term(2) = forces_term(2) - rho_m * gamma * u
870 
871  ! Last R.H.S. term in equation 3 from Costa & Macedonio, 2005
872  forces_term(3) = forces_term(3) - rho_m * gamma * v
873 
874  ENDIF
875 
876  ! Lahars rheology (O'Brien 1993, FLO2D)
877  ELSEIF ( rheology_model .EQ. 4 ) THEN
878 
879  h_threshold = 1.d-20
880 
881  ! THIS IS ONLY USED WHEN SEDIMENT PERCENTAGE IS GIVEN AS INPUT AND
882  ! IT IS CONSTANT WITHIN THE SIMULATION
883  ! TO BE REMOVED
884  ! alphas = DCMPLX(sed_vol_perc/100.D0,0.D0)
885 
886  ! Fluid viscosity
887  fluid_visc = alpha1 * cdexp( beta1 * alphas )
888 
889  IF ( h .GT. h_threshold ) THEN
890 
891  ! Viscous slope component
892  s_v = kappa * fluid_visc * mod_vel / ( 8.d0 * h**2 )
893 
894  ! Turbulent dispersive component
895  s_td = rho_m * n_td**2 * mod_vel**2 / ( h**(4.d0/3.d0) )
896 
897  ELSE
898 
899  ! Viscous slope component
900  s_v = kappa * fluid_visc * mod_vel / ( 8.d0 * h_threshold**2 )
901 
902  ! Turbulent dispersive components
903  s_td = rho_m * n_td**2 * (mod_vel**2) / ( h_threshold**(4.d0/3.d0) )
904 
905  END IF
906 
907  ! Total implicit friction slope
908  s_f = s_v + s_td
909 
910  IF ( mod_vel .GT. 0.d0 ) THEN
911 
912  forces_term(2) = forces_term(2) - grav * h * ( u / mod_vel ) * s_f
913 
914  forces_term(3) = forces_term(3) - grav * h * ( v / mod_vel ) * s_f
915 
916  END IF
917 
918  ELSEIF ( rheology_model .EQ. 5 ) THEN
919 
920  tau = 1.d-3 / ( 1.d0 + 10.d0 * h ) * mod_vel
921 
922  IF ( dble(mod_vel) .NE. 0.d0 ) THEN
923 
924  forces_term(2) = forces_term(2) - rho_m * tau * ( u / mod_vel )
925  forces_term(3) = forces_term(3) - rho_m * tau * ( v / mod_vel )
926 
927  END IF
928 
929  ENDIF
930 
931  ENDIF
932 
933  IF ( temperature_flag ) THEN
934 
935  CALL phys_var(c_qj = qj)
936 
937  IF ( dble(h) .GT. 0.d0 ) THEN
938 
939  ! Equation 8 from Costa & Macedonio, 2005
940  radiative_coeff = emissivity * sbconst * exp_area_fract / ( rho * c_p )
941 
942  ELSE
943 
944  radiative_coeff = 0.d0
945 
946  END IF
947 
948  IF ( dble(t) .GT. t_env ) THEN
949 
950  ! First R.H.S. term in equation 4 from Costa & Macedonio, 2005
951  radiative_term = - radiative_coeff * ( t**4 - t_env**4 )
952 
953  ELSE
954 
955  radiative_term = dcmplx(0.d0,0.d0)
956 
957  END IF
958 
959  IF ( dble(h) .GT. 0.d0 ) THEN
960 
961  ! Equation 9 from Costa & Macedonio, 2005
962  convective_coeff = atm_heat_transf_coeff * exp_area_fract &
963  / ( rho * c_p )
964 
965  ELSE
966 
967  convective_coeff = 0.d0
968 
969  END IF
970 
971  IF ( dble(t) .GT. t_env ) THEN
972 
973  ! Second R.H.S. term in equation 4 from Costa & Macedonio, 2005
974  convective_term = - convective_coeff * ( t - t_env )
975 
976  ELSE
977 
978  convective_term = dcmplx(0.d0,0.d0)
979 
980  END IF
981 
982  IF ( dble(h) .GT. h_threshold ) THEN
983 
984  thermal_diffusivity = thermal_conductivity / ( rho * c_p )
985 
986  ! Equation 7 from Costa & Macedonio, 2005
987  conductive_coeff = enne * thermal_diffusivity / h
988 
989  ELSE
990 
991  conductive_coeff = dcmplx(0.d0,0.d0)
992  conductive_coeff = enne * thermal_diffusivity / dcmplx(h_threshold,0.d0)
993 
994  END IF
995 
996  ! Third R.H.S. term in equation 4 from Costa & Macedonio, 2005
997  IF ( dble(t) .GT. t_ground ) THEN
998 
999  conductive_term = - conductive_coeff * ( t - t_ground )
1000 
1001  ELSE
1002 
1003  conductive_term = dcmplx(0.d0,0.d0)
1004 
1005  END IF
1006 
1007  IF ( solid_transport_flag ) THEN
1008 
1009  relaxation_term(5) = radiative_term + convective_term + conductive_term
1010 
1011  ELSE
1012 
1013  relaxation_term(4) = radiative_term + convective_term + conductive_term
1014 
1015  END IF
1016 
1017  END IF
1018 
1019  nh_term = relaxation_term + forces_term
1020 
1021  IF ( present(c_qj) .AND. present(c_nh_term_impl) ) THEN
1022 
1023  c_nh_term_impl = nh_term
1024 
1025  ELSEIF ( present(r_qj) .AND. present(r_nh_term_impl) ) THEN
1026 
1027  r_nh_term_impl = dble( nh_term )
1028 
1029  END IF
1030 
1031  END SUBROUTINE eval_nonhyperbolic_terms
1032 
1033  !******************************************************************************
1035  !
1044  !******************************************************************************
1045 
1046  SUBROUTINE eval_nh_semi_impl_terms( grav3_surf , c_qj , c_nh_semi_impl_term , &
1047  r_qj , r_nh_semi_impl_term )
1049  USE complexify
1050 
1051 
1052  IMPLICIT NONE
1053 
1054  REAL*8, INTENT(IN) :: grav3_surf
1055 
1056  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
1057  COMPLEX*16, INTENT(OUT), OPTIONAL :: c_nh_semi_impl_term(n_eqns)
1058  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
1059  REAL*8, INTENT(OUT), OPTIONAL :: r_nh_semi_impl_term(n_eqns)
1060 
1061  COMPLEX*16 :: qj(n_vars)
1062 
1063  COMPLEX*16 :: forces_term(n_eqns)
1064 
1065  INTEGER :: i
1066 
1067  COMPLEX*16 :: mod_vel
1068 
1069  REAL*8 :: h_threshold
1070 
1071  !--- Lahars rheology model variables
1072 
1074  COMPLEX*8 :: tau_y
1075 
1077  COMPLEX*8 :: s_y
1078 
1079 
1080  IF ( present(c_qj) .AND. present(c_nh_semi_impl_term) ) THEN
1081 
1082  qj = c_qj
1083 
1084  ELSEIF ( present(r_qj) .AND. present(r_nh_semi_impl_term) ) THEN
1085 
1086  DO i = 1,n_vars
1087 
1088  qj(i) = dcmplx( r_qj(i) )
1089 
1090  END DO
1091 
1092  ELSE
1093 
1094  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
1095  stop
1096 
1097  END IF
1098 
1099  ! initialize and evaluate the forces terms
1100  forces_term(1:n_eqns) = dcmplx(0.d0,0.d0)
1101 
1102  IF (rheology_flag) THEN
1103 
1104  CALL phys_var(c_qj = qj)
1105 
1106  mod_vel = cdsqrt( u**2 + v**2 )
1107 
1108  ! Voellmy Salm rheology
1109  IF ( rheology_model .EQ. 1 ) THEN
1110 
1111  IF ( mod_vel .GT. 0.d0 ) THEN
1112 
1113  forces_term(2) = forces_term(2) - rho_m * ( u / mod_vel ) * &
1114  mu * h * ( - grav * grav3_surf )
1115 
1116  forces_term(3) = forces_term(3) - rho_m * ( v / mod_vel ) * &
1117  mu * h * ( - grav * grav3_surf )
1118 
1119  END IF
1120 
1121  ! Plastic rheology
1122  ELSEIF ( rheology_model .EQ. 2 ) THEN
1123 
1124 
1125  ! Temperature dependent rheology
1126  ELSEIF ( rheology_model .EQ. 3 ) THEN
1127 
1128 
1129  ! Lahars rheology (O'Brien 1993, FLO2D)
1130  ELSEIF ( rheology_model .EQ. 4 ) THEN
1131 
1132  h_threshold = 1.d-20
1133 
1134  ! THIS IS ONLY USED WHEN SEDIMENT PERCENTAGE IS GIVEN AS INPUT AND
1135  ! IT IS CONSTANT WITHIN THE SIMULATION
1136  ! alphas = DCMPLX( sed_vol_perc*1.D-2 , 0.D0 )
1137 
1138  ! Yield strength
1139  tau_y = alpha2 * cdexp( beta2 * alphas )
1140 
1141  IF ( h .GT. h_threshold ) THEN
1142 
1143  ! Yield slope component
1144  s_y = tau_y / h
1145 
1146  ELSE
1147 
1148  ! Yield slope component
1149  s_y = tau_y / h_threshold
1150 
1151  END IF
1152 
1153  IF ( mod_vel .GT. 0.d0 ) THEN
1154 
1155  forces_term(2) = forces_term(2) - grav * h * ( u / mod_vel ) * s_y
1156 
1157  forces_term(3) = forces_term(3) - grav * h * ( v / mod_vel ) * s_y
1158 
1159  END IF
1160 
1161  ELSEIF ( rheology_model .EQ. 5 ) THEN
1162 
1163 
1164  ENDIF
1165 
1166  ENDIF
1167 
1168  IF ( temperature_flag ) THEN
1169 
1170 
1171  END IF
1172 
1173 
1174  IF ( present(c_qj) .AND. present(c_nh_semi_impl_term) ) THEN
1175 
1176  c_nh_semi_impl_term = forces_term
1177 
1178  ELSEIF ( present(r_qj) .AND. present(r_nh_semi_impl_term) ) THEN
1179 
1180  r_nh_semi_impl_term = dble( forces_term )
1181 
1182  END IF
1183 
1184  END SUBROUTINE eval_nh_semi_impl_terms
1185 
1186 
1187  !******************************************************************************
1189  !
1196  !******************************************************************************
1197 
1198  SUBROUTINE eval_expl_terms( Bprimej_x , Bprimej_y , source_xy , qj , &
1199  expl_term )
1202 
1203  IMPLICIT NONE
1204 
1205  REAL*8, INTENT(IN) :: Bprimej_x
1206  REAL*8, INTENT(IN) :: Bprimej_y
1207  REAL*8, INTENT(IN) :: source_xy
1208 
1209  REAL*8, INTENT(IN) :: qj(n_eqns)
1210  REAL*8, INTENT(OUT) :: expl_term(n_eqns)
1211 
1212  REAL*8 :: visc_heat_coeff
1213 
1214  expl_term(1:n_eqns) = 0.d0
1215 
1216  CALL phys_var(r_qj = qj)
1217 
1218  IF ( source_flag ) expl_term(1) = - source_xy * vel_source
1219 
1220  expl_term(2) = grav * dble(rho_m) * dble(h) * bprimej_x
1221 
1222  expl_term(3) = grav * dble(rho_m) * dble(h) * bprimej_y
1223 
1224  IF ( temperature_flag .AND. source_flag ) THEN
1225 
1226  IF ( solid_transport_flag ) THEN
1227 
1228  expl_term(5) = - source_xy * vel_source * t_source
1229 
1230  ELSE
1231 
1232  expl_term(4) = - source_xy * vel_source * t_source
1233 
1234  END IF
1235 
1236  IF ( rheology_model .EQ. 3 ) THEN
1237 
1238  IF ( dble(h) .GT. 0.d0 ) THEN
1239 
1240  ! Equation 10 from Costa & Macedonio, 2005
1241  visc_heat_coeff = emme * nu_ref / ( c_p * dble(h) )
1242 
1243  ELSE
1244 
1245  visc_heat_coeff = 0.d0
1246 
1247  END IF
1248 
1249  IF ( solid_transport_flag ) THEN
1250 
1251  ! Viscous heating
1252  ! Last R.H.S. term in equation 4 from Costa & Macedonio, 2005
1253  expl_term(5) = expl_term(5) - visc_heat_coeff * ( dble(u)**2 &
1254  + dble(v)**2 ) * dexp( - visc_par * ( dble(t) - t_ref ) )
1255 
1256  ELSE
1257 
1258  ! Viscous heating
1259  ! Last R.H.S. term in equation 4 from Costa & Macedonio, 2005
1260  expl_term(4) = expl_term(4) - visc_heat_coeff * ( dble(u)**2 &
1261  + dble(v)**2 ) * dexp( - visc_par * ( dble(t) - t_ref ) )
1262 
1263  END IF
1264 
1265  END IF
1266 
1267  END IF
1268 
1269  END SUBROUTINE eval_expl_terms
1270 
1271 
1272  !******************************************************************************
1274  !
1280  !******************************************************************************
1281 
1282  SUBROUTINE eval_erosion_dep_term( qj , erosion_term , deposition_term )
1284  IMPLICIT NONE
1285 
1286  REAL*8, INTENT(IN) :: qj(n_eqns)
1287 
1288  REAL*8, INTENT(OUT) :: erosion_term
1289  REAL*8, INTENT(OUT) :: deposition_term
1290 
1291  REAL*8 :: r_alphas
1292 
1293 
1295  !REAL*8 :: settling_single_vel
1296 
1298  !REAL*8 :: RZ_exp
1299 
1301  !REAL*8 :: Rey
1302 
1304  !REAL*8 :: kin_visc
1305 
1307  !REAL*8 :: diam
1308 
1310  !REAL*8 :: R
1311 
1312  REAL*8 :: mod_vel
1313 
1314  !diam = 1.D-3
1315 
1316  CALL phys_var(r_qj = qj)
1317 
1318  deposition_term = 0.d0
1319  erosion_term = 0.d0
1320 
1321  r_alphas = dble(alphas)
1322 
1323  !Rey = DSQRT( grav * diam**3 ) / kin_visc
1324 
1325  !RZ_exp = ( 4.7D0 + 0.41D0 * Rey**0.75D0 ) / ( 1.D0 + 0.175D0 * Rey**0.75D0 )
1326 
1327  !settling_single_vel = kin_visc / diam *
1328 
1329  !settling_vel = ( 1.D0 - r_alphas )**(2.7D0 - 0.15D0*Rz_exp )
1330 
1331  deposition_term = r_alphas * settling_vel
1332 
1333  mod_vel = dsqrt( dble(u)**2 + dble(v)**2 )
1334 
1335  IF ( dble(h) .GT. 1.d-2) THEN
1336 
1337  !erosion_term = erosion_coeff * mod_vel * DBLE(h) * ( rho_s - DBLE(rho_m) ) &
1338  ! / ( rho_s - rho_w )
1339 
1340  erosion_term = erosion_coeff * mod_vel * dble(h) * ( 1.d0 - r_alphas )
1341 
1342  ELSE
1343 
1344  erosion_term = 0.d0
1345 
1346  END IF
1347 
1348  !WRITE(*,*) 'r_alphas, settling_vel',r_alphas, settling_vel
1349  !WRITE(*,*) 'eval_erosion_dep_term',erosion_term,deposition_term
1350  !READ(*,*)
1351 
1352  RETURN
1353 
1354  END SUBROUTINE eval_erosion_dep_term
1355 
1356 
1357  !******************************************************************************
1359  !
1367  !******************************************************************************
1368 
1369  SUBROUTINE eval_topo_term( qj , deposition_avg_term , erosion_avg_term , &
1370  eqns_term, topo_term )
1372  IMPLICIT NONE
1373 
1374  REAL*8, INTENT(IN) :: qj(n_eqns)
1375  REAL*8, INTENT(IN) :: deposition_avg_term
1376  REAL*8, INTENT(IN) :: erosion_avg_term
1377 
1378  REAL*8, INTENT(OUT):: eqns_term(n_eqns)
1379  REAL*8, INTENT(OUT):: topo_term
1380 
1381 
1382  CALL phys_var(r_qj = qj)
1383 
1384  eqns_term(1:n_eqns) = 0.d0
1385 
1386  ! free surface (topography+flow) equation
1387  eqns_term(1) = erosion_avg_term - deposition_avg_term
1388 
1389  ! x-momenutm equation
1390  eqns_term(2) = - dble(u) * rho_s * deposition_avg_term
1391 
1392  ! y-momentum equation
1393  eqns_term(3) = - dble(v) * rho_s * deposition_avg_term
1394 
1395  ! solid phase thickness equation
1396  eqns_term(4) = erosion_avg_term - deposition_avg_term
1397 
1398  ! topography term
1399  topo_term = - erosion_avg_term + deposition_avg_term
1400 
1401  END SUBROUTINE eval_topo_term
1402 
1403 
1404 END MODULE constitutive_2d
1405 
1406 
real *8 emissivity
emissivity (eps in Costa & Macedonio, 2005)
real *8 rho_s
Specific weight of sediments.
subroutine qc_to_qp(qc, B, qp)
Conservative to physical variables.
real *8 sed_vol_perc
real *8 nu_ref
reference kinematic viscosity [m2/s]
real *8 t_ground
temperature of lava-ground interface
real *8 vel_source
real *8 beta2
2nd parameter for yield strenght empirical relationship (O'Brian et al, 1993)
real *8, parameter sbconst
Stephan-Boltzmann constant [W m-2 K-4].
subroutine phys_var(r_qj, c_qj)
Physical variables.
logical temperature_flag
Flag to choose if we model temperature transport.
logical rheology_flag
Flag to choose if we add the rheology.
subroutine eval_expl_terms(Bprimej_x, Bprimej_y, source_xy, qj, expl_term)
Explicit Forces term.
real *8 rad_coeff
radiative coefficient
real *8 c_p
specific heat [J kg-1 K-1]
Parameters.
subroutine eval_erosion_dep_term(qj, erosion_term, deposition_term)
Deposition term.
integer rheology_model
choice of the rheology model
subroutine eval_nh_semi_impl_terms(grav3_surf, c_qj, c_nh_semi_impl_term, r_qj, r_nh_semi_impl_term)
Non-Hyperbolic semi-implicit terms.
real *8 rho_w
Specific weight of water.
real *8 thermal_conductivity
thermal conductivity [W m-1 K-1] (k in Costa & Macedonio, 2005)
real *8 beta1
2nd parameter for fluid viscosity empirical relationship (O'Brian et al, 1993)
integer n_vars
Number of conservative variables.
complex *16 v
velocity (y direction)
real *8 enne
thermal boundary layer fraction of total thickness
logical source_flag
Flag to choose if there is a source of mass within the domain.
real *8 rho
fluid density [kg/m3]
Constitutive equations.
real *8 grav
gravitational acceleration
real *8 mu
drag coefficients (Voellmy-Salm model)
real *8 visc_par
viscosity parameter [K-1] (b in Table 1 Costa & Macedonio, 2005)
logical, dimension(:), allocatable implicit_flag
character(len=20) phase1_name
real *8 n_td
Mannings roughness coefficient ( units: T L^(-1/3) )
subroutine init_problem_param
Initialization of relaxation flags.
real *8 t_env
evironment temperature [K]
real *8 alpha2
1st parameter for yield strenght empirical relationship (O'Brian et al, 1993)
real *8 erosion_coeff
erosion model coefficient
real *8 atm_heat_transf_coeff
atmospheric heat trasnfer coefficient [W m-2 K-1] (lambda in C&M, 2005)
real *8 settling_vel
hindered settling
real *8 alpha1
1st parameter for fluid viscosity empirical relationship (O'Brian et al, 1993)
real *8 t_ref
reference temperature [K]
subroutine qc2_to_qc(qc2, B, qc)
Reconstructed to conservative variables.
subroutine qc_to_qc2(qc, B, qc2)
Conservative to alternative conservative variables.
subroutine eval_local_speeds_y(qj, vel_min, vel_max)
Local Characteristic speeds y direction.
real *8 exp_area_fract
fractional area of the exposed inner core (f in C&M, 2005)
integer n_eqns
Number of equations.
subroutine qp_to_qc(qp, B, qc)
Physical to conservative variables.
subroutine eval_nonhyperbolic_terms(c_qj, c_nh_term_impl, r_qj, r_nh_term_impl)
Non-Hyperbolic terms.
subroutine eval_fluxes(c_qj, r_qj, c_flux, r_flux, dir)
Hyperbolic Fluxes.
complex *16 h
height [m]
subroutine eval_topo_term(qj, deposition_avg_term, erosion_avg_term, eqns_term, topo_term)
Topography modification related term.
real *8 emme
velocity boundary layer fraction of total thickness
real *8 eps_sing
parameter for desingularization
real *8 tau
drag coefficients (plastic model)
complex *16 t
temperature
complex *16 alphas
sediment volume fraction
complex *16 u
velocity (x direction)
real *8 frict_coeff
friction coefficient
real *8 kappa
Empirical resistance parameter.
logical solid_transport_flag
Flag to choose if we model solid phase transport.
complex *16 rho_m
mixture density
subroutine eval_local_speeds_x(qj, vel_min, vel_max)
Local Characteristic speeds x direction.
integer n_nh
Number of non-hyperbolic terms.
character(len=20) phase2_name