Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PhysicalModels/MagneticModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function (obj::Magnetic)(Λ::Float64=1.0)
# Energy #
Ψmm(ℋ₀, N) = (-μ / 2.0) * ((ℋ₀ + ℋᵣ(N)) ⋅ (ℋ₀ + ℋᵣ(N))) * (1 + χe)
∂Ψmm_∂φ(ℋ₀, N) = (-μ) * (ℋ₀ + ℋᵣ(N)) * (1 + χe)
∂Ψmm_∂φφ(ℋ₀, N) = (-μ) * I3 * (1 + χe)
∂Ψmm_∂φφ(ℋ₀, N) = (-μ) * Id(N) * (1 + χe)
return (Ψmm, ∂Ψmm_∂φ, ∂Ψmm_∂φφ)
end

Expand Down
2 changes: 1 addition & 1 deletion src/TensorAlgebra/Operations.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


function (*)(Ten1::TensorValue, Ten2::VectorValue)
return (⋅)(Ten1, Ten2)
Expand Down
2 changes: 2 additions & 0 deletions src/TensorAlgebra/TensorAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export I3
export I9
export I2
export I4
export Id

export logreg
export Tensorize
export δᵢⱼδₖₗ2D
Expand Down
14 changes: 14 additions & 0 deletions src/TensorAlgebra/TensorsDefinitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ Identity fourth-order tensor 3D
const I9 = I_(9)



function Id(A::VectorValue{2, Float64})
return I2
end

function Id(A::VectorValue{3, Float64})
return I3
end

function Id(A::VectorValue{4, Float64})
return I4
end


# =====================
# Delta Kronecker
# =====================
Expand Down
25 changes: 24 additions & 1 deletion test/TestConstitutiveModels/PhysicalModelTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ end
end


@testset "Magnetic" begin
@testset "Magnetic3D" begin
∇φ = VectorValue(1.0, 2.0, 3.0)
a=40e-3
ra=Ref(a)
Expand All @@ -529,6 +529,29 @@ end



@testset "Magnetic2D" begin
∇φ = VectorValue(1.0, 2.0)
a=40e-3
ra=Ref(a)
modelID = Magnetic(μ=1.2566e-6, αr=ra ,χe=0.0)
Ψ, ∂Ψφ, ∂Ψφφ = modelID()
H0 = get_Kinematics(modelID.Kinematic)
N = VectorValue(0.0, 0.0)

# ∂Ψφ_(H) =VectorValue(ForwardDiff.gradient(x -> Ψ( x,get_array(N) ), get_array(H)))
# ∂Ψφφ_(H) =TensorValue(ForwardDiff.jacobian(x -> ∂Ψφ( x,get_array(N) ), get_array(H)))

# norm(∂Ψφ_(H0(∇φ))) - norm(∂Ψφ( H0(∇φ), N))
# norm(∂Ψφφ_(H0(∇φ))) -norm(∂Ψφφ(H0(∇φ), N))

@test Ψ(H0(∇φ),N) == -3.1415e-6
@test norm(∂Ψφ(H0(∇φ),N)) == 2.8098430205262357e-6
@test norm(∂Ψφφ(H0(∇φ),N)) == 2.1764950447910513e-6
end




@testset "IdealMagnetic_SoftMaterial2D" begin

∇u = TensorValue(1.0, 2.0, 3.0, 4.0) * 1e-3
Expand Down
Loading