www.mooseframework.org
SetAdaptivityOptionsAction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
16 #include "FEProblem.h"
17 
18 #include "libmesh/fe.h"
19 
20 template <>
23 {
25  params.addParam<MarkerName>("marker",
26  "The name of the Marker to use to actually adapt the mesh.");
27  params.addParam<unsigned int>(
28  "steps", 0, "The number of adaptive steps to use when doing a Steady simulation.");
29  params.addParam<unsigned int>(
30  "initial_steps", 0, "The number of adaptive steps to do based on the initial condition.");
31  params.addParam<MarkerName>(
32  "initial_marker",
33  "The name of the Marker to use to adapt the mesh during initial refinement.");
34  params.addParam<unsigned int>(
35  "max_h_level",
36  0,
37  "Maximum number of times a single element can be refined. If 0 then infinite.");
38  params.addParam<Real>("start_time",
39  -std::numeric_limits<Real>::max(),
40  "The time that adaptivity will be active after.");
41  params.addParam<Real>("stop_time",
42  std::numeric_limits<Real>::max(),
43  "The time after which adaptivity will no longer be active.");
44  params.addParam<unsigned int>(
45  "cycles_per_step",
46  1,
47  "The number of adaptive steps to use when on each timestep during a Transient simulation.");
48  params.addParam<bool>(
49  "recompute_markers_during_cycles", false, "Recompute markers during adaptivity cycles");
50  return params;
51 }
52 
54 
55 void
57 {
58  Adaptivity & adapt = _problem->adaptivity();
59 
60  if (isParamValid("marker"))
61  adapt.setMarkerVariableName(getParam<MarkerName>("marker"));
62  if (isParamValid("initial_marker"))
63  adapt.setInitialMarkerVariableName(getParam<MarkerName>("initial_marker"));
64 
65  adapt.setCyclesPerStep(getParam<unsigned int>("cycles_per_step"));
66 
67  adapt.setMaxHLevel(getParam<unsigned int>("max_h_level"));
68 
69  adapt.init(getParam<unsigned int>("steps"), getParam<unsigned int>("initial_steps"));
70  adapt.setUseNewSystem();
71 
72  adapt.setTimeActive(getParam<Real>("start_time"), getParam<Real>("stop_time"));
73 
74  adapt.setRecomputeMarkersFlag(getParam<bool>("recompute_markers_during_cycles"));
75 }
InputParameters validParams< SetAdaptivityOptionsAction >()
void setRecomputeMarkersFlag(const bool flag)
Set the flag to recompute markers during adaptivity cycles.
Definition: Adaptivity.h:127
void setCyclesPerStep(const unsigned int &num)
Set the number of cycles_per_step.
Definition: Adaptivity.h:114
void init(unsigned int steps, unsigned int initial_steps)
Initialize the initial adaptivity ;-)
Definition: Adaptivity.C:59
void setTimeActive(Real start_time, Real stop_time)
Sets the time when the adaptivity is active.
Definition: Adaptivity.C:251
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void setMaxHLevel(unsigned int level)
Set the maximum refinement level (for the new Adaptivity system).
Definition: Adaptivity.h:213
void setUseNewSystem()
Tells this object we&#39;re using the "new" adaptivity system.
Definition: Adaptivity.C:258
Base class for actions.
Definition: Action.h:39
SetAdaptivityOptionsAction(InputParameters params)
bool isParamValid(const std::string &name) const
Definition: Action.h:80
Takes care of everything related to mesh adaptivity.
Definition: Adaptivity.h:48
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:131
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void setMarkerVariableName(std::string marker_field)
Sets the name of the field variable to actually use to flag elements for refinement / coarsening...
Definition: Adaptivity.C:264
void setInitialMarkerVariableName(std::string marker_field)
Sets the name of the field variable to actually use to flag elements for initial refinement / coarsen...
Definition: Adaptivity.C:270
InputParameters validParams< Action >()
Definition: Action.C:23