https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LevelSetReinitializationMultiApp.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
12
13#include "Executioner.h"
14
15// libMesh
16#include "libmesh/mesh_tools.h"
17
19
22{
25 "MultiApp capable of performing repeated complete solves for level set reinitialization.");
26 params.addParam<unsigned int>(
27 "interval", 1, "Time step interval when to perform reinitialization.");
28
29 params.suppressParameter<std::vector<Point>>("positions");
30 params.suppressParameter<std::vector<FileName>>("positions_file");
31 params.suppressParameter<bool>("output_in_position");
32 params.suppressParameter<std::vector<Real>>("reset_time");
33 params.suppressParameter<std::vector<unsigned int>>("reset_apps");
34 params.suppressParameter<Real>("move_time");
35 params.suppressParameter<std::vector<unsigned int>>("move_apps");
36 params.suppressParameter<std::vector<Point>>("move_positions");
37
38 return params;
39}
40
42 const InputParameters & parameters)
43 : MultiApp(parameters), _level_set_problem(NULL), _interval(getParam<unsigned int>("interval"))
44{
45}
46
47void
49{
51
52 if (_has_an_app)
53 {
54 Executioner * ex = _apps[0]->getExecutioner();
55
56 if (!ex)
57 mooseError("Executioner does not exist!");
58
59 ex->init();
60
61 _executioner = ex;
62
65 mooseError("The Problem type must be LevelSetReinitializationProblem.");
66 }
67}
68
69bool
71 Real /*target_time*/,
72 bool /*auto_advance*/)
73{
74 // Do nothing if not on interval
75 if ((_fe_problem.timeStep() % _interval) != 0)
76 return true;
77
78 if (!_has_an_app)
79 return true;
80
81 _console << "Solving Reinitialization problem." << std::endl;
82
83 int rank;
84 int ierr;
85 ierr = MPI_Comm_rank(_orig_comm, &rank);
86 mooseCheckMPIErr(ierr);
87
88 bool last_solve_converged = true;
89
93 last_solve_converged = false;
94
95 return last_solve_converged;
96}
registerMooseObject("LevelSetApp", LevelSetReinitializationMultiApp)
void ErrorVector unsigned int
const ConsoleStream _console
virtual void execute()=0
virtual bool lastSolveConverged() const=0
virtual void init()
virtual int & timeStep() const
void suppressParameter(const std::string &name)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
MultiApp that performs a time reset prior to solving, this enables the level set reinitialization to ...
Executioner * _executioner
Access to the Executioner object to call execute()
LevelSetReinitializationProblem * _level_set_problem
Access to the level set specific problem to allow for the resetTime() method to be called.
const unsigned int & _interval
The solve interval for reinitialization.
LevelSetReinitializationMultiApp(const InputParameters &parameters)
virtual bool solveStep(Real dt, Real target_time, bool auto_advance=true) override
A Problem object to perform level set equation reinitialization implementation, mainly implementing a...
void resetTime()
Resets the state of the simulation to allow for it to be re-executed.
void mooseError(Args &&... args) const
FEProblemBase & appProblemBase(unsigned int app)
virtual void initialSetup() override
bool _has_an_app
static InputParameters validParams()
const MPI_Comm & _orig_comm
FEProblemBase & _fe_problem
std::vector< std::shared_ptr< MooseApp > > _apps