Improve FEM API #457
Labels
documentation
enhancement
New feature or request
FEEC
Finite element exterior calculus
FEM API
Objects describing finite element concepts
multi-patch
Next Release
Must be in next release
When trying to improve the compatibility between single and multi-patch simulations, I noticed a few issues with the Fem user interface. Below is a list, with some suggestions for improvement.
First a reminder of the different types of Fem spaces:
Then, a list of some problems that I saw:
name ProductFemSpace is ambiguous: seems to be used only for multi-patch spaces, but a space of vector-valued fields
(a VectorFemSpace) is also a product of FEM spaces...
-> rename as MultipatchFemSpace ?
"product" ambiguity is made worse by the flag function Vh.is_product which means either multi-patch or vector-valued
(see for instance in the FemField constructor where its is understood as vector-valued...)
-> replace by Vh.is_multipatch and Vh.is_vector_valued ?
also the ProductFemSpace constructor may not return a ProductFemSpace, so the code is not easy to follow.
-> use factory function instead ?
Vh.spaces may return different types of spaces (as seen above) which makes the code not always easy to read, and hampers the single/multi-patch compatibility
->: add helper attributes? eg
Vh.patch_spaces[i]:
if Vh is multi-patch space (ie ProductFemSpace), returns FEM space on patch i
if Vh is single-patch (anything else) returns itself (and raise Error if i>0 ?)
Vh.component_spaces[i]:
if Vh is multi-patch space (ie ProductFemSpace), raise error
if Vh is single-patch, vector-valued (ie VectorFemSpace) returns space of component i
if Vh is single-patch, scalar-valued (ie TensorFemSpace) returns itself (or error? only if i>0?)
Vh.axis_spaces[i]:
if Vh is single-patch, scalar-valued tensor-product (ie TensorFemSpace), returns space for axis i
else raise Error ?
a similar problem occurs for a multipatch/vector-valued FemField uh (uh.fields may correspond to patch or component fields)
-> add helper functions? eg
uh.patch_field(i):
if uh is a multi-patch field returns FEM field on patch i
else returns itself (raise error if i>0 ?)
Vh.component_field(i):
needed ?
several function or class docstrings indicate types of arguments which are wrong,
eg:
"L2 : SplineSpace" in class Projector_L2(GlobalProjector)
"Vh : TensorFemSpace" in function construct_hcurl_conforming_projection
(in feec.multipatch.non_matching_operators)
-> better review of MR, use type hints, asserts ?
the class
DiscreteDerhamMultipatch
is a subclass ofDiscreteDerham
(single patch by default)but it does not implement all the basic methods.
In particular, the
derivatives
method which returns the differential operators is not implemented.-> all the make sure that all the functions of DiscreteDerham are well implemented for DiscreteDerhamMultipatch.
In particular, for a multipatch dR sequence the derivatives should return the
broken_derivatives
(as operators, matrices).should be understood as broken ones
DiffOperator
class does not subclassFemLinearOperator
, although they are very similar-> Doing so will probably simplify a few things. Also,
to_sparse_matrix
(to convert a FemLinearOperator to sparse scipy format)can probably be merged with
tosparse
DiscreteDerhamMultipatch
in feec/multipatch/apiDiscreteDerham
in api/feec-> move the DiscreteDerhamMultipatch api in api/broken_feec ? Or api/feec/broken ?
(original idea was that classes defined in the
api
directory are exposed to the user)There is also a related problem in Sympde:
domain.interior.args
returns objects of different types:-> this is probably because
domain.interior
is a Union of subdomains.To fix this without changing how Unions are handled in Sympde, we could add a function/attribute
domain.subdomains
which always returns the subdomains as a tuple of logical domainsThe text was updated successfully, but these errors were encountered: