31 #include "libmesh/petsc_nonlinear_solver.h" 32 #include "libmesh/petsc_vector.h" 33 #include "libmesh/dof_map.h" 56 sys.add_vector(
"old_solution");
63 PetscErrorCode ierr = SNESGetSolutionUpdate(snes, &dx);
64 libmesh_assert(!ierr);
67 std::unique_ptr<libMesh::NumericVector<Real> >
68 vec(
new libMesh::PetscVector<Real>(dx, sys.comm())),
69 vec_scaled(vec->clone().release());
73 vec_scaled->scale(-1.);
85 sys.get_vector(
"old_solution") = *sys.solution;
86 sys.get_vector(
"old_solution").close();
136 libMesh::PetscNonlinearSolver<Real> &petsc_nonlinear_solver =
137 *(
dynamic_cast<libMesh::PetscNonlinearSolver<Real>*
> 142 if (libMesh::on_command_line(
"--solver_system_names"))
143 petsc_nonlinear_solver.init((assembly.
system().name()+
"_").c_str());
146 SNES snes = petsc_nonlinear_solver.snes();
148 PetscErrorCode ierr =
154 libmesh_assert(!ierr);
163 libMesh::PetscNonlinearSolver<Real> &petsc_nonlinear_solver =
164 *(
dynamic_cast<libMesh::PetscNonlinearSolver<Real>*
> 168 SNES snes = petsc_nonlinear_solver.snes();
170 PetscErrorCode ierr =
171 SNESMonitorCancel(snes);
172 libmesh_assert(!ierr);
181 libMesh::NumericVector<Real>& dX) {
193 std::vector<libMesh::dof_id_type> dof_indices;
194 const libMesh::DofMap& dof_map = sys.get_dof_map();
197 std::unique_ptr<libMesh::NumericVector<Real> >
209 libMesh::MeshBase::const_element_iterator el =
210 sys.get_mesh().active_local_elements_begin();
211 const libMesh::MeshBase::const_element_iterator end_el =
212 sys.get_mesh().active_local_elements_end();
215 for ( ; el != end_el; ++el) {
217 const libMesh::Elem* elem = *el;
231 dof_map.dof_indices (elem, dof_indices);
234 unsigned int ndofs = (
unsigned int)dof_indices.size();
238 for (
unsigned int i=0; i<dof_indices.size(); i++) {
239 sol(i) = (*localized_solution) (dof_indices[i]);
240 dsol(i) = (*localized_dsolution)(dof_indices[i]);
virtual void update_incompatible_mode_solution(const RealVectorX &dsol)
updates the incompatible solution for this element.
This class implements a system for solution of nonlinear systems.
This class provides some routines that are common to structural assembly routines.
std::map< const libMesh::Elem *, RealVectorX > _incompatible_sol
map of local incompatible mode solution per 3D elements
void detach_active_solution_function()
Detaches the function object that may have been attached to the element.
const MAST::GeomElem & elem() const
void set_elem_incompatible_sol(MAST::StructuralElementBase &elem)
virtual bool if_incompatible_modes() const =0
virtual const libMesh::Elem & get_reference_elem() const
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...
MAST::ElementBase & get_physics_elem()
MAST::AssemblyBase * _assembly
assembles the point loas
void update_incompatible_solution(libMesh::NumericVector< Real > &X, libMesh::NumericVector< Real > &dX)
virtual void init(MAST::AssemblyBase &assembly)
virtual void set_solution(const RealVectorX &vec, bool if_sens=false)
stores vec as solution for element level calculations, or its sensitivity if if_sens is true...
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.
virtual unsigned int incompatible_mode_size() 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...
MAST::AssemblyBase::SolverMonitor * get_solver_monitor()
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
MAST::SystemInitialization & system_init()
virtual ~StructuralAssembly()
MAST::AssemblyElemOperations & get_elem_ops()
virtual void init(const libMesh::Elem &elem, const MAST::SystemInitialization &sys_init)
initialize the object for the specified reference elem.
void set_incompatible_mode_solution(RealVectorX &vec)
sets the pointer to the incompatible mode solution vector.
PetscErrorCode _snes_structural_nonlinear_assembly_monitor_function(SNES snes, PetscInt its, PetscReal norm2, void *ctx)
const MAST::NonlinearSystem & system() const