Newer
Older
!> @author
!> Mattia de' Michieli Vitturi
!> \date 15/08/2011
!>
!> Modification :: add friction weakening law
!> @Author T. Frasson & A. Lucas
!> \data 15/07/2020
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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
219
220
221
222
223
224
225
226
227
228
229
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
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
332
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
363
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
414
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
446
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
520
521
522
523
524
525
526
527
528
529
530
531
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
601
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
649
650
651
652
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
684
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
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
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
872
873
874
875
876
877
878
879
880
881
882
883
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
941
942
943
944
945
946
947
948
949
950
951
952
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
!********************************************************************************
!> \brief Constitutive equations
!********************************************************************************
MODULE constitutive_2d
USE parameters_2d, ONLY : n_eqns , n_vars
USE parameters_2d, ONLY : rheology_flag , rheology_model
USE parameters_2d, ONLY : temperature_flag
USE parameters_2d, ONLY : solid_transport_flag
IMPLICIT none
LOGICAL, ALLOCATABLE :: implicit_flag(:)
CHARACTER(LEN=20) :: phase1_name
CHARACTER(LEN=20) :: phase2_name
COMPLEX*16 :: h !< height [m]
COMPLEX*16 :: u !< velocity (x direction)
COMPLEX*16 :: v !< velocity (y direction)
COMPLEX*16 :: T !< temperature
COMPLEX*16 :: xs !< sediment concentration
!> gravitational acceleration
REAL*8 :: grav
!> drag coefficients (Voellmy-Salm model)
REAL*8 :: mu
REAL*8 :: xi
!> drag coefficients (plastic model)
REAL*8 :: tau
!> evironment temperature [K]
REAL*8 :: T_env
!> radiative coefficient
REAL*8 :: rad_coeff
!> friction coefficient
REAL*8 :: frict_coeff
!> fluid density [kg/m3]
REAL*8 :: rho
!> reference temperature [K]
REAL*8 :: T_ref
!> reference kinematic viscosity [m2/s]
REAL*8 :: nu_ref
!> viscosity parameter [K-1] (b in Table 1 Costa & Macedonio, 2005)
REAL*8 :: visc_par
!> velocity boundary layer fraction of total thickness
REAL*8 :: emme
!> specific heat [J kg-1 K-1]
REAL*8 :: c_p
!> atmospheric heat trasnfer coefficient [W m-2 K-1] (lambda in C&M, 2005)
REAL*8 :: atm_heat_transf_coeff
!> fractional area of the exposed inner core (f in C&M, 2005)
REAL*8 :: exp_area_fract
!> Stephan-Boltzmann constant [W m-2 K-4]
REAL*8, PARAMETER :: SBconst = 5.67D-8
!> emissivity (eps in Costa & Macedonio, 2005)
REAL*8 :: emissivity
!> thermal boundary layer fraction of total thickness
REAL*8 :: enne
!> temperature of lava-ground interface
REAL*8 :: T_ground
!> thermal conductivity [W m-1 K-1] (k in Costa & Macedonio, 2005)
REAL*8 :: thermal_conductivity
!--- Lahars rheology model parameters
!> 1st parameter for yield strenght empirical relationship (O'Brian et al, 1993)
REAL*8 :: alpha2
!> 2nd parameter for yield strenght empirical relationship (O'Brian et al, 1993)
REAL*8 :: beta2
!> 1st parameter for fluid viscosity empirical relationship (O'Brian et al, 1993)
REAL*8 :: alpha1
!> 2nd parameter for fluid viscosity empirical relationship (O'Brian et al, 1993)
REAL*8 :: beta1
!> Empirical resistance parameter
REAL*8 :: Kappa
!> Mannings roughness coefficient ( units: T L^(-1/3) )
REAL*8 :: n_td
!> Specific weight of water
REAL*8 :: gamma_w
!> Specific weight of sediments
REAL*8 :: gamma_s
!> parametres Pouliquen
REAL*8 :: beta
REAL*8 :: theta1
REAL*8 :: theta2
REAL*8 :: hstop
REAL*8 :: L
REAL*8 :: d
!> parametres Bingham
REAL*8 :: eta
REAL*8 :: thet
REAL*8 :: tau_bing
!> parametres weakening
REAL*8 :: mu_0
REAL*8 :: mu_w
REAL*8 :: U_0
CONTAINS
!******************************************************************************
!> \brief Initialization of relaxation flags
!
!> This subroutine set the number and the flags of the non-hyperbolic
!> terms.
!> \date 07/09/2012
!******************************************************************************
SUBROUTINE init_problem_param
USE parameters_2d, ONLY : n_nh
ALLOCATE( implicit_flag(n_eqns) )
implicit_flag(1:n_eqns) = .FALSE.
implicit_flag(2) = .TRUE.
implicit_flag(3) = .TRUE.
IF ( solid_transport_flag ) THEN
IF ( temperature_flag ) implicit_flag(5) = .TRUE.
ELSE
IF ( temperature_flag ) implicit_flag(4) = .TRUE.
END IF
n_nh = COUNT( implicit_flag )
END SUBROUTINE init_problem_param
!******************************************************************************
!> \brief Physical variables
!
!> This subroutine evaluates from the conservative local variables qj
!> the local physical variables (\f$h+B, u, v, xs , T \f$).
!> \param[in] r_qj real conservative variables
!> \param[in] c_qj complex conservative variables
!> @author
!> Mattia de' Michieli Vitturi
!> \date 15/08/2011
!******************************************************************************
SUBROUTINE phys_var(Bj,r_qj,c_qj)
USE COMPLEXIFY
USE parameters_2d, ONLY : eps_sing
IMPLICIT none
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
COMPLEX*16 :: qj(n_vars)
IF ( present(c_qj) ) THEN
qj = c_qj
ELSE
qj = DCMPLX(r_qj)
END IF
h = qj(1) - DCMPLX( Bj , 0.D0 )
IF ( REAL( h ) .GT. eps_sing ** 0.25D0 ) THEN
u = qj(2) / h
v = qj(3) / h
ELSE
u = DSQRT(2.D0) * h * qj(2) / CDSQRT( h**4 + eps_sing )
v = DSQRT(2.D0) * h * qj(3) / CDSQRT( h**4 + eps_sing )
END IF
IF ( solid_transport_flag ) THEN
IF ( REAL( h ) .GT. 1.D-25 ) THEN
xs = qj(4) / h
IF ( temperature_flag ) T = qj(5) / h
ELSE
xs = DSQRT(2.D0) * h * qj(4) / CDSQRT( h**4 + eps_sing )
IF ( temperature_flag ) THEN
T = DSQRT(2.D0) * h * qj(5) / CDSQRT( h**4 + eps_sing )
END IF
END IF
ELSE
IF ( temperature_flag ) THEN
IF ( REAL( h ) .GT. 1.D-25 ) THEN
T = qj(4) / h
ELSE
T = DSQRT(2.D0) * h * qj(4) / CDSQRT( h**4 + eps_sing )
END IF
END IF
END IF
END SUBROUTINE phys_var
!******************************************************************************
!> \brief Local Characteristic speeds x direction
!
!> This subroutine desingularize the velocities and then evaluates the largest
!> positive and negative characteristic speed in the x-direction.
!> \param[in] qj array of conservative variables
!> \param[in] Bj topography at the cell center
!> \param[out] vel_min minimum x-velocity
!> \param[out] vel_max maximum x-velocity
!> @author
!> Mattia de' Michieli Vitturi
!> \date 05/12/2017
!******************************************************************************
SUBROUTINE eval_local_speeds_x(qj,Bj,vel_min,vel_max)
IMPLICIT none
REAL*8, INTENT(IN) :: qj(n_vars)
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
CALL phys_var(Bj,r_qj = qj)
vel_min(1:n_eqns) = REAL(u) - DSQRT( grav * REAL(h) )
vel_max(1:n_eqns) = REAL(u) + DSQRT( grav * REAL(h) )
END SUBROUTINE eval_local_speeds_x
!******************************************************************************
!> \brief Local Characteristic speeds y direction
!
!> This subroutine desingularize the velocities and then evaluates the largest
!> positive and negative characteristic speed in the y-direction.
!> \param[in] qj array of conservative variables
!> \param[in] Bj topography at the cell center
!> \param[out] vel_min minimum y-velocity
!> \param[out] vel_max maximum y-velocity
!> @author
!> Mattia de' Michieli Vitturi
!> \date 05/12/2017
!******************************************************************************
SUBROUTINE eval_local_speeds_y(qj,Bj,vel_min,vel_max)
IMPLICIT none
REAL*8, INTENT(IN) :: qj(n_vars)
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
CALL phys_var(Bj,r_qj = qj)
vel_min(1:n_eqns) = REAL(v) - DSQRT( grav * REAL(h) )
vel_max(1:n_eqns) = REAL(v) + DSQRT( grav * REAL(h) )
END SUBROUTINE eval_local_speeds_y
!******************************************************************************
!> \brief Local Characteristic speeds
!
!> This subroutine evaluates an the largest pos and neg characteristic speeds
!> from the conservative variables qj, without any change on u and h.
!> \param[in] qj array of conservative variables
!> \param[in] Bj topography at the cell center
!> \param[out] vel_min minimum x-velocity
!> \param[out] vel_max maximum x-velocity
!> @author
!> Mattia de' Michieli Vitturi
!> \date 05/12/2017
!******************************************************************************
SUBROUTINE eval_local_speeds2_x(qj,Bj,vel_min,vel_max)
IMPLICIT none
REAL*8, INTENT(IN) :: qj(n_vars)
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
REAL*8 :: h_temp , u_temp
h_temp = qj(1) - Bj
IF ( h_temp .NE. 0.D0 ) THEN
u_temp = qj(2) / h_temp
ELSE
u_temp = 0.D0
END IF
vel_min(1:n_eqns) = u_temp - DSQRT( grav * h_temp )
vel_max(1:n_eqns) = u_temp + DSQRT( grav * h_temp )
END SUBROUTINE eval_local_speeds2_x
!******************************************************************************
!> \brief Local Characteristic speeds
!
!> This subroutine evaluates an the largest pos and neg characteristic speeds
!> from the conservative variables qj, without any change on v and h.
!> \param[in] qj array of conservative variables
!> \param[in] Bj topography at the cell center
!> \param[out] vel_min minimum y-velocity
!> \param[out] vel_max maximum y-velocity
!> @author
!> Mattia de' Michieli Vitturi
!> \date 05/12/2017
!******************************************************************************
SUBROUTINE eval_local_speeds2_y(qj,Bj,vel_min,vel_max)
IMPLICIT none
REAL*8, INTENT(IN) :: qj(n_vars)
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(OUT) :: vel_min(n_vars) , vel_max(n_vars)
REAL*8 :: h_temp , v_temp
h_temp = qj(1) - Bj
IF ( h_temp .NE. 0.D0 ) THEN
v_temp = qj(3) / h_temp
ELSE
v_temp = 0.D0
END IF
vel_min(1:n_eqns) = v_temp - DSQRT( grav * h_temp )
vel_max(1:n_eqns) = v_temp + DSQRT( grav * h_temp )
END SUBROUTINE eval_local_speeds2_y
!******************************************************************************
!> \brief Conservative to physical variables
!
!> This subroutine evaluates from the conservative variables qc the
!> array of physical variables qp:\n
!> - qp(1) = \f$ h+B \f$
!> - qp(2) = \f$ u \f$
!> - qp(3) = \f$ v \f$
!> - qp(4) = \f$ xs \f$
!> - qp(5) = \f$ T \f$
!> .
!> The physical variables are those used for the linear reconstruction at the
!> cell interfaces. Limiters are applied to the reconstructed slopes.
!> \param[in] qc conservative variables
!> \param[out] qp physical variables
!> \date 15/08/2011
!******************************************************************************
SUBROUTINE qc_to_qp(qc,B,qp)
IMPLICIT none
REAL*8, INTENT(IN) :: qc(n_vars)
REAL*8, INTENT(IN) :: B
REAL*8, INTENT(OUT) :: qp(n_vars)
CALL phys_var(B,r_qj = qc)
qp(1) = REAL(h+B)
qp(2) = REAL(u)
qp(3) = REAL(v)
IF ( solid_transport_flag ) THEN
qp(4) = REAL(xs)
IF ( temperature_flag ) qp(5) = REAL(T)
ELSE
IF ( temperature_flag ) qp(4) = REAL(T)
END IF
END SUBROUTINE qc_to_qp
!******************************************************************************
!> \brief Physical to conservative variables
!
!> This subroutine evaluates the conservative variables qc from the
!> array of physical variables qp:\n
!> - qp(1) = \f$ h + B \f$
!> - qp(2) = \f$ u \f$
!> - qp(3) = \f$ v \f$
!> - qp(4) = \f$ xs \f$
!> - qp(5) = \f$ T \f$
!> .
!> \param[in] qp physical variables
!> \param[out] qc conservative variables
!> \date 15/08/2011
!******************************************************************************
SUBROUTINE qp_to_qc(qp,B,qc)
USE COMPLEXIFY
IMPLICIT none
REAL*8, INTENT(IN) :: qp(n_vars)
REAL*8, INTENT(IN) :: B
REAL*8, INTENT(OUT) :: qc(n_vars)
REAL*8 :: r_hB !> topography + height
REAL*8 :: r_u !> velocity
REAL*8 :: r_v !> velocity
REAL*8 :: r_xs !> sediment concentration
REAL*8 :: r_T !> temperature
r_hB = qp(1)
r_u = qp(2)
r_v = qp(3)
qc(1) = r_hB
qc(2) = ( r_hB - B ) * r_u
qc(3) = ( r_hB - B ) * r_v
IF ( solid_transport_flag ) THEN
r_xs = qp(4)
qc(4) = ( r_hB - B ) * r_xs
IF ( temperature_flag ) THEN
r_T = qp(5)
qc(5) = ( r_hB - B ) * r_T
END IF
ELSE
IF ( temperature_flag ) THEN
r_T = qp(4)
qc(4) = ( r_hB - B ) * r_T
END IF
END IF
END SUBROUTINE qp_to_qc
!******************************************************************************
!> \brief Reconstructed to conservative variables
!
!> This subroutine evaluates the conservative variables qc from the
!> array of physical variables qrec:\n
!> - qrec(1) = \f$ h + B \f$
!> - qrec(2) = \f$ hu \f$
!> - qrec(3) = \f$ hv \f$
!> - qrec(4) = \f$ h \cdot xs \f$
!> - qrec(5) = \f$ T \f$
!> .
!> \param[in] qrec physical variables
!> \param[out] qc conservative variables
!> \date 15/08/2011
!******************************************************************************
SUBROUTINE qrec_to_qc(qrec,B,qc)
IMPLICIT none
REAL*8, INTENT(IN) :: qrec(n_vars)
REAL*8, INTENT(IN) :: B
REAL*8, INTENT(OUT) :: qc(n_vars)
REAL*8 :: r_hB !> topography + height
REAL*8 :: r_u !> velocity
REAL*8 :: r_v !> velocity
REAL*8 :: r_xs !> sediment concentration
REAL*8 :: r_T !> temperature
! Desingularization
CALL phys_var(B,r_qj = qrec)
r_hB = REAL(h) + B
r_u = REAL(u)
r_v = REAL(v)
qc(1) = r_hB
qc(2) = REAL(h) * r_u
qc(3) = REAL(h) * r_v
IF ( solid_transport_flag ) THEN
r_xs = REAL(xs)
qc(4) = REAL(h) * r_xs
IF ( temperature_flag ) THEN
r_T = REAL(T)
qc(5) = REAL(h) * r_T
END IF
ELSE
IF ( temperature_flag ) THEN
r_T = REAL(T)
qc(4) = REAL(h) * r_T
END IF
END IF
END SUBROUTINE qrec_to_qc
!******************************************************************************
!> \brief Hyperbolic Fluxes
!
!> This subroutine evaluates the numerical fluxes given the conservative
!> variables qj, accordingly to the equations for the single temperature
!> model introduced in Romenki et al. 2010.
!> \date 01/06/2012
!> \param[in] c_qj complex conservative variables
!> \param[in] r_qj real conservative variables
!> \param[out] c_flux complex analytical fluxes
!> \param[out] r_flux real analytical fluxes
!******************************************************************************
SUBROUTINE eval_fluxes(Bj,c_qj,r_qj,c_flux,r_flux,dir)
USE COMPLEXIFY
IMPLICIT none
REAL*8, INTENT(IN) :: Bj
COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
COMPLEX*16, INTENT(OUT), OPTIONAL :: c_flux(n_eqns)
REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
REAL*8, INTENT(OUT), OPTIONAL :: r_flux(n_eqns)
INTEGER, INTENT(IN) :: dir
COMPLEX*16 :: qj(n_vars)
COMPLEX*16 :: flux(n_eqns)
COMPLEX*16 :: h_temp , u_temp , v_temp
INTEGER :: i
IF ( present(c_qj) .AND. present(c_flux) ) THEN
qj = c_qj
ELSEIF ( present(r_qj) .AND. present(r_flux) ) THEN
DO i = 1,n_vars
qj(i) = DCMPLX( r_qj(i) )
END DO
ELSE
WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
STOP
END IF
IF ( dir .EQ. 1 ) THEN
! flux F (derivated wrt x in the equations)
flux(1) = qj(2)
h_temp = qj(1) - Bj
IF ( REAL(h_temp) .NE. 0.D0 ) THEN
u_temp = qj(2) / h_temp
flux(2) = h_temp * u_temp**2 + 0.5D0 * grav * h_temp**2
flux(3) = u_temp * qj(3)
IF ( solid_transport_flag ) THEN
flux(4) = u_temp * qj(4)
! Temperature flux in x-direction: U*T*h
IF ( temperature_flag ) flux(5) = u_temp * qj(5)
ELSE
! Temperature flux in x-direction: U*T*h
IF ( temperature_flag ) flux(4) = u_temp * qj(4)
END IF
ELSE
flux(2:n_eqns) = 0.D0
ENDIF
ELSEIF ( dir .EQ. 2 ) THEN
! flux G (derivated wrt y in the equations)
flux(1) = qj(3)
h_temp = qj(1) - Bj
IF(REAL(h_temp).NE.0.d0)THEN
v_temp = qj(3) / h_temp
flux(2) = v_temp * qj(2)
flux(3) = h_temp * v_temp**2 + 0.5D0 * grav * h_temp**2
IF ( solid_transport_flag ) THEN
flux(4) = v_temp * qj(4)
! Temperature flux in x-direction: V*T*h
IF ( temperature_flag ) flux(5) = v_temp * qj(5)
ELSE
! Temperature flux in x-direction: V*T*h
IF ( temperature_flag ) flux(4) = v_temp * qj(4)
END IF
ELSE
flux(2:n_eqns) = 0.D0
ENDIF
ELSE
WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
STOP
ENDIF
IF ( present(c_qj) .AND. present(c_flux) ) THEN
c_flux = flux
ELSEIF ( present(r_qj) .AND. present(r_flux) ) THEN
r_flux = REAL( flux )
END IF
END SUBROUTINE eval_fluxes
!******************************************************************************
!> \brief Non-Hyperbolic terms
!
!> This subroutine evaluates the non-hyperbolic terms (relaxation terms
!> and forces) of the system of equations, both for real or complex
!> inputs. These terms are treated implicitely in the DIRK numerical
!> scheme.
!> \date 01/06/2012
!> \param[in] c_qj complex conservative variables
!> \param[in] r_qj real conservative variables
!> \param[out] c_nh_term_impl complex non-hyperbolic terms
!> \param[out] r_nh_term_impl real non-hyperbolic terms
!******************************************************************************
SUBROUTINE eval_nonhyperbolic_terms( Bj , Bprimej_x , Bprimej_y , grav3_surf ,&
c_qj , c_nh_term_impl , r_qj , r_nh_term_impl )
USE COMPLEXIFY
USE parameters_2d, ONLY : sed_vol_perc
IMPLICIT NONE
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(IN) :: Bprimej_x, Bprimej_y
REAL*8, INTENT(IN) :: grav3_surf
COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
COMPLEX*16, INTENT(OUT), OPTIONAL :: c_nh_term_impl(n_eqns)
REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
REAL*8, INTENT(OUT), OPTIONAL :: r_nh_term_impl(n_eqns)
COMPLEX*16 :: qj(n_vars)
COMPLEX*16 :: nh_term(n_eqns)
COMPLEX*16 :: relaxation_term(n_eqns)
COMPLEX*16 :: forces_term(n_eqns)
INTEGER :: i
COMPLEX*16 :: mod_vel
COMPLEX*16 :: gamma
REAL*8 :: radiative_coeff
COMPLEX*16 :: radiative_term
REAL*8 :: convective_coeff
COMPLEX*16 :: convective_term
COMPLEX*16 :: conductive_coeff , conductive_term
REAL*8 :: thermal_diffusivity
REAL*8 :: h_threshold
REAL*8 :: mu_pouliquen
REAL*8 :: mu_bingham
REAL*8 :: mu_weak
!--- Lahars rheology model variables
!> Yield strenght
COMPLEX*8 :: tau_y
!> Fluid viscosity
COMPLEX*8 :: fluid_visc
!> Sediment volume fraction
COMPLEX*8 :: sed_vol_fract_cmplx
!> Specific weight of sediment mixture
COMPLEX*8 :: gamma_m
!> Total friction
COMPLEX*8 :: s_f
!> Yield slope component of total friction
COMPLEX*8 :: s_y
!> Viscous slope component of total Friction
COMPLEX*8 :: s_v
!> Turbulent dispersive slope component of total friction
COMPLEX*8 :: s_td
IF ( temperature_flag ) THEN
IF ( ( thermal_conductivity .GT. 0.D0 ) .OR. ( emme .GT. 0.D0 ) ) THEN
h_threshold = 1.D-10
ELSE
h_threshold = 0.D0
END IF
END IF
IF ( present(c_qj) .AND. present(c_nh_term_impl) ) THEN
qj = c_qj
ELSEIF ( present(r_qj) .AND. present(r_nh_term_impl) ) THEN
DO i = 1,n_vars
qj(i) = DCMPLX( r_qj(i) )
END DO
ELSE
WRITE(*,*) 'Constitutive, eval_fluxes: problem with arguments'
STOP
END IF
! initialize and evaluate the relaxation terms
relaxation_term(1:n_eqns) = DCMPLX(0.D0,0.D0)
! initialize and evaluate the forces terms
forces_term(1:n_eqns) = DCMPLX(0.D0,0.D0)
IF (rheology_flag) THEN
CALL phys_var(Bj,c_qj = qj)
mod_vel = CDSQRT( u**2 + v**2 )
! Voellmy Salm rheology
IF ( rheology_model .EQ. 1 ) THEN
IF ( REAL(mod_vel) .NE. 0.D0 ) THEN
! IMPORTANT: grav3_surv is always negative
forces_term(2) = forces_term(2) - ( u / mod_vel ) * &
( grav / xi ) * mod_vel ** 2
forces_term(3) = forces_term(3) - ( v / mod_vel ) * &
( grav / xi ) * mod_vel ** 2
ENDIF
!Loi de Coulomb
ELSEIF ( rheology_model .EQ. 8 ) THEN
forces_term(2) = forces_term(2)
forces_term(3) = forces_term(3)
! Loi de Pouliquen
ELSEIF ( rheology_model .EQ. 9 ) THEN
IF ( REAL(mod_vel) .NE. 0.D0 ) THEN
hstop = beta*h*sqrt(grav*rho)/mod_vel !mod_vel varie ?
mu_pouliquen = tan(theta1)+(tan(theta2)-tan(theta1))*exp(-hstop/(L*d))
forces_term(2) = mu_pouliquen * grav * grav3_surf * h * (u/mod_vel)
! grav * grav3_surf ?
forces_term(3) = mu_pouliquen * grav * grav3_surf * h * (v/mod_vel)
ENDIF
! Loi de Bingham
ELSEIF ( rheology_model .EQ. 10 ) THEN
IF ( REAL(mod_vel) .NE. 0.D0 ) THEN
mu_bingham = (1.5*tau_bing+3*eta*mod_vel/h)/(rho*grav*h*thet)
forces_term(2) = mu_bingham * grav * grav3_surf * h * (u/mod_vel)
forces_term(3) = mu_bingham * grav * grav3_surf * h * (v/mod_vel)
ENDIF
! Loi de weakening
ELSEIF ( rheology_model .EQ. 11 ) THEN
mu_weak = (mu_0 - mu_w)/(1 + mod_vel/U_0) + mu_w
forces_term(2) = mu_weak * grav * grav3_surf * h
forces_term(3) = mu_weak * grav * grav3_surf * h
! Plastic rheology
ELSEIF ( rheology_model .EQ. 2 ) THEN
IF ( REAL(mod_vel) .NE. 0.D0 ) THEN
forces_term(2) = forces_term(2) - tau * (u/mod_vel)
forces_term(3) = forces_term(3) - tau * (v/mod_vel)
ENDIF
! Temperature dependent rheology
ELSEIF ( rheology_model .EQ. 3 ) THEN
IF ( REAL(h) .GT. h_threshold ) THEN
! Equation 6 from Costa & Macedonio, 2005
gamma = 3.D0 * nu_ref / h * CDEXP( - visc_par * ( T - T_ref ) )
ELSE
! Equation 6 from Costa & Macedonio, 2005
gamma = 3.D0 * nu_ref / h_threshold * CDEXP( - visc_par &
* ( T - T_ref ) )
END IF
IF ( REAL(mod_vel) .NE. 0.D0 ) THEN
! Last R.H.S. term in equation 2 from Costa & Macedonio, 2005
forces_term(2) = forces_term(2) - gamma * u
! Last R.H.S. term in equation 3 from Costa & Macedonio, 2005
forces_term(3) = forces_term(3) - gamma * v
ENDIF
! Lahars rheology (O'Brien 1993, FLO2D)
ELSEIF ( rheology_model .EQ. 4 ) THEN
h_threshold = 1.D-20
sed_vol_fract_cmplx = DCMPLX(sed_vol_perc/100.D0,0.D0)
! Convert from mass fraction to volume fraction
! sed_vol_fract_cmplx = xs * gamma_w / ( xs * gamma_w + &
! ( DCMPLX(1.D0,0.D0) - xs ) * gamma_s )
!IF ( xs .NE. 0.D0 ) THEN
!WRITE(*,*) 'xs',xs
!WRITE(*,*) 'sed_vol_fract',DBLE(sed_vol_fract_cmplx)
!READ(*,*)
!END IF
! Mixture density
gamma_m = ( DCMPLX(1.D0,0.D0) - sed_vol_fract_cmplx ) * gamma_w &
+ sed_vol_fract_cmplx * gamma_s
! Yield strength
tau_y = alpha2 * CDEXP( beta2 * sed_vol_fract_cmplx )
! Fluid viscosity
fluid_visc = alpha1 * CDEXP( beta1 * sed_vol_fract_cmplx )
IF ( h .GT. h_threshold ) THEN
! Yield slope component
s_y = tau_y / ( gamma_m * h )
! Viscous slope component
s_v = Kappa * fluid_visc * mod_vel / ( 8.D0 * gamma_m * h**2 )
! Turbulent dispersive component
s_td = n_td**2 * mod_vel**2 / ( h**(4.D0/3.D0) )
! WRITE(*,*) 's_terms',REAL(s_y),REAL(s_v),REAL(s_td)