Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance boost to ViscosityPartialMelt_Costa_etal_2009 #203

Merged
merged 1 commit into from
Jun 24, 2024
Merged
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
22 changes: 10 additions & 12 deletions src/CreepLaw/MeltViscosity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,16 @@ end

# viscosity correction; where c_vf=crystal volume fraction and strain_rate is the strainrate in s^-1
function viscosity_correction(c_vf, Strain_Rate)
strain_rate = Strain_Rate
if strain_rate < eps(Float64)
strain_rate = 1.e-6
end
phi_max = 0.066499 * tanh(0.913424 * log10(strain_rate) + 3.850623) + 0.591806
delta = -6.301095 * tanh(0.818496 * log10(strain_rate) + 2.86) + 7.462405
alpha = -0.000378 * tanh(1.148101 * log10(strain_rate) + 3.92) + 0.999572
gamma = 3.987815 * tanh(0.8908 * log10(strain_rate) + 3.24) + 5.099645
num = 1.0 + (c_vf / phi_max)^delta
x = √(π) * c_vf / (2 * alpha * phi_max) * (1.0 + (c_vf / phi_max)^gamma)
den = (1.0 - alpha * erf(x))^(2.5 * phi_max)
mu_r = num / den
strain_rate = Strain_Rate + (Strain_Rate < eps(Float64)) * 1e-6
θ = log10(strain_rate)
ϕ_max = 0.066499 * tanh(0.913424 * θ + 3.850623) + 0.591806
δ = -6.301095 * tanh(0.818496 * θ + 2.86) + 7.462405
α = -0.000378 * tanh(1.148101 * θ + 3.92) + 0.999572
γ = 3.987815 * tanh(0.8908 * θ + 3.24) + 5.099645
num = 1 + (c_vf / ϕ_max)^δ
x = √π * c_vf / (2 * α * ϕ_max) * (1 + (c_vf / ϕ_max)^γ)
den = (1 - α * erf(x))^(2.5 * ϕ_max)
mu_r = num / den
return mu_r
end

Expand Down
Loading