43 for (
unsigned j = 0, nj = data_pt->
nvalue(); j < nj; j++)
47 for (
unsigned t =
ndt();
t > 0;
t--)
60 unsigned n_dim = node_pt->
ndim();
68 double velocity[n_position_type][n_dim];
74 for (
unsigned i = 0;
i < n_dim;
i++)
76 for (
unsigned k = 0; k < n_position_type; k++)
81 for (
unsigned t = 0;
t < n_tstorage;
t++)
90 for (
unsigned i = 0;
i < n_dim;
i++)
96 for (
unsigned k = 0; k < n_position_type; k++)
99 for (
unsigned t =
ndt();
t > 0;
t--)
132 std::string err(
"Tried to get the temporal error from a non-adaptive");
133 err +=
" time stepper.";
135 err, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
146 std::string err =
"This implementation of midpoint can only work with a ";
147 err +=
"single time stepper, try using IMR instead (but check ";
148 err +=
"your Jacobian and residual calculations very carefully for "
151 err, OOMPH_EXCEPTION_LOCATION, OOMPH_CURRENT_FUNCTION);
177 for (
unsigned i = 0;
i < problem_pt->
ndof();
i++)
179 problem_pt->
dof(
i) = (problem_pt->
dof(
i) + dof_n[
i]) / 2;
190 for (
unsigned j = 0, nj = dat_pt->
nvalue(); j < nj; j++)
193 if (update_pinned || eqn >= 0)
195 double ynp1 = 2 * dat_pt->
value(0, j) - dat_pt->
value(1, j);
208 const unsigned ndof = problem_pt->
ndof();
213 for (
unsigned i = 0;
i < ndof;
i++)
215 dof_np1[
i] += dof_np1[
i] - dof_n[
i];
248 using namespace StringConversion;
250 problem_pt->
get_dofs(actual_dof_np1);
252 for (
unsigned j = 0; j < actual_dof_np1.
nrow(); j++)
254 if (std::abs(actual_dof_np1[j] - dof_np1[j]) > 1
e-8)
256 std::string err =
"Got different values doing midpoint update via "
257 "extracted dofs than doing it in place!";
260 err, OOMPH_EXCEPTION_LOCATION, OOMPH_CURRENT_FUNCTION);
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.
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...
virtual bool is_a_copy() const
Return a boolean to indicate whether the Data objact contains any copied values. A base Data object c...
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 ...
unsigned nrow() const
access function to the number of global rows.
A vector in the mathematical sense, initially developed for linear algebra type applications....
A Generalised Element class.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
unsigned ninternal_data() const
Return the number of internal data objects.
void calculate_predicted_values(Data *const &data_pt)
Dummy - just check that the values that problem::calculate_predicted_values() has been called right.
void shift_time_values(Data *const &data_pt)
This function advances the Data's time history so that we can move on to the next timestep.
void shift_time_positions(Node *const &node_pt)
This function advances the time history of the positions at a node.
unsigned ndt() const
Number of timestep increments that are required by the scheme.
double temporal_error_in_value(Data *const &data_pt, const unsigned &i)
Compute the error in the value i in a Data structure zero here – overwrite for specific scheme.
bool Update_pinned
Should we update pinned variables after the half-step?
void actions_after_timestep(Problem *problem_pt)
Take problem from t={n+1/2} to t=n+1 by algebraic update and restore time step.
void set_weights()
Setup weights for time derivative calculations.
void actions_before_timestep(Problem *problem_pt)
Half the timestep before starting solve.
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.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x_gen(const unsigned &k, const unsigned &i)
Reference to the generalised position x(k,i). ‘Type’: k; Coordinate direction: i.
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
virtual bool position_is_a_copy() const
Return whether any position coordinate has been copied (always false)
unsigned nposition_type() const
Number of coordinate types needed in the mapping between local and global coordinates.
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
unsigned long ndof() const
Return the number of dofs.
bool & use_predictor_values_as_initial_guess()
Time *& time_pt()
Return a pointer to the global time object.
unsigned nglobal_data() const
Return the number of global data values.
double & dof(const unsigned &i)
i-th dof in the problem
Mesh *& mesh_pt()
Return a pointer to the global mesh.
unsigned ntime_stepper() const
Return the number of time steppers.
void get_dofs(DoubleVector &dofs) const
Return the vector of dofs, i.e. a vector containing the current values of all unknowns.
Data *& global_data_pt(const unsigned &i)
Return a pointer to the the i-th global data object.
DenseMatrix< double > Weight
Storage for the weights associated with the timestepper.
void check_predicted_values_up_to_date() const
Check that the predicted values are the ones we want.
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
bool adaptive_flag() const
Function to indicate whether the scheme is adaptive (false by default)
Time *const & time_pt() const
Access function for the pointer to time (const version)
int Predictor_storage_index
The time-index in each Data object where predicted values are stored. -1 if not set.
double & dt(const unsigned &t=0)
Return the value of the t-th stored timestep (t=0: present; t>0: previous).
double & time()
Return the current value of the continuous time.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types).
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void post_midpoint_update(Data *dat_pt, const bool &update_pinned)
Local (not exported in header) helper function to handle midpoint update on a data object.