Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/Utils/PorousMaterialModels.F90
3203 views
1
!/*****************************************************************************/
2
! *
3
! * Elmer, A Finite Element Software for Multiphysical Problems
4
! *
5
! * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
6
! *
7
! * This library is free software; you can redistribute it and/or
8
! * modify it under the terms of the GNU Lesser General Public
9
! * License as published by the Free Software Foundation; either
10
! * version 2.1 of the License, or (at your option) any later version.
11
! *
12
! * This library is distributed in the hope that it will be useful,
13
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
! * Lesser General Public License for more details.
16
! *
17
! * You should have received a copy of the GNU Lesser General Public
18
! * License along with this library (in file ../LGPL-2.1); if not, write
19
! * to the Free Software Foundation, Inc., 51 Franklin Street,
20
! * Fifth Floor, Boston, MA 02110-1301 USA
21
! *
22
! *****************************************************************************/
23
!
24
!/******************************************************************************
25
! *
26
! * Authors: Olivier Gagliardini and Julien Brondex
27
! * Email: [email protected]
28
! * [email protected]
29
! *
30
! * Web: http://elmerice.elmerfem.org
31
! *
32
! * Original Date: January 2024
33
! *
34
! ******************************************************************************/
35
!--------------------------------------------------------------------------------
36
!> Module containing utility routines for the Porous Solver
37
!--------------------------------------------------------------------------------
38
39
MODULE PorousMaterialModels
40
41
USE DefUtils
42
43
IMPLICIT NONE
44
45
CONTAINS
46
47
48
!-------------------------------------------------------------------------------
49
!> Function a(D) and b(D) from Gagliardini and Meyssonier, 1997.
50
!> modified to fulfill the condition 3x a(D) >= 2x b(D) for D > 0.1
51
!> for n=3 only
52
!-------------------------------------------------------------------------------
53
54
!> Function a (Olivier Gagliardini)
55
FUNCTION ParameterA ( D ) RESULT(a)
56
USE types
57
USE CoordinateSystems
58
USE SolverUtils
59
USE ElementDescription
60
USE DefUtils
61
IMPLICIT NONE
62
REAL(KIND=dp) :: a, D, DD
63
64
IF (D > 0.99_dp ) THEN
65
a = 1.0_dp
66
67
ELSE IF (D <= 0.81) THEN
68
DD = D
69
IF (D < 0.4 ) DD = 0.4_dp
70
a = EXP( 13.22240_dp - 15.78652_dp * DD )
71
72
ELSE
73
a = 1.0_dp + 2.0/3.0 * (1.0_dp - D)
74
a = a / ( D**1.5 )
75
END IF
76
END FUNCTION ParameterA
77
78
79
!> Function b (Olivier Gagliardini)
80
FUNCTION ParameterB ( D ) RESULT(b)
81
USE types
82
USE CoordinateSystems
83
USE SolverUtils
84
USE ElementDescription
85
USE DefUtils
86
IMPLICIT NONE
87
REAL(KIND=dp) :: b, D, DD
88
89
IF (D > 0.99_dp) THEN
90
b = 0.0_dp
91
92
ELSE IF (D <= 0.81) THEN
93
DD = D
94
IF (D < 0.4 ) DD = 0.4_dp
95
b = EXP( 15.09371_dp - 20.46489_dp * DD )
96
97
ELSE
98
b = (1.0_dp - D)**(1.0/3.0)
99
b = 3.0/4.0 * ( b / (3.0 * (1 - b)) )**1.5
100
101
END IF
102
END FUNCTION ParameterB
103
104
!------------------------------------------------------------------------------
105
!> Returns effective viscosity for Porous Solver (Julien Brondex)
106
!------------------------------------------------------------------------------
107
FUNCTION PorousEffectiveViscosity( Fluidity, Density, SR, Em, Element, &
108
Nodes, n, nd, u, v, w, LocalIP ) RESULT(mu)
109
!------------------------------------------------------------------------------
110
111
REAL(KIND=dp) :: Fluidity, Density, u, v, w, eta, Kcp, mu(2)
112
REAL(KIND=dp) :: SR(:,:)
113
TYPE(Nodes_t) :: Nodes
114
INTEGER :: n,nd
115
INTEGER, OPTIONAL :: LocalIP
116
TYPE(Element_t),POINTER :: Element
117
118
!------------------------------------------------------------------------------
119
TYPE(ValueList_t), POINTER :: Material
120
REAL(KIND=dp) :: Wn, MinSRInvariant, fa, fb, ss, nn, Em
121
122
INTEGER :: i, j
123
INTEGER :: body_id
124
INTEGER :: old_body = -1
125
126
LOGICAL :: GotIt
127
128
SAVE :: old_body, Wn, MinSRInvariant
129
130
Material => GetMaterial(Element)
131
132
! Get uniform rheological parameters only once per body to save computational time
133
!-------------------------------------------------------------------------------------
134
body_id = Element % BodyId
135
IF (body_id /= old_body) Then
136
old_body = body_id
137
! Get flow law exponent
138
Wn = GetConstReal( Material , 'Powerlaw Exponent', GotIt )
139
IF (.NOT.GotIt) THEN
140
CALL INFO('ComputeDevStress', 'Variable Powerlaw Exponent not found. &
141
& Setting to 1.0', Level = 20)
142
Wn = 1.0
143
ELSE
144
WRITE(Message,'(A,F10.4)') 'Powerlaw Exponent = ', Wn
145
CALL INFO('ComputeDevStress', Message, Level = 20)
146
END IF
147
! Get the Minimum value of the Effective Strain rate
148
MinSRInvariant = 100.0*AEPS
149
IF ( Wn > 1.0 ) THEN
150
MinSRInvariant = GetConstReal( Material, 'Min Second Invariant', GotIt )
151
IF (.NOT.GotIt) THEN
152
WRITE(Message,'(A)') 'Variable Min Second Invariant not &
153
&found. Setting to 100.0*AEPS )'
154
CALL INFO('ComputeDevStress', Message, Level = 20)
155
ELSE
156
WRITE(Message,'(A,F14.8)') 'Min Second Invariant = ', MinSRInvariant
157
CALL INFO('ComputeDevStress', Message, Level = 20)
158
END IF
159
END IF
160
END IF
161
162
! Get non-uniform rheological parameters for Porous at current point
163
!-------------------------------------------------------------------------------------
164
! Evaluate parameterized functions a and b from Density interpolated at current point
165
fa = ParameterA(Density)
166
fb = ParameterB(Density)
167
168
! Calculate Strain Rate invariant as E_D^2 = gamma_e^2/fa + E_m^2/fb
169
ss = 1.0_dp !case linear by default -> ss = E_D^((1-n)/n) -> ss = 1 if n = 1
170
IF ( Wn > 1.0 ) THEN !case non-linear
171
ss = 0.0_dp !Initialize ss
172
DO i = 1, 3
173
DO j = 1, 3
174
ss = ss + SR(i,j)**2 ! Gamma_e^2/2 = e_ij e_ij
175
END DO
176
END DO
177
ss = 2.0*ss / fa !Gamma_e^2/fa
178
IF ( fb > 1.0e-8 ) ss = ss + Em**2 / fb !Full E_D^2 = gamma_e^2/fa + E_m^2/fb
179
180
nn =(1.0 - Wn)/Wn !nn = (1 -n)/n
181
182
ss = SQRT(ss)! Full E_D
183
IF (ss < MinSRInvariant ) ss = MinSRInvariant !Invariant not less than prescribed min
184
ss = ss**nn ! ss = E_D^((1-n)/n)
185
END IF
186
187
! Compute effective viscosity at current point
188
!-------------------------------------------------------------------------------------
189
eta = ss / ( fa * Fluidity ** (1.0 / Wn ) )
190
! Compute compressibility parameter at current point
191
!-------------------------------------------------------------------------------------
192
Kcp = fb * Fluidity ** (1.0 / Wn ) / ss
193
! Return output array as [eta, Kcp]
194
!-------------------------------------------------------------------------------------
195
mu = [ eta, Kcp ]
196
!------------------------------------------------------------------------------
197
END FUNCTION PorousEffectiveViscosity
198
!------------------------------------------------------------------------------
199
200
END MODULE PorousMaterialModels
201
202