Skip to content

Commit

Permalink
Rename stencil in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
zjwegert committed Apr 10, 2024
1 parent 46232b5 commit ae39c6c
Show file tree
Hide file tree
Showing 51 changed files with 116 additions and 116 deletions.
4 changes: 2 additions & 2 deletions compile/warmup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function main(mesh_partition,distribute)
dJ = (q,u,φ,dΩ,dΓ_N) -> ((ξ-D*(u)(u))*q*(DH φ)*(norm (φ)))dΩ;

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,Δ./order,max_steps,tol)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,Δ./order,max_steps,tol)
reinit!(stencil,φ,γ_reinit)

## Setup solver and FE operators
Expand All @@ -84,7 +84,7 @@ function main(mesh_partition,distribute)

## Optimiser
_conv_cond = t->LevelSetTopOpt.conv_cond(t;coef=1/50);
optimiser = AugmentedLagrangian(φ,pcfs,stencil,vel_ext,interp,el_size,γ,γ_reinit,conv_criterion=_conv_cond);
optimiser = AugmentedLagrangian(φ,pcfs,ls_evo,vel_ext,interp,el_size,γ,γ_reinit,conv_criterion=_conv_cond);
for history in optimiser
it,Ji,_,_ = last(history)
print_history(it,["J"=>Ji];ranks=ranks)
Expand Down
26 changes: 13 additions & 13 deletions docs/src/tutorials/minimum_thermal_compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Both of these equations can be solved numerically on a Cartesian mesh using a fi
```julia
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
```

In the above we first build an object [`FirstOrderStencil`](@ref) that represents a finite difference stencil for a single step of the Hamilton-Jacobi evolution equation and reinitialisation equation. We use `length(el_size)` to indicate the dimension of the problem. We then create an [`HamiltonJacobiEvolution`](@ref) which enables finite differencing on order `O` finite elements in serial or parallel. The [`HamiltonJacobiEvolution`](@ref) object provides two important methods [`evolve!`](@ref) and [`reinit!`](@ref) that correspond to solving the Hamilton-Jacobi evolution equation and reinitialisation equation, respectively.
Expand All @@ -357,7 +357,7 @@ We may now create the optimiser object. This structure holds all information reg

```julia
# Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
```

As optimisers inheriting from [`LevelSetTopOpt.Optimiser`](@ref) implement Julia's iterator functionality, we can solve the optimisation problem to convergence by iterating over the optimiser:
Expand Down Expand Up @@ -461,9 +461,9 @@ a_hilb(p,q) =∫(α^2*∇(p)⋅∇(q) + p*q)dΩ
vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
# Solve
for (it,uh,φh) in optimiser
data = ["phi"=>φh,"H(phi)"=>(H φh),"|nabla(phi)|"=>(norm (φh)),"uh"=>uh]
Expand Down Expand Up @@ -604,9 +604,9 @@ a_hilb(p,q) =∫(α^2*∇(p)⋅∇(q) + p*q)dΩ
vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
# Solve
for (it,uh,φh) in optimiser
data = ["phi"=>φh,"H(phi)"=>(H φh),"|nabla(phi)|"=>(norm (φh)),"uh"=>uh]
Expand Down Expand Up @@ -754,9 +754,9 @@ function main()
)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
# Solve
for (it,uh,φh) in optimiser
data = ["phi"=>φh,"H(phi)"=>(H φh),"|nabla(phi)|"=>(norm (φh)),"uh"=>uh]
Expand Down Expand Up @@ -827,7 +827,7 @@ We then adjust lines 28-31 as follows:
The function `i_am_main` returns true only on the first processor. This function is useful for ensuring certain operations only happen once instead of several times across each executable. In addition, we now create a partitioned Cartesian model using `CartesianDiscreteModel(ranks,mesh_partition,dom,el_size)`. Finally, we adjust line 82 to ensure that verbosity only happens on the first processors:

```julia
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
```

Expand Down Expand Up @@ -918,9 +918,9 @@ function main(mesh_partition,distribute)
)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
# Solve
for (it,uh,φh) in optimiser
Expand Down Expand Up @@ -1070,9 +1070,9 @@ a_hilb(p,q) =∫(α^2*∇(p)⋅∇(q) + p*q)dΩ
vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose=true,constraint_names=[:Vol])
# Solve
for (it,uh,φh) in optimiser
data = ["phi"=>φh,"H(phi)"=>(H φh),"|nabla(phi)|"=>(norm (φh)),"uh"=>uh]
Expand Down
16 changes: 8 additions & 8 deletions scripts/Benchmarks/benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ function nl_elast(mesh_partition,ranks,el_size,order,verbose)
)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
return AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose)
return AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose)
end

function therm(mesh_partition,ranks,el_size,order,verbose)
Expand Down Expand Up @@ -180,9 +180,9 @@ function therm(mesh_partition,ranks,el_size,order,verbose)
)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
return AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose)
return AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose)
end

function elast(mesh_partition,ranks,el_size,order,verbose)
Expand Down Expand Up @@ -256,9 +256,9 @@ function elast(mesh_partition,ranks,el_size,order,verbose)
)
# Finite difference scheme
scheme = FirstOrderStencil(length(el_size),Float64)
stencil = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(scheme,model,V_φ,tol,max_steps)
# Optimiser
return AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose)
return AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose)
end

function inverter_HPM(mesh_partition,ranks,el_size,order,verbose)
Expand Down Expand Up @@ -329,7 +329,7 @@ function inverter_HPM(mesh_partition,ranks,el_size,order,verbose)
UΓ_out(u,φ,dΩ,dΓ_in,dΓ_out) = ((u⋅-e₁-δₓ)/vol_Γ_out)dΓ_out

## Finite difference solver
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -355,7 +355,7 @@ function inverter_HPM(mesh_partition,ranks,el_size,order,verbose)
)

## Optimiser
return HilbertianProjection(pcfs,stencil,vel_ext,φh;γ,γ_reinit,verbose=verbose)
return HilbertianProjection(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,verbose=verbose)
end

with_mpi() do distribute
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_elastic_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -107,7 +107,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_hyperelastic_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -110,7 +110,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_hyperelastic_compliance_neohook_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -124,7 +124,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_inverse_homenisation_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -111,7 +111,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh))]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_inverter_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function main(mesh_partition,distribute,el_size)
UΓ_out(u,φ,dΩ,dΓ_in,dΓ_out) = ((u⋅-e₁-δₓ)/vol_Γ_out)dΓ_out

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -125,7 +125,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol,:UΓ_out])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_inverter_HPM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function main(mesh_partition,distribute,el_size)
UΓ_out(u,φ,dΩ,dΓ_in,dΓ_out) = ((u⋅-e₁-δₓ)/vol_Γ_out)dΓ_out

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -126,7 +126,7 @@ function main(mesh_partition,distribute,el_size)

## Optimiser
ls_enabled=false # Setting to true will use a line search instead of oscillation detection
optimiser = HilbertianProjection(pcfs,stencil,vel_ext,φh;γ,γ_reinit,ls_enabled,α_min=0.7,
optimiser = HilbertianProjection(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,ls_enabled,α_min=0.7,
ls_γ_max=0.05,verbose=i_am_main(ranks),constraint_names=[:Vol,:UΓ_out])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_nonlinear_thermal_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand Down Expand Up @@ -113,7 +113,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/3d_thermal_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(3,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -107,7 +107,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/elastic_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -98,7 +98,7 @@ function main(mesh_partition,distribute,el_size)
ls=PETScLinearSolver())

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/inverse_homenisation_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -99,7 +99,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh))]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/thermal_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function main(mesh_partition,distribute)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
state_map = AffineFEStateMap(a,l,U,V,V_φ,U_reg,φh,dΩ,dΓ_N)
Expand All @@ -84,7 +84,7 @@ function main(mesh_partition,distribute)
vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,
verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/MPI/thermal_compliance_ALM_PETSc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function main(mesh_partition,distribute,el_size)
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
Expand All @@ -98,7 +98,7 @@ function main(mesh_partition,distribute,el_size)
)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;γ,γ_reinit,
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;γ,γ_reinit,
verbose=i_am_main(ranks),constraint_names=[:Vol])
for (it, uh, φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
4 changes: 2 additions & 2 deletions scripts/Serial/elastic_compliance_ALM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function main()
dVol(q,u,φ,dΩ,dΓ_N) = (-1/vol_D*q*(DH φ)*(norm (φ)))dΩ

## Finite difference solver and level set function
stencil = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)
ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,tol,max_steps)

## Setup solver and FE operators
state_map = AffineFEStateMap(a,l,U,V,V_φ,U_reg,φh,dΩ,dΓ_N)
Expand All @@ -83,7 +83,7 @@ function main()
vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)

## Optimiser
optimiser = AugmentedLagrangian(pcfs,stencil,vel_ext,φh;
optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;
γ,γ_reinit,verbose=true,constraint_names=[:Vol])
for (it,uh,φh) in optimiser
data = ["φ"=>φh,"H(φ)"=>(H φh),"|∇(φ)|"=>(norm (φh)),"uh"=>uh]
Expand Down
Loading

0 comments on commit ae39c6c

Please sign in to comment.