Skip to content

Commit

Permalink
add visc and buoyancy calculations inside the solver
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-de-montserrat committed May 3, 2024
1 parent b286112 commit ae5b77f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/stokes/Stokes2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ function _solve!(
θ = @zeros(ni...)
Vx_on_Vy = @zeros(size(stokes.V.Vy))

# compute buoyancy forces and viscosity
compute_ρg!(ρg[end], phase_ratios, rheology, args)
compute_viscosity!(stokes, phase_ratios, args, rheology, cutoff_visc)

while iter < 2 || (err > ϵ && iter iterMax)
wtime0 += @elapsed begin
@parallel (@idx ni) compute_∇V!(stokes.∇V, @velocity(stokes)..., _di...)
Expand Down Expand Up @@ -502,6 +506,10 @@ function _solve!(
end
Vx_on_Vy = @zeros(size(stokes.V.Vy))

# compute buoyancy forces and viscosity
compute_ρg!(ρg[end], phase_ratios, rheology, args)
compute_viscosity!(stokes, phase_ratios, args, rheology, cutoff_visc)

while iter iterMax
iterMin < iter && err < ϵ && break

Expand Down
8 changes: 8 additions & 0 deletions src/stokes/Stokes3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ function _solve!(
λ = @zeros(ni...)
θ = @zeros(ni...)

# compute buoyancy forces and viscosity
compute_ρg!(ρg[end], phase_ratios, rheology, args)
compute_viscosity!(stokes, phase_ratios, args, rheology, cutoff_visc)

# solver loop
wtime0 = 0.0
while iter < 2 || (err > ϵ && iter iterMax)
Expand Down Expand Up @@ -382,6 +386,10 @@ function _solve!(
wtime0 = 0.0
ητ = deepcopy(η)

# compute buoyancy forces and viscosity
compute_ρg!(ρg[end], phase_ratios, rheology, args)
compute_viscosity!(stokes, phase_ratios, args, rheology, cutoff_visc)

while iter < 2 || (err > ϵ && iter iterMax)
wtime0 += @elapsed begin
# ~preconditioner
Expand Down

0 comments on commit ae5b77f

Please sign in to comment.