femo_alpha.fea.fea_dolfinx

The FEniCSx wrapper for variational forms and partial derivatives computation

Module Contents

Classes

FEA

The class of the FEniCSx wrapper for FEA submodels in optimization,

class femo_alpha.fea.fea_dolfinx.FEA(mesh)

Bases: object

The class of the FEniCSx wrapper for FEA submodels in optimization, with methods to compute the variational forms, partial derivatives, and solve the nonlinear/linear subproblems.

add_exact_solution(Expression, function_space)

(Optional) for inverse problem only

add_field_output(name, form, arguments, function_space=('CG', 1), record=False, vtk=False)

Add field output variables to dicitionary

add_input(name: str, function: femo_alpha.fea.utils_dolfinx.dolfinx.fem.Function, init_val=1.0, record=False)

Add input variables to dictionary

add_output(name: str, form: femo_alpha.fea.utils_dolfinx.dolfinx.fem.form, arguments: list)

Add scalar output variables to dictionary

add_state(name: str, function: femo_alpha.fea.utils_dolfinx.dolfinx.fem.Function, residual_form: femo_alpha.fea.utils_dolfinx.dolfinx.fem.form, arguments: list, dR_du=None, dR_df_list=None, record=False)

Add state variables to dictionary

add_strong_bc(ubc, locate_BC_list, function_space=None)

(Optional) for strong BCs where the location does not change

createRecorder(name, record=False, vtk=False)
projectFieldOutput(form, func)
solve(res, func, bc)

Solve the PDE problem

solveLinearBwd(dR, A, du, du_array, ksp=None)

solve linear system du = dR_du.T (A_T) * dR in DOLFIN type

solveLinearFwd(du, A, dR, dR_array, ksp=None)

solve linear system dR = dR_du (A) * du in DOLFIN type