GRINS-0.8.0
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GRINS::AdaptiveTimeSteppingOptions Class Reference

Container for adaptive time-stepping options. More...

#include <adaptive_time_stepping_options.h>

Public Member Functions

 AdaptiveTimeSteppingOptions (const GetPot &input)
 
 ~AdaptiveTimeSteppingOptions ()
 
bool is_time_adaptive () const
 
double target_tolerance () const
 
double upper_tolerance () const
 
double max_growth () const
 
const libMesh::SystemNorm & component_norm ()
 

Private Member Functions

void check_dup_input_style (const GetPot &input) const
 
bool is_old_style (const GetPot &input) const
 
void parse_old_style (const GetPot &input)
 
void parse_new_style (const GetPot &input)
 
void parse_options (const GetPot &input, const std::string &section)
 

Private Attributes

bool _is_time_adaptive
 
double _target_tolerance
 0.0 means there is no adaptive time stepping enabled. More...
 
double _upper_tolerance
 
double _max_growth
 
libMesh::SystemNorm _component_norm
 

Detailed Description

Container for adaptive time-stepping options.

Definition at line 40 of file adaptive_time_stepping_options.h.

Constructor & Destructor Documentation

GRINS::AdaptiveTimeSteppingOptions::AdaptiveTimeSteppingOptions ( const GetPot &  input)

Definition at line 37 of file adaptive_time_stepping_options.C.

References _is_time_adaptive, _target_tolerance, check_dup_input_style(), is_old_style(), parse_new_style(), and parse_old_style().

38  : _is_time_adaptive(false),
39  _target_tolerance(0.0),
40  _upper_tolerance(0.0),
41  _max_growth(0.0)
42  {
43  this->check_dup_input_style(input);
44 
45  if( this->is_old_style(input) )
46  this->parse_old_style(input);
47  else
48  this->parse_new_style(input);
49 
50  if( _target_tolerance != 0.0 )
51  _is_time_adaptive = true;
52  }
double _target_tolerance
0.0 means there is no adaptive time stepping enabled.
void check_dup_input_style(const GetPot &input) const
bool is_old_style(const GetPot &input) const
GRINS::AdaptiveTimeSteppingOptions::~AdaptiveTimeSteppingOptions ( )
inline

Definition at line 44 of file adaptive_time_stepping_options.h.

44 {};

Member Function Documentation

void GRINS::AdaptiveTimeSteppingOptions::check_dup_input_style ( const GetPot &  input) const
private

Definition at line 54 of file adaptive_time_stepping_options.C.

Referenced by AdaptiveTimeSteppingOptions().

55  {
56  if( (input.have_variable("unsteady-solver/target_tolerance") &&
57  input.have_section("Strategies/AdaptiveTimeStepping/target_tolerance")) ||
58  (input.have_variable("unsteady-solver/upper_tolerance") &&
59  input.have_section("Strategies/AdaptiveTimeStepping/upper_tolerance")) ||
60  (input.have_variable("unsteady-solver/max_growth") &&
61  input.have_section("Strategies/AdaptiveTimeStepping/max_growth")) )
62  libmesh_error_msg("ERROR: Cannot use both old and new style of options for AdaptiveTimeSteppingOptions!");
63  }
const libMesh::SystemNorm& GRINS::AdaptiveTimeSteppingOptions::component_norm ( )
inline
bool GRINS::AdaptiveTimeSteppingOptions::is_old_style ( const GetPot &  input) const
private

Definition at line 65 of file adaptive_time_stepping_options.C.

Referenced by AdaptiveTimeSteppingOptions().

66  {
67  return input.have_variable("unsteady-solver/target_tolerance");
68  }
bool GRINS::AdaptiveTimeSteppingOptions::is_time_adaptive ( ) const
inline
double GRINS::AdaptiveTimeSteppingOptions::max_growth ( ) const
inline
void GRINS::AdaptiveTimeSteppingOptions::parse_new_style ( const GetPot &  input)
private

Definition at line 83 of file adaptive_time_stepping_options.C.

References parse_options().

Referenced by AdaptiveTimeSteppingOptions().

84  {
85  std::string section = "Strategies/AdaptiveTimeStepping";
86  this->parse_options(input,section);
87  }
void parse_options(const GetPot &input, const std::string &section)
void GRINS::AdaptiveTimeSteppingOptions::parse_old_style ( const GetPot &  input)
private

Definition at line 70 of file adaptive_time_stepping_options.C.

References grins_warning, and parse_options().

Referenced by AdaptiveTimeSteppingOptions().

71  {
72  {
73  std::string warning = "WARNING: Using [MeshAdaptivity/<options>] is a DEPRECATED\n";
74  warning += " style of input for ErrorEstimator options. Please\n";
75  warning += " update to use the [Strategies/ErrorEstimation/<options> style.\n";
76  grins_warning(warning);
77  }
78 
79  std::string section = "unsteady-solver";
80  this->parse_options(input,section);
81  }
#define grins_warning(message)
Definition: common.h:34
void parse_options(const GetPot &input, const std::string &section)
void GRINS::AdaptiveTimeSteppingOptions::parse_options ( const GetPot &  input,
const std::string &  section 
)
private

Definition at line 89 of file adaptive_time_stepping_options.C.

References _component_norm, _max_growth, _target_tolerance, and _upper_tolerance.

Referenced by parse_new_style(), and parse_old_style().

90  {
91  // If the user set the target tolerance, for them to set the other values too
92  if( input.have_variable(section+"/target_tolerance") )
93  {
94  if( !input.have_variable(section+"/upper_tolerance") )
95  libmesh_error_msg("ERROR: Must specify "+section+"/upper_tolerance for adaptive time stepping!");
96 
97  if( !input.have_variable(section+"/max_growth") )
98  libmesh_error_msg("ERROR: Must specify "+section+"/max_growth for adaptive time stepping!");
99  }
100 
101  _target_tolerance = input(section+"/target_tolerance", 0.0 );
102  _upper_tolerance = input(section+"/upper_tolerance", 0.0 );
103  _max_growth = input(section+"/max_growth", 0.0 );
104 
105  // parse component_norm
106  const unsigned int n_component_norm =
107  input.vector_variable_size(section+"/component_norm");
108 
109  for (unsigned int i=0; i != n_component_norm; ++i)
110  {
111  const std::string current_norm = input(section+"/component_norm", std::string("L2"), i);
112  _component_norm.set_type(i, libMesh::Utility::string_to_enum<libMesh::FEMNormType>(current_norm) );
113  }
114  }
double _target_tolerance
0.0 means there is no adaptive time stepping enabled.
double GRINS::AdaptiveTimeSteppingOptions::target_tolerance ( ) const
inline

Definition at line 49 of file adaptive_time_stepping_options.h.

References _target_tolerance.

Referenced by GRINS::UnsteadySolver::init_time_solver().

50  { return _target_tolerance; }
double _target_tolerance
0.0 means there is no adaptive time stepping enabled.
double GRINS::AdaptiveTimeSteppingOptions::upper_tolerance ( ) const
inline

Member Data Documentation

libMesh::SystemNorm GRINS::AdaptiveTimeSteppingOptions::_component_norm
private

Definition at line 84 of file adaptive_time_stepping_options.h.

Referenced by component_norm(), and parse_options().

bool GRINS::AdaptiveTimeSteppingOptions::_is_time_adaptive
private
double GRINS::AdaptiveTimeSteppingOptions::_max_growth
private

Definition at line 81 of file adaptive_time_stepping_options.h.

Referenced by max_growth(), and parse_options().

double GRINS::AdaptiveTimeSteppingOptions::_target_tolerance
private

0.0 means there is no adaptive time stepping enabled.

To enable adaptive time stepping with the libMesh::TwostepTimeSolver, this parameter should be positive.

Definition at line 79 of file adaptive_time_stepping_options.h.

Referenced by AdaptiveTimeSteppingOptions(), parse_options(), and target_tolerance().

double GRINS::AdaptiveTimeSteppingOptions::_upper_tolerance
private

Definition at line 80 of file adaptive_time_stepping_options.h.

Referenced by parse_options(), and upper_tolerance().


The documentation for this class was generated from the following files:

Generated on Tue Dec 19 2017 12:47:29 for GRINS-0.8.0 by  doxygen 1.8.9.1