16 #include "libmesh/distributed_mesh.h" 17 #include "libmesh/equation_systems.h" 18 #include "libmesh/mesh_function.h" 19 #include "libmesh/explicit_system.h" 27 params.
addParam<
unsigned int>(
"refinements",
29 "Number of uniform refinements for oversampling " 30 "(refinement levels beyond any uniform " 33 "Set a positional offset, this vector will get added to the " 34 "nodal coordinates to move the domain.");
35 params.
addParam<MeshFileName>(
"file",
"The name of the mesh file to read, for oversampling");
40 "Set to true to enable oversampling",
41 "This parameter is no longer active, simply set 'refinements' to " 42 "a value greater than zero to evoke oversampling");
45 "Append '_oversample' to the output file base",
46 "This parameter is no longer operational, to append " 47 "'_oversample' utilize the output block name or 'file_base'");
57 _refinements(getParam<unsigned
int>(
"refinements")),
58 _oversample(_refinements > 0 || isParamValid(
"file")),
59 _change_position(isParamValid(
"position")),
60 _position(_change_position ? getParam<Point>(
"position") : Point()),
61 _oversample_mesh_changed(true)
98 TIME_SECTION(
"outputStep", 2,
"Outputting Step");
159 DistributedMesh * dist_mesh =
dynamic_cast<DistributedMesh *
>(&source_es.get_mesh());
162 for (
auto & elem : dist_mesh->active_local_element_ptr_range())
163 dist_mesh->add_extra_ghost_elem(elem);
167 unsigned int num_systems = source_es.n_systems();
171 for (
unsigned int sys_num = 0; sys_num < num_systems; sys_num++)
174 System & source_sys = source_es.get_system(sys_num);
177 ExplicitSystem & dest_sys =
_oversample_es->add_system<ExplicitSystem>(source_sys.name());
180 unsigned int num_vars = source_sys.n_vars();
192 for (
unsigned int var_num = 0; var_num < num_vars; var_num++)
195 const FEType & fe_type = source_sys.variable_type(var_num);
197 if (fe_type == second)
198 dest_sys.add_variable(source_sys.variable_name(var_num), second);
200 dest_sys.add_variable(source_sys.variable_name(var_num), FEType());
220 for (
unsigned int sys_num = 0; sys_num < source_es.n_systems(); ++sys_num)
225 System & source_sys = source_es.get_system(sys_num);
234 for (
unsigned int var_num = 0; var_num <
_mesh_functions[sys_num].size(); ++var_num)
251 for (
unsigned int var_num = 0; var_num <
_mesh_functions[sys_num].size(); ++var_num)
252 if (node->n_dofs(sys_num, var_num))
253 dest_sys.solution->set(node->dof_number(sys_num, var_num, 0),
257 dest_sys.solution->close();
274 mesh_params.
set<
bool>(
"nemesis") =
false;
287 mooseWarning(
"Recovering or Restarting with Oversampling may not work (especially with " 288 "adapted meshes)!! Refs #2295");
302 if (getParam<bool>(
"append_oversample"))
bool _oversample_mesh_changed
A flag indicating that the mesh has changed and the oversampled mesh needs to be re-initialized.
virtual void meshChanged() override
Called on this object when the mesh changes.
virtual void setFileBaseInternal(const std::string &file_base)
Internal function that sets the file_base.
virtual void updateOversample()
Performs the update of the solution vector for the oversample/re-positioned mesh. ...
const ExecFlagType EXEC_FORCED
OversampleOutput(const InputParameters ¶meters)
virtual bool onInterval()
Returns true if the output interval is satisfied.
std::vector< std::vector< std::unique_ptr< MeshFunction > > > _mesh_functions
A vector of pointers to the mesh functions This is only populated when the oversample() function is c...
Point _position
When oversampling, the output is shift by this amount.
const ExecFlagType EXEC_NONE
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
std::string _file_base
The base filename from the input paramaters.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
const Parallel::Communicator & _communicator
std::unique_ptr< EquationSystems > _oversample_es
void initOversample()
Setups the output object to produce re-positioned and/or oversampled results.
std::unique_ptr< NumericVector< Number > > _serialized_solution
Oversample solution vector.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
virtual EquationSystems & es() override
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
virtual void setFileBaseInternal(const std::string &file_base) override
Appends the base class's file base string.
Real & _last_output_simulation_time
last simulation time an output has occured
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
bool _oversample
Flag indicating that oversampling is enabled.
ExecFlagType _current_execute_flag
Current execute on flag.
virtual void initialSetup() override
Call init() method on setup.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
void cloneMesh()
Clone mesh in preperation for re-positioning or oversampling.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
bool _allow_output
Flag for disabling output.
const std::string & type() const
Get the type of this class.
MooseApp & _app
The MOOSE application this is associated with.
static std::unique_ptr< NumericVector< Number > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Based class for output objects.
virtual ~OversampleOutput()
virtual void initialSetup()
Call init() method on setup.
Class for containing MooseEnum item information.
virtual std::unique_ptr< MooseMesh > safeClone() const =0
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer...
MooseMesh * _mesh_ptr
A convenience pointer to the current mesh (reference or displaced depending on "use_displaced") ...
const InputParameters & parameters() const
Get the parameters of the object.
const unsigned int _refinements
The number of oversampling refinements.
MeshBase::node_iterator localNodesEnd()
static InputParameters validParams()
MeshBase::node_iterator localNodesBegin()
Calls local_nodes_begin/end() on the underlying libMesh mesh object.
std::unique_ptr< MooseObject > createUnique(const std::string &obj_name, const std::string &name, const InputParameters ¶meters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
bool isRecovering() const
Whether or not this is a "recover" calculation.
std::unique_ptr< MooseMesh > _cloned_mesh_ptr
bool _change_position
Flag for re-positioning.
static InputParameters validParams()
const ExecFlagType EXEC_FINAL
Real & _time
The current time for output purposes.
void ErrorVector unsigned int
virtual void outputStep(const ExecFlagType &type) override
A single call to this function should output all the necessary data for a single timestep.
const ExecFlagType EXEC_INITIAL