GridapROMs.TProduct

GridapROMs.TProductModule
module TProduct

Infrastructure for tensor product finite element spaces and operators on Cartesian meshes. The key idea is that a D-dimensional Cartesian domain $[a_1,b_1] \times \cdots \times [a_D,b_D]$ can be discretised as the tensor product of D 1D meshes, allowing bilinear forms to be assembled as rank tensors of 1D matrices rather than full D-dimensional sparse matrices.

Geometry

FE spaces

  • TensorProductReferenceFE: a ReferenceFE that carries the 1D factor reffes and triggers TProductFESpace construction via the standard FESpace(model,reffe;kwargs...) interface.
  • TProductFESpace: wraps an OrderedFESpace and D 1D OrderedFESpaces.

Cell data

Rank tensors

Assembly

source
GridapROMs.TProduct.GenericRankTensorType
struct GenericRankTensor{D,K,A<:AbstractArray} <: AbstractRankTensor{D,K}
  decompositions::Vector{Rank1Tensor{D,A}}
end

Structure representing a generic rank-K tensor, i.e. assuming the form

$a = \sum\limits_{k=1}^K a_1^k \otimes \cdots \otimes a_D^k$

source
GridapROMs.TProduct.GenericTProductDiffCellFieldType
struct GenericTProductDiffCellField{O,A,B,C} <: TProductDiffCellField
  op::O
  cell_data::A
  diff_cell_data::B
  summation::C
end

A differentiated TProductCellField. Stores the original field cell_data, its differentiated counterpart diff_cell_data (e.g. the gradient of each 1D factor), the differentiation operator op, and an optional summation cache used during multi-field or mixed block assembly.

The type alias GradientTProductCellField is provided for the op = gradient case.

source
GridapROMs.TProduct.Rank1TensorType
struct Rank1Tensor{D,A<:AbstractArray} <: AbstractRankTensor{D,1}
  factors::Vector{A}
end

Structure representing rank-1 tensors, i.e. assuming the form

$a = a_1 \otimes \cdots \otimes a_D$

source
GridapROMs.TProduct.TProductDiscreteModelType
struct TProductDiscreteModel{D,A,B} <: DiscreteModel{D,D}
  model::A
  models_1d::B
end

A D-dimensional CartesianDiscreteModel together with D 1D CartesianDiscreteModels whose Cartesian product reproduces it.

Use TProductTriangulation and TProductMeasure to build the corresponding integration objects, and TProductFESpace (or the TensorProductReferenceFE interface) to build the FE space.

Construction

TProductDiscreteModel(args...; kwargs...)

Accepts the same arguments as CartesianDiscreteModel: a domain tuple and a partition tuple. The 1D components are split automatically from the D-dimensional CartesianDescriptor.

Example

model = TProductDiscreteModel((0,1,0,1),(10,10))  # 10×10 Cartesian mesh on [0,1]²
source
GridapROMs.TProduct.TProductFESpaceType
struct TProductFESpace{S} <: SingleFieldFESpace
  space::S
  spaces_1d::Vector{<:SingleFieldFESpace}
  trian::TProductTriangulation
end

A SingleFieldFESpace on a tensor product mesh, storing the D-dimensional OrderedFESpace space and a vector of D 1D OrderedFESpaces spaces_1d. The TProductTriangulation trian is stored explicitly to ensure compatibility with MultiField scenarios.

All standard SingleFieldFESpace interface methods are delegated to space. The 1D spaces are used exclusively for tensor product assembly via TProductSparseMatrixAssembler and basis extraction via get_tp_fe_basis / get_tp_trial_fe_basis.

The preferred construction path is via TensorProductReferenceFE:

model = TProductDiscreteModel((0,1,0,1),(10,10))
reffe = TensorProductReferenceFE(model,lagrangian,Float64,1)
V = FESpace(model,reffe;conformity=:H1,dirichlet_tags="boundary")

Alternatively, the reffe tuple form is still supported:

Ω  = Triangulation(model)
dΩ = Measure(Ω,2)
V  = FESpace(Ω,(lagrangian,Float64,1);conformity=:H1,dirichlet_tags="boundary")
source
GridapROMs.TProduct.TProductMeasureType
struct TProductMeasure{A,B} <: Measure
  measure::A
  measures_1d::B
end

A Measure whose quadrature is the Cartesian product of D 1D quadratures stored in measures_1d. The full D-dimensional measure measure is also kept for standard Gridap integration.

Integrating a TProductCellField against a TProductMeasure returns a vector of D DomainContributions, one per spatial direction, which are later assembled into a AbstractRankTensor by TProductSparseMatrixAssembler.

Construct via Measure(trian::TProductTriangulation,degree;kwargs...).

source
GridapROMs.TProduct.TProductSparseMatrixAssemblerType
struct TProductSparseMatrixAssembler{A<:SparseMatrixAssembler} <: SparseMatrixAssembler
  assems_1d::Vector{A}
end

A SparseMatrixAssembler for tensor product FE spaces. Wraps D 1D SparseMatrixAssemblers, one per spatial direction.

Assembly operates direction-by-direction: integrating a bilinear form against a TProductMeasure yields a vector of D DomainContributions, and the assembler collects and assembles each into a 1D sparse matrix. The results are combined into an AbstractRankTensor:

  • A Rank1Tensor for forms without derivatives (e.g. mass matrix).
  • A GenericRankTensor for forms involving gradient or PartialDerivative (e.g. stiffness matrix), where the rank equals the spatial dimension D.

Construction

TProductSparseMatrixAssembler(trial::TProductFESpace,test::TProductFESpace)
TProductSparseMatrixAssembler(mat,trial::TProductFESpace,test::TProductFESpace)
TProductSparseMatrixAssembler(mat,vec,trial,test[,strategy])

For multi-field scenarios use TProductBlockSparseMatrixAssembler.

source
GridapROMs.TProduct.TProductTriangulationType
struct TProductTriangulation{Dt,Dp,A,B,C} <: Triangulation{Dt,Dp}
  model::A
  trian::B
  trians_1d::C
end

A Triangulation whose cells are the Cartesian product of D 1D triangulations stored in trians_1d. The full D-dimensional triangulation trian and the background TProductDiscreteModel model are also stored for standard Gridap compatibility.

Construct via Triangulation(model::TProductDiscreteModel) or by wrapping an existing Triangulation with a vector of 1D triangulations.

source
GridapROMs.TProduct.get_1d_tagsMethod
get_1d_tags(model::TProductDiscreteModel,tags) -> Vector{Vector{Int8}}

Fetches the tags of the tensor product 1D models corresponding to the tags of the D-dimensional model tags. The length of the output is D

source
GridapROMs.TProduct.get_arrays_1dMethod
get_arrays_1d(a::GenericRankTensor{D,D}) -> Vector

For a gradient-assembled GenericRankTensor built by tproduct_array(gradient,arrays,grads), recovers the original arrays_1d (mass-like factors) as a vector of length D.

source
GridapROMs.TProduct.get_decompositionMethod
get_decomposition(a::AbstractRankTensor,k::Integer) -> Vector{<:AbstractArray}

For a tensor a of dimension D and rank K assuming the form

$a = \sum\limits_{k=1}^K a_1^k \otimes \cdots \otimes a_D^k$

returns the decomposition relative to the kth rank:

$[a_1^k, \hdots , a_D^k]$

source
GridapROMs.TProduct.get_gradients_1dMethod
get_gradients_1d(a::GenericRankTensor{D,D}) -> Vector

For a gradient-assembled GenericRankTensor built by tproduct_array(gradient,arrays,grads), recovers the original gradients_1d (stiffness-like factors) as a vector of length D.

source
GridapROMs.TProduct.tproduct_arrayMethod
tproduct_array(arrays_1d::Vector{<:AbstractArray}) -> Rank1Tensor
tproduct_array(op,arrays_1d::Vector{<:AbstractArray},gradients_1d::Vector{<:AbstractArray},args...) -> GenericRankTensor

Returns a AbstractRankTensor storing the arrays arrays_1d (usually matrices) arising from an integration routine on D 1-d triangulations whose tensor product gives a D-dimensional triangulation. In the absence of the field gradients_1d, the output is a Rank1Tensor; when provided, the output is a GenericRankTensor

tproduct_array(arrays_1d::Vector{<:BlockArray}) -> BlockRankTensor
tproduct_array(op,arrays_1d::Vector{<:BlockArray},gradients_1d::Vector{<:BlockArray},args...) -> BlockRankTensor

Generalization of the previous functions to multi-field scenarios

source