Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
! WRITE(*,*) ' u', REAL(u)
ELSE
! Yield slope component
s_y = tau_y / ( gamma_m * h_threshold )
! Viscous slope component
s_v = Kappa * fluid_visc * mod_vel / ( 8.D0 * gamma_m * &
h_threshold**2 )
! Turbulent dispersive components
s_td = n_td**2 * (mod_vel**2) / ( h_threshold**(4.D0/3.D0) )
END IF
! Total implicit friction slope
s_f = s_v + s_td
IF ( mod_vel .GT. 0.D0 ) THEN
forces_term(2) = forces_term(2) - grav * h * ( u / mod_vel ) * s_f
forces_term(3) = forces_term(3) - grav * h * ( v / mod_vel ) * s_f
END IF
!WRITE(*,*) 's_terms',DBLE(s_y), &
! DBLE(Kappa * fluid_visc / ( 8.D0 * gamma_m * h**2 )), &
! DBLE(n_td**2 / ( h**(4.D0/3.D0) ))
!WRITE(*,*) 'grav*h',grav*h
!WRITE(*,*) 'eval_nh',DBLE(u),DBLE(forces_term(2))
ELSEIF ( rheology_model .EQ. 5 ) THEN
tau = 1.D-3 / ( 1.D0 + 10.D0 * h ) * mod_vel
IF ( DBLE(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 )
END IF
ENDIF
ENDIF
IF ( temperature_flag ) THEN
CALL phys_var(Bj,c_qj = qj)
IF ( REAL(h) .GT. 0.d0 ) THEN
! Equation 8 from Costa & Macedonio, 2005
radiative_coeff = emissivity * SBconst * exp_area_fract / ( rho * c_p )
ELSE
radiative_coeff = 0.D0
END IF
IF ( REAL(T) .GT. T_env ) THEN
! First R.H.S. term in equation 4 from Costa & Macedonio, 2005
radiative_term = - radiative_coeff * ( T**4 - T_env**4 )
ELSE
radiative_term = DCMPLX(0.D0,0.D0)
END IF
IF ( REAL(h) .GT. 0.d0 ) THEN
! Equation 9 from Costa & Macedonio, 2005
convective_coeff = atm_heat_transf_coeff * exp_area_fract &
/ ( rho * c_p )
ELSE
convective_coeff = 0.D0
END IF
IF ( REAL(T) .GT. T_env ) THEN
! Second R.H.S. term in equation 4 from Costa & Macedonio, 2005
convective_term = - convective_coeff * ( T - T_env )
ELSE
convective_term = DCMPLX(0.D0,0.D0)
END IF
IF ( REAL(h) .GT. h_threshold ) THEN
thermal_diffusivity = thermal_conductivity / ( rho * c_p )
! Equation 7 from Costa & Macedonio, 2005
conductive_coeff = enne * thermal_diffusivity / h
ELSE
conductive_coeff = DCMPLX(0.D0,0.D0)
conductive_coeff = enne * thermal_diffusivity / DCMPLX(h_threshold,0.D0)
END IF
! Third R.H.S. term in equation 4 from Costa & Macedonio, 2005
IF ( REAL(T) .GT. T_ground ) THEN
conductive_term = - conductive_coeff * ( T - T_ground )
ELSE
conductive_term = DCMPLX(0.D0,0.D0)
END IF
IF ( solid_transport_flag ) THEN
relaxation_term(5) = radiative_term + convective_term + conductive_term
ELSE
relaxation_term(4) = radiative_term + convective_term + conductive_term
END IF
END IF
nh_term = relaxation_term + forces_term
IF ( present(c_qj) .AND. present(c_nh_term_impl) ) THEN
c_nh_term_impl = nh_term
ELSEIF ( present(r_qj) .AND. present(r_nh_term_impl) ) THEN
r_nh_term_impl = REAL( nh_term )
END IF
END SUBROUTINE eval_nonhyperbolic_terms
!******************************************************************************
!> \brief Non-Hyperbolic semi-implicit terms
!
!> This subroutine evaluates the non-hyperbolic terms that are solved
!> semi-implicitely by the solver. For example, any discontinuous term that
!> appears in the friction terms.
!> \date 20/01/2018
!> \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_nh_semi_impl_terms( Bj , grav3_surf , c_qj , &
c_nh_semi_impl_term , r_qj , r_nh_semi_impl_term )
USE COMPLEXIFY
USE parameters_2d, ONLY : sed_vol_perc
IMPLICIT NONE
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(IN) :: grav3_surf
COMPLEX*16, INTENT(IN), OPTIONAL :: c_qj(n_vars)
COMPLEX*16, INTENT(OUT), OPTIONAL :: c_nh_semi_impl_term(n_eqns)
REAL*8, INTENT(IN), OPTIONAL :: r_qj(n_vars)
REAL*8, INTENT(OUT), OPTIONAL :: r_nh_semi_impl_term(n_eqns)
COMPLEX*16 :: qj(n_vars)
COMPLEX*16 :: forces_term(n_eqns)
INTEGER :: i
COMPLEX*16 :: mod_vel
REAL*8 :: h_threshold
!--- Lahars rheology model variables
!> Yield strenght
COMPLEX*8 :: tau_y
!> Sediment volume fraction
COMPLEX*8 :: sed_vol_fract_cmplx
!> Specific weight of sediment mixture
COMPLEX*8 :: gamma_m
!> Yield slope component of total friction
COMPLEX*8 :: s_y
IF ( present(c_qj) .AND. present(c_nh_semi_impl_term) ) THEN
qj = c_qj
ELSEIF ( present(r_qj) .AND. present(r_nh_semi_impl_term) ) 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 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 ( mod_vel .GT. 0.D0 ) THEN
forces_term(2) = forces_term(2) - ( u / mod_vel ) * &
mu * h * ( - grav * grav3_surf )
forces_term(3) = forces_term(3) - ( v / mod_vel ) * &
mu * h * ( - grav * grav3_surf )
END IF
! Loi de Coulomb
ELSEIF ( rheology_model .EQ. 8 ) THEN
forces_term(2) = forces_term(2) - mu * grav * ( - grav3_surf * h )
forces_term(3) = forces_term(3) - mu * grav * ( - grav3_surf * h )
! Plastic rheology
ELSEIF ( rheology_model .EQ. 2 ) THEN
! Temperature dependent rheology
ELSEIF ( rheology_model .EQ. 3 ) THEN
! 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*1.D-2 , 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 )
IF ( h .GT. h_threshold ) THEN
! Yield slope component
s_y = tau_y / ( gamma_m * h )
ELSE
! Yield slope component
s_y = tau_y / ( gamma_m * h_threshold )
END IF
IF ( mod_vel .GT. 0.D0 ) THEN
forces_term(2) = forces_term(2) - grav * h * ( u / mod_vel ) * s_y
forces_term(3) = forces_term(3) - grav * h * ( v / mod_vel ) * s_y
END IF
ELSEIF ( rheology_model .EQ. 5 ) THEN
ENDIF
ENDIF
IF ( temperature_flag ) THEN
END IF
IF ( present(c_qj) .AND. present(c_nh_semi_impl_term) ) THEN
c_nh_semi_impl_term = forces_term
ELSEIF ( present(r_qj) .AND. present(r_nh_semi_impl_term) ) THEN
r_nh_semi_impl_term = DBLE( forces_term )
END IF
END SUBROUTINE eval_nh_semi_impl_terms
!******************************************************************************
!> \brief Explicit Forces term
!
!> This subroutine evaluates the non-hyperbolic terms to be treated explicitely
!> in the DIRK numerical scheme (e.g. gravity,source of mass). The sign of the
!> terms is taken with the terms on the left-hand side of the equations.
!> \date 01/06/2012
!> \param[in] qj conservative variables
!> \param[out] expl_term explicit term
!******************************************************************************
SUBROUTINE eval_expl_terms( Bj, Bprimej_x , Bprimej_y , source_xy , qj , &
expl_term )
USE parameters_2d, ONLY : source_flag , vel_source , T_source
IMPLICIT NONE
REAL*8, INTENT(IN) :: Bj
REAL*8, INTENT(IN) :: Bprimej_x
REAL*8, INTENT(IN) :: Bprimej_y
REAL*8, INTENT(IN) :: source_xy
REAL*8, INTENT(IN) :: qj(n_eqns) !< conservative variables
REAL*8, INTENT(OUT) :: expl_term(n_eqns) !< explicit forces
REAL*8 :: visc_heat_coeff
expl_term(1:n_eqns) = 0.D0
CALL phys_var(Bj,r_qj = qj)
IF ( source_flag ) expl_term(1) = - source_xy * vel_source
expl_term(2) = grav * REAL(h) * Bprimej_x
expl_term(3) = grav * REAL(h) * Bprimej_y
IF ( temperature_flag .AND. source_flag ) THEN
IF ( solid_transport_flag ) THEN
expl_term(5) = - source_xy * vel_source * T_source
ELSE
expl_term(4) = - source_xy * vel_source * T_source
END IF
IF ( rheology_model .EQ. 3 ) THEN
IF ( REAL(h) .GT. 0.D0 ) THEN
! Equation 10 from Costa & Macedonio, 2005
visc_heat_coeff = emme * nu_ref / ( c_p * REAL(h) )
ELSE
visc_heat_coeff = 0.D0
END IF
IF ( solid_transport_flag ) THEN
! Viscous heating
! Last R.H.S. term in equation 4 from Costa & Macedonio, 2005
expl_term(5) = expl_term(5) - visc_heat_coeff * ( REAL(u)**2 &
+ REAL(v)**2 ) * DEXP( - visc_par * ( REAL(T) - T_ref ) )
ELSE
! Viscous heating
! Last R.H.S. term in equation 4 from Costa & Macedonio, 2005
expl_term(4) = expl_term(4) - visc_heat_coeff * ( REAL(u)**2 &
+ REAL(v)**2 ) * DEXP( - visc_par * ( REAL(T) - T_ref ) )
END IF
END IF
END IF
END SUBROUTINE eval_expl_terms
END MODULE constitutive_2d