34 #include "libmesh/system.h" 35 #include "libmesh/dof_map.h" 36 #include "libmesh/numeric_vector.h" 41 _intersection (nullptr),
42 _dof_handler (nullptr) {
95 const libMesh::NumericVector<Real>& X) {
111 const std::vector<unsigned int>&
114 stress_sys.solution->zero();
116 std::vector<libMesh::dof_id_type> dof_indices;
117 const libMesh::DofMap& dof_map = structural_sys.get_dof_map();
119 std::unique_ptr<libMesh::NumericVector<Real> > localized_solution;
124 libMesh::MeshBase::const_element_iterator el =
125 structural_sys.get_mesh().active_local_elements_begin();
126 const libMesh::MeshBase::const_element_iterator end_el =
127 structural_sys.get_mesh().active_local_elements_end();
133 sys_num = stress_sys.number();
136 max_strain_vals = RealVectorX::Zero(6),
137 max_stress_vals = RealVectorX::Zero(6);
142 for ( ; el != end_el; el++) {
144 const libMesh::Elem* elem = *el;
147 structural_sys.get_mesh().max_elem_id(),
148 structural_sys.get_mesh().max_node_id());
157 dof_map.dof_indices (elem, dof_indices);
159 unsigned int ndofs = (
unsigned int)dof_indices.size();
162 for (
unsigned int i=0; i<dof_indices.size(); i++)
163 sol(i) = (*localized_solution)(dof_indices[i]);
168 const std::vector<const libMesh::Elem *> &
171 std::vector<const libMesh::Elem*>::const_iterator
172 hi_sub_elem_it = elems_hi.begin(),
173 hi_sub_elem_end = elems_hi.end();
175 for (; hi_sub_elem_it != hi_sub_elem_end; hi_sub_elem_it++ ) {
177 const libMesh::Elem* sub_elem = *hi_sub_elem_it;
190 const std::map<
const libMesh::dof_id_type,
191 std::vector<MAST::StressStrainOutputBase::Data*> >& output_map =
196 libmesh_assert_equal_to(output_map.size(), elems_hi.size());
200 std::map<
const libMesh::dof_id_type,
201 std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
202 e_it = output_map.begin(),
203 e_end = output_map.end();
206 max_vals = RealVectorX::Zero(13);
209 for ( ; e_it != e_end; e_it++) {
218 for (
unsigned int i=0; i<6; i++) {
219 if (std::fabs(max_strain_vals(i)) > std::fabs(max_vals(i)))
220 max_vals(i) = max_strain_vals(i);
221 if (std::fabs(max_stress_vals(i)) > std::fabs(max_vals(i+6)))
222 max_vals(i+6) = max_stress_vals(i);
224 max_vals(12) = std::max(max_vm_stress, max_vals(12));
229 dof_id = elem->dof_number(sys_num, stress_vars[12], 0);
230 stress_sys.solution->set(dof_id, max_vals(12));
232 for (
unsigned int i=0; i<6; i++) {
234 dof_id = elem->dof_number(sys_num, stress_vars[i], 0);
235 stress_sys.solution->set(dof_id, max_vals(i));
238 dof_id = elem->dof_number(sys_num, stress_vars[i+6], 0);
239 stress_sys.solution->set(dof_id, max_vals(i+6));
246 stress_sys.solution->close();
MAST::AssemblyElemOperations * _elem_ops
provides assembly elem operations for use by this class
MAST::NonlinearSystem & system()
virtual void clear()
clears association with level set function
Data structure provides the mechanism to store stress and strain output from a structural analysis...
This class implements a system for solution of nonlinear systems.
void get_max_stress_strain_values(const std::vector< MAST::StressStrainOutputBase::Data * > &data, RealVectorX &max_strain, RealVectorX &max_stress, Real &max_vm, const MAST::FunctionBase *p)
void solution_of_factored_element(const libMesh::Elem &elem, RealVectorX &elem_sol)
updates the components of the solution vector in elem_sol for the void domain using the stored soluti...
virtual void clear_elem_operation_object()
clears the association of this object with the assembly element operation object. ...
MAST::LevelSetInterfaceDofHandler * _dof_handler
void clear()
clears the data structure of any stored values so that it can be used for another element...
virtual void init(const libMesh::Elem &elem, const MAST::SystemInitialization &sys_init)
This method should not get called for this class.
MAST::FieldFunction< Real > * _level_set
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...
virtual void set_elem_solution(const RealVectorX &sol)
sets the element solution
void init(const MAST::FieldFunction< Real > &phi, const libMesh::Elem &e, const Real t, unsigned int max_elem_id, unsigned int max_node_id)
virtual void init(MAST::FieldFunction< Real > &level_set, MAST::LevelSetInterfaceDofHandler *dof_handler=nullptr)
attaches level set function to this.
MAST::SystemInitialization * _system
System for which this assembly is performed.
virtual ~LevelSetStressAssembly()
destructor resets the association of this assembly object with the system
virtual void update_stress_strain_data(MAST::StressStrainOutputBase &ops, const libMesh::NumericVector< Real > &X)
updates the stresses and strains for the specified solution vector X.
MAST::PhysicsDisciplineBase * _discipline
PhysicsDisciplineBase object for which this class is assembling.
virtual const std::map< const libMesh::dof_id_type, std::vector< MAST::StressStrainOutputBase::Data * > > & get_stress_strain_data() const
LevelSetStressAssembly()
constructor associates this assembly object with the system
This class inherits from MAST::GeomElem and provides an interface to initialize FE objects on sub-ele...
virtual void init(const MAST::GeomElem &elem)
initialize for the element.
virtual void set_elem_data(unsigned int dim, const libMesh::Elem &ref_elem, MAST::GeomElem &elem) const
sets the structural element y-vector if 1D element is used.
Matrix< Real, Dynamic, 1 > RealVectorX
bool if_elem_has_positive_phi_region() const
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...
const std::vector< const libMesh::Elem * > & get_sub_elems_positive_phi() const
virtual void evaluate()
this evaluates all relevant stress components on the element to evaluate the p-averaged quantity...
virtual void clear_elem()
clears the element initialization
MAST::LevelSetIntersection * _intersection
bool if_factor_element(const libMesh::Elem &elem) const
void clear()
clears the data structures