Go to the documentation of this file.
18 #include "libmesh/distributed_mesh.h"
19 #include "libmesh/equation_systems.h"
20 #include "libmesh/mesh_function.h"
21 #include "libmesh/explicit_system.h"
31 params.
addParam<
unsigned int>(
"refinements",
33 "Number of uniform refinements for oversampling "
34 "(refinement levels beyond any uniform "
37 "Set a positional offset, this vector will get added to the "
38 "nodal coordinates to move the domain.");
39 params.
addParam<MeshFileName>(
"file",
"The name of the mesh file to read, for oversampling");
44 "Set to true to enable oversampling",
45 "This parameter is no longer active, simply set 'refinements' to "
46 "a value greater than zero to evoke oversampling");
49 "Append '_oversample' to the output file base",
50 "This parameter is no longer operational, to append "
51 "'_oversample' utilize the output block name or 'file_base'");
61 _refinements(getParam<unsigned int>(
"refinements")),
62 _oversample(_refinements > 0 || isParamValid(
"file")),
63 _change_position(isParamValid(
"position")),
64 _position(_change_position ? getParam<Point>(
"position") : Point()),
65 _oversample_mesh_changed(true)
68 if (getParam<bool>(
"append_oversample"))
84 CONSOLE_TIMED_PRINT(
"Outputting ",
name());
161 DistributedMesh * dist_mesh = dynamic_cast<DistributedMesh *>(&source_es.get_mesh());
164 for (
auto & elem : dist_mesh->active_local_element_ptr_range())
165 dist_mesh->add_extra_ghost_elem(elem);
169 unsigned int num_systems = source_es.n_systems();
173 for (
unsigned int sys_num = 0; sys_num < num_systems; sys_num++)
176 System & source_sys = source_es.get_system(sys_num);
179 ExplicitSystem & dest_sys =
_oversample_es->add_system<ExplicitSystem>(source_sys.name());
182 unsigned int num_vars = source_sys.n_vars();
194 for (
unsigned int var_num = 0; var_num < num_vars; var_num++)
197 const FEType & fe_type = source_sys.variable_type(var_num);
198 FEType second(SECOND, LAGRANGE);
199 if (fe_type == second)
200 dest_sys.add_variable(source_sys.variable_name(var_num), second);
202 dest_sys.add_variable(source_sys.variable_name(var_num), FEType());
222 for (
unsigned int sys_num = 0; sys_num < source_es.n_systems(); ++sys_num)
227 System & source_sys = source_es.get_system(sys_num);
236 for (
unsigned int var_num = 0; var_num <
_mesh_functions[sys_num].size(); ++var_num)
253 for (
unsigned int var_num = 0; var_num <
_mesh_functions[sys_num].size(); ++var_num)
254 if (node->n_dofs(sys_num, var_num))
255 dest_sys.solution->set(node->dof_number(sys_num, var_num, 0),
259 dest_sys.solution->close();
276 mesh_params.
set<MeshFileName>(
"file") = getParam<MeshFileName>(
"file");
277 mesh_params.
set<
bool>(
"nemesis") =
false;
278 mesh_params.
set<
bool>(
"skip_partitioning") =
false;
279 mesh_params.
set<std::string>(
"_object_name") =
"output_problem_mesh";
291 mooseWarning(
"Recovering or Restarting with Oversampling may not work (especially with "
292 "adapted meshes)!! Refs #2295");
virtual void initialSetup() override
Initialization method.
virtual ~OversampleOutput()
void cloneMesh()
Clone mesh in preperation for re-positioning or oversampling.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
const unsigned int _refinements
The number of oversampling refinements.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
PerfID _output_step_timer
Timers.
MeshBase::const_node_iterator localNodesBegin()
Calls local_nodes_begin/end() on the underlying libMesh mesh object.
const std::string & type() const
Get the type of this object.
static InputParameters validParams()
const ExecFlagType EXEC_FORCED
Based class for output objects.
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
virtual void output(const ExecFlagType &type)
A single call to this function should output all the necessary data for a single timestep.
const InputParameters & parameters() const
Get the parameters of the object.
virtual void initialSetup()
Initialization method.
defineLegacyParams(OversampleOutput)
virtual void outputStep(const ExecFlagType &type) override
A single call to this function should output all the necessary data for a single timestep.
bool _allow_output
Flag for disabling output.
virtual void updateOversample()
Performs the update of the solution vector for the oversample/re-positioned mesh.
std::unique_ptr< MooseMesh > _cloned_mesh_ptr
OversampleOutput(const InputParameters ¶meters)
virtual void meshChanged() override
Called on this object when the mesh changes.
MeshBase::const_node_iterator localNodesEnd()
virtual bool shouldOutput(const ExecFlagType &type)
Handles logic for determining if a step should be output.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
bool _oversample_mesh_changed
A flag indicating that the mesh has changed and the oversampled mesh needs to be re-initialized.
static InputParameters validParams()
Class for containing MooseEnum item information.
bool _change_position
Flag for re-positioning.
bool isRecovering() const
Whether or not this is a "recover" calculation.
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...
const ExecFlagType EXEC_INITIAL
MooseMesh * _mesh_ptr
A convenience pointer to the current mesh (reference or displaced depending on "use_displaced")
Point _position
When oversampling, the output is shift by this amount.
void initOversample()
Setups the output object to produce re-positioned and/or oversampled results.
const ExecFlagType EXEC_FINAL
virtual EquationSystems & es() override
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.
std::unique_ptr< NumericVector< Number > > _serialized_solution
Oversample solution vector.
std::unique_ptr< EquationSystems > _oversample_es
std::string _file_base
The base filename from the input paramaters.
MooseApp & _app
The MooseApp this object is associated with.
bool _oversample
Flag indicating that oversampling is enabled.
void mooseWarning(Args &&... args) const
Based class for providing re-positioning and oversampling support to output objects.
virtual const std::string & name() const
Get the name of the object.
virtual bool onInterval()
Returns true if the output interval is satisfied.