Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
timestep_estimator.hpp
Go to the documentation of this file.
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
13 #pragma once
14 
15 #include "gretl/double_state.hpp"
17 
18 namespace smith {
19 
22  public:
24  virtual ~TimestepEstimator() {}
25 
27  virtual DoubleState dt(const FieldState& shape_disp, const std::vector<FieldState>& states,
28  const std::vector<FieldState>& params) const = 0;
29 };
30 
33  public:
37 
39  DoubleState dt([[maybe_unused]] const FieldState& shape_disp, [[maybe_unused]] const std::vector<FieldState>& states,
40  [[maybe_unused]] const std::vector<FieldState>& params) const override
41  {
42  double dt = dt_;
43  DoubleState DT = gretl::create_state<double, double>(
44  gretl::defaultInitializeZeroDual<double, double>(), [dt](FEFieldPtr) { return dt; },
45  [](FEFieldPtr, double, FEDualPtr&, double) {}, shape_disp);
46  return DT;
47  }
48 
49  double dt_;
50 };
51 
52 } // namespace smith
TimeStepEstimator which uses a simple and fixed timestep.
ConstantTimeStepEstimator(double dt)
Constructor.
DoubleState dt([[maybe_unused]] const FieldState &shape_disp, [[maybe_unused]] const std::vector< FieldState > &states, [[maybe_unused]] const std::vector< FieldState > &params) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
Base class interface for estimating the stable timestep given the current state and parameters.
virtual DoubleState dt(const FieldState &shape_disp, const std::vector< FieldState > &states, const std::vector< FieldState > &params) const =0
Interface method for estimating the stable timestep give the current state and parameters.
virtual ~TimestepEstimator()
destructor
Accelerator functionality.
Definition: smith.cpp:36
gretl::State< double, double > DoubleState
typedef
Definition: field_state.hpp:25
std::shared_ptr< FiniteElementState > FEFieldPtr
typedef
Definition: field_state.hpp:20
gretl::State< FEFieldPtr, FEDualPtr > FieldState
typedef
Definition: field_state.hpp:22
std::shared_ptr< FiniteElementDual > FEDualPtr
typedef
Definition: field_state.hpp:21