30 #ifndef OOMPH_ELASTIC_PROBLEMS_HEADER 31 #define OOMPH_ELASTIC_PROBLEMS_HEADER 35 #include <oomph-lib-config.h> 110 Max_residual_after_consistent_newton_ic=1.0e-12;
135 void set_static_initial_condition(
Problem* problem_pt,
146 set_static_initial_condition(problem_pt,mesh_pt,ic_pt,time);
153 template<
class TIMESTEPPER>
154 void set_newmark_initial_condition_directly(
Problem* problem_pt,
156 TIMESTEPPER* timestepper_pt,
174 template<
class TIMESTEPPER>
175 void set_newmark_initial_condition_consistently(
Problem* problem_pt,
177 TIMESTEPPER* timestepper_pt,
188 return Max_residual_after_consistent_newton_ic;
195 void backup_original_state();
198 void reset_original_state();
202 void setup_problem();
229 template<
class TIMESTEPPER>
231 Problem* problem_pt,
Mesh* wall_mesh_pt, TIMESTEPPER* timestepper_pt,
236 if (timestepper_pt->type()!=
"Newmark")
238 std::ostringstream error_message;
240 <<
"SolidICProblem::set_newmark_initial_condition_directly()\n" 241 <<
"can only be called for Newmark type timestepper whereas\n " 242 <<
"you've called it for " << timestepper_pt->type() << std::endl;
246 "SolidICProblem::set_newmark_initial_condition_directly()",
247 OOMPH_EXCEPTION_LOCATION);
252 timestepper_pt->time_pt()->dt()=dt;
255 timestepper_pt->set_weights();
261 mesh_pt()=wall_mesh_pt;
268 backup_original_state();
277 double current_time=timestepper_pt->time_pt()->time();
278 double previous_time=timestepper_pt->time_pt()->time(1);
284 IC_pt->geom_object_pt()->time_stepper_pt()->time_pt()->time()=
288 for (
unsigned t_deriv=0;t_deriv<=2;t_deriv++)
293 IC_pt->ic_time_deriv()=t_deriv;
299 unsigned n_node=mesh_pt()->nnode();
300 for(
unsigned n=0;n<n_node;n++)
304 timestepper_pt->assign_initial_data_values_stage1(
305 t_deriv,dynamic_cast<SolidNode*>(
306 mesh_pt()->
node_pt(n))->variable_position_pt());
320 IC_pt->geom_object_pt()->time_stepper_pt()->time_pt()->time()=
325 IC_pt->ic_time_deriv()=0;
331 unsigned n_node=mesh_pt()->nnode();
332 for(
unsigned n=0;n<n_node;n++)
334 timestepper_pt->assign_initial_data_values_stage2(
335 dynamic_cast<SolidNode*>(mesh_pt()->
node_pt(n))
336 ->variable_position_pt());
340 IC_pt->geom_object_pt()->time_stepper_pt()->time_pt()->time()=
344 reset_original_state();
352 oomph_info <<
"Number of equations in big problem: " 373 template<
class TIMESTEPPER>
375 Problem* problem_pt,
Mesh* wall_mesh_pt, TIMESTEPPER* timestepper_pt,
381 if (timestepper_pt->type()!=
"Newmark")
383 std::ostringstream error_message;
385 <<
"SolidICProblem::set_newmark_initial_condition_consistently()\n" 386 <<
"can only be called for Newmark type timestepper whereas\n " 387 <<
"you've called it for " << timestepper_pt->type() << std::endl;
392 "SolidICProblem::set_newmark_initial_condition_consistently()",
393 OOMPH_EXCEPTION_LOCATION);
398 timestepper_pt->time_pt()->dt()=dt;
401 timestepper_pt->set_weights();
407 mesh_pt()=wall_mesh_pt;
414 backup_original_state();
422 unsigned ntstorage=IC_pt->geom_object_pt()->time_stepper_pt()->
429 unsigned nprevtime=IC_pt->geom_object_pt()->time_stepper_pt()->
434 for (
unsigned i=0;
i<=nprevtime;
i++)
436 prev_time[
i]=IC_pt->geom_object_pt()->time_stepper_pt()->
442 for (
unsigned i=1;
i<=nprevtime;
i++)
447 IC_pt->geom_object_pt()->time_stepper_pt()->time_pt()->time()=
452 IC_pt->ic_time_deriv()=0;
460 unsigned n_node=mesh_pt()->nnode();
461 for(
unsigned n=0;n<n_node;n++)
464 Data* position_data_pt =
465 dynamic_cast<SolidNode*
>(mesh_pt()->node_pt(n))->variable_position_pt();
467 unsigned nval= position_data_pt->
nvalue();
471 for (
unsigned ival=0;ival<nval;ival++)
474 position_data_pt->
value(0,ival));
488 IC_pt->geom_object_pt()->time_stepper_pt()->time_pt()->time()=
493 IC_pt->ic_time_deriv()=1;
501 unsigned n_node=mesh_pt()->nnode();
502 for(
unsigned n=0;n<n_node;n++)
506 (mesh_pt()->node_pt(n))->variable_position_pt();
509 unsigned nval = position_data_pt->
nvalue();
513 for (
unsigned ival=0;ival<nval;ival++)
515 position_data_pt->
set_value(ntstorage-2,ival,
516 position_data_pt->
value(0,ival));
517 position_data_pt->
set_value(ntstorage-1,ival,0.0);
527 IC_pt->geom_object_pt()->time_stepper_pt()->time_pt()->time()=
532 IC_pt->ic_time_deriv()=0;
544 unsigned Nelement = mesh_pt()->nelement();
545 for(
unsigned i=0;
i<Nelement;
i++)
549 mesh_pt()->element_pt(
i));
572 (linear_solver_pt()->*solver_mem_pt)(
this,correction);
578 for(
unsigned n=0;n<n_node;n++)
581 Data* position_data_pt =
582 dynamic_cast<SolidNode*
>(mesh_pt()->node_pt(n))
583 ->variable_position_pt();
586 unsigned nval = position_data_pt->
nvalue();
591 for (
unsigned ival=0;ival<nval;ival++)
594 int ieqn = position_data_pt->
eqn_number(ival);
600 "No positional dofs should be pinned at this stage!",
601 OOMPH_CURRENT_FUNCTION,
602 OOMPH_EXCEPTION_LOCATION);
607 *(position_data_pt->
value_pt(ntstorage-1,ival))
616 get_residuals(residuals);
617 double res_max=residuals.
max();
618 oomph_info <<
"Max. residual after assigning consistent initial conditions: " 619 << res_max << std::endl;
620 if (res_max>Max_residual_after_consistent_newton_ic)
622 std::ostringstream error_message;
623 error_message <<
"Residual is bigger than allowed! [Current tolerance: " 624 << Max_residual_after_consistent_newton_ic <<
"]\n\n";
625 error_message <<
"This is probably because you've not specified the " 626 <<
"correct multiplier \n(the product of growth factor " 627 <<
"and timescale ratio [the non-dim density]). \nPlease " 628 <<
"check the Solid Mechanics Theory Tutorial for " 630 <<
"If you're sure that the residual is OK, overwrite " 631 <<
"the default tolerance using\n";
633 <<
"SolidICProblem::max_residual_after_consistent_newton_ic()" 634 << std::endl <<
"or recompile without the PARANOID flag." << std::endl;
638 OOMPH_CURRENT_FUNCTION,
639 OOMPH_EXCEPTION_LOCATION);
644 reset_original_state();
652 oomph_info <<
"Number of equations in big problem: " virtual void solve(Problem *const &problem_pt, DoubleVector &result)=0
Solver: Takes pointer to problem and returns the results vector which contains the solution of the li...
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
void set_newmark_initial_condition_consistently(Problem *problem_pt, Mesh *mesh_pt, TIMESTEPPER *timestepper_pt, SolidInitialCondition *ic_pt, const double &dt, SolidFiniteElement::MultiplierFctPt multiplier_fct_pt=0)
Setup initial condition for time-integration with Newmark's method. Past displacements and velocities...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void set_newmark_initial_condition_directly(Problem *problem_pt, Mesh *mesh_pt, TIMESTEPPER *timestepper_pt, SolidInitialCondition *ic_pt, const double &dt)
Setup initial condition for time-integration with Newmark's method. History values are assigned to th...
double Max_residual_after_consistent_newton_ic
Max. tolerated residual after application of consistent Newmark IC. Used to check if we have specifie...
A class to specify the initial conditions for a solid body. Solid bodies are often discretised with H...
SolidInitialCondition *& solid_ic_pt()
Pointer to object that describes the initial condition.
SolidICProblem()
Constructor. Initialise pointer to IC object to NULL. Create a dummy mesh that can be deleted when st...
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
double & max_residual_after_consistent_newton_ic()
Max. tolerated residual after application of consistent Newmark IC. Used to check if we have specifie...
void operator=(const SolidICProblem &)
Broken assignment operator.
double(* MultiplierFctPt)(const Vector< double > &xi)
Pointer to function that computes the "multiplier" for the inertia terms in the consistent determinat...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Dummy mesh that can be created and deleted in SolidICProblem.
void enable_solve_for_consistent_newmark_accel()
Set to alter the problem being solved when assigning the initial conditions for time-dependent proble...
MultiplierFctPt & multiplier_fct_pt()
Access function: Pointer to multiplicator function for assignment of consistent assignement of initia...
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
void actions_before_newton_solve()
Update the problem specs before solve. (empty)
A class that represents a collection of data; each Data object may contain many different individual ...
SolidInitialCondition * IC_pt
Pointer to initial condition object.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
void actions_after_newton_solve()
Update after solve (empty)
A Class for nodes that deform elastically (i.e. position is an unknown in the problem). The idea is that the Eulerian positions are stored in a Data object and the Lagrangian coordinates are stored in addition. The pointer that addresses the Eulerian positions is set to the pointer to Value in the Data object. Hence, SolidNode uses knowledge of the internal structure of Data and must be a friend of the Data class. In order to allow a mesh to deform via an elastic-style equation in deforming-domain problems, the positions are stored separately from the values, so that elastic problems may be combined with any other type of problem.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
Vector< int > Backup_pinned
Vector to store pinned status of all data.
unsigned long assign_eqn_numbers(const bool &assign_local_eqn_numbers=true)
Assign all equation numbers for problem: Deals with global data (= data that isn't attached to any el...
Vector< Vector< Data * > > Backup_ext_data
Vector of Vectors to store pointers to exernal data in the elements.
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
SolidICProblem(const SolidICProblem &)
Broken copy constructor.
SolidFiniteElement class.
void set_static_initial_condition(Problem *problem_pt, Mesh *mesh_pt, SolidInitialCondition *ic_pt)
Force the elastic structure that is discretised on the specified mesh to deform in the shape of the i...
IC problem for an elastic body discretised on a given (sub)-mesh. We switch the elements' residuals a...
double max() const
returns the maximum coefficient