Skip to content

Commit 0efc66e

Browse files
authored
Merge pull request #73 from MultiSimOLab/thermo-visco
Thermo-electro-mechanical constitutive model
2 parents 05f2be6 + bc8b2ef commit 0efc66e

File tree

5 files changed

+115
-61
lines changed

5 files changed

+115
-61
lines changed

src/ComputationalModels/CartesianTags.jl

Lines changed: 66 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,83 @@
22
"Shortcuts for the tags of cartesian discrete models."
33
module CartesianTags
44

5-
"Tags indicating points, edges and faces at X0."
6-
const faceX0 = [1,3,5,7,13,15,17,19,25]
5+
"Tags indicating points, edges and faces at plane X0."
6+
const faceX0 = [1, 3, 5, 7, 13, 15, 17, 19, 25]
77

8-
"Tags indicating points, edges and faces at X1."
9-
const faceX1 = [2,4,6,8,14,16,18,20,26]
8+
"Tags indicating points, edges and faces at plane X1."
9+
const faceX1 = [2, 4, 6, 8, 14, 16, 18, 20, 26]
1010

11-
"Tags indicating points, edges and faces at Y0."
12-
const faceY0 = [1,2,5,6,9,11,17,18,23]
11+
"Tags indicating points, edges and faces at plane Y0."
12+
const faceY0 = [1, 2, 5, 6, 9, 11, 17, 18, 23]
1313

14-
"Tags indicating points, edges and faces at Y1."
15-
const faceY1 = [3,4,7,8,10,12,19,20,24]
14+
"Tags indicating points, edges and faces at plane Y1."
15+
const faceY1 = [3, 4, 7, 8, 10, 12, 19, 20, 24]
1616

17-
"Tags indicating points, edges and faces at Z0."
18-
const faceZ0 = [1,2,3,4,9,10,13,14,21]
17+
"Tags indicating points, edges and faces at plane Z0."
18+
const faceZ0 = [1, 2, 3, 4, 9, 10, 13, 14, 21]
1919

20-
"Tags indicating points, edges and faces at Z1."
21-
const faceZ1 = [5,6,7,8,11,12,15,16,22]
20+
"Tags indicating points, edges and faces at plane Z1."
21+
const faceZ1 = [5, 6, 7, 8, 11, 12, 15, 16, 22]
2222

23-
"Tag indicating the point at corner X0, Y0, Z0."
24-
const corner000 = [1]
2523

26-
"Tag indicating the point at corner X1, Y0, Z0."
27-
const corner100 = [2]
24+
"Tag indicating the edge at X, Y0, Z0."
25+
const edgeX00 = [9]
2826

29-
"Tag indicating the point at corner X0, Y1, Z0."
30-
const corner010 = [3]
27+
"Tag indicating the edge at X, Y1, Z0."
28+
const edgeX10 = [10]
3129

32-
"Tag indicating the point at corner X1, Y1, Z0."
33-
const corner110 = [4]
30+
"Tag indicating the edge at X, Y0, Z1."
31+
const edgeX01 = [11]
3432

35-
"Tag indicating the point at corner X0, Y0, Z1."
36-
const corner001 = [5]
33+
"Tag indicating the edge at X, Y1, Z1."
34+
const edgeX11 = [12]
3735

38-
"Tag indicating the point at corner X1, Y0, Z1."
39-
const corner101 = [6]
36+
"Tag indicating the edge at X0, Y, Z0."
37+
const edge0Y0 = [13]
4038

41-
"Tag indicating the point at corner X0, Y1, Z1."
42-
const corner011 = [7]
39+
"Tag indicating the edge at X1, Y, Z0."
40+
const edge1Y0 = [14]
4341

44-
"Tag indicating the point at corner X1, Y1, Z1."
45-
const corner111 = [8]
42+
"Tag indicating the edge at X0, Y, Z1."
43+
const edge0Y1 = [15]
44+
45+
"Tag indicating the edge at X1, Y, Z1."
46+
const edge1Y1 = [16]
47+
48+
"Tag indicating the edge at X0, Y0, Z."
49+
const edge00Z = [17]
50+
51+
"Tag indicating the edge at X1, Y0, Z."
52+
const edge10Z = [18]
53+
54+
"Tag indicating the edge at X0, Y1, Z."
55+
const edge01Z = [19]
56+
57+
"Tag indicating the edge at X1, Y1, Z."
58+
const edge11Z = [20]
59+
60+
61+
"Tag indicating the point at corner X0, Y0, Z0."
62+
const corner000 = [1]
63+
64+
"Tag indicating the point at corner X1, Y0, Z0."
65+
const corner100 = [2]
66+
67+
"Tag indicating the point at corner X0, Y1, Z0."
68+
const corner010 = [3]
69+
70+
"Tag indicating the point at corner X1, Y1, Z0."
71+
const corner110 = [4]
72+
73+
"Tag indicating the point at corner X0, Y0, Z1."
74+
const corner001 = [5]
75+
76+
"Tag indicating the point at corner X1, Y0, Z1."
77+
const corner101 = [6]
78+
79+
"Tag indicating the point at corner X0, Y1, Z1."
80+
const corner011 = [7]
81+
82+
"Tag indicating the point at corner X1, Y1, Z1."
83+
const corner111 = [8]
4684
end

src/Exports.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ end
8585
@publish PhysicalModels EvolutiveKinematics
8686
@publish PhysicalModels get_Kinematics
8787
@publish PhysicalModels getIsoInvariants
88-
88+
89+
@publish PhysicalModels Dissipation
8990
@publish PhysicalModels initializeStateVariables
9091
@publish PhysicalModels updateStateVariables!
9192

src/PhysicalModels/ThermoElectroMechanicalModels.jl

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct ThermoElectroMech_Bonet{T<:Thermo,E<:Electro,M<:Mechano} <: ThermoElectro
107107
thermo::T
108108
electro::E
109109
mechano::M
110-
110+
111111
function ThermoElectroMech_Bonet(thermo::T, electro::E, mechano::M) where {T<:Thermo,E<:Electro,M<:Mechano}
112112
new{T,E,M}(thermo, electro, mechano)
113113
end
@@ -116,41 +116,40 @@ struct ThermoElectroMech_Bonet{T<:Thermo,E<:Electro,M<:Mechano} <: ThermoElectro
116116
new{T,E,M}(thermo, electro, mechano)
117117
end
118118

119-
function (obj::ThermoElectroMech_Bonet)(Λ::Float64=1.0)
119+
function (obj::ThermoElectroMech_Bonet)(Λ::Float64=1.0; kwargs...)
120120
@unpack Cv,θr, α, κ, γv, γd = obj.thermo
121-
Ψem, ∂Ψem∂F, ∂Ψem∂E, ∂Ψem∂FF, ∂Ψem∂EF, ∂Ψem∂EE = _getCoupling(obj.electro, obj.mechano, Λ)
122-
gd(δθ)=1/(γd+1) * (((δθ+θr)/θr)^(γd+1) -1)
123-
∂gd(δθ)=(δθ+θr)^γd / θr^(γd+1)
124-
∂∂gd(δθ)= γd*(δθ+θr)^(γd-1) / θr^(γd+1)
125-
gv(δθ)=1/(γv+1) * (((δθ+θr)/θr)^(γv+1) -1)
126-
∂gv(δθ)=(δθ+θr)^γv / θr^(γv+1)
127-
∂∂gv(δθ)=γv*(δθ+θr)^(γv-1) / θr^(γv+1)
121+
em = ElectroMechModel(obj.electro, obj.mechano)
122+
Ψem, ∂Ψem∂F, ∂Ψem∂E, ∂Ψem∂FF, ∂Ψem∂EF, ∂Ψem∂EE = em(;kwargs...)
123+
gd(θ) = 1/(γd+1) * ((θ/θr)^(γd+1) -1)
124+
∂gd(θ) = θ^γd / θr^(γd+1)
125+
∂∂gd(θ) = γd*θ^(γd-1) / θr^(γd+1)
126+
gv(θ) = 1/(γv+1) * ((θ/θr)^(γv+1) -1)
127+
∂gv(θ) = θ^γv / θr^(γv+1)
128+
∂∂gv(θ) = γv*θ^(γv-1) / θr^(γv+1)
128129

129130
J(F) = det(F)
130131
H(F) = det(F) * inv(F)'
131132

132-
η(F) =α*(J(F) - 1.0)+Cv/γv
133-
∂η∂J(F)=α
134-
∂η∂F(F)=∂η∂J(F)*H(F)
135-
∂2η∂FF(F)=×ᵢ⁴(∂η∂J(F) * F)
136-
137-
Ψ(F,E,δθ) = Ψem(F,E)*(1.0+gd(δθ))+gv(δθ)*η(F)
133+
ηR(F) = α*(J(F) - 1.0)+Cv/γv
134+
∂ηR∂J(F) = α
135+
∂ηR∂F(F) = ∂ηR∂J(F)*H(F)
136+
∂2ηR∂FF(F) = ×ᵢ⁴(∂ηR∂J(F) * F)
138137

139-
∂Ψ_∂F(F, E, δθ) = (1.0+gd(δθ)) *∂Ψem∂F(F, E) + gv(δθ)*∂η∂F(F)
140-
∂Ψ_∂E(F, E, δθ) = (1.0+gd(δθ)) *∂Ψem∂E(F, E)
141-
∂Ψ_∂δθ(F, E, δθ) = ∂gd(δθ) *Ψem(F, E) + ∂gv(δθ)*η(F)
138+
Ψ(F, E, θ, X...) = Ψem(F, E, X...)*(1.0+gd(θ))+gv(θ)*ηR(F)
142139

143-
2Ψ_∂2F(F, E, δθ) = (1.0+gd(δθ)) *∂Ψem∂FF(F, E) + gv(δθ)*2η∂FF(F)
144-
2Ψ_∂2E(F, E, δθ) = (1.0+gd(δθ)) *∂Ψem∂EE(F, E)
145-
2Ψ_∂2δθ(F, E, δθ) = gd(δθ) *Ψem(F, E) + gv(δθ)*η(F)
140+
Ψ_∂F(F, E, θ, X...) = (1.0+gd(θ)) *∂Ψem∂F(F, E, X...) + gv(θ)*ηR∂F(F)
141+
Ψ_∂E(F, E, θ, X...) = (1.0+gd(θ)) *∂Ψem∂E(F, E, X...)
142+
Ψ_∂θ(F, E, θ, X...) = ∂gd(θ) *Ψem(F, E, X...) + ∂gv(θ)*ηR(F)
146143

147-
ΨEF(F, E, δθ) = (1.0+gd(δθ)) *∂Ψem∂EF(F, E)
148-
ΨFδθ(F, E, δθ) = gd(δθ) *∂Ψem∂F(F, E) + ∂gv(δθ)*∂η∂F(F)
149-
ΨEδθ(F, E, δθ) = ∂gd(δθ) *Ψem∂E(F, E)
144+
2Ψ_∂2F(F, E, θ, X...) = (1.0+gd(θ)) *∂Ψem∂FF(F, E, X...) + gv(θ)*∂2ηR∂FF(F)
145+
2Ψ_∂2E(F, E, θ, X...) = (1.0+gd(θ)) *∂Ψem∂EE(F, E, X...)
146+
2Ψ_∂2θ(F, E, θ, X...) = gd(θ) *Ψem(F, E, X...) + ∂∂gv(θ)*ηR(F)
150147

151-
entropy(F, E, δθ) = -∂Ψ_∂δθ(F, E, δθ)
148+
∂ΨEF(F, E, θ, X...) = (1.0+gd(θ)) *∂Ψem∂EF(F, E, X...)
149+
∂ΨFθ(F, E, θ, X...) = ∂gd(θ) *∂Ψem∂F(F, E, X...) + ∂gv(θ)*∂ηR∂F(F)
150+
∂ΨEθ(F, E, θ, X...) = ∂gd(θ) *∂Ψem∂E(F, E, X...)
152151

153-
return (Ψ, ∂Ψ_∂F, ∂Ψ_∂E, ∂Ψ_∂δθ, ∂2Ψ_∂2F, ∂2Ψ_∂2E, ∂2Ψ_∂2δθ, ∂ΨEF, ∂ΨFδθ, ∂ΨEδθ, entropy)
152+
return (Ψ, ∂Ψ_∂F, ∂Ψ_∂E, ∂Ψ_∂θ, ∂2Ψ_∂2F, ∂2Ψ_∂2E, ∂2Ψ_∂, ∂ΨEF, ∂ΨFθ, ∂ΨEθ)
154153
end
155154
end
156155

@@ -159,7 +158,7 @@ function Dissipation(obj::ThermoElectroMech_Bonet, Δt)
159158
Dvis = Dissipation(obj.mechano, Δt)
160159
gd(δθ) = 1/(γd+1) * (((δθ+θr)/θr)^(γd+1) -1)
161160
∂gd(δθ) = (δθ+θr)^γd / θr^(γd+1)
162-
D(F, E, δθ, A...) = (1 + gd(δθ)) * Dvis(F, A...)
163-
∂D∂θ(F, E, δθ, A...) = ∂gd(δθ) * Dvis(F, A...)
161+
D(F, E, δθ, X...) = (1 + gd(δθ)) * Dvis(F, X...)
162+
∂D∂θ(F, E, δθ, X...) = ∂gd(δθ) * Dvis(F, X...)
164163
return(D, ∂D∂θ)
165164
end

src/WeakForms/WeakForms.jl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,16 @@ function residual(physicalmodel::ThermoElectroMechano, ::Type{Electro}, kine::NT
8585
return -1.0*((vφ)' (∂Ψφ (F((u)'), E((φ)), θ)))dΩ
8686
end
8787

88-
function residual(physicalmodel::ThermoElectroMechano, ::Type{Thermo}, kine::NTuple{3,KinematicModel}, (u, φ, θ), vθ, dΩ, Λ=1.0)
89-
κ=physicalmodel.thermo.κ
90-
return * (θ) (vθ))dΩ
88+
function residual(physicalmodel::ThermoElectroMechano, ::Type{Thermo}, kine::NTuple{3,KinematicModel}, (u, φ, θ), vθ, dΩ, Λ=1.0, Δt=0.0, vars...)
89+
κ = physicalmodel.thermo.κ
90+
D, ∂D = Dissipation(Δt)
91+
return * (θ) (vθ) -D(u, φ, θ, vars...))dΩ
92+
end
93+
94+
function transient_residual(physicalmodel::ThermoElectroMechano, ::Type{Thermo}, kine::NTuple{3,KinematicModel}, (u, φ, θ), (un, φn, θn), vθ, dΩ, Λ=1.0, Δt=0.0, vars...)
95+
= physicalmodel(Δt=Δt)
96+
η = -DΨ[4]
97+
return ((1/Δt)**η(F,E,θ,vars...) - θn*η(Fn,En,θn,vars...) + η(F,E,θ)*- θn)))dΩ
9198
end
9299

93100

@@ -410,4 +417,13 @@ function jacobian(physicalmodel::ThermoElectroMech_PINNs, kine::NTuple{2,Kinemat
410417
end
411418

412419

420+
421+
422+
function transient_residual(physicalmodel::ThermoElectroMech_Bonet, ::Type{Thermo}, kine::NTuple{3,KinematicModel}, (u, φ, θ), vθ, dΩ, Λ=1.0)
423+
κ = physicalmodel.thermo.κ
424+
425+
return * (θ) (vθ))dΩ
426+
end
427+
428+
413429
end

test/TestConstitutiveModels/PhysicalModelTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ end
467467
modelT = ThermalModel(Cv=17.385, θr=293.0, α=0.00156331, γv=2.0, γd=2.0)
468468

469469
modelTEM = ThermoElectroMech_Bonet(modelT, modelID, modelMR)
470-
Ψ, ∂Ψu, ∂ΨE, ∂Ψθ, ∂ΨFF, ∂ΨEE, ∂2Ψθθ, ∂ΨEF, ∂ΨFθ, ∂ΨEθ, η = modelTEM()
470+
Ψ, ∂Ψu, ∂ΨE, ∂Ψθ, ∂ΨFF, ∂ΨEE, ∂2Ψθθ, ∂ΨEF, ∂ΨFθ, ∂ΨEθ = modelTEM()
471471

472472
K = Kinematics(Mechano, Solid)
473473
F, _, _ = get_Kinematics(K)

0 commit comments

Comments
 (0)