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
ForcingCovarianceorInterpolationMatrixobject, it calls theassemblemethod and returns. Otherwise, it passes the arguments along to Firedrake for assembly.If f is a
Formthen this evaluates the corresponding integral(s) and returns afloatfor 0-forms, aFunctionfor 1-forms and aMatrixorImplicitMatrixfor 2-forms.If f is an expression other than a form, it will be evaluated pointwise on the
Functions 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
tensoris supplied, the assembled result will be placed there, otherwise a new object of the appropriate type will be returned.If
bcsis supplied andfis a 2-form, the rows and columns of the resultingMatrixcorresponding to boundary nodes will be set to 0 and the diagonal entries to 1. Iffis a 1-form, the vector entries at boundary nodes are set to the boundary condition values.Parameters: - f – a
ForcingCovariance,InterpolationMatrix,Form,ExprorTensorBaseexpression. - 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 theMeasurein the form. For example, if aquadrature_degreeof 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
ImplicitMatrixgiving 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_typeisnest. 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