m3l_classes

Module Contents

Classes

Field

A class for representing mathematical fields such as the field of all real numbers.

Function

A class for representing a general function.

FunctionSpace

A class for representing function spaces.

FunctionValues

A class for representing the evaluation of a function over a mesh.

Model

ModelGroup

A class for storing a group of M3L models. These can be used to establish coupling loops.

ModelIOModule

A parent class for representing modules that map variables in or out of a model.

ModelInputModule

A class for representing modules that map a variable into a model.

ModelOutputModule

A class for representing modules that map a variable out of a model.

Variable

A general M3L variable.

Vector

A general vector class.

VectorSpace

A class for representing vector spaces.

class m3l_classes.Field

A class for representing mathematical fields such as the field of all real numbers.

class m3l_classes.Function

Bases: Variable

A class for representing a general function.

Parameters:
namestr

The name of the variable.

upstream_variablesdict = None

A dictionary containing the immediate inputs to the map to compute this variable.

mapcsdl.Model = None

A CSDL Model that computes this variable given input of the upstream variables.

valuenp.ndarray = None

The value of the variable.

mesham.MappedArray

The mesh over which the function is evaluated.

coefficients: numpy.ndarray
function_space: FunctionSpace
__call__(mesh) FunctionValues
evaluate(mesh)

Evaluate the function at a given set of nodal locations.

Parameters:
mesham.MappedArray

The mesh to evaluate over.

Returns:
function_valuesFunctionValues

A variable representing the evaluated function values.

inverse_evaluate(function_values: FunctionValues)

Performs an inverse evaluation to set the coefficients of this function given an input of evaluated points over a mesh.

Parameters:
function_valuesFunctionValues

A variable representing the evaluated function values.

class m3l_classes.FunctionSpace

A class for representing function spaces.

class m3l_classes.FunctionValues

Bases: Variable

A class for representing the evaluation of a function over a mesh.

Parameters:
namestr

The name of the variable.

upstream_variablesdict = None

A dictionary containing the immediate inputs to the map to compute this variable.

mapcsdl.Model = None

A CSDL Model that computes this variable given input of the upstream variables.

valuenp.ndarray = None

The value of the variable.

mesham.MappedArray

The mesh over which the function is evaluated.

mesh: array_mapper.MappedArray
__post_init__()
class m3l_classes.Model(**kwargs)

Bases: lsdo_modules.module.module.Module

assign_attributes()
construct_module_csdl(model_map: csdl.Model, input_modules: List[ModelInputModule], output_modules: List[ModelOutputModule])

Automates a significant portion of a model’s evaluate method.

Parameters:
model_mapcsdl.Model

The csdl model for the solver/model.

input_modulesList[ModelInputModule]

The list of input modules that map into the solver/model.

output_modulesList[ModelOutputModule]

The list of output modules that map out of the solver/model.

Returns:
outputstuple

A tuple containing the FunctionValues object corresponding to each output module.

class m3l_classes.ModelGroup

A class for storing a group of M3L models. These can be used to establish coupling loops.

_assemble_csdl()
add_output(output: Function)

Registers an output to the model group so the model group will compute and output this variable.

Parameters:
outputFunction

The function for which the model group will output its coefficients.

add_residual(residual: Function)

Adds a residual to define a coupling loop.

Parameters:
residualFunction

The residual that the model group will try to drive to 0.

assemble()
gather_variables(variable: Function)
set_implicit_solver(solver)

Sets an implicit solver for the model group.

Parameters:
solver?

The solver object.

class m3l_classes.ModelIOModule

A parent class for representing modules that map variables in or out of a model.

Parameters:
namestr

The name of the mapping.

map{np.ndarray, sps.csc_matrix}

The map that maps the variable in or out of the solver.

map: numpy.ndarray
name: str
class m3l_classes.ModelInputModule

Bases: ModelIOModule

A class for representing modules that map a variable into a model.

Parameters:
namestr

The name of the mapping.

map{np.ndarray, sps.csc_matrix}

The map that maps the variable in or out of the solver.

module_inputFunctionValues

The input that will be mapped into the model.

model_input_namestr

The name of input as the model’s csdl model is expecting.

model_input_name: str
module_input: FunctionValues
class m3l_classes.ModelOutputModule

Bases: ModelIOModule

A class for representing modules that map a variable out of a model.

Parameters:
namestr

The name of the mapping.

map{np.ndarray, sps.csc_matrix}

The map that maps the variable in or out of the solver.

model_output_namestr

The name of the output as the model’s csdl model is outputing.

module_output_namestr

The name that will be given to the evaluated function values.

module_output_mesham.MappedArray

The mesh that the function values are evaluated over.

model_output_name: str
module_output_mesh: array_mapper.MappedArray
module_output_name: str
class m3l_classes.Variable

A general M3L variable.

Parameters:
namestr

The name of the variable.

upstream_variablesdict = None

A dictionary containing the immediate inputs to the map to compute this variable.

mapcsdl.Model = None

A CSDL Model that computes this variable given input of the upstream variables.

valuenp.ndarray = None

The value of the variable.

map: csdl.Model
name: str
upstream_variables: dict
value: numpy.ndarray
class m3l_classes.Vector

Bases: Variable

A general vector class.

Parameters:
namestr

The name of the variable.

upstream_variablesdict = None

A dictionary containing the immediate inputs to the map to compute this variable.

mapcsdl.Model = None

A CSDL Model that computes this variable given input of the upstream variables.

valuenp.ndarray = None

The value of the variable.

vector_spaceVectorSpace

The vector space from which this vector is defined.

vector_space: VectorSpace
__post_init__()
class m3l_classes.VectorSpace

A class for representing vector spaces.

Parameters:
fieldField

The field that the vector space is defined over.

dimensionstuple

The dimensions/shape of the vectors.

dimensions: tuple
field: Field