26 #ifndef OOMPH_ELASTIC_PROBLEMS_HEADER
27 #define OOMPH_ELASTIC_PROBLEMS_HEADER
31 #include <oomph-lib-config.h>
138 template<
class TIMESTEPPER>
141 TIMESTEPPER* timestepper_pt,
159 template<
class TIMESTEPPER>
163 TIMESTEPPER* timestepper_pt,
211 template<
class TIMESTEPPER>
215 TIMESTEPPER* timestepper_pt,
220 if (timestepper_pt->type() !=
"Newmark")
222 std::ostringstream error_message;
224 <<
"SolidICProblem::set_newmark_initial_condition_directly()\n"
225 <<
"can only be called for Newmark type timestepper whereas\n "
226 <<
"you've called it for " << timestepper_pt->type() << std::endl;
230 "SolidICProblem::set_newmark_initial_condition_directly()",
231 OOMPH_EXCEPTION_LOCATION);
236 timestepper_pt->time_pt()->dt() = dt;
239 timestepper_pt->set_weights();
261 double current_time = timestepper_pt->time_pt()->time();
262 double previous_time = timestepper_pt->time_pt()->time(1);
272 for (
unsigned t_deriv = 0; t_deriv <= 2; t_deriv++)
283 for (
unsigned n = 0; n < n_node; n++)
287 timestepper_pt->assign_initial_data_values_stage1(
290 ->variable_position_pt());
315 for (
unsigned n = 0; n < n_node; n++)
317 timestepper_pt->assign_initial_data_values_stage2(
319 ->variable_position_pt());
335 oomph_info <<
"Number of equations in big problem: "
355 template<
class TIMESTEPPER>
359 TIMESTEPPER* timestepper_pt,
365 if (timestepper_pt->type() !=
"Newmark")
367 std::ostringstream error_message;
369 <<
"SolidICProblem::set_newmark_initial_condition_consistently()\n"
370 <<
"can only be called for Newmark type timestepper whereas\n "
371 <<
"you've called it for " << timestepper_pt->type() << std::endl;
375 "SolidICProblem::set_newmark_initial_condition_consistently()",
376 OOMPH_EXCEPTION_LOCATION);
381 timestepper_pt->time_pt()->dt() = dt;
384 timestepper_pt->set_weights();
417 for (
unsigned i = 0;
i <= nprevtime;
i++)
425 for (
unsigned i = 1;
i <= nprevtime;
i++)
443 for (
unsigned n = 0; n < n_node; n++)
447 ->variable_position_pt();
449 unsigned nval = position_data_pt->
nvalue();
453 for (
unsigned ival = 0; ival < nval; ival++)
456 i, ival, position_data_pt->
value(0, ival));
484 for (
unsigned n = 0; n < n_node; n++)
487 Data* position_data_pt =
491 unsigned nval = position_data_pt->
nvalue();
495 for (
unsigned ival = 0; ival < nval; ival++)
498 ntstorage - 2, ival, position_data_pt->
value(0, ival));
499 position_data_pt->
set_value(ntstorage - 1, ival, 0.0);
527 for (
unsigned i = 0;
i < Nelement;
i++)
559 for (
unsigned n = 0; n < n_node; n++)
562 Data* position_data_pt =
566 unsigned nval = position_data_pt->
nvalue();
571 for (
unsigned ival = 0; ival < nval; ival++)
574 int ieqn = position_data_pt->
eqn_number(ival);
580 "No positional dofs should be pinned at this stage!",
581 OOMPH_CURRENT_FUNCTION,
582 OOMPH_EXCEPTION_LOCATION);
587 *(position_data_pt->
value_pt(ntstorage - 1, ival)) -= correction[ieqn];
596 double res_max = residuals.
max();
598 <<
"Max. residual after assigning consistent initial conditions: "
599 << res_max << std::endl;
602 std::ostringstream error_message;
603 error_message <<
"Residual is bigger than allowed! [Current tolerance: "
605 error_message <<
"This is probably because you've not specified the "
606 <<
"correct multiplier \n(the product of growth factor "
607 <<
"and timescale ratio [the non-dim density]). \nPlease "
608 <<
"check the Solid Mechanics Theory Tutorial for "
610 <<
"If you're sure that the residual is OK, overwrite "
611 <<
"the default tolerance using\n";
613 <<
"SolidICProblem::max_residual_after_consistent_newton_ic()"
615 <<
"or recompile without the PARANOID flag." << std::endl;
618 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
631 oomph_info <<
"Number of equations in big problem: "
A class that represents a collection of data; each Data object may contain many different individual ...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
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...
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...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
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 ...
A vector in the mathematical sense, initially developed for linear algebra type applications....
double max() const
returns the maximum coefficient
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
Base class for all linear solvers. This merely defines standard interfaces for linear solvers,...
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...
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nnode() const
Return number of nodes in the mesh.
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
unsigned long nelement() const
Return number of elements in the mesh.
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
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...
void newton_solve()
Use Newton method to solve the problem.
LinearSolver *& linear_solver_pt()
Return a pointer to the linear solver object.
virtual void get_residuals(DoubleVector &residuals)
Return the fully-assembled residuals Vector for the problem: Virtual so it can be overloaded in for m...
Mesh *& mesh_pt()
Return a pointer to the global mesh.
double & time()
Return the current value of continuous time.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
double(* MultiplierFctPt)(const Vector< double > &xi)
Pointer to function that computes the "multiplier" for the inertia terms in the consistent determinat...
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...
SolidInitialCondition *& solid_ic_pt()
Pointer to object that describes the initial condition.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
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 backup_original_state()
Backup original state of all data associated with mesh.
double & max_residual_after_consistent_newton_ic()
Max. tolerated residual after application of consistent Newmark IC. Used to check if we have specifie...
Vector< Vector< Data * > > Backup_ext_data
Vector of Vectors to store pointers to exernal data in the elements.
void operator=(const SolidICProblem &)=delete
Broken assignment operator.
void setup_problem()
Change pinned status of all data associated with mesh so that the IC problem can be solved.
void set_static_initial_condition(Problem *problem_pt, Mesh *mesh_pt, SolidInitialCondition *ic_pt, const double &time)
Force the elastic structure that is discretised on the specified mesh to deform in the shape of the i...
SolidICProblem(const SolidICProblem &)=delete
Broken copy constructor.
Vector< int > Backup_pinned
Vector to store pinned status of all data.
double Max_residual_after_consistent_newton_ic
Max. tolerated residual after application of consistent Newmark IC. Used to check if we have specifie...
void reset_original_state()
Reset original state of all data associated with mesh.
SolidInitialCondition * IC_pt
Pointer to initial condition object.
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...
void actions_before_newton_solve()
Update the problem specs before solve. (empty)
SolidICProblem()
Constructor. Initialise pointer to IC object to NULL. Create a dummy mesh that can be deleted when st...
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...
void actions_after_newton_solve()
Update after solve (empty)
A class to specify the initial conditions for a solid body. Solid bodies are often discretised with H...
GeomObject *& geom_object_pt()
(Reference to) pointer to geom object that specifies the initial condition
unsigned & ic_time_deriv()
Which time derivative are we currently assigning?
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
Time *const & time_pt() const
Access function for the pointer to time (const version)
double & time()
Return the current value of the continuous time.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...