From 74972a2bc7cbdb54117d9401703e4357f33f6954 Mon Sep 17 00:00:00 2001 From: Albert de Montserrat <58044444+albert-de-montserrat@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:55:15 +0200 Subject: [PATCH] Bugfix in `get_Kb` (#219) * bugfix in get_Kb * fix traits test --- src/GeoParams.jl | 8 ++------ test/test_Traits.jl | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/GeoParams.jl b/src/GeoParams.jl index 520f91e7..dea42709 100644 --- a/src/GeoParams.jl +++ b/src/GeoParams.jl @@ -444,15 +444,11 @@ for modulus in (:G, :Kb) @inline $(fun)(::ElasticRheologyTrait, c::CompositeRheology) = mapreduce(x->$(fun)(x), +, c.elements) @inline $(fun)(r::AbstractMaterialParamsStruct) = $(fun)(r.CompositeRheology[1]) @inline $(fun)(a::NTuple{N, AbstractMaterialParamsStruct}, phase) where N = nphase($(fun), phase, a) + @inline $(fun)(::NonElasticRheologyTrait, c::CompositeRheology) = 0 + @inline $(fun)(::Union{NonElasticRheologyTrait, AbstractCreepLaw, AbstractPlasticity, AbstractConstitutiveLaw}) = 0 end end -@inline get_G(::NonElasticRheologyTrait, c::CompositeRheology) = 0 -@inline get_G(::Union{NonElasticRheologyTrait, AbstractCreepLaw, AbstractPlasticity, AbstractConstitutiveLaw}) = 0 - -@inline get_Kb(::NonElasticRheologyTrait, c::CompositeRheology) = Inf -@inline get_Kb(::Union{NonElasticRheologyTrait, AbstractCreepLaw, AbstractPlasticity, AbstractConstitutiveLaw}) = Inf - export get_G, get_Kb const get_shearmodulus = get_G diff --git a/test/test_Traits.jl b/test/test_Traits.jl index a2e3dc72..9098d419 100644 --- a/test/test_Traits.jl +++ b/test/test_Traits.jl @@ -66,7 +66,7 @@ using Test, GeoParams # test get_G and get_Kb r = CompositeRheology(v1, v2, v3) @test GeoParams.get_G(isviscoelastic(r), r) == 0 - @test GeoParams.get_Kb(isviscoelastic(r), r) == Inf + @test GeoParams.get_Kb(isviscoelastic(r), r) == 0 ## linear rheology traits # test basic cases