www.mooseframework.org
LevelSetMeshRefinementTransfer.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 // MOOSE includes
11 #include "Adaptivity.h"
12 #include "FEProblem.h"
13 #include "MooseVariable.h"
14 #include "MultiApp.h"
15 
16 template <>
17 InputParameters
19 {
20  InputParameters params = validParams<MultiAppCopyTransfer>();
21  params.addClassDescription("Transfers the mesh from the master application to the sub "
22  "application for the purposes of level set reinitialization problems "
23  "with mesh adaptivity.");
24  params.set<MooseEnum>("direction") = "TO_MULTIAPP";
25  params.suppressParameter<MooseEnum>("direction");
26 
27  params.set<MultiMooseEnum>("execute_on") = "CUSTOM";
28  params.set<bool>("check_multiapp_execute_on") = false;
29  params.suppressParameter<MultiMooseEnum>("execute_on");
30 
31  return params;
32 }
33 
35  : MultiAppCopyTransfer(parameters)
36 {
37 }
38 
39 void
41 {
42  FEProblemBase & from_problem = _multi_app->problemBase();
43  for (unsigned int i = 0; i < _multi_app->numGlobalApps(); i++)
44  if (_multi_app->hasLocalApp(i))
45  {
46  FEProblemBase & to_problem = _multi_app->appProblemBase(i);
47  MooseVariable & to_var = to_problem.getVariable(0, _to_var_name);
48  Adaptivity & adapt = to_problem.adaptivity();
49 
50  adapt.setMarkerVariableName(to_var.name());
51  adapt.setCyclesPerStep(1);
52  adapt.init(0, 0);
53  adapt.setUseNewSystem();
54  adapt.setMaxHLevel(from_problem.adaptivity().getMaxHLevel());
55  adapt.setAdaptivityOn(false);
56  }
57 }
58 
59 void
61 {
62  MultiAppCopyTransfer::execute();
63 
64  for (unsigned int i = 0; i < _multi_app->numGlobalApps(); i++)
65  if (_multi_app->hasLocalApp(i))
66  {
67  FEProblemBase & to_problem = _multi_app->appProblemBase(i);
68  Adaptivity & adapt = to_problem.adaptivity();
69  adapt.setAdaptivityOn(true);
70  to_problem.adaptMesh();
71  adapt.setAdaptivityOn(false);
72  }
73 }
LevelSetMeshRefinementTransfer(const InputParameters &parameters)
InputParameters validParams< LevelSetMeshRefinementTransfer >()