17 #include "libmesh/distributed_mesh.h" 18 #include "libmesh/equation_systems.h" 19 #include "libmesh/mesh_function.h" 20 #include "libmesh/explicit_system.h" 28 params.
addParam<
unsigned int>(
"refinements",
30 "Number of uniform refinements for oversampling " 31 "(refinement levels beyond any uniform " 34 "Set a positional offset, this vector will get added to the " 35 "nodal coordinates to move the domain.");
36 params.
addParam<MeshFileName>(
"file",
"The name of the mesh file to read, for oversampling");
41 "Set to true to enable oversampling",
42 "This parameter is no longer active, simply set 'refinements' to " 43 "a value greater than zero to evoke oversampling");
46 "Append '_oversample' to the output file base",
47 "This parameter is no longer operational, to append " 48 "'_oversample' utilize the output block name or 'file_base'");
58 _refinements(getParam<unsigned
int>(
"refinements")),
59 _oversample(_refinements > 0 || isParamValid(
"file")),
60 _change_position(isParamValid(
"position")),
61 _position(_change_position ? getParam<Point>(
"position") : Point()),
62 _oversample_mesh_changed(true)
99 TIME_SECTION(
"outputStep", 2,
"Outputting Step");
160 DistributedMesh * dist_mesh =
dynamic_cast<DistributedMesh *
>(&source_es.get_mesh());
163 for (
auto & elem : dist_mesh->active_local_element_ptr_range())
164 dist_mesh->add_extra_ghost_elem(elem);
168 unsigned int num_systems = source_es.n_systems();
172 for (
unsigned int sys_num = 0; sys_num < num_systems; sys_num++)
175 System & source_sys = source_es.get_system(sys_num);
178 ExplicitSystem & dest_sys =
_oversample_es->add_system<ExplicitSystem>(source_sys.name());
181 unsigned int num_vars = source_sys.n_vars();
193 for (
unsigned int var_num = 0; var_num < num_vars; var_num++)
196 const FEType & fe_type = source_sys.variable_type(var_num);
198 if (fe_type == second)
199 dest_sys.add_variable(source_sys.variable_name(var_num), second);
201 dest_sys.add_variable(source_sys.variable_name(var_num), FEType());
221 for (
unsigned int sys_num = 0; sys_num < source_es.n_systems(); ++sys_num)
226 System & source_sys = source_es.get_system(sys_num);
235 for (
unsigned int var_num = 0; var_num <
_mesh_functions[sys_num].size(); ++var_num)
252 for (
unsigned int var_num = 0; var_num <
_mesh_functions[sys_num].size(); ++var_num)
253 if (node->n_dofs(sys_num, var_num))
254 dest_sys.solution->set(node->dof_number(sys_num, var_num, 0),
258 dest_sys.solution->close();
275 mesh_params.
set<MeshFileName>(
"file") = getParam<MeshFileName>(
"file");
276 mesh_params.
set<
bool>(
"nemesis") =
false;
277 mesh_params.
set<
bool>(
"skip_partitioning") =
false;
278 mesh_params.
set<std::string>(
"_object_name") =
"output_problem_mesh";
290 mooseWarning(
"Recovering or Restarting with Oversampling may not work (especially with " 291 "adapted meshes)!! Refs #2295");
305 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
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.
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)
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.
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