Skip to content

Commit

Permalink
Bugfix in get_Kb (#219)
Browse files Browse the repository at this point in the history
* bugfix in get_Kb

* fix traits test
  • Loading branch information
albert-de-montserrat authored Sep 13, 2024
1 parent e65b54f commit 74972a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/GeoParams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_Traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 74972a2

Please sign in to comment.