The assemble
Module¶
-
stat_fem.assemble.
assemble
(f, tensor=None, bcs=None, form_compiler_parameters=None, mat_type=None, sub_mat_type=None, appctx={}, options_prefix=None, **kwargs)¶ Overloaded assembly function to include assembly of stat-fem operators
This provides a functional interface to assemblying stat-fem objects in the same manner as other matrices and vectors in Firedrake. If the input object is a
ForcingCovariance
orInterpolationMatrix
object, it calls theassemble
method and returns. Otherwise, it passes the arguments along to Firedrake for assembly.If f is a
Form
then this evaluates the corresponding integral(s) and returns afloat
for 0-forms, aFunction
for 1-forms and aMatrix
orImplicitMatrix
for 2-forms.If f is an expression other than a form, it will be evaluated pointwise on the
Function
s in the expression. This will only succeed if all the Functions are on the sameFunctionSpace
.If f is a Slate tensor expression, then it will be compiled using Slate’s linear algebra compiler.
If
tensor
is supplied, the assembled result will be placed there, otherwise a new object of the appropriate type will be returned.If
bcs
is supplied andf
is a 2-form, the rows and columns of the resultingMatrix
corresponding to boundary nodes will be set to 0 and the diagonal entries to 1. Iff
is a 1-form, the vector entries at boundary nodes are set to the boundary condition values.Parameters: - f – a
ForcingCovariance
,InterpolationMatrix
,Form
,Expr
orTensorBase
expression. - tensor – an existing tensor object to place the result in (optional).
- bcs – a list of boundary conditions to apply (optional).
- form_compiler_parameters – (optional) dict of parameters to pass to
the form compiler. Ignored if not assembling a
Form
. Any parameters provided here will be overridden by parameters set on theMeasure
in the form. For example, if aquadrature_degree
of 4 is specified in this argument, but a degree of 3 is requested in the measure, the latter will be used. - mat_type – (optional) string indicating how a 2-form (matrix) should be
assembled – either as a monolithic matrix (‘aij’ or ‘baij’), a block matrix
(‘nest’), or left as a
ImplicitMatrix
giving matrix-free actions (‘matfree’). If not supplied, the default value inparameters["default_matrix_type"]
is used. BAIJ differs from AIJ in that only the block sparsity rather than the dof sparsity is constructed. This can result in some memory savings, but does not work with all PETSc preconditioners. BAIJ matrices only make sense for non-mixed matrices. - sub_mat_type – (optional) string indicating the matrix type to
use inside a nested block matrix. Only makes sense if
mat_type
isnest
. May be one of ‘aij’ or ‘baij’. If not supplied, defaults toparameters["default_sub_matrix_type"]
. - appctx – Additional information to hang on the assembled matrix if an implicit matrix is requested (mat_type “matfree”).
- options_prefix – PETSc options prefix to apply to matrices.
- f – a