IMEX_SfloW2D  0.9
Shallowwatergranularflowmodel
constitutive_2d.f90
Go to the documentation of this file.
1 !********************************************************************************
3 !********************************************************************************
5 
6  USE parameters_2d, ONLY : n_eqns , n_vars
10 
11  IMPLICIT none
12 
13  LOGICAL, ALLOCATABLE :: implicit_flag(:)
14 
15  CHARACTER(LEN=20) :: phase1_name
16  CHARACTER(LEN=20) :: phase2_name
17 
18 
19  COMPLEX*16 :: h
20  COMPLEX*16 :: u
21  COMPLEX*16 :: v
22  COMPLEX*16 :: t
23  COMPLEX*16 :: xs
24 
26  REAL*8 :: grav
27 
29  REAL*8 :: mu
30  REAL*8 :: xi
31 
33  REAL*8 :: tau
34 
36  REAL*8 :: t_env
37 
39  REAL*8 :: rad_coeff
40 
42  REAL*8 :: frict_coeff
43 
45  REAL*8 :: rho
46 
48  REAL*8 :: t_ref
49 
51  REAL*8 :: nu_ref
52 
54  REAL*8 :: visc_par
55 
57  REAL*8 :: emme
58 
60  REAL*8 :: c_p
61 
64 
66  REAL*8 :: exp_area_fract
67 
69  REAL*8, PARAMETER :: sbconst = 5.67d-8
70 
72  REAL*8 :: emissivity
73 
75  REAL*8 :: enne
76 
78  REAL*8 :: t_ground
79 
82 
83  !--- Lahars rheology model parameters
84 
86  REAL*8 :: alpha2
87 
89  REAL*8 :: beta2
90 
92  REAL*8 :: alpha1
93 
95  REAL*8 :: beta1
96 
98  REAL*8 :: kappa
99 
101  REAL*8 :: n_td
102 
104  REAL*8 :: gamma_w
105 
107  REAL*8 :: gamma_s
108 
109 CONTAINS
110 
111  !******************************************************************************
113  !
117  !******************************************************************************
118 
119  SUBROUTINE init_problem_param
121  USE parameters_2d, ONLY : n_nh
122 
123  ALLOCATE( implicit_flag(n_eqns) )
124 
125  implicit_flag(1:n_eqns) = .false.
126  implicit_flag(2) = .true.
127  implicit_flag(3) = .true.
128 
129  IF ( solid_transport_flag ) THEN
130 
131  IF ( temperature_flag ) implicit_flag(5) = .true.
132 
133  ELSE
134 
135  IF ( temperature_flag ) implicit_flag(4) = .true.
136 
137  END IF
138 
139  n_nh = count( implicit_flag )
140 
141  END SUBROUTINE init_problem_param
142 
143  !******************************************************************************
145  !
153  !******************************************************************************
154 
155  SUBROUTINE phys_var(Bj,r_qj,c_qj)
156 
157  USE complexify
158  USE parameters_2d, ONLY : eps_sing
159  IMPLICIT none
160 
161  REAL*8, INTENT(IN) :: Bj
162  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
163  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
164 
165  COMPLEX*16 :: qj(n_vars)
166 
167  IF ( present(c_qj) ) THEN
168 
169  qj = c_qj
170 
171  ELSE
172 
173  qj = dcmplx(r_qj)
174 
175  END IF
176 
177  h = qj(1) - dcmplx( bj , 0.d0 )
178 
179  IF ( REAL( h ) .GT. eps_sing ** 0.25D0 ) then
180 
181  u = qj(2) / h
182 
183  v = qj(3) / h
184 
185  ELSE
186 
187  u = dsqrt(2.d0) * h * qj(2) / cdsqrt( h**4 + eps_sing )
188 
189  v = dsqrt(2.d0) * h * qj(3) / cdsqrt( h**4 + eps_sing )
190 
191  END IF
192 
193  IF ( solid_transport_flag ) THEN
194 
195  IF ( REAL( h ) .GT. 1.D-25 ) then
196 
197  xs = qj(4) / h
198 
199  IF ( temperature_flag ) t = qj(5) / h
200 
201  ELSE
202 
203  xs = dsqrt(2.d0) * h * qj(4) / cdsqrt( h**4 + eps_sing )
204 
205  IF ( temperature_flag ) THEN
206 
207  t = dsqrt(2.d0) * h * qj(5) / cdsqrt( h**4 + eps_sing )
208 
209  END IF
210 
211  END IF
212 
213  ELSE
214 
215  IF ( temperature_flag ) THEN
216 
217  IF ( REAL( h ) .GT. 1.D-25 ) then
218 
219  t = qj(4) / h
220 
221  ELSE
222 
223  t = dsqrt(2.d0) * h * qj(4) / cdsqrt( h**4 + eps_sing )
224 
225  END IF
226 
227  END IF
228 
229  END IF
230 
231  END SUBROUTINE phys_var
232 
233  !******************************************************************************
235  !
245  !******************************************************************************
246 
247  SUBROUTINE eval_local_speeds_x(qj,Bj,vel_min,vel_max)
248 
249  IMPLICIT none
250 
251  REAL*8, INTENT(IN) :: qj(n_vars)
252  REAL*8, INTENT(IN) :: Bj
253  REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
254 
255  CALL phys_var(bj,r_qj = qj)
256 
257  vel_min(1:n_eqns) = REAL(u) - DSQRT( grav * REAL(h) )
258  vel_max(1:n_eqns) = REAL(u) + DSQRT( grav * REAL(h) )
259 
260  END SUBROUTINE eval_local_speeds_x
261 
262  !******************************************************************************
264  !
274  !******************************************************************************
275 
276  SUBROUTINE eval_local_speeds_y(qj,Bj,vel_min,vel_max)
277 
278  IMPLICIT none
279 
280  REAL*8, INTENT(IN) :: qj(n_vars)
281  REAL*8, INTENT(IN) :: Bj
282  REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
283 
284  CALL phys_var(bj,r_qj = qj)
285 
286  vel_min(1:n_eqns) = REAL(v) - DSQRT( grav * REAL(h) )
287  vel_max(1:n_eqns) = REAL(v) + DSQRT( grav * REAL(h) )
288 
289  END SUBROUTINE eval_local_speeds_y
290 
291  !******************************************************************************
293  !
303  !******************************************************************************
304 
305  SUBROUTINE eval_local_speeds2_x(qj,Bj,vel_min,vel_max)
306 
307  IMPLICIT none
308 
309  REAL*8, INTENT(IN) :: qj(n_vars)
310  REAL*8, INTENT(IN) :: Bj
311  REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
312 
313  REAL*8 :: h_temp , u_temp
314 
315  h_temp = qj(1) - bj
316 
317  IF ( h_temp .NE. 0.d0 ) THEN
318 
319  u_temp = qj(2) / h_temp
320 
321  ELSE
322 
323  u_temp = 0.d0
324 
325  END IF
326 
327  vel_min(1:n_eqns) = u_temp - dsqrt( grav * h_temp )
328  vel_max(1:n_eqns) = u_temp + dsqrt( grav * h_temp )
329 
330  END SUBROUTINE eval_local_speeds2_x
331 
332  !******************************************************************************
334  !
344  !******************************************************************************
345 
346  SUBROUTINE eval_local_speeds2_y(qj,Bj,vel_min,vel_max)
347 
348  IMPLICIT none
349 
350  REAL*8, INTENT(IN) :: qj(n_vars)
351  REAL*8, INTENT(IN) :: Bj
352  REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
353 
354  REAL*8 :: h_temp , v_temp
355 
356  h_temp = qj(1) - bj
357 
358  IF ( h_temp .NE. 0.d0 ) THEN
359 
360  v_temp = qj(3) / h_temp
361 
362  ELSE
363 
364  v_temp = 0.d0
365 
366  END IF
367 
368  vel_min(1:n_eqns) = v_temp - dsqrt( grav * h_temp )
369  vel_max(1:n_eqns) = v_temp + dsqrt( grav * h_temp )
370 
371  END SUBROUTINE eval_local_speeds2_y
372 
373  !******************************************************************************
375  !
389  !******************************************************************************
390 
391  SUBROUTINE qc_to_qp(qc,B,qp)
392 
393  IMPLICIT none
394 
395  REAL*8, INTENT(IN) :: qc(n_vars)
396  REAL*8, INTENT(IN) :: B
397  REAL*8, INTENT(OUT) :: qp(n_vars)
398 
399  CALL phys_var(b,r_qj = qc)
400 
401  qp(1) = REAL(h+b)
402  qp(2) = REAL(u)
403  qp(3) = REAL(v)
404 
405  IF ( solid_transport_flag ) THEN
406 
407  qp(4) = REAL(xs)
408 
409  IF ( temperature_flag ) qp(5) = REAL(t)
410 
411  ELSE
412 
413  IF ( temperature_flag ) qp(4) = REAL(t)
414 
415  END IF
416 
417 
418  END SUBROUTINE qc_to_qp
419 
420  !******************************************************************************
422  !
434  !******************************************************************************
435 
436  SUBROUTINE qp_to_qc(qp,B,qc)
437 
438  USE complexify
439  IMPLICIT none
440 
441  REAL*8, INTENT(IN) :: qp(n_vars)
442  REAL*8, INTENT(IN) :: B
443  REAL*8, INTENT(OUT) :: qc(n_vars)
444 
445  REAL*8 :: r_hB
446  REAL*8 :: r_u
447  REAL*8 :: r_v
448  REAL*8 :: r_xs
449  REAL*8 :: r_T
450 
451  r_hb = qp(1)
452  r_u = qp(2)
453  r_v = qp(3)
454 
455  qc(1) = r_hb
456  qc(2) = ( r_hb - b ) * r_u
457  qc(3) = ( r_hb - b ) * r_v
458 
459  IF ( solid_transport_flag ) THEN
460 
461  r_xs = qp(4)
462  qc(4) = ( r_hb - b ) * r_xs
463 
464  IF ( temperature_flag ) THEN
465 
466  r_t = qp(5)
467  qc(5) = ( r_hb - b ) * r_t
468 
469  END IF
470 
471  ELSE
472 
473  IF ( temperature_flag ) THEN
474 
475  r_t = qp(4)
476  qc(4) = ( r_hb - b ) * r_t
477 
478  END IF
479 
480  END IF
481 
482  END SUBROUTINE qp_to_qc
483 
484  !******************************************************************************
486  !
498  !******************************************************************************
499 
500  SUBROUTINE qrec_to_qc(qrec,B,qc)
501 
502  IMPLICIT none
503 
504  REAL*8, INTENT(IN) :: qrec(n_vars)
505  REAL*8, INTENT(IN) :: B
506  REAL*8, INTENT(OUT) :: qc(n_vars)
507 
508  REAL*8 :: r_hB
509  REAL*8 :: r_u
510  REAL*8 :: r_v
511  REAL*8 :: r_xs
512  REAL*8 :: r_T
513 
514  ! Desingularization
515  CALL phys_var(b,r_qj = qrec)
516 
517  r_hb = REAL(h) + B
518  r_u = REAL(u)
519  r_v = REAL(v)
520 
521  qc(1) = r_hb
522  qc(2) = REAL(h) * r_u
523  qc(3) = REAL(h) * r_v
524 
525  IF ( solid_transport_flag ) THEN
526 
527  r_xs = REAL(xs)
528  qc(4) = REAL(h) * r_xs
529 
530  IF ( temperature_flag ) THEN
531 
532  r_t = REAL(t)
533  qc(5) = REAL(h) * r_T
534 
535  END IF
536 
537  ELSE
538 
539  IF ( temperature_flag ) THEN
540 
541  r_t = REAL(t)
542  qc(4) = REAL(h) * r_T
543 
544  END IF
545 
546  END IF
547 
548  END SUBROUTINE qrec_to_qc
549 
550 
551  !******************************************************************************
553  !
562  !******************************************************************************
563 
564  SUBROUTINE eval_fluxes(Bj,c_qj,r_qj,c_flux,r_flux,dir)
565 
566  USE complexify
567  IMPLICIT none
568 
569  REAL*8, INTENT(IN) :: Bj
570  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
571  COMPLEX*16, INTENT(OUT), OPTIONAL :: c_flux(n_eqns)
572  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
573  REAL*8, INTENT(OUT), OPTIONAL :: r_flux(n_eqns)
574  INTEGER, INTENT(IN) :: dir
575 
576  COMPLEX*16 :: qj(n_vars)
577  COMPLEX*16 :: flux(n_eqns)
578  COMPLEX*16 :: h_temp , u_temp , v_temp
579 
580  INTEGER :: i
581 
582  IF ( present(c_qj) .AND. present(c_flux) ) THEN
583 
584  qj = c_qj
585 
586  ELSEIF ( present(r_qj) .AND. present(r_flux) ) THEN
587 
588  DO i = 1,n_vars
589 
590  qj(i) = dcmplx( r_qj(i) )
591 
592  END DO
593 
594  ELSE
595 
596  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
597  stop
598 
599  END IF
600 
601 
602  IF ( dir .EQ. 1 ) THEN
603 
604  ! flux F (derivated wrt x in the equations)
605 
606  flux(1) = qj(2)
607 
608  h_temp = qj(1) - bj
609 
610  IF ( REAL(h_temp) .NE. 0.D0 ) then
611 
612  u_temp = qj(2) / h_temp
613 
614  flux(2) = h_temp * u_temp**2 + 0.5d0 * grav * h_temp**2
615 
616  flux(3) = u_temp * qj(3)
617 
618  IF ( solid_transport_flag ) THEN
619 
620  flux(4) = u_temp * qj(4)
621 
622  ! Temperature flux in x-direction: U*T*h
623  IF ( temperature_flag ) flux(5) = u_temp * qj(5)
624 
625  ELSE
626 
627  ! Temperature flux in x-direction: U*T*h
628  IF ( temperature_flag ) flux(4) = u_temp * qj(4)
629 
630  END IF
631 
632  ELSE
633 
634  flux(2:n_eqns) = 0.d0
635 
636  ENDIF
637 
638  ELSEIF ( dir .EQ. 2 ) THEN
639 
640  ! flux G (derivated wrt y in the equations)
641 
642  flux(1) = qj(3)
643 
644  h_temp = qj(1) - bj
645 
646  IF(REAL(h_temp).NE.0.d0)then
647 
648  v_temp = qj(3) / h_temp
649 
650  flux(2) = v_temp * qj(2)
651 
652  flux(3) = h_temp * v_temp**2 + 0.5d0 * grav * h_temp**2
653 
654  IF ( solid_transport_flag ) THEN
655 
656  flux(4) = v_temp * qj(4)
657 
658  ! Temperature flux in x-direction: V*T*h
659  IF ( temperature_flag ) flux(5) = v_temp * qj(5)
660 
661  ELSE
662 
663  ! Temperature flux in x-direction: V*T*h
664  IF ( temperature_flag ) flux(4) = v_temp * qj(4)
665 
666  END IF
667 
668  ELSE
669 
670  flux(2:n_eqns) = 0.d0
671 
672  ENDIF
673 
674  ELSE
675 
676  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
677 
678  stop
679 
680  ENDIF
681 
682  IF ( present(c_qj) .AND. present(c_flux) ) THEN
683 
684  c_flux = flux
685 
686  ELSEIF ( present(r_qj) .AND. present(r_flux) ) THEN
687 
688  r_flux = REAL( flux )
689 
690  END IF
691 
692  END SUBROUTINE eval_fluxes
693 
694  !******************************************************************************
696  !
706  !******************************************************************************
707 
708  SUBROUTINE eval_nonhyperbolic_terms( Bj , Bprimej_x , Bprimej_y , grav3_surf ,&
709  c_qj , c_nh_term_impl , r_qj , r_nh_term_impl )
711  USE complexify
712  USE parameters_2d, ONLY : sed_vol_perc
713 
714  IMPLICIT NONE
715 
716  REAL*8, INTENT(IN) :: Bj
717  REAL*8, INTENT(IN) :: Bprimej_x, Bprimej_y
718  REAL*8, INTENT(IN) :: grav3_surf
719 
720  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
721  COMPLEX*16, INTENT(OUT), OPTIONAL :: c_nh_term_impl(n_eqns)
722  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
723  REAL*8, INTENT(OUT), OPTIONAL :: r_nh_term_impl(n_eqns)
724 
725  COMPLEX*16 :: qj(n_vars)
726 
727  COMPLEX*16 :: nh_term(n_eqns)
728 
729  COMPLEX*16 :: relaxation_term(n_eqns)
730 
731  COMPLEX*16 :: forces_term(n_eqns)
732 
733  INTEGER :: i
734 
735  COMPLEX*16 :: mod_vel
736 
737  COMPLEX*16 :: gamma
738 
739  REAL*8 :: radiative_coeff
740 
741  COMPLEX*16 :: radiative_term
742 
743  REAL*8 :: convective_coeff
744 
745  COMPLEX*16 :: convective_term
746 
747  COMPLEX*16 :: conductive_coeff , conductive_term
748 
749  REAL*8 :: thermal_diffusivity
750 
751  REAL*8 :: h_threshold
752 
753  !--- Lahars rheology model variables
754 
756  COMPLEX*8 :: tau_y
757 
759  COMPLEX*8 :: fluid_visc
760 
762  COMPLEX*8 :: sed_vol_fract_cmplx
763 
765  COMPLEX*8 :: gamma_m
766 
768  COMPLEX*8 :: s_f
769 
771  COMPLEX*8 :: s_y
772 
774  COMPLEX*8 :: s_v
775 
777  COMPLEX*8 :: s_td
778 
779 
780  IF ( temperature_flag ) THEN
781 
782  IF ( ( thermal_conductivity .GT. 0.d0 ) .OR. ( emme .GT. 0.d0 ) ) THEN
783 
784  h_threshold = 1.d-10
785 
786  ELSE
787 
788  h_threshold = 0.d0
789 
790  END IF
791 
792  END IF
793 
794 
795  IF ( present(c_qj) .AND. present(c_nh_term_impl) ) THEN
796 
797  qj = c_qj
798 
799  ELSEIF ( present(r_qj) .AND. present(r_nh_term_impl) ) THEN
800 
801  DO i = 1,n_vars
802 
803  qj(i) = dcmplx( r_qj(i) )
804 
805  END DO
806 
807  ELSE
808 
809  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
810  stop
811 
812  END IF
813 
814  ! initialize and evaluate the relaxation terms
815  relaxation_term(1:n_eqns) = dcmplx(0.d0,0.d0)
816 
817  ! initialize and evaluate the forces terms
818  forces_term(1:n_eqns) = dcmplx(0.d0,0.d0)
819 
820  IF (rheology_flag) THEN
821 
822  CALL phys_var(bj,c_qj = qj)
823 
824  mod_vel = cdsqrt( u**2 + v**2 )
825 
826  ! Voellmy Salm rheology
827  IF ( rheology_model .EQ. 1 ) THEN
828 
829  IF ( REAL(mod_vel) .NE. 0.D0 ) then
830 
831  ! IMPORTANT: grav3_surv is always negative
832  forces_term(2) = forces_term(2) - ( u / mod_vel ) * &
833  ( grav / xi ) * mod_vel ** 2
834 
835  forces_term(3) = forces_term(3) - ( v / mod_vel ) * &
836  ( grav / xi ) * mod_vel ** 2
837 
838  ENDIF
839 
840  ! Plastic rheology
841  ELSEIF ( rheology_model .EQ. 2 ) THEN
842 
843  IF ( REAL(mod_vel) .NE. 0.D0 ) then
844 
845  forces_term(2) = forces_term(2) - tau * (u/mod_vel)
846 
847  forces_term(3) = forces_term(3) - tau * (v/mod_vel)
848 
849  ENDIF
850 
851  ! Temperature dependent rheology
852  ELSEIF ( rheology_model .EQ. 3 ) THEN
853 
854  IF ( REAL(h) .GT. h_threshold ) then
855 
856  ! Equation 6 from Costa & Macedonio, 2005
857  gamma = 3.d0 * nu_ref / h * cdexp( - visc_par * ( t - t_ref ) )
858 
859  ELSE
860 
861  ! Equation 6 from Costa & Macedonio, 2005
862  gamma = 3.d0 * nu_ref / h_threshold * cdexp( - visc_par &
863  * ( t - t_ref ) )
864 
865  END IF
866 
867  IF ( REAL(mod_vel) .NE. 0.D0 ) then
868 
869  ! Last R.H.S. term in equation 2 from Costa & Macedonio, 2005
870  forces_term(2) = forces_term(2) - gamma * u
871 
872  ! Last R.H.S. term in equation 3 from Costa & Macedonio, 2005
873  forces_term(3) = forces_term(3) - gamma * v
874 
875  ENDIF
876 
877  ! Lahars rheology (O'Brien 1993, FLO2D)
878  ELSEIF ( rheology_model .EQ. 4 ) THEN
879 
880  h_threshold = 1.d-20
881 
882  sed_vol_fract_cmplx = dcmplx(sed_vol_perc/100.d0,0.d0)
883 
884  ! Convert from mass fraction to volume fraction
885  ! sed_vol_fract_cmplx = xs * gamma_w / ( xs * gamma_w + &
886  ! ( DCMPLX(1.D0,0.D0) - xs ) * gamma_s )
887 
888  !IF ( xs .NE. 0.D0 ) THEN
889 
890  !WRITE(*,*) 'xs',xs
891  !WRITE(*,*) 'sed_vol_fract',DBLE(sed_vol_fract_cmplx)
892  !READ(*,*)
893 
894  !END IF
895 
896 
897  ! Mixture density
898  gamma_m = ( dcmplx(1.d0,0.d0) - sed_vol_fract_cmplx ) * gamma_w &
899  + sed_vol_fract_cmplx * gamma_s
900 
901  ! Yield strength
902  tau_y = alpha2 * cdexp( beta2 * sed_vol_fract_cmplx )
903 
904  ! Fluid viscosity
905  fluid_visc = alpha1 * cdexp( beta1 * sed_vol_fract_cmplx )
906 
907 
908  IF ( h .GT. h_threshold ) THEN
909 
910  ! Yield slope component
911  s_y = tau_y / ( gamma_m * h )
912 
913  ! Viscous slope component
914  s_v = kappa * fluid_visc * mod_vel / ( 8.d0 * gamma_m * h**2 )
915 
916 
917  ! Turbulent dispersive component
918  s_td = n_td**2 * mod_vel**2 / ( h**(4.d0/3.d0) )
919 
920  ! WRITE(*,*) 's_terms',REAL(s_y),REAL(s_v),REAL(s_td)
921  ! WRITE(*,*) ' u', REAL(u)
922 
923  ELSE
924 
925  ! Yield slope component
926  s_y = tau_y / ( gamma_m * h_threshold )
927 
928  ! Viscous slope component
929  s_v = kappa * fluid_visc * mod_vel / ( 8.d0 * gamma_m * &
930  h_threshold**2 )
931 
932  ! Turbulent dispersive components
933  s_td = n_td**2 * (mod_vel**2) / ( h_threshold**(4.d0/3.d0) )
934 
935  END IF
936 
937  ! Total implicit friction slope
938  s_f = s_v + s_td
939 
940  IF ( mod_vel .GT. 0.d0 ) THEN
941 
942  forces_term(2) = forces_term(2) - grav * h * ( u / mod_vel ) * s_f
943  forces_term(3) = forces_term(3) - grav * h * ( v / mod_vel ) * s_f
944 
945  END IF
946 
947 
948  !WRITE(*,*) 's_terms',DBLE(s_y), &
949  ! DBLE(Kappa * fluid_visc / ( 8.D0 * gamma_m * h**2 )), &
950  ! DBLE(n_td**2 / ( h**(4.D0/3.D0) ))
951 
952  !WRITE(*,*) 'grav*h',grav*h
953 
954  !WRITE(*,*) 'eval_nh',DBLE(u),DBLE(forces_term(2))
955 
956  ELSEIF ( rheology_model .EQ. 5 ) THEN
957 
958  tau = 1.d-3 / ( 1.d0 + 10.d0 * h ) * mod_vel
959 
960  IF ( dble(mod_vel) .NE. 0.d0 ) THEN
961 
962  forces_term(2) = forces_term(2) - tau * ( u / mod_vel )
963  forces_term(3) = forces_term(3) - tau * ( v / mod_vel )
964 
965  END IF
966 
967  ENDIF
968 
969  ENDIF
970 
971  IF ( temperature_flag ) THEN
972 
973  CALL phys_var(bj,c_qj = qj)
974 
975  IF ( REAL(h) .GT. 0.d0 ) then
976 
977  ! Equation 8 from Costa & Macedonio, 2005
978  radiative_coeff = emissivity * sbconst * exp_area_fract / ( rho * c_p )
979 
980  ELSE
981 
982  radiative_coeff = 0.d0
983 
984  END IF
985 
986  IF ( REAL(T) .GT. T_env ) then
987 
988  ! First R.H.S. term in equation 4 from Costa & Macedonio, 2005
989  radiative_term = - radiative_coeff * ( t**4 - t_env**4 )
990 
991  ELSE
992 
993  radiative_term = dcmplx(0.d0,0.d0)
994 
995  END IF
996 
997  IF ( REAL(h) .GT. 0.d0 ) then
998 
999  ! Equation 9 from Costa & Macedonio, 2005
1000  convective_coeff = atm_heat_transf_coeff * exp_area_fract &
1001  / ( rho * c_p )
1002 
1003  ELSE
1004 
1005  convective_coeff = 0.d0
1006 
1007  END IF
1008 
1009  IF ( REAL(T) .GT. T_env ) then
1010 
1011  ! Second R.H.S. term in equation 4 from Costa & Macedonio, 2005
1012  convective_term = - convective_coeff * ( t - t_env )
1013 
1014  ELSE
1015 
1016  convective_term = dcmplx(0.d0,0.d0)
1017 
1018  END IF
1019 
1020  IF ( REAL(h) .GT. h_threshold ) then
1021 
1022  thermal_diffusivity = thermal_conductivity / ( rho * c_p )
1023 
1024  ! Equation 7 from Costa & Macedonio, 2005
1025  conductive_coeff = enne * thermal_diffusivity / h
1026 
1027  ELSE
1028 
1029  conductive_coeff = dcmplx(0.d0,0.d0)
1030  conductive_coeff = enne * thermal_diffusivity / dcmplx(h_threshold,0.d0)
1031 
1032  END IF
1033 
1034  ! Third R.H.S. term in equation 4 from Costa & Macedonio, 2005
1035  IF ( REAL(T) .GT. T_ground ) then
1036 
1037  conductive_term = - conductive_coeff * ( t - t_ground )
1038 
1039  ELSE
1040 
1041  conductive_term = dcmplx(0.d0,0.d0)
1042 
1043  END IF
1044 
1045  IF ( solid_transport_flag ) THEN
1046 
1047  relaxation_term(5) = radiative_term + convective_term + conductive_term
1048 
1049  ELSE
1050 
1051  relaxation_term(4) = radiative_term + convective_term + conductive_term
1052 
1053  END IF
1054 
1055  END IF
1056 
1057  nh_term = relaxation_term + forces_term
1058 
1059  IF ( present(c_qj) .AND. present(c_nh_term_impl) ) THEN
1060 
1061  c_nh_term_impl = nh_term
1062 
1063  ELSEIF ( present(r_qj) .AND. present(r_nh_term_impl) ) THEN
1064 
1065  r_nh_term_impl = REAL( nh_term )
1066 
1067  END IF
1068 
1069  END SUBROUTINE eval_nonhyperbolic_terms
1070 
1071  !******************************************************************************
1073  !
1082  !******************************************************************************
1083 
1084  SUBROUTINE eval_nh_semi_impl_terms( Bj , grav3_surf , c_qj , &
1085  c_nh_semi_impl_term , r_qj , r_nh_semi_impl_term )
1087  USE complexify
1088  USE parameters_2d, ONLY : sed_vol_perc
1089 
1090  IMPLICIT NONE
1091 
1092  REAL*8, INTENT(IN) :: Bj
1093  REAL*8, INTENT(IN) :: grav3_surf
1094 
1095  COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
1096  COMPLEX*16, INTENT(OUT), OPTIONAL :: c_nh_semi_impl_term(n_eqns)
1097  REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
1098  REAL*8, INTENT(OUT), OPTIONAL :: r_nh_semi_impl_term(n_eqns)
1099 
1100  COMPLEX*16 :: qj(n_vars)
1101 
1102  COMPLEX*16 :: forces_term(n_eqns)
1103 
1104  INTEGER :: i
1105 
1106  COMPLEX*16 :: mod_vel
1107 
1108  REAL*8 :: h_threshold
1109 
1110  !--- Lahars rheology model variables
1111 
1113  COMPLEX*8 :: tau_y
1114 
1116  COMPLEX*8 :: sed_vol_fract_cmplx
1117 
1119  COMPLEX*8 :: gamma_m
1120 
1122  COMPLEX*8 :: s_y
1123 
1124 
1125 
1126  IF ( present(c_qj) .AND. present(c_nh_semi_impl_term) ) THEN
1127 
1128  qj = c_qj
1129 
1130  ELSEIF ( present(r_qj) .AND. present(r_nh_semi_impl_term) ) THEN
1131 
1132  DO i = 1,n_vars
1133 
1134  qj(i) = dcmplx( r_qj(i) )
1135 
1136  END DO
1137 
1138  ELSE
1139 
1140  WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
1141  stop
1142 
1143  END IF
1144 
1145  ! initialize and evaluate the forces terms
1146  forces_term(1:n_eqns) = dcmplx(0.d0,0.d0)
1147 
1148  IF (rheology_flag) THEN
1149 
1150  CALL phys_var(bj,c_qj = qj)
1151 
1152  mod_vel = cdsqrt( u**2 + v**2 )
1153 
1154  ! Voellmy Salm rheology
1155  IF ( rheology_model .EQ. 1 ) THEN
1156 
1157  IF ( mod_vel .GT. 0.d0 ) THEN
1158 
1159  forces_term(2) = forces_term(2) - ( u / mod_vel ) * &
1160  mu * h * ( - grav * grav3_surf )
1161 
1162  forces_term(3) = forces_term(3) - ( v / mod_vel ) * &
1163  mu * h * ( - grav * grav3_surf )
1164 
1165  END IF
1166 
1167  ! Plastic rheology
1168  ELSEIF ( rheology_model .EQ. 2 ) THEN
1169 
1170 
1171  ! Temperature dependent rheology
1172  ELSEIF ( rheology_model .EQ. 3 ) THEN
1173 
1174 
1175  ! Lahars rheology (O'Brien 1993, FLO2D)
1176  ELSEIF ( rheology_model .EQ. 4 ) THEN
1177 
1178  h_threshold = 1.d-20
1179 
1180  sed_vol_fract_cmplx = dcmplx( sed_vol_perc*1.d-2 , 0.d0 )
1181 
1182  ! Convert from mass fraction to volume fraction
1183  ! sed_vol_fract_cmplx = xs * gamma_w / ( xs * gamma_w + &
1184  ! ( DCMPLX(1.D0,0.D0) - xs ) * gamma_s )
1185 
1186  !IF ( xs .NE. 0.D0 ) THEN
1187 
1188  !WRITE(*,*) 'xs',xs
1189  !WRITE(*,*) 'sed_vol_fract',DBLE(sed_vol_fract_cmplx)
1190  !READ(*,*)
1191 
1192  !END IF
1193 
1194 
1195  ! Mixture density
1196  gamma_m = ( dcmplx(1.d0,0.d0) - sed_vol_fract_cmplx ) * gamma_w &
1197  + sed_vol_fract_cmplx * gamma_s
1198 
1199  ! Yield strength
1200  tau_y = alpha2 * cdexp( beta2 * sed_vol_fract_cmplx )
1201 
1202  IF ( h .GT. h_threshold ) THEN
1203 
1204  ! Yield slope component
1205  s_y = tau_y / ( gamma_m * h )
1206 
1207  ELSE
1208 
1209  ! Yield slope component
1210  s_y = tau_y / ( gamma_m * h_threshold )
1211 
1212  END IF
1213 
1214  IF ( mod_vel .GT. 0.d0 ) THEN
1215 
1216  forces_term(2) = forces_term(2) - grav * h * ( u / mod_vel ) * s_y
1217  forces_term(3) = forces_term(3) - grav * h * ( v / mod_vel ) * s_y
1218 
1219  END IF
1220 
1221  ELSEIF ( rheology_model .EQ. 5 ) THEN
1222 
1223 
1224  ENDIF
1225 
1226  ENDIF
1227 
1228  IF ( temperature_flag ) THEN
1229 
1230 
1231  END IF
1232 
1233 
1234  IF ( present(c_qj) .AND. present(c_nh_semi_impl_term) ) THEN
1235 
1236  c_nh_semi_impl_term = forces_term
1237 
1238  ELSEIF ( present(r_qj) .AND. present(r_nh_semi_impl_term) ) THEN
1239 
1240  r_nh_semi_impl_term = dble( forces_term )
1241 
1242  END IF
1243 
1244  END SUBROUTINE eval_nh_semi_impl_terms
1245 
1246 
1247  !******************************************************************************
1249  !
1256  !******************************************************************************
1257 
1258  SUBROUTINE eval_expl_terms( Bj, Bprimej_x , Bprimej_y , source_xy , qj , &
1259  expl_term )
1262 
1263  IMPLICIT NONE
1264 
1265  REAL*8, INTENT(IN) :: Bj
1266  REAL*8, INTENT(IN) :: Bprimej_x
1267  REAL*8, INTENT(IN) :: Bprimej_y
1268  REAL*8, INTENT(IN) :: source_xy
1269 
1270  REAL*8, INTENT(IN) :: qj(n_eqns)
1271  REAL*8, INTENT(OUT) :: expl_term(n_eqns)
1272 
1273  REAL*8 :: visc_heat_coeff
1274 
1275  expl_term(1:n_eqns) = 0.d0
1276 
1277  CALL phys_var(bj,r_qj = qj)
1278 
1279  IF ( source_flag ) expl_term(1) = - source_xy * vel_source
1280 
1281  expl_term(2) = grav * REAL(h) * Bprimej_x
1282 
1283  expl_term(3) = grav * REAL(h) * Bprimej_y
1284 
1285  IF ( temperature_flag .AND. source_flag ) THEN
1286 
1287  IF ( solid_transport_flag ) THEN
1288 
1289  expl_term(5) = - source_xy * vel_source * t_source
1290 
1291  ELSE
1292 
1293  expl_term(4) = - source_xy * vel_source * t_source
1294 
1295  END IF
1296 
1297  IF ( rheology_model .EQ. 3 ) THEN
1298 
1299  IF ( REAL(h) .GT. 0.D0 ) then
1300 
1301  ! Equation 10 from Costa & Macedonio, 2005
1302  visc_heat_coeff = emme * nu_ref / ( c_p * REAL(h) )
1303 
1304  ELSE
1305 
1306  visc_heat_coeff = 0.d0
1307 
1308  END IF
1309 
1310  IF ( solid_transport_flag ) THEN
1311 
1312  ! Viscous heating
1313  ! Last R.H.S. term in equation 4 from Costa & Macedonio, 2005
1314  expl_term(5) = expl_term(5) - visc_heat_coeff * ( REAL(u)**2 &
1315  + REAL(v)**2 ) * dexp( - visc_par * ( REAL(T) - t_ref ) )
1316 
1317  ELSE
1318 
1319  ! Viscous heating
1320  ! Last R.H.S. term in equation 4 from Costa & Macedonio, 2005
1321  expl_term(4) = expl_term(4) - visc_heat_coeff * ( REAL(u)**2 &
1322  + REAL(v)**2 ) * dexp( - visc_par * ( REAL(T) - t_ref ) )
1323 
1324  END IF
1325 
1326  END IF
1327 
1328  END IF
1329 
1330  END SUBROUTINE eval_expl_terms
1331 
1332 END MODULE constitutive_2d
1333 
1334 
real *8 emissivity
emissivity (eps in Costa & Macedonio, 2005)
subroutine qc_to_qp(qc, B, qp)
Conservative to physical variables.
real *8 sed_vol_perc
real *8 gamma_s
Specific weight of sediments.
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].
logical temperature_flag
Flag to choose if we model temperature transport.
logical rheology_flag
Flag to choose if we add the rheology.
real *8 rad_coeff
radiative coefficient
subroutine qrec_to_qc(qrec, B, qc)
Reconstructed to conservative variables.
real *8 c_p
specific heat [J kg-1 K-1]
Parameters.
subroutine eval_local_speeds_x(qj, Bj, vel_min, vel_max)
Local Characteristic speeds x direction.
subroutine eval_local_speeds2_y(qj, Bj, vel_min, vel_max)
Local Characteristic speeds.
integer rheology_model
choice of the rheology model
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 eval_fluxes(Bj, c_qj, r_qj, c_flux, r_flux, dir)
Hyperbolic Fluxes.
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 gamma_w
Specific weight of water.
subroutine eval_expl_terms(Bj, Bprimej_x, Bprimej_y, source_xy, qj, expl_term)
Explicit Forces term.
real *8 atm_heat_transf_coeff
atmospheric heat trasnfer coefficient [W m-2 K-1] (lambda in C&M, 2005)
subroutine eval_local_speeds_y(qj, Bj, vel_min, vel_max)
Local Characteristic speeds y direction.
subroutine phys_var(Bj, r_qj, c_qj)
Physical variables.
real *8 alpha1
1st parameter for fluid viscosity empirical relationship (O'Brian et al, 1993)
real *8 t_ref
reference temperature [K]
real *8 exp_area_fract
fractional area of the exposed inner core (f in C&M, 2005)
subroutine eval_nonhyperbolic_terms(Bj, Bprimej_x, Bprimej_y, grav3_surf, c_qj, c_nh_term_impl, r_qj, r_nh_term_impl)
Non-Hyperbolic terms.
subroutine eval_local_speeds2_x(qj, Bj, vel_min, vel_max)
Local Characteristic speeds.
integer n_eqns
Number of equations.
subroutine qp_to_qc(qp, B, qc)
Physical to conservative variables.
complex *16 xs
sediment concentration
complex *16 h
height [m]
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 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.
integer n_nh
Number of non-hyperbolic terms.
character(len=20) phase2_name
subroutine eval_nh_semi_impl_terms(Bj, grav3_surf, c_qj, c_nh_semi_impl_term, r_qj, r_nh_semi_impl_term)
Non-Hyperbolic semi-implicit terms.