Embedded
This page is still under construction! Please refer to the tutorial for a discussion of functionality.
Non-TET/TRI polytopes are simplexified by GridapEmbedded when cutting. As a result, derivative information from AD will not be correct when using a mesh that isn't made of TRI/TET. Please use a mesh with TRI/TET polytopes to ensure correctness of derivative results.
Isolated volumes
GridapTopOpt.get_isolated_volumes_mask
— Methodget_isolated_volumes_mask(cutgeo::EmbeddedDiscretization,dirichlet_tags)
Given an EmbeddedDiscretization cutgeo
and a list of tags dirichlet_tags
, this function returns a CellField which is 1
on isolated volumes and 0
otherwise.
We define an isolated volume as a volume that is IN but is not constrained by any of the tags in dirichlet_tags
. Specify the In domain using the first entry in groups.
If remove_cuts
is true
, then volumes that only contain CUT cells are also considered isolated.
GridapTopOpt.tag_disconnected_volumes
— Methodfunction tag_disconnected_volumes(
model::DiscreteModel{Dc},
cell_to_state::Vector{<:Integer};
groups = Tuple(unique(cell_to_state))
)
Given a DiscreteModel model
and an initial coloring cell_to_state
, returns another coloring such that each color corresponds to a connected component of the graph of cells that are connected by a face and have their state in the same group.
GridapTopOpt.tag_volume!
— Methodfunction tag_volume!(
cell::Int,color::Int16,group::Union{Integer,NTuple{N,Integer}},
cell_to_nbors::Vector{Vector{Int32}},
cell_to_state::Vector{Int8},
cell_to_color::Vector{Int16},
touched::BitVector
)
Starting from a cell cell
, crawls the cell graph provided by cell_to_nbors
and colors all cells connected to cell
that
- belong to the group
group
(i.e.,cell_to_state[cell] ∈ group
), and - have not been seen yet (i.e.,
!touched[cell]
).
This is done by using a breadth-first search algorithm.
GridapTopOpt.get_isolated_volumes_mask_polytopal
— Methodget_isolated_volumes_mask_polytopal(model::DiscreteModel,cell_values,dirichlet_tags)
Given a DiscreteModel model
, the cell values of the level set function cell_values
, and a list of tags dirichlet_tags
, this function returns two cell fields:
cf_IN
: a CellField which is1
on isolated volumes of the IN domain and0
otherwise.cf_OUT
: a CellField which is1
on isolated volumes of the OUT domain and0
otherwise.
EmbeddedCollection
and EmbeddedPDEConstrainedFunctionals
GridapTopOpt.EmbeddedCollection
— Typestruct EmbeddedCollection
recipes :: Vector{<:Function}
objects :: Dict{Symbol,Any}
bgmodel :: DiscreteModel
end
A collection of embedded objects on the same background model. This structure provides a way to update all the stored objects at once.
Constructor
EmbeddedCollection(recipes::Union{<:Function,Vector{<:Function}},bgmodel::DiscreteModel[,φh])
If provided, φh
will be used to compute the initial collection of objects. If not provided, the collection will remain empty until update_collection!
is called.
API:
update_collection!(c::EmbeddedCollection,φh)
: Update the collection of objects using the level set functionφh
.add_recipe!(c::EmbeddedCollection,r::Function[,φh])
: Add a recipe to the collection. Update the collection ifφh
is provided.
We implement special structures that update the state map etc. on the fly using EmbeddedPDEConstrainedFunctionals
:
GridapTopOpt.EmbeddedCollection_in_φh
— FunctionEmbeddedCollection_in_φh(recipes::Union{<:Function,Vector{<:Function}},bgmodel,φ0)
Returns an EmbeddedCollection
whoose recipes are only updated using the parameter φ0
. This is useful for problems where the recipes are not computed using the cut geometry information.
GridapTopOpt.EmbeddedPDEConstrainedFunctionals
— Typestruct EmbeddedPDEConstrainedFunctionals{N,T} <: AbstractPDEConstrainedFunctionals{N}
A version of PDEConstrainedFunctionals
that has an embedded_collection
to allow the state_map
to be updated given new FE spaces for the forward problem. This is currently required for unfitted methods.
GridapTopOpt.evaluate_functionals!
— Methodevaluate_functionals!(pcf::EmbeddedPDEConstrainedFunctionals,φh;update_space::Bool=true)
Evaluate the objective and constraints at φh
.
GridapTopOpt.evaluate_derivatives!
— Methodevaluate_derivatives!(pcf::EmbeddedPDEConstrainedFunctionals,φh;update_space::Bool=true)
Evaluate the derivatives of the objective and constraints at φh
.
Gridap.Arrays.evaluate!
— MethodFields.evaluate!(pcf::EmbeddedPDEConstrainedFunctionals,φh;update_space::Bool=true)
Evaluate the objective and constraints, and their derivatives at φh
.
Automatic shape differentiation
Automatic shape differentiation has been moved to GridapEmbedded.