Embedded

Warning

This page is still under construction! Please refer to the tutorial for a discussion of functionality.

Warning

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_maskMethod
get_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.

source
GridapTopOpt.tag_disconnected_volumesMethod
function 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.

source
GridapTopOpt.tag_volume!Method
function 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.

source
GridapTopOpt.get_isolated_volumes_mask_polytopalMethod
get_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 is 1 on isolated volumes of the IN domain and 0 otherwise.
  • cf_OUT: a CellField which is 1 on isolated volumes of the OUT domain and 0 otherwise.
source

EmbeddedCollection and EmbeddedPDEConstrainedFunctionals

GridapTopOpt.EmbeddedCollectionType
struct 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.
source

We implement special structures that update the state map etc. on the fly using EmbeddedPDEConstrainedFunctionals:

GridapTopOpt.EmbeddedCollection_in_φhFunction
EmbeddedCollection_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.

source
GridapTopOpt.EmbeddedPDEConstrainedFunctionalsType
struct 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.

source
GridapTopOpt.evaluate_functionals!Method
evaluate_functionals!(pcf::EmbeddedPDEConstrainedFunctionals,φh;update_space::Bool=true)

Evaluate the objective and constraints at φh.

Warning

Taking update_space = false will NOT update the underlying finite element spaces and assemblers that depend on φh. This should only be used when you are certain that φh has not been updated.

source
GridapTopOpt.evaluate_derivatives!Method
evaluate_derivatives!(pcf::EmbeddedPDEConstrainedFunctionals,φh;update_space::Bool=true)

Evaluate the derivatives of the objective and constraints at φh.

Warning

Taking update_space = false will NOT update the underlying finite element spaces and assemblers that depend on φh. This should only be used when you are certain that φh has not been updated.

source
Gridap.Arrays.evaluate!Method
Fields.evaluate!(pcf::EmbeddedPDEConstrainedFunctionals,φh;update_space::Bool=true)

Evaluate the objective and constraints, and their derivatives at φh.

Warning

Taking update_space = false will NOT update the underlying finite element spaces and assemblers that depend on φh. This should only be used when you are certain that φh has not been updated.

source

Automatic shape differentiation

Automatic shape differentiation has been moved to GridapEmbedded.