Skip to content

Commit 99beec9

Browse files
Add a function to calculate a thermal diffusivity
1 parent e9b89a8 commit 99beec9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/heat_conduction.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ function forward_euler!(stpm::SingleTPM, Δt)
8585
Cₚ = stpm.thermo_params.heat_capacity[i_face]
8686
Δz = stpm.thermo_params.Δz
8787

88-
λ = k * Δt /* Cₚ * Δz^2)
88+
α = thermal_diffusivity(k, ρ, Cₚ) # Thermal diffusivity [m²/s]
89+
λ = α * Δt / Δz^2
8990
λ 0.5 && error("The forward Euler method is unstable because λ = . This should be less than 0.5.")
9091

9192
for i_depth in 2:(n_depth-1)

src/thermo_params.jl

+14
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ thermal_skin_depth(P, k, ρ, Cₚ) = @. √(4π * P * k / (ρ * Cₚ))
3333
thermal_inertia(k, ρ, Cₚ) = @. (k * ρ * Cₚ)
3434

3535

36+
"""
37+
thermal_diffusivity(k, ρ, Cp) -> α
38+
39+
# Arguments
40+
- `k` : Thermal conductivity [W/m/K]
41+
- `ρ` : Material density [kg/m³]
42+
- `Cₚ` : Heat capacity [J/kg/K]
43+
44+
# Return
45+
- `α` : Thermal diffusivity [m²/s]
46+
"""
47+
thermal_diffusivity(k, ρ, Cₚ) = @. k /* Cₚ)
48+
49+
3650
# ****************************************************************
3751
# Struct for thermophysical parameters
3852
# ****************************************************************

0 commit comments

Comments
 (0)