32 #include "libmesh/nonlinear_solver.h" 33 #include "libmesh/numeric_vector.h" 34 #include "libmesh/sparse_matrix.h" 35 #include "libmesh/dof_map.h" 69 libMesh::NumericVector<Real>* R,
70 libMesh::SparseMatrix<Real>* J,
71 libMesh::NonlinearImplicitSystem& S) {
88 libmesh_assert_equal_to(&S, &transient_sys);
98 std::vector<libMesh::dof_id_type> dof_indices;
99 const libMesh::DofMap& dof_map = transient_sys.get_dof_map();
105 std::vector<libMesh::NumericVector<Real>*>
108 std::unique_ptr<libMesh::NumericVector<Real> > localized_solution;
119 libMesh::MeshBase::const_element_iterator el =
120 transient_sys.get_mesh().active_local_elements_begin();
121 const libMesh::MeshBase::const_element_iterator end_el =
122 transient_sys.get_mesh().active_local_elements_end();
124 for ( ; el != end_el; ++el) {
126 const libMesh::Elem* elem = *el;
128 dof_map.dof_indices (elem, dof_indices);
133 solver.
init(geom_elem);
136 unsigned int ndofs = (
unsigned int)dof_indices.size();
138 ref_sol.setZero(ndofs);
139 mat.setZero(ndofs, ndofs);
141 for (
unsigned int i=0; i<dof_indices.size(); i++)
142 ref_sol(i) = (*localized_solution)(dof_indices[i]);
144 solver.set_element_data(dof_indices, local_qtys);
165 dof_map.constrain_element_matrix_and_vector(m, v, dof_indices);
167 dof_map.constrain_element_vector(v, dof_indices);
169 dof_map.constrain_element_matrix(m, dof_indices);
172 if (R) R->add_vector(v, dof_indices);
173 if (J) J->add_matrix(m, dof_indices);
178 for (
unsigned int i=0; i<local_qtys.size(); i++)
179 delete local_qtys[i];
MAST::AssemblyElemOperations * _elem_ops
provides assembly elem operations for use by this class
LevelSetReinitializationTransientAssembly()
MAST::NonlinearSystem & system()
const libMesh::NumericVector< Real > * _ref_sol
libMesh::DenseMatrix< Real > DenseRealMatrix
This class implements a system for solution of nonlinear systems.
virtual MAST::TransientAssemblyElemOperations & get_elem_operation_object()
bool close_matrix
flag to control the closing fo the Jacobian after assembly
MAST::SystemInitialization * _system
System for which this assembly is performed.
virtual void elem_calculations(bool if_jac, RealVectorX &vec, RealMatrixX &mat)=0
performs the element calculations over elem, and returns the element vector and matrix quantities in ...
MAST::PhysicsDisciplineBase * _discipline
PhysicsDisciplineBase object for which this class is assembling.
virtual void set_elem_data(unsigned int dim, const libMesh::Elem &ref_elem, MAST::GeomElem &elem) const =0
some analyses may want to set additional element data before initialization of the GeomElem...
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 ...
void set_reference_solution(const libMesh::NumericVector< Real > &sol)
For reinitialization to , the solution before initialization is used to calculate the source and velo...
libMesh::DenseVector< Real > DenseRealVector
Matrix< Real, Dynamic, Dynamic > RealMatrixX
void copy(DenseRealMatrix &m1, const RealMatrixX &m2)
virtual void build_local_quantities(const libMesh::NumericVector< Real > ¤t_sol, std::vector< libMesh::NumericVector< Real > * > &qtys)
localizes the relevant solutions for system assembly.
void clear()
clear the solution
Matrix< Real, Dynamic, 1 > RealVectorX
virtual void init(const MAST::GeomElem &elem)=0
initializes the object for calculation of element quantities for the specified elem.
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 t...
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
virtual ~LevelSetReinitializationTransientAssembly()
void init(const libMesh::NumericVector< Real > &sol, const libMesh::NumericVector< Real > *dsol=nullptr)
initializes the data structures to perform the interpolation function of sol.
virtual void clear_elem()
clears the element initialization
void set_elem_reference_solution(const RealVectorX &sol)
set element reference solution for reinitialization
virtual void init(const libMesh::Elem &elem, const MAST::SystemInitialization &sys_init)
initialize the object for the specified reference elem.
MAST::MeshFieldFunction * _sol_function
system solution that will be initialized before each solution