GridapROMs.TProduct
GridapROMs.TProduct — Module
module TProductInfrastructure 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.
FE spaces
TProductFESpace: wraps a (dof-reindexed)spaceand a vector ofD1D (dof-reindexed)spaces_1d, all plain GridapFESpaces.
Rank tensors
Rank1Tensor: $a_1 \otimes \cdots \otimes a_D$.GenericRankTensor: $\sum_{k=1}^K a_1^k \otimes \cdots \otimes a_D^k$.BlockRankTensor: multi-field variant.
1D matrices are assembled directly on spaces_1d with Gridap's own assemble_matrix, then packed into an AbstractRankTensor (Rank1Tensor/ GenericRankTensor) directly — no dedicated tensor-product assembler is needed.
GridapROMs.TProduct.MatrixOrTensor — Type
const MatrixOrTensor = Union{AbstractMatrix,AbstractRankTensor}GridapROMs.TProduct.AbstractRankTensor — Type
abstract type AbstractRankTensor{D,K} endType representing a tensor a of dimension D and rank K, i.e. assuming the form
$a = \sum\limits_{k=1}^K a_1^k \otimes \cdots \otimes a_D^k$
Subtypes:
GridapROMs.TProduct.BlockRankTensor — Type
struct BlockRankTensor{A<:AbstractRankTensor,N} <: AbstractArray{A,N}
array::Array{A,N}
endMulti-field version of a AbstractRankTensor
GridapROMs.TProduct.GenericRankTensor — Type
struct GenericRankTensor{D,K,A<:AbstractArray} <: AbstractRankTensor{D,K}
decompositions::Vector{Rank1Tensor{D,A}}
endStructure 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$
GridapROMs.TProduct.Rank1Tensor — Type
struct Rank1Tensor{D,A<:AbstractArray} <: AbstractRankTensor{D,1}
factors::Vector{A}
endStructure representing rank-1 tensors, i.e. assuming the form
$a = a_1 \otimes \cdots \otimes a_D$
GridapROMs.TProduct.TProductDiscreteModel — Type
struct TProductDiscreteModel{D,A,B} <: DiscreteModel{D,D}
model::A
models_1d::B
endA 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]²GridapROMs.TProduct.TProductFESpace — Type
struct TProductFESpace{S} <: SingleFieldFESpace
space::S
spaces_1d::Vector{<:SingleFieldFESpace}
endA SingleFieldFESpace on a tensor product mesh, storing the D-dimensional space and a vector of D 1D spaces_1d. Neither is reordered: their native (Gridap-assigned) dof numbering is mapped to lexicographic rank wherever a tensor/Cartesian structure is needed (get_dof_map, get_sparse_dof_map).
All standard SingleFieldFESpace interface methods are delegated to space.
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")GridapROMs.TProduct.TProductTriangulation — Type
struct TProductTriangulation{Dt,Dp,A,B,C} <: Triangulation{Dt,Dp}
model::A
trian::B
trians_1d::C
endA 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.
GridapROMs.TProduct.get_decomposition — Method
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]$
GridapROMs.TProduct.get_factor — Method
get_factor(a::AbstractRankTensor,d::Integer,k::Integer) -> AbstractArrayReturns the d-th factor array of the k-th rank-1 decomposition of a. For a Rank1Tensor k must equal 1.
GridapROMs.TProduct.get_factors — Method
get_factors(a::Rank1Tensor) -> VectorReturns the vector of D factor arrays of the rank-1 tensor a.