Skip to content

Commit

Permalink
add get_α for new GP density functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aelligp committed Jan 3, 2025
1 parent 32554ae commit dcc8100
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/JustRelax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ using Statistics
function solve!() end
#! format: off
function __init__()
println("""
printstyled("""
_ _ ____ _ _ _
| |_ _ ___| |_| _ \\ ___| | __ ___ __ (_) |
_ | | | | / __| __| |_) / _ \\ |/ _` \\ \\/ / | | |
| |_| | |_| \\__ \\ |_| _ < __/ | (_| |> < _ | | |
\\___/ \\__,_|___/\\__|_| \\_\\___|_|\\__,_/_/\\_(_)/ |_|
|__/
""")
""", bold=true, color=:white)
end
#! format: on
abstract type AbstractBackend end
Expand Down
28 changes: 28 additions & 0 deletions src/rheology/GeoParams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,38 @@ function get_α(rho::MeltDependent_Density; ϕ::T=0.0, kwargs...) where {T}
return ϕ * αmelt + (1 - ϕ) * αsolid
end


function get_α(rho::BubbleFlow_Density; P = 0e0, kwargs...)
αmelt = get_α(rho.ρmelt, kwargs...)
αgas = get_α(rho.ρgas, kwargs...)

@unpack_val c0, a = rho

cutoff = c0^2/a^2

if P < cutoff
c = a * sqrt(abs(P))
else
c = c0
end

return inv((c0-c)/αgas + (1-(c0-c))/αmelt)
end

function get_α(rho::GasPyroclast_Density; kwargs...)
αmelt = get_α(rho.ρmelt, kwargs...)
αgas = get_α(rho.ρgas, kwargs...)
@unpack_val δ, β = rho

return δ * αgas + (1 - δ) * αmelt
end

@inline get_α(p::MaterialParams) = get_α(p.Density[1])
@inline get_α(p::MaterialParams, args::NamedTuple) = get_α(p.Density[1], args)
@inline get_α(p::Union{T_Density,PT_Density}) = GeoParams.get_α(p)
@inline get_α(p::Union{T_Density,PT_Density}, ::Any) = GeoParams.get_α(p)
@inline get_α(rho::MeltDependent_Density, ::Any) = get_α(rho)
@inline get_α(rho::BubbleFlow_Density, ::Any) = get_α(rho)
@inline get_α(rho::GasPyroclast_Density, ::Any) = get_α(rho)
@inline get_α(rho::ConstantDensity, args) = 0
@inline get_α(rho::ConstantDensity) = 0
2 changes: 0 additions & 2 deletions test/test/Project.toml

This file was deleted.

0 comments on commit dcc8100

Please sign in to comment.