Skip to content

Commit

Permalink
Add field forcings
Browse files Browse the repository at this point in the history
  • Loading branch information
utkinis committed Nov 22, 2023
1 parent 2a13c19 commit b7df5e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Models/full_stokes/isothermal/isothermal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function advance_iteration!(model::IsothermalFullStokesModel, t, Δt; async=true
launch!(model.arch, model.grid, update_σ! => (Pr, τ, V, η, Δτ, Δ);
location=Center(), expand=1, boundary_conditions=model.boundary_conditions.stress, hide_boundaries, outer_width)

launch!(model.arch, model.grid, update_V! => (V, Pr, τ, η, Δτ, ρg, model.grid, Δ);
launch!(model.arch, model.grid, update_V! => (V, Pr, τ, η, ρg, Δτ, model.grid, Δ);
location=Vertex(), boundary_conditions=model.boundary_conditions.velocity, hide_boundaries, outer_width)

# rheology
Expand Down
14 changes: 7 additions & 7 deletions src/Models/full_stokes/isothermal/kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ end
end
end

@kernel function update_V!(V, Pr, τ, η, Δτ, ρg, grid, Δ, offset=nothing)
@kernel function update_V!(V, Pr, τ, η, ρg, Δτ, grid, Δ, offset=nothing)
I = @index(Global, Cartesian)
isnothing(offset) || (I += offset)
@inbounds if within(grid, V.x, I)
∂σxx_∂x = (-∂ᵛx(Pr, I) + ∂ᵛx.xx, I)) / Δ.x
∂τxy_∂y = ∂ᶜy.xy, I) / Δ.y
∂τxz_∂z = ∂ᶜz.xz, I) / Δ.z
V.x[I] += (∂σxx_∂x + ∂τxy_∂y + ∂τxz_∂z - ρg.x) / maxlᵛx(η, I) * Δτ.V.x
V.x[I] += (∂σxx_∂x + ∂τxy_∂y + ∂τxz_∂z - ρg.x[I]) / maxlᵛx(η, I) * Δτ.V.x
end
@inbounds if within(grid, V.y, I)
∂σyy_∂y = (-∂ᵛy(Pr, I) + ∂ᵛy.yy, I)) / Δ.y
∂τxy_∂x = ∂ᶜx.xy, I) / Δ.x
∂τyz_∂z = ∂ᶜz.yz, I) / Δ.z
V.y[I] += (∂σyy_∂y + ∂τxy_∂x + ∂τyz_∂z - ρg.y) / maxlᵛy(η, I) * Δτ.V.y
V.y[I] += (∂σyy_∂y + ∂τxy_∂x + ∂τyz_∂z - ρg.y[I]) / maxlᵛy(η, I) * Δτ.V.y
end
@inbounds if within(grid, V.z, I)
∂σzz_∂z = (-∂ᵛz(Pr, I) + ∂ᵛz.zz, I)) / Δ.z
∂τxz_∂x = ∂ᶜx.xz, I) / Δ.x
∂τyz_∂y = ∂ᶜy.yz, I) / Δ.y
V.z[I] += (∂σzz_∂z + ∂τxz_∂x + ∂τyz_∂y - ρg.z) / maxlᵛz(η, I) * Δτ.V.z
V.z[I] += (∂σzz_∂z + ∂τxz_∂x + ∂τyz_∂y - ρg.z[I]) / maxlᵛz(η, I) * Δτ.V.z
end
end

Expand Down Expand Up @@ -114,18 +114,18 @@ end
∂σxx_∂x = (-∂ᵛx(Pr, I) + ∂ᵛx.xx, I)) / Δ.x
∂τxy_∂y = ∂ᶜy.xy, I) / Δ.y
∂τxz_∂z = ∂ᶜz.xz, I) / Δ.z
r_V.x[I] = ∂σxx_∂x + ∂τxy_∂y + ∂τxz_∂z - ρg.x
r_V.x[I] = ∂σxx_∂x + ∂τxy_∂y + ∂τxz_∂z - ρg.x[I]
end
@inbounds if within(grid, r_V.y, I)
∂σyy_∂y = (-∂ᵛy(Pr, I) + ∂ᵛy.yy, I)) / Δ.y
∂τxy_∂x = ∂ᶜx.xy, I) / Δ.x
∂τyz_∂z = ∂ᶜz.yz, I) / Δ.z
r_V.y[I] = ∂σyy_∂y + ∂τxy_∂x + ∂τyz_∂z - ρg.y
r_V.y[I] = ∂σyy_∂y + ∂τxy_∂x + ∂τyz_∂z - ρg.y[I]
end
@inbounds if within(grid, r_V.z, I)
∂σzz_∂z = (-∂ᵛz(Pr, I) + ∂ᵛz.zz, I)) / Δ.z
∂τxz_∂x = ∂ᶜx.xz, I) / Δ.x
∂τyz_∂y = ∂ᶜy.yz, I) / Δ.y
r_V.z[I] = ∂σzz_∂z + ∂τxz_∂x + ∂τyz_∂y - ρg.z
r_V.z[I] = ∂σzz_∂z + ∂τxz_∂x + ∂τyz_∂y - ρg.z[I]
end
end

0 comments on commit b7df5e8

Please sign in to comment.