62 template <
typename T1,
typename T2>
69 template <
typename T1,
typename T2>
72 return (1.0 / t.
dt()) * (field_new - field_old);
76 template <
typename T1,
typename T2>
79 return std::make_tuple(
value(t, field_new, field_old),
dot(t, field_new, field_old));
85 return value(t, states[0], states[1]);
91 return dot(t, states[0], states[1]);
97 SLIC_ERROR(
"BackwardEulerFirstOrderTimeIntegrationRule does not support second derivatives.");
116 template <
typename T1>
124 template <
typename T1>
132 template <
typename T1>
135 return std::make_tuple(
value(t, field_new),
dot(t, field_new));
141 return value(t, states[0]);
153 SLIC_ERROR(
"QuasiStaticRule does not support second derivatives.");
168 template <
typename T1>
177 template <
typename T1>
186 template <
typename T1>
195 template <
typename T1>
198 return std::make_tuple(
value(t, field_new),
dot(t, field_new),
ddot(t, field_new));
203 return value(t, states[0]);
239 template <
typename T1,
typename T2,
typename T3,
typename T4>
241 [[maybe_unused]]
const T2& field_old, [[maybe_unused]]
const T3& velo_old,
242 [[maybe_unused]]
const T4& accel_old)
const
244 auto regular_value = field_new + (field_old - field_old);
245 auto cycle_zero_correction = field_old - field_new;
246 if (t.isCycleZeroEvaluation()) {
247 return regular_value + cycle_zero_correction;
249 return regular_value + (cycle_zero_correction - cycle_zero_correction);
253 template <
typename T1,
typename T2,
typename T3,
typename T4>
255 [[maybe_unused]]
const T2& field_old, [[maybe_unused]]
const T3& velo_old,
256 [[maybe_unused]]
const T4& accel_old)
const
258 auto regular_dot = (2.0 / t.dt()) * (field_new - field_old) - velo_old;
259 auto cycle_zero_correction = velo_old - regular_dot;
260 if (t.isCycleZeroEvaluation()) {
261 return regular_dot + cycle_zero_correction;
263 return regular_dot + (cycle_zero_correction - cycle_zero_correction);
267 template <
typename T1,
typename T2,
typename T3,
typename T4>
269 [[maybe_unused]]
const T2& field_old, [[maybe_unused]]
const T3& velo_old,
270 [[maybe_unused]]
const T4& accel_old)
const
273 auto regular_ddot = (4.0 / (dt * dt)) * (field_new - field_old) - (4.0 / dt) * velo_old - accel_old;
274 auto cycle_zero_correction = accel_old - regular_ddot;
275 if (t.isCycleZeroEvaluation()) {
276 return regular_ddot + cycle_zero_correction;
278 return regular_ddot + (cycle_zero_correction - cycle_zero_correction);
282 template <
typename T1,
typename T2,
typename T3,
typename T4>
284 const T4& accel_old)
const
286 return std::make_tuple(
value(t, field_new, field_old, velo_old, accel_old),
287 dot(t, field_new, field_old, velo_old, accel_old),
288 ddot(t, field_new, field_old, velo_old, accel_old));
294 return value(t, states[0], states[1], states[2], states[3]);
300 return dot(t, states[0], states[1], states[2], states[3]);
306 return ddot(t, states[0], states[1], states[2], states[3]);
328 template <
typename T1,
typename T2,
typename T3,
typename T4>
330 [[maybe_unused]]
const T2& field_old, [[maybe_unused]]
const T3& velo_old,
331 [[maybe_unused]]
const T4& accel_old)
const
337 template <
typename T1,
typename T2,
typename T3,
typename T4>
339 [[maybe_unused]]
const T2& field_old, [[maybe_unused]]
const T3& velo_old,
340 [[maybe_unused]]
const T4& accel_old)
const
342 return (1.0 / t.dt()) * (field_new - field_old);
346 template <
typename T1,
typename T2,
typename T3,
typename T4>
348 [[maybe_unused]]
const T2& field_old, [[maybe_unused]]
const T3& velo_old,
349 [[maybe_unused]]
const T4& accel_old)
const
355 template <
typename T1,
typename T2,
typename T3,
typename T4>
357 const T4& accel_old)
const
359 return std::make_tuple(
value(t, field_new, field_old, velo_old, accel_old),
360 dot(t, field_new, field_old, velo_old, accel_old),
361 ddot(t, field_new, field_old, velo_old, accel_old));
367 return value(t, states[0], states[1], states[2], states[3]);
373 return dot(t, states[0], states[1], states[2], states[3]);
#define SMITH_HOST_DEVICE
Macro that evaluates to __host__ __device__ when compiling with nvcc or amdclang and does nothing on ...
encodes rules for time discretizing first order odes (involving first time derivatives)....
SMITH_HOST_DEVICE auto dot(const TimeInfo &t, const T1 &field_new, const T2 &field_old) const
evaluate time derivative discretization of the ode state as used by the integration rule
FieldState corrected_value(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
BackwardEulerFirstOrderTimeIntegrationRule()
Constructor.
FieldState corrected_ddot(const TimeInfo &, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
static constexpr int num_states
number of states required by this rule (compile-time)
FieldState corrected_dot(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
SMITH_HOST_DEVICE auto value(const TimeInfo &, const T1 &field_new, const T2 &) const
evaluate value of the ode state as used by the integration rule
int num_args() const override
get the number of states required by the rule
SMITH_HOST_DEVICE auto interpolate(const TimeInfo &t, const T1 &field_new, const T2 &field_old) const
interpolate all derived quantities in one call
encodes rules for time discretizing first order odes where time derivatives are zero....
FieldState corrected_dot(const TimeInfo &, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
SMITH_HOST_DEVICE auto dot(const TimeInfo &, const T1 &) const
evaluate time derivative discretization of the ode state as used by the integration rule
int num_args() const override
get the number of states required by the rule
FieldState corrected_value(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
FieldState corrected_ddot(const TimeInfo &, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
SMITH_HOST_DEVICE auto interpolate(const TimeInfo &t, const T1 &field_new) const
interpolate all derived quantities in one call
QuasiStaticRule()
Constructor.
SMITH_HOST_DEVICE auto value(const TimeInfo &, const T1 &field_new) const
evaluate value of the ode state as used by the integration rule
static constexpr int num_states
number of states required by this rule (compile-time)
encodes rules for static postprocessing fields with zero time derivatives.
FieldState corrected_dot(const TimeInfo &, const std::vector< FieldState > &states) const override
update the current value of the independent variable's first time derivative, given the predicted val...
SMITH_HOST_DEVICE auto interpolate(const TimeInfo &t, const T1 &field_new) const
Return value, first derivative, and second derivative for a static field.
SMITH_HOST_DEVICE auto ddot(const TimeInfo &, const T1 &) const
Return zero second derivative for a static field.
FieldState corrected_value(const TimeInfo &t, const std::vector< FieldState > &states) const override
update the current value of the independent variable, given the predicted value of the current indepe...
SMITH_HOST_DEVICE auto value(const TimeInfo &, const T1 &field_new) const
Return the static field value.
int num_args() const override
get the number of states required by the rule
static constexpr int num_states
number of states required by this rule (compile-time)
SMITH_HOST_DEVICE auto dot(const TimeInfo &, const T1 &) const
Return zero first derivative for a static field.
FieldState corrected_ddot(const TimeInfo &, const std::vector< FieldState > &states) const override
update the current value of the independent variable's second time derivative, given the predicted va...
Abstract time integration rule for discretizing odes in time.
virtual ~TimeIntegrationRule()
destructor
virtual FieldState corrected_ddot(const TimeInfo &t, const std::vector< FieldState > &states) const =0
update the current value of the independent variable's second time derivative, given the predicted va...
virtual FieldState corrected_value(const TimeInfo &t, const std::vector< FieldState > &states) const =0
update the current value of the independent variable, given the predicted value of the current indepe...
virtual bool requiresInitialAccelerationSolve() const
whether this rule needs a cycle-zero initial acceleration solve
virtual FieldState corrected_dot(const TimeInfo &t, const std::vector< FieldState > &states) const =0
update the current value of the independent variable's first time derivative, given the predicted val...
virtual int num_args() const =0
get the number of states required by the rule
A file defining some enums and structs that are used by the different physics modules.
Accelerator functionality.
gretl::State< FEFieldPtr, FEDualPtr > FieldState
typedef
FieldState zeroCopy(const FieldState &x)
gretl-function to make a deep-copy of a FieldState and initialize it to 0.
encodes rules for time discretizing second order odes (involving first and second time derivatives)....
SMITH_HOST_DEVICE auto value([[maybe_unused]] const TimeInfo &t, [[maybe_unused]] const T1 &field_new, [[maybe_unused]] const T2 &field_old, [[maybe_unused]] const T3 &velo_old, [[maybe_unused]] const T4 &accel_old) const
evaluate value of the ode state as used by the integration rule
int num_args() const override
get the number of states required by the rule
SMITH_HOST_DEVICE auto interpolate(const TimeInfo &t, const T1 &field_new, const T2 &field_old, const T3 &velo_old, const T4 &accel_old) const
interpolate all derived quantities in one call
FieldState corrected_ddot(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool requiresInitialAccelerationSolve() const override
implicit second-order dynamics needs the cycle-zero acceleration solve
ImplicitNewmarkSecondOrderTimeIntegrationRule()
Constructor.
FieldState corrected_dot(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
static constexpr int num_states
number of states required by this rule (compile-time)
SMITH_HOST_DEVICE auto dot([[maybe_unused]] const TimeInfo &t, [[maybe_unused]] const T1 &field_new, [[maybe_unused]] const T2 &field_old, [[maybe_unused]] const T3 &velo_old, [[maybe_unused]] const T4 &accel_old) const
evaluate time derivative discretization of the ode state as used by the integration rule
SMITH_HOST_DEVICE auto ddot([[maybe_unused]] const TimeInfo &t, [[maybe_unused]] const T1 &field_new, [[maybe_unused]] const T2 &field_old, [[maybe_unused]] const T3 &velo_old, [[maybe_unused]] const T4 &accel_old) const
evaluate time derivative discretization of the ode state as used by the integration rule
FieldState corrected_value(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
encodes rules for time discretizing second order odes (involving first and second time derivatives)....
SMITH_HOST_DEVICE auto ddot([[maybe_unused]] const TimeInfo &t, [[maybe_unused]] const T1 &field_new, [[maybe_unused]] const T2 &field_old, [[maybe_unused]] const T3 &velo_old, [[maybe_unused]] const T4 &accel_old) const
evaluate time derivative discretization of the ode state as used by the integration rule
FieldState corrected_value(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
FieldState corrected_ddot(const TimeInfo &, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
FieldState corrected_dot(const TimeInfo &t, const std::vector< FieldState > &states) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
int num_args() const override
get the number of states required by the rule
bool requiresInitialAccelerationSolve() const override
quasi-static second-order rules do not need the cycle-zero acceleration solve
SMITH_HOST_DEVICE auto dot([[maybe_unused]] const TimeInfo &t, [[maybe_unused]] const T1 &field_new, [[maybe_unused]] const T2 &field_old, [[maybe_unused]] const T3 &velo_old, [[maybe_unused]] const T4 &accel_old) const
evaluate time derivative discretization of the ode state as used by the integration rule
QuasiStaticSecondOrderTimeIntegrationRule()
Constructor.
SMITH_HOST_DEVICE auto value([[maybe_unused]] const TimeInfo &t, [[maybe_unused]] const T1 &field_new, [[maybe_unused]] const T2 &field_old, [[maybe_unused]] const T3 &velo_old, [[maybe_unused]] const T4 &accel_old) const
evaluate value of the ode state as used by the integration rule
static constexpr int num_states
number of states required by this rule (compile-time)
SMITH_HOST_DEVICE auto interpolate(const TimeInfo &t, const T1 &field_new, const T2 &field_old, const T3 &velo_old, const T4 &accel_old) const
interpolate all derived quantities in one call
struct storing time and timestep information
double dt() const
accessor for dt
A sentinel struct for eliding no-op tensor operations.