Skip to content

Commit

Permalink
fix sher hesting kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-de-montserrat committed Dec 17, 2023
1 parent 98cf4bf commit d02955d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/thermal_diffusion/Shearheating.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
@parallel_indices (I...) function compute_SH!(
H, τ, τII, τ_old, τII_old, ε, phase_ratios, rheology, dt
)
SH, τ::NTuple{N, T}, τ_old::NTuple{N, T}, ε::NTuple{N, T}, rheology, dt
) where {N, T}
_Gdt = inv(fn_ratio(get_G, rheology) * dt)
τij, τij_o, εij = JustRelax.cache_tensors(τ, τ_old, ε, I...)
εij_el = @. 0.5 * ((τij - τij_o) * _Gdt)
SH[I...] = compute_shearheating(rheology, τij, εij, εij_el)
return nothing
end

@parallel_indices (I...) function compute_SH!(
SH, τ::NTuple{N, T}, τ_old::NTuple{N, T}, ε::NTuple{N, T}, phase_ratios::CellArray, rheology, dt
) where {N, T}
phase = @inbounds phase_ratios[I...]
_Gdt = inv(fn_ratio(get_G, rheology, phase) * dt)
τij, τij_o, εij = JustRelax.cache_tensors(τ, τ_old, ε, I...)
τII[I...] = τII_ij = second_invariant(τij...)
τII_old[I...] = τII_ij_old = second_invariant(τij_o...)

εij_el = 0.5 * ((τII_ij - τII_ij_old) * _Gdt)
H[I...] = H_s = compute_shearheating(rheology, phase, τij, εij, εij_el)
εij_el = @. 0.5 * ((τij - τij_o) * _Gdt)
SH[I...] = compute_shearheating(rheology, phase, τij, εij, εij_el)
return nothing
end
end

0 comments on commit d02955d

Please sign in to comment.