Skip to content

Commit cd932f6

Browse files
committed
Merge branch 'main' into third-law
2 parents c84ff2c + b6022a4 commit cd932f6

18 files changed

Lines changed: 204 additions & 281 deletions

File tree

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
2121
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
2222
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
2323
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
24+
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
2425
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"

benchmark/TensorAlgebraBenchmarks/TensorAlgebraBenchmarks.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,10 @@ function _δδ_λ_2D(λ::Float64)
4242
λ)
4343
end
4444

45+
A = TensorValue(1.:9...)
46+
A = A + A' + I3
47+
4548
SUITE["Tensor algebra"]["δδ_μ_2d"] = @benchmarkable δᵢₖδⱼₗ2D + δᵢₗδⱼₖ2D
4649
SUITE["Tensor algebra"]["δδ_λ_2d"] = @benchmarkable 1.0 * δᵢⱼδₖₗ2D
50+
SUITE["Tensor algebra"]["Cofactor"] = cof(A)
51+
SUITE["Tensor algebra"]["Det(A)Inv(A')"] = det(A)*inv(A')

src/ComputationalModels/FESpaces.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ function Gridap.FESpaces.TrialFESpace!(space::MultiFieldFESpace, bc::MultiFieldB
5454
end
5555
end
5656

57+
function Gridap.FESpaces.TrialFESpace(space::SingleFieldFESpace, bc::DirichletBC)
58+
TrialFESpace(space, bc, 0.0)
59+
end
60+
61+
function Gridap.FESpaces.TrialFESpace(space::MultiFieldFESpace, bc::MultiFieldBC)
62+
TrialFESpace(space, bc, 0.0)
63+
end
64+
5765

5866
function Gridap.FESpaces.TrialFESpace(space::SingleFieldFESpace, ::NothingBC, Λ::Float64)
5967
space

src/ComputationalModels/PostProcessors.jl

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,16 @@ end
7878

7979
function Piola(physmodel::ThermoElectroMechano,kine::NTuple{3,KinematicModel}, uh, φh, θh, Ω, dΩ, Λ=1.0)
8080
= physmodel(Λ)
81-
8281
F, _, _ = get_Kinematics(kine[1])
8382
E = get_Kinematics(kine[2])
8483
∂Ψu = DΨ[2]
85-
refL2 = ReferenceFE(lagrangian, Float64, 0)
86-
ref = ReferenceFE(lagrangian, Float64, 1)
87-
VL2 = FESpace(Ω, refL2, conformity=:L2)
88-
V = FESpace(Ω, ref, conformity=:H1)
89-
n1 = VectorValue(1.0, 0.0, 0.0)
90-
n2 = VectorValue(0.0, 1.0, 0.0)
91-
n3 = VectorValue(0.0, 0.0, 1.0)
92-
σ11h = interpolate_everywhere(L2_Projection(n1 ((∂Ψu (F((uh)'), E((φh)), θh)) * n1), dΩ, VL2), V)
93-
σ12h = interpolate_everywhere(L2_Projection(n1 ((∂Ψu (F((uh)'), E((φh)), θh)) * n2), dΩ, VL2), V)
94-
σ13h = interpolate_everywhere(L2_Projection(n1 ((∂Ψu (F((uh)'), E((φh)), θh)) * n3), dΩ, VL2), V)
95-
σ22h = interpolate_everywhere(L2_Projection(n2 ((∂Ψu (F((uh)'), E((φh)), θh)) * n2), dΩ, VL2), V)
96-
σ23h = interpolate_everywhere(L2_Projection(n2 ((∂Ψu (F((uh)'), E((φh)), θh)) * n3), dΩ, VL2), V)
97-
σ33h = interpolate_everywhere(L2_Projection(n3 ((∂Ψu (F((uh)'), E((φh)), θh)) * n3), dΩ, VL2), V)
98-
ph = interpolate_everywhere(L2_Projection(tr (∂Ψu (F((uh)'), E((φh)), θh)), dΩ, VL2), V)
99-
return (σ11h, σ12h, σ13h, σ22h, σ23h, σ33h, ph)
84+
σh = ∂Ψu (F((uh)'), E((φh)), θh)
85+
interpolate_L2_tensor(σh, Ω, dΩ)
10086
end
10187

10288

10389
function Cauchy(args...)
104-
@warn "The function Cauchy is deprecated and will be removed at the end of November 25. Please, replace it by Piola."
90+
@warn "The function Cauchy is deprecated. Shortly it'll be J^-1*P*F^-T."
10591
Piola(args...)
10692
end
10793

src/PhysicalModels/ElectroMechanicalModels.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ struct ElectroMechModel{E<:Electro,M<:Mechano} <: ElectroMechano
3636
function (obj::ElectroMechModel{<:Electro,<:ViscoElastic})(Λ::Float64=1.0; Δt)
3737
Ψm, ∂Ψm_u, ∂Ψm_uu = obj.mechano(Λ, Δt=Δt)
3838
Ψem, ∂Ψem_u, ∂Ψem_φ, ∂Ψem_uu, ∂Ψem_φu, ∂Ψem_φφ = _getCoupling(obj.electro, obj.mechano, Λ)
39-
Ψ(F, Fn, E, A...) = Ψm(F, Fn, A...) + Ψem(F, E)
40-
∂Ψu(F, Fn, E, A...) = ∂Ψm_u(F, Fn, A...) + ∂Ψem_u(F, E)
41-
∂Ψφ(F, Fn, E, A...) = ∂Ψem_φ(F, E)
42-
∂Ψuu(F, Fn, E, A...) = ∂Ψm_uu(F, Fn, A...) + ∂Ψem_uu(F, E)
43-
∂Ψφu(F, Fn, E, A...) = ∂Ψem_φu(F, E)
44-
∂Ψφφ(F, Fn, E, A...) = ∂Ψem_φφ(F, E)
39+
Ψ(F, E, Fn, A...) = Ψm(F, Fn, A...) + Ψem(F, E)
40+
∂Ψu(F, E, Fn, A...) = ∂Ψm_u(F, Fn, A...) + ∂Ψem_u(F, E)
41+
∂Ψφ(F, E, Fn, A...) = ∂Ψem_φ(F, E)
42+
∂Ψuu(F, E, Fn, A...) = ∂Ψm_uu(F, Fn, A...) + ∂Ψem_uu(F, E)
43+
∂Ψφu(F, E, Fn, A...) = ∂Ψem_φu(F, E)
44+
∂Ψφφ(F, E, Fn, A...) = ∂Ψem_φφ(F, E)
4545
return (Ψ, ∂Ψu, ∂Ψφ, ∂Ψuu, ∂Ψφu, ∂Ψφφ)
4646
end
4747

src/PhysicalModels/MagneticModels.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ struct Magnetic <: Magneto
99
αr::Ref{Float64}
1010
χe::Float64
1111

12-
function Magnetic(; μ::Float64, αr::Ref{Float64}, χe::Float64=0.0)
13-
new(μ, αr, χe)
12+
function Magnetic(; μ0::Float64, αr::Float64, χe::Float64=0.0)
13+
new(μ0, Ref(αr), χe)
1414
end
1515
function (obj::Magnetic)(Λ::Float64=1.0)
1616
μ, αr, χe = obj.μ, obj.αr, obj.χe
@@ -29,8 +29,8 @@ end
2929
struct IdealMagnetic <: Magneto
3030
μ::Float64
3131
χe::Float64
32-
function IdealMagnetic(; μ::Float64, χe::Float64=0.0)
33-
new(μ, χe)
32+
function IdealMagnetic(; μ0::Float64, χe::Float64=0.0)
33+
new(μ0, χe)
3434
end
3535
function (obj::IdealMagnetic)(Λ::Float64=1.0)
3636

@@ -74,8 +74,8 @@ end
7474
struct IdealMagnetic2D <: Magneto
7575
μ::Float64
7676
χe::Float64
77-
function IdealMagnetic2D(; μ::Float64, χe::Float64=0.0)
78-
new(μ, χe)
77+
function IdealMagnetic2D(; μ0::Float64, χe::Float64=0.0)
78+
new(μ0, χe)
7979
end
8080

8181
function (obj::IdealMagnetic2D)(Λ::Float64=1.0)
@@ -119,8 +119,8 @@ struct HardMagnetic <: Magneto
119119
χr::Float64
120120
βmok::Float64
121121
βcoup::Float64
122-
function HardMagnetic(; μ::Float64, αr::Float64, χe::Float64=0.0, χr::Float64=8.0, βmok::Float64=1.0, βcoup::Float64=1.0)
123-
new(μ, αr, χe, χr, βmok, βcoup)
122+
function HardMagnetic(; μ0::Float64, αr::Float64, χe::Float64=0.0, χr::Float64=8.0, βmok::Float64=0.0, βcoup::Float64=0.0)
123+
new(μ0, αr, χe, χr, βmok, βcoup)
124124
end
125125

126126
function (obj::HardMagnetic)(Λ::Float64=1.0)
@@ -167,8 +167,8 @@ struct HardMagnetic2D <: Magneto
167167
χr::Float64
168168
βmok::Float64
169169
βcoup::Float64
170-
function HardMagnetic2D(; μ::Float64, αr::Float64, χe::Float64=0.0, χr::Float64=8.0, βmok::Float64=1.0, βcoup::Float64=1.0)
171-
new(μ, αr, χe, χr, βmok, βcoup)
170+
function HardMagnetic2D(; μ0::Float64, αr::Float64, χe::Float64=0.0, χr::Float64=8.0, βmok::Float64=0.0, βcoup::Float64=0.0)
171+
new(μ0, αr, χe, χr, βmok, βcoup)
172172
end
173173

174174
function (obj::HardMagnetic2D)(Λ::Float64=1.0)

0 commit comments

Comments
 (0)