MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
MAST::AssemblyBase Class Reference

Detailed Description

Definition at line 51 of file assembly_base.h.

#include <assembly_base.h>

Inheritance diagram for MAST::AssemblyBase:
Collaboration diagram for MAST::AssemblyBase:

Classes

class  ElemParameterDependence
 Inherited objects from this class can be provided by the user provide assessment of whether or not an element is influenced by a give parameter. More...
 
class  SolverMonitor
 

Public Member Functions

 AssemblyBase ()
 constructor takes a reference to the discipline that provides the boundary conditions, volume loads, properties, etc. More...
 
virtual ~AssemblyBase ()
 virtual destructor More...
 
void attach_elem_parameter_dependence_object (MAST::AssemblyBase::ElemParameterDependence &dep)
 This object, if provided by user, will be used to reduce unnecessary computations in sensitivity analysis assembly operations. More...
 
void attach_solution_function (MAST::MeshFieldFunction &f)
 tells the assembly object that this function is will need to be initialized before each residual evaluation More...
 
std::unique_ptr< libMesh::NumericVector< Real > > build_localized_vector (const libMesh::System &sys, const libMesh::NumericVector< Real > &global) const
 localizes the parallel vector so that the local copy stores all values necessary for calculation of the element quantities More...
 
virtual void calculate_output (const libMesh::NumericVector< Real > &X, bool if_localize_sol, MAST::OutputAssemblyElemOperations &output)
 calculates the value of quantity $ q(X,p) $. More...
 
virtual Real calculate_output_adjoint_sensitivity (const libMesh::NumericVector< Real > &X, bool if_localize_sol, const libMesh::NumericVector< Real > &adj_sol, const MAST::FunctionBase &p, MAST::AssemblyElemOperations &elem_ops, MAST::OutputAssemblyElemOperations &output, const bool include_partial_sens=true)
 Evaluates the total sensitivity of output wrt p using the adjoint solution provided in adj_sol for a linearization about solution X. More...
 
virtual void calculate_output_adjoint_sensitivity_multiple_parameters_no_direct (const libMesh::NumericVector< Real > &X, bool if_localize_sol, const libMesh::NumericVector< Real > &adj_sol, const std::vector< const MAST::FunctionBase *> &p_vec, MAST::AssemblyElemOperations &elem_ops, MAST::OutputAssemblyElemOperations &output, std::vector< Real > &sens)
 Evaluates the dot product between adj_sol and sensitivity of residual about X for multiple parameter_vectors p_vec and returns the results in sens. More...
 
virtual void calculate_output_derivative (const libMesh::NumericVector< Real > &X, bool if_localize_sol, MAST::OutputAssemblyElemOperations &output, libMesh::NumericVector< Real > &dq_dX)
 calculates $ \frac{\partial q(X, p)}{\partial X} $ More...
 
virtual void calculate_output_direct_sensitivity (const libMesh::NumericVector< Real > &X, bool if_localize_sol, const libMesh::NumericVector< Real > *dXdp, bool if_localize_sol_sens, const MAST::FunctionBase &p, MAST::OutputAssemblyElemOperations &output)
 evaluates the sensitivity of the outputs in the attached discipline with respect to the parametrs in params. More...
 
virtual void clear_discipline_and_system ()
 clears association with a system to this discipline More...
 
virtual void clear_elem_operation_object ()
 clears the association of this object with the assembly element operation object. More...
 
void clear_elem_parameter_dependence_object ()
 
void clear_solver_monitor ()
 clears the monitor object More...
 
void detach_solution_function ()
 removes the attachment of the solution function More...
 
const MAST::PhysicsDisciplineBasediscipline () const
 
MAST::PhysicsDisciplineBasediscipline ()
 
MAST::AssemblyElemOperationsget_elem_ops ()
 
MAST::AssemblyBase::SolverMonitorget_solver_monitor ()
 
virtual void residual_and_jacobian (const libMesh::NumericVector< Real > &X, libMesh::NumericVector< Real > *R, libMesh::SparseMatrix< Real > *J, libMesh::NonlinearImplicitSystem &S)
 function that assembles the matrices and vectors quantities for nonlinear solution More...
 
virtual bool sensitivity_assemble (const libMesh::NumericVector< Real > &X, bool if_localize_sol, const MAST::FunctionBase &f, libMesh::NumericVector< Real > &sensitivity_rhs, bool close_vector=true)
 Assembly function. More...
 
virtual void set_discipline_and_system (MAST::PhysicsDisciplineBase &discipline, MAST::SystemInitialization &system)
 attaches a system to this discipline More...
 
virtual void set_elem_operation_object (MAST::AssemblyElemOperations &elem_ops)
 attaches a element operation to this object, and associated this with the element operation object. More...
 
void set_solver_monitor (MAST::AssemblyBase::SolverMonitor &monitor)
 attaches the solver monitor, which is a user provided routine that is called each time More...
 
const MAST::NonlinearSystemsystem () const
 
MAST::NonlinearSystemsystem ()
 
MAST::SystemInitializationsystem_init ()
 

Public Attributes

bool close_matrix
 flag to control the closing fo the Jacobian after assembly More...
 
std::set< unsigned int > diagonal_elem_subdomain_id
 subdomain ids for which residuakl and Jacobian contributions will not be computed. More...
 

Protected Attributes

MAST::PhysicsDisciplineBase_discipline
 PhysicsDisciplineBase object for which this class is assembling. More...
 
MAST::AssemblyElemOperations_elem_ops
 provides assembly elem operations for use by this class More...
 
MAST::AssemblyBase::ElemParameterDependence_param_dependence
 If provided by user, this object is used by sensitiivty analysis to check for whether or the current design parameter influences an element. More...
 
MAST::MeshFieldFunction_sol_function
 system solution that will be initialized before each solution More...
 
MAST::AssemblyBase::SolverMonitor_solver_monitor
 User provided solver monitor is attached to the linear nonlinear solvers, if provided. More...
 
MAST::SystemInitialization_system
 System for which this assembly is performed. More...
 

Constructor & Destructor Documentation

◆ AssemblyBase()

MAST::AssemblyBase::AssemblyBase ( )

constructor takes a reference to the discipline that provides the boundary conditions, volume loads, properties, etc.

Definition at line 39 of file assembly_base.cpp.

◆ ~AssemblyBase()

MAST::AssemblyBase::~AssemblyBase ( )
virtual

virtual destructor

Definition at line 53 of file assembly_base.cpp.

Member Function Documentation

◆ attach_elem_parameter_dependence_object()

void MAST::AssemblyBase::attach_elem_parameter_dependence_object ( MAST::AssemblyBase::ElemParameterDependence dep)

This object, if provided by user, will be used to reduce unnecessary computations in sensitivity analysis assembly operations.

This association is cleard when clear_discipline_and_system() is called.

Definition at line 129 of file assembly_base.cpp.

◆ attach_solution_function()

void MAST::AssemblyBase::attach_solution_function ( MAST::MeshFieldFunction f)

tells the assembly object that this function is will need to be initialized before each residual evaluation

Definition at line 234 of file assembly_base.cpp.

◆ build_localized_vector()

std::unique_ptr< libMesh::NumericVector< Real > > MAST::AssemblyBase::build_localized_vector ( const libMesh::System &  sys,
const libMesh::NumericVector< Real > &  global 
) const

localizes the parallel vector so that the local copy stores all values necessary for calculation of the element quantities

Definition at line 211 of file assembly_base.cpp.

◆ calculate_output()

void MAST::AssemblyBase::calculate_output ( const libMesh::NumericVector< Real > &  X,
bool  if_localize_sol,
MAST::OutputAssemblyElemOperations output 
)
virtual

calculates the value of quantity $ q(X,p) $.

Reimplemented in MAST::LevelSetNonlinearImplicitAssembly.

Definition at line 254 of file assembly_base.cpp.

◆ calculate_output_adjoint_sensitivity()

Real MAST::AssemblyBase::calculate_output_adjoint_sensitivity ( const libMesh::NumericVector< Real > &  X,
bool  if_localize_sol,
const libMesh::NumericVector< Real > &  adj_sol,
const MAST::FunctionBase p,
MAST::AssemblyElemOperations elem_ops,
MAST::OutputAssemblyElemOperations output,
const bool  include_partial_sens = true 
)
virtual

Evaluates the total sensitivity of output wrt p using the adjoint solution provided in adj_sol for a linearization about solution X.

Definition at line 557 of file assembly_base.cpp.

◆ calculate_output_adjoint_sensitivity_multiple_parameters_no_direct()

void MAST::AssemblyBase::calculate_output_adjoint_sensitivity_multiple_parameters_no_direct ( const libMesh::NumericVector< Real > &  X,
bool  if_localize_sol,
const libMesh::NumericVector< Real > &  adj_sol,
const std::vector< const MAST::FunctionBase *> &  p_vec,
MAST::AssemblyElemOperations elem_ops,
MAST::OutputAssemblyElemOperations output,
std::vector< Real > &  sens 
)
virtual

Evaluates the dot product between adj_sol and sensitivity of residual about X for multiple parameter_vectors p_vec and returns the results in sens.

Note that partial derivative of output with respect to design variables will not be included. The size of p_vec and sens should be the same and the results of sens will be overwritten.

Definition at line 596 of file assembly_base.cpp.

◆ calculate_output_derivative()

void MAST::AssemblyBase::calculate_output_derivative ( const libMesh::NumericVector< Real > &  X,
bool  if_localize_sol,
MAST::OutputAssemblyElemOperations output,
libMesh::NumericVector< Real > &  dq_dX 
)
virtual

calculates $ \frac{\partial q(X, p)}{\partial X} $

Reimplemented in MAST::LevelSetNonlinearImplicitAssembly.

Definition at line 340 of file assembly_base.cpp.

◆ calculate_output_direct_sensitivity()

void MAST::AssemblyBase::calculate_output_direct_sensitivity ( const libMesh::NumericVector< Real > &  X,
bool  if_localize_sol,
const libMesh::NumericVector< Real > *  dXdp,
bool  if_localize_sol_sens,
const MAST::FunctionBase p,
MAST::OutputAssemblyElemOperations output 
)
virtual

evaluates the sensitivity of the outputs in the attached discipline with respect to the parametrs in params.

The base solution should be provided in X. If total sensitivity is desired, then dXdp should contain the sensitivity of solution wrt the parameter p, otherwise it can be set to nullptr. If dXdp is zero, the calculated sensitivity will be the partial derivarive of output wrt p.

Reimplemented in MAST::LevelSetNonlinearImplicitAssembly.

Definition at line 436 of file assembly_base.cpp.

◆ clear_discipline_and_system()

void MAST::AssemblyBase::clear_discipline_and_system ( )
virtual

clears association with a system to this discipline

Reimplemented in MAST::StructuralBucklingEigenproblemAssembly, MAST::FSIGeneralizedAeroForceAssembly, and MAST::StructuralFluidInteractionAssembly.

Definition at line 176 of file assembly_base.cpp.

◆ clear_elem_operation_object()

void MAST::AssemblyBase::clear_elem_operation_object ( )
virtual

clears the association of this object with the assembly element operation object.

Definition at line 199 of file assembly_base.cpp.

◆ clear_elem_parameter_dependence_object()

void MAST::AssemblyBase::clear_elem_parameter_dependence_object ( )

Definition at line 139 of file assembly_base.cpp.

◆ clear_solver_monitor()

void MAST::AssemblyBase::clear_solver_monitor ( )

clears the monitor object

Definition at line 154 of file assembly_base.cpp.

◆ detach_solution_function()

void MAST::AssemblyBase::detach_solution_function ( )

removes the attachment of the solution function

Definition at line 246 of file assembly_base.cpp.

◆ discipline() [1/2]

const MAST::PhysicsDisciplineBase & MAST::AssemblyBase::discipline ( ) const
Returns
a const reference to the PhysicsDisciplineBase object associated with this object

Definition at line 62 of file assembly_base.cpp.

◆ discipline() [2/2]

MAST::PhysicsDisciplineBase & MAST::AssemblyBase::discipline ( )
Returns
a non-const reference to the PhysicsDisciplineBase object associated with this object

Definition at line 72 of file assembly_base.cpp.

◆ get_elem_ops()

MAST::AssemblyElemOperations & MAST::AssemblyBase::get_elem_ops ( )
Returns
a reference to the element operations object

Definition at line 101 of file assembly_base.cpp.

◆ get_solver_monitor()

MAST::AssemblyBase::SolverMonitor * MAST::AssemblyBase::get_solver_monitor ( )
Returns
the solver monitor, which is a user provided routine that is called each time

Definition at line 147 of file assembly_base.cpp.

◆ residual_and_jacobian()

virtual void MAST::AssemblyBase::residual_and_jacobian ( const libMesh::NumericVector< Real > &  X,
libMesh::NumericVector< Real > *  R,
libMesh::SparseMatrix< Real > *  J,
libMesh::NonlinearImplicitSystem &  S 
)
inlinevirtual

function that assembles the matrices and vectors quantities for nonlinear solution

Reimplemented in MAST::LevelSetNonlinearImplicitAssembly, MAST::NonlinearImplicitAssembly, MAST::TransientAssembly, and MAST::LevelSetReinitializationTransientAssembly.

Definition at line 227 of file assembly_base.h.

◆ sensitivity_assemble()

virtual bool MAST::AssemblyBase::sensitivity_assemble ( const libMesh::NumericVector< Real > &  X,
bool  if_localize_sol,
const MAST::FunctionBase f,
libMesh::NumericVector< Real > &  sensitivity_rhs,
bool  close_vector = true 
)
inlinevirtual

Assembly function.

This function will be called to assemble the RHS of the sensitivity equations (which is -1 times sensitivity of system residual) prior to a solve and must be provided by the user in a derived class. The method provides dR/dp for f parameter.

If the routine is not able to provide sensitivity for this parameter, then it should return false, and the system will attempt to use finite differencing.

Reimplemented in MAST::NonlinearImplicitAssembly, and MAST::LevelSetNonlinearImplicitAssembly.

Definition at line 246 of file assembly_base.h.

◆ set_discipline_and_system()

void MAST::AssemblyBase::set_discipline_and_system ( MAST::PhysicsDisciplineBase discipline,
MAST::SystemInitialization system 
)
virtual

attaches a system to this discipline

Definition at line 162 of file assembly_base.cpp.

◆ set_elem_operation_object()

void MAST::AssemblyBase::set_elem_operation_object ( MAST::AssemblyElemOperations elem_ops)
virtual

attaches a element operation to this object, and associated this with the element operation object.

Definition at line 187 of file assembly_base.cpp.

◆ set_solver_monitor()

void MAST::AssemblyBase::set_solver_monitor ( MAST::AssemblyBase::SolverMonitor monitor)

attaches the solver monitor, which is a user provided routine that is called each time

Definition at line 119 of file assembly_base.cpp.

◆ system() [1/2]

const MAST::NonlinearSystem & MAST::AssemblyBase::system ( ) const
Returns
a const reference to the MAST::NonlinearSystem object associated with this object

Definition at line 83 of file assembly_base.cpp.

◆ system() [2/2]

MAST::NonlinearSystem & MAST::AssemblyBase::system ( )
Returns
a non-const reference to the MAST::NonlinearSystem object associated with this object

Definition at line 92 of file assembly_base.cpp.

◆ system_init()

MAST::SystemInitialization & MAST::AssemblyBase::system_init ( )
Returns
a non-const reference to the MAST::SystemInitialization

Definition at line 110 of file assembly_base.cpp.

Member Data Documentation

◆ _discipline

MAST::PhysicsDisciplineBase* MAST::AssemblyBase::_discipline
protected

PhysicsDisciplineBase object for which this class is assembling.

Definition at line 345 of file assembly_base.h.

◆ _elem_ops

MAST::AssemblyElemOperations* MAST::AssemblyBase::_elem_ops
protected

provides assembly elem operations for use by this class

Definition at line 339 of file assembly_base.h.

◆ _param_dependence

MAST::AssemblyBase::ElemParameterDependence* MAST::AssemblyBase::_param_dependence
protected

If provided by user, this object is used by sensitiivty analysis to check for whether or the current design parameter influences an element.

This can be used to enhance computational efficiency.

Definition at line 369 of file assembly_base.h.

◆ _sol_function

MAST::MeshFieldFunction* MAST::AssemblyBase::_sol_function
protected

system solution that will be initialized before each solution

Definition at line 356 of file assembly_base.h.

◆ _solver_monitor

MAST::AssemblyBase::SolverMonitor* MAST::AssemblyBase::_solver_monitor
protected

User provided solver monitor is attached to the linear nonlinear solvers, if provided.

Definition at line 362 of file assembly_base.h.

◆ _system

MAST::SystemInitialization* MAST::AssemblyBase::_system
protected

System for which this assembly is performed.

Definition at line 351 of file assembly_base.h.

◆ close_matrix

bool MAST::AssemblyBase::close_matrix

flag to control the closing fo the Jacobian after assembly

Definition at line 110 of file assembly_base.h.

◆ diagonal_elem_subdomain_id

std::set<unsigned int> MAST::AssemblyBase::diagonal_elem_subdomain_id

subdomain ids for which residuakl and Jacobian contributions will not be computed.

Instead, a small diagonal value will be added to the Jacobian for the dofs corresponding to this element.

Definition at line 71 of file assembly_base.h.


The documentation for this class was generated from the following files: