29 #include "libmesh/numeric_vector.h" 48 const std::vector<libMesh::NumericVector<Real>*>& sols){
50 libmesh_assert_equal_to(sols.size(), 3);
52 const unsigned int n_dofs = (
unsigned int)dof_indices.size();
57 sol = RealVectorX::Zero(n_dofs),
58 vel = RealVectorX::Zero(n_dofs),
59 accel = RealVectorX::Zero(n_dofs);
63 const libMesh::NumericVector<Real>
64 &sol_global = *sols[0],
65 &vel_global = *sols[1],
66 &acc_global = *sols[2];
68 for (
unsigned int i=0; i<n_dofs; i++) {
70 sol(i) = sol_global(dof_indices[i]);
71 vel(i) = vel_global(dof_indices[i]);
72 accel(i) = acc_global(dof_indices[i]);
75 _assembly_ops->set_elem_solution(sol);
76 _assembly_ops->set_elem_velocity(vel);
77 _assembly_ops->set_elem_acceleration(accel);
85 const std::vector<libMesh::NumericVector<Real>*>& sols,
86 std::vector<RealVectorX>& local_sols) {
88 libmesh_assert_equal_to(sols.size(), 3);
90 const unsigned int n_dofs = (
unsigned int)dof_indices.size();
97 &accel = local_sols[2];
99 sol = RealVectorX::Zero(n_dofs);
100 vel = RealVectorX::Zero(n_dofs);
101 accel = RealVectorX::Zero(n_dofs);
105 const libMesh::NumericVector<Real>
106 &sol_global = *sols[0],
107 &vel_global = *sols[1],
108 &acc_global = *sols[2];
110 for (
unsigned int i=0; i<n_dofs; i++) {
112 sol(i) = sol_global(dof_indices[i]);
113 vel(i) = vel_global(dof_indices[i]);
114 accel(i) = acc_global(dof_indices[i]);
125 const std::vector<libMesh::NumericVector<Real>*>& sols){
127 libmesh_assert_equal_to(sols.size(), 3);
129 const unsigned int n_dofs = (
unsigned int)dof_indices.size();
134 sol = RealVectorX::Zero(n_dofs),
135 vel = RealVectorX::Zero(n_dofs),
136 accel = RealVectorX::Zero(n_dofs);
140 const libMesh::NumericVector<Real>
141 &sol_global = *sols[0],
142 &vel_global = *sols[1],
143 &acc_global = *sols[2];
145 for (
unsigned int i=0; i<n_dofs; i++) {
147 sol(i) = sol_global(dof_indices[i]);
148 vel(i) = vel_global(dof_indices[i]);
149 accel(i) = acc_global(dof_indices[i]);
152 _assembly_ops->set_elem_perturbed_solution(sol);
153 _assembly_ops->set_elem_perturbed_velocity(vel);
154 _assembly_ops->set_elem_perturbed_acceleration(accel);
163 const libMesh::NumericVector<Real>& sol) {
165 const libMesh::NumericVector<Real>
173 vec.add( -1., prev_sol);
186 const libMesh::NumericVector<Real>& sol) {
188 const libMesh::NumericVector<Real>
196 vec.add( -1., prev_sol);
198 vec.add( -1./
beta/
dt, prev_vel);
208 const libMesh::NumericVector<Real>& sol) {
210 const libMesh::NumericVector<Real>
218 vec.add( -1., prev_sol);
230 const libMesh::NumericVector<Real>& sol) {
232 const libMesh::NumericVector<Real>
240 vec.add( -1., prev_sol);
242 vec.add( -1./
beta/
dt, prev_vel);
253 const libMesh::NumericVector<Real>& sol) {
267 const libMesh::NumericVector<Real>& sol) {
286 unsigned int n_dofs = (
unsigned int)vec.size();
289 f_x = RealVectorX::Zero(n_dofs),
290 f_m = RealVectorX::Zero(n_dofs);
293 f_m_jac_xddot = RealMatrixX::Zero(n_dofs, n_dofs),
294 f_m_jac_xdot = RealMatrixX::Zero(n_dofs, n_dofs),
295 f_m_jac = RealMatrixX::Zero(n_dofs, n_dofs),
296 f_x_jac_xdot = RealMatrixX::Zero(n_dofs, n_dofs),
297 f_x_jac = RealMatrixX::Zero(n_dofs, n_dofs);
300 _assembly_ops->elem_calculations(if_jac,
310 if (_if_highest_derivative_solution) {
375 mat = ((1./
beta/
dt/
dt) * f_m_jac_xddot +
377 (f_m_jac + f_x_jac));
388 libmesh_assert(_assembly_ops);
391 _assembly_ops->linearized_jacobian_solution_product(vec);
403 libmesh_assert(_assembly_ops);
404 unsigned int n_dofs = (
unsigned int)vec.size();
407 f_x = RealVectorX::Zero(n_dofs),
408 f_m = RealVectorX::Zero(n_dofs);
411 _assembly_ops->elem_sensitivity_calculations(f,
426 libmesh_assert(_assembly_ops);
427 libmesh_assert_equal_to(prev_sols.size(), 3);
429 unsigned int n_dofs = (
unsigned int)vec.size();
434 &accel = prev_sols[2];
436 dummy_vec = RealVectorX::Zero(n_dofs);
439 f_m_jac_xdot = RealMatrixX::Zero(n_dofs, n_dofs),
440 dummy_mat = RealMatrixX::Zero(n_dofs, n_dofs);
443 _assembly_ops->elem_calculations(
true,
450 libmesh_assert(
false);
460 libmesh_assert(
false);
470 libmesh_assert(
false);
virtual void set_element_data(const std::vector< libMesh::dof_id_type > &dof_indices, const std::vector< libMesh::NumericVector< Real > * > &sols)
provides the element with the transient data for calculations
virtual void elem_sensitivity_contribution_previous_timestep(const std::vector< RealVectorX > &prev_sols, RealVectorX &vec)
computes the contribution for this element from previous time step
virtual void update_delta_acceleration(libMesh::NumericVector< Real > &acc, const libMesh::NumericVector< Real > &sol)
update the perturbation in transient acceleration based on the current perturbed solution ...
virtual void update_acceleration(libMesh::NumericVector< Real > &vec, const libMesh::NumericVector< Real > &sol)
update the transient acceleration based on the current solution
virtual void update_sensitivity_velocity(libMesh::NumericVector< Real > &vel, const libMesh::NumericVector< Real > &sol)
update the transient sensitivity velocity based on the current sensitivity solution ...
virtual void elem_calculations(bool if_jac, RealVectorX &vec, RealMatrixX &mat)
performs the element calculations over elem, and returns the element vector and matrix quantities in ...
virtual void elem_sensitivity_calculations(const MAST::FunctionBase &f, RealVectorX &vec)=0
performs the element sensitivity calculations over elem, and returns the element residual sensitivity...
libMesh::NumericVector< Real > & solution_sensitivity(unsigned int prev_iter=0) const
libMesh::NumericVector< Real > & velocity(unsigned int prev_iter=0) const
virtual void update_delta_velocity(libMesh::NumericVector< Real > &vel, const libMesh::NumericVector< Real > &sol)
update the perturbation in transient velocity based on the current perturbed solution ...
Matrix< Real, Dynamic, Dynamic > RealMatrixX
virtual void elem_shape_sensitivity_calculations(const MAST::FunctionBase &f, RealVectorX &vec)=0
performs the element shape sensitivity calculations over elem, and returns the element residual sensi...
Real gamma
parameter used by this solver.
libMesh::NumericVector< Real > & velocity_sensitivity(unsigned int prev_iter=0) const
Matrix< Real, Dynamic, 1 > RealVectorX
virtual void elem_topology_sensitivity_calculations(const MAST::FunctionBase &f, const MAST::FieldFunction< RealVectorX > &vel, RealVectorX &vec)=0
performs the element topology sensitivity calculations over elem, and returns the element residual se...
virtual void update_sensitivity_acceleration(libMesh::NumericVector< Real > &acc, const libMesh::NumericVector< Real > &sol)
update the transient sensitivity acceleration based on the current sensitivity solution ...
libMesh::NumericVector< Real > & acceleration_sensitivity(unsigned int prev_iter=0) const
libMesh::NumericVector< Real > & solution(unsigned int prev_iter=0) const
MAST::AssemblyBase * _assembly
virtual void update_velocity(libMesh::NumericVector< Real > &vec, const libMesh::NumericVector< Real > &sol)
update the transient velocity based on the current solution
virtual void set_element_perturbed_data(const std::vector< libMesh::dof_id_type > &dof_indices, const std::vector< libMesh::NumericVector< Real > * > &sols)
provides the element with the transient data for calculations
virtual ~SecondOrderNewmarkTransientSolver()
SecondOrderNewmarkTransientSolver()
virtual void extract_element_sensitivity_data(const std::vector< libMesh::dof_id_type > &dof_indices, const std::vector< libMesh::NumericVector< Real > * > &sols, std::vector< RealVectorX > &local_sols)
provides the element with the sensitivity of transient data for calculations
Real beta
parameter used by this solver.
virtual void elem_linearized_jacobian_solution_product(RealVectorX &vec)=0
performs the element calculations over elem, and returns the element vector quantity in vec...
libMesh::NumericVector< Real > & acceleration(unsigned int prev_iter=0) const