From b01c9848a0841670a2653285c16319c3081b38c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Mart=C3=ADnez?= Date: Wed, 12 Nov 2025 15:07:20 +0100 Subject: [PATCH] =?UTF-8?q?Updates=20Magnetic=20model=20=CE=B1r=20paramete?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes the Magnetic model to directly accept a Float64 value for `αr` instead of a `Ref{Float64}`. This simplifies the instantiation of the `Magnetic` struct and improves usability by removing the need to create a `Ref` object before passing the `αr` value. --- src/PhysicalModels/MagneticModels.jl | 4 ++-- test/TestConstitutiveModels/PhysicalModelTests.jl | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/PhysicalModels/MagneticModels.jl b/src/PhysicalModels/MagneticModels.jl index e60c328..78e7f2f 100644 --- a/src/PhysicalModels/MagneticModels.jl +++ b/src/PhysicalModels/MagneticModels.jl @@ -9,8 +9,8 @@ struct Magnetic <: Magneto αr::Ref{Float64} χe::Float64 -function Magnetic(; μ0::Float64, αr::Ref{Float64}, χe::Float64=0.0) - new(μ0, αr, χe) +function Magnetic(; μ0::Float64, αr::Float64, χe::Float64=0.0) + new(μ0, Ref(αr), χe) end function (obj::Magnetic)(Λ::Float64=1.0) μ, αr, χe = obj.μ, obj.αr, obj.χe diff --git a/test/TestConstitutiveModels/PhysicalModelTests.jl b/test/TestConstitutiveModels/PhysicalModelTests.jl index eab5106..dea916f 100644 --- a/test/TestConstitutiveModels/PhysicalModelTests.jl +++ b/test/TestConstitutiveModels/PhysicalModelTests.jl @@ -666,8 +666,7 @@ end @testset "Magnetic3D" begin ∇φ = VectorValue(1.0, 2.0, 3.0) a=40e-3 - ra=Ref(a) - modelID = Magnetic(μ0=1.2566e-6, αr=ra ,χe=0.0) + modelID = Magnetic(μ0=1.2566e-6, αr=a ,χe=0.0) Ψ, ∂Ψφ, ∂Ψφφ = modelID() Km=Kinematics(Magneto,Solid) @@ -690,8 +689,7 @@ end @testset "Magnetic2D" begin ∇φ = VectorValue(1.0, 2.0) a=40e-3 - ra=Ref(a) - modelID = Magnetic(μ0=1.2566e-6, αr=ra ,χe=0.0) + modelID = Magnetic(μ0=1.2566e-6, αr=a ,χe=0.0) Ψ, ∂Ψφ, ∂Ψφφ = modelID() Km=Kinematics(Magneto,Solid)