https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SampledOutput.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
10// MOOSE includes
11#include "SampledOutput.h"
12#include "FEProblem.h"
13#include "DisplacedProblem.h"
14#include "MooseApp.h"
15#include "MoosePartitioner.h"
16
17#include "libmesh/distributed_mesh.h"
18#include "libmesh/equation_systems.h"
19#include "libmesh/mesh_function.h"
20#include "libmesh/explicit_system.h"
21
24{
25
26 // Get the parameters from the parent object
28 params.addParam<unsigned int>("refinements",
29 0,
30 "Number of uniform refinements for oversampling "
31 "(refinement levels beyond any level of "
32 "refinements already applied on the regular mesh)");
33 params.addParam<Point>("position",
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");
37 params.addParam<std::vector<SubdomainName>>(
38 "sampling_blocks", "The list of blocks to restrict the mesh sampling to");
39 params.addParam<bool>(
40 "serialize_sampling",
41 true,
42 "If set to true, all sampled output (see sampling parameters) will be done "
43 "on rank 0. This option is useful to debug suspected parallel output issues");
44
45 // **** DEPRECATED PARAMETERS ****
46 params.addDeprecatedParam<bool>("append_oversample",
47 false,
48 "Append '_oversample' to the output file base",
49 "This parameter is deprecated. To append '_oversample' utilize "
50 "the output block name or the 'file_base'");
51
52 // 'Oversampling' Group
53 params.addParamNamesToGroup("refinements position file sampling_blocks serialize_sampling",
54 "Modified Mesh Sampling");
55
56 return params;
57}
58
60 : AdvancedOutput(parameters),
61 _refinements(getParam<unsigned int>("refinements")),
62 _using_external_sampling_file(isParamValid("file")),
63 _change_position(isParamValid("position")),
64 _use_sampled_output(_refinements > 0 || _using_external_sampling_file ||
65 isParamValid("sampling_blocks") || _change_position),
66 _position(_change_position ? getParam<Point>("position") : Point()),
67 _sampling_mesh_changed(true),
68 _mesh_subdomains_match(true),
69 _serialize(getParam<bool>("serialize_sampling"))
70{
71}
72
73void
75{
77
78 // Creates and initializes the sampling mesh
79 initSample();
80}
81
82void
84{
85 // Output is not allowed
87 return;
88
89 // If recovering disable output of initial condition, it was already output
91 return;
92
93 // Return if the current output is not on the desired interval
94 if (type != EXEC_FINAL && !onInterval())
95 return;
96
97 // store current simulation time
99
100 // store current wall time of output
101 _last_output_wall_time = std::chrono::steady_clock::now();
102
103 // set current type
105
106 // Call the output method
107 if (shouldOutput())
108 {
109 TIME_SECTION("outputStep", 2, "Outputting Step");
110 updateSample();
111 output();
112 }
113
115}
116
118{
119 // TODO: Remove once libmesh Issue #1184 is fixed
120 _sampling_es.reset();
121 _sampling_mesh_ptr.reset();
122}
123
124void
129
130void
132{
133 // Perform the mesh cloning, if needed
135 return;
136
137 cloneMesh();
138
139 // Re-position the sampling mesh
141 for (auto & node : _mesh_ptr->getMesh().node_ptr_range())
142 *node += _position;
143
144 // Perform the mesh refinement
145 if (_refinements > 0)
146 {
147 libMesh::MeshRefinement mesh_refinement(_mesh_ptr->getMesh());
148
149 // We want original and refined partitioning to match so we can
150 // query from one to the other safely on distributed meshes.
151 _mesh_ptr->getMesh().skip_partitioning(true);
152 mesh_refinement.uniformly_refine(_refinements);
153
154 // Note that nodesets are not propagated with mesh refinement, unless you built the nodesets
155 // from the sidesets again, which is what happens for the regular mesh with initial refinement
156 }
157
158 // We can't allow renumbering if we want to output multiple time
159 // steps to the same Exodus file
160 _mesh_ptr->getMesh().allow_renumbering(false);
161
162 // This should be called after changing the mesh (block restriction for example)
163 if (_change_position || (_refinements > 0) || isParamValid("sampling_blocks"))
164 _sampling_mesh_ptr->meshChanged();
165
166 // Create the new EquationSystems
167 _sampling_es = std::make_unique<EquationSystems>(_mesh_ptr->getMesh());
168 _es_ptr = _sampling_es.get();
169
170 // Reference the system from which we are copying
171 EquationSystems & source_es = _problem_ptr->es();
172
173 // If we're going to be copying from that system later, we need to keep its
174 // original elements as ghost elements even if it gets grossly
175 // repartitioned, since we can't repartition the sample mesh to
176 // match.
177 // FIXME: this is not enough. It assumes our initial partition of the sampling mesh
178 // and the source mesh match. But that's usually only true in the 'refinement' case,
179 // not with an arbitrary sampling mesh file
180 DistributedMesh * dist_mesh = dynamic_cast<DistributedMesh *>(&source_es.get_mesh());
181 if (dist_mesh)
182 {
183 for (auto & elem : dist_mesh->active_local_element_ptr_range())
184 dist_mesh->add_extra_ghost_elem(elem);
185 }
186
187 // Initialize the _mesh_functions vector
188 const auto num_systems = source_es.n_systems();
189 _mesh_functions.resize(num_systems);
190
191 // Keep track of the variable numbering in both regular and sampled system
192 _variable_numbers_in_system.resize(num_systems);
193
194 // Get the list of nodal and elemental output data
195 const auto & nodal_data = getNodalVariableOutput();
196 const auto & elemental_data = getElementalVariableOutput();
197
198 // Loop over the number of systems
199 for (const auto sys_num : make_range(num_systems))
200 {
201 // Reference to the current system
202 const auto & source_sys = source_es.get_system(sys_num);
203
204 // Add the system to the new EquationsSystems
205 ExplicitSystem & dest_sys = _sampling_es->add_system<ExplicitSystem>(source_sys.name());
206
207 // Loop through the variables in the System
208 const auto num_vars = source_sys.n_vars();
209 unsigned int num_actual_vars = 0;
210 if (num_vars > 0)
211 {
212 if (_serialize)
213 _serialized_solution = NumericVector<Number>::build(_communicator);
214
215 // Add the variables to the system... simultaneously creating MeshFunctions for them.
216 for (const auto var_num : make_range(num_vars))
217 {
218 // Is the variable supposed to be output?
219 const auto & var_name = source_sys.variable_name(var_num);
220 if (!nodal_data.count(var_name) && !elemental_data.count(var_name))
221 continue;
222
223 // We do what we can to preserve the block restriction
224 const std::set<SubdomainID> * subdomains;
225 std::set<SubdomainID> restricted_subdomains;
227 subdomains = nullptr;
228 else
229 {
230 subdomains = &source_sys.variable(var_num).active_subdomains();
231 // Reduce the block restriction if the output is block restricted
232 if (isParamValid("sampling_blocks") && !subdomains->empty())
233 {
234 const auto & sampling_blocks = _sampling_mesh_ptr->getSubdomainIDs(
235 getParam<std::vector<SubdomainName>>("sampling_blocks"));
236 set_intersection(subdomains->begin(),
237 subdomains->end(),
238 sampling_blocks.begin(),
239 sampling_blocks.end(),
240 std::inserter(restricted_subdomains, restricted_subdomains.begin()));
241 subdomains = &restricted_subdomains;
242
243 // None of the subdomains are included in the sampling, might as well skip
244 if (subdomains->empty())
245 {
246 hideAdditionalVariable(nodal_data.count(var_name) ? "nodal" : "elemental", var_name);
247 continue;
248 }
249 }
250 }
251
252 // We are going to add the variable, let's count it
253 _variable_numbers_in_system[sys_num].push_back(var_num);
254 num_actual_vars++;
255
256 // Add the variable. We essentially support nodal variables and constant monomials
257 const FEType & fe_type = source_sys.variable_type(var_num);
258 if (isSampledAtNodes(fe_type))
259 {
260 dest_sys.add_variable(source_sys.variable_name(var_num), fe_type, subdomains);
261 if (dist_mesh && !_serialize)
262 paramError("serialize_sampling",
263 "Variables sampled as nodal currently require serialization with a "
264 "distributed mesh.");
265 }
266 else
267 {
268 const auto & var_name = source_sys.variable_name(var_num);
269 if (fe_type != FEType(CONSTANT, MONOMIAL))
270 {
271 mooseInfoRepeated("Sampled output projects variable '" + var_name +
272 "' onto a constant monomial");
273 if (!_serialize)
274 paramWarning("serialize_sampling",
275 "Projection without serialization may fail with insufficient ghosting. "
276 "Consider setting 'serialize_sampling' to true.");
277 }
278 dest_sys.add_variable(var_name, FEType(CONSTANT, MONOMIAL), subdomains);
279 }
280 // Note: we could do more, using the generic projector. But exodus output of higher order
281 // or more exotic variables is limited anyway
282 }
283
284 // Size for the actual number of variables output
285 _mesh_functions[sys_num].resize(num_actual_vars);
286 }
287 }
288
289 // Initialize the newly created EquationSystem
290 _sampling_es->init();
291}
292
293void
295{
296 // Do nothing if oversampling and changing position are not enabled
298 return;
299
300 // We need the mesh functions to extend the whole domain so we serialize both the mesh and the
301 // solution. We need this because the partitioning of the sampling mesh may not match the
302 // partitioning of the source mesh
303 if (_serialize)
304 {
305 _problem_ptr->mesh().getMesh().gather_to_zero();
306 _mesh_ptr->getMesh().gather_to_zero();
307 }
308
309 // Get a reference to actual equation system
310 EquationSystems & source_es = _problem_ptr->es();
311 const auto num_systems = source_es.n_systems();
312
313 // Loop through each system
314 for (const auto sys_num : make_range(num_systems))
315 {
316 if (!_mesh_functions[sys_num].empty())
317 {
318 // Get references to the source and destination systems
319 System & source_sys = source_es.get_system(sys_num);
320 System & dest_sys = _sampling_es->get_system(sys_num);
321
322 // Update the solution for the sampling mesh
323 if (_serialize)
324 {
325 _serialized_solution->clear();
326 _serialized_solution->init(source_sys.n_dofs(), false, SERIAL);
327 // Pull down a full copy of this vector on every processor so we can get values in
328 // parallel
329 source_sys.solution->localize(*_serialized_solution);
330 }
331
332 // Update the mesh functions
333 for (const auto var_num : index_range(_mesh_functions[sys_num]))
334 {
335 const auto original_var_num = _variable_numbers_in_system[sys_num][var_num];
336
337 // If the mesh has changed, the MeshFunctions need to be re-built, otherwise simply clear
338 // it for re-initialization
339 // TODO: inherit from MeshChangedInterface and rebuild mesh functions on meshChanged()
340 if (!_mesh_functions[sys_num][var_num] || _sampling_mesh_changed)
341 _mesh_functions[sys_num][var_num] = std::make_unique<libMesh::MeshFunction>(
342 source_es,
343 _serialize ? *_serialized_solution : *source_sys.solution,
344 source_sys.get_dof_map(),
345 original_var_num);
346 else
347 _mesh_functions[sys_num][var_num]->clear();
348
349 // Initialize the MeshFunctions for application to the sampled solution
350 _mesh_functions[sys_num][var_num]->init();
351
352 // Mesh functions are still defined on the original mesh, which might not fully overlap
353 // with the sampling mesh. We don't want to error with a libMesh assert on the out of mesh
354 // mode
355 _mesh_functions[sys_num][var_num]->enable_out_of_mesh_mode(-1e6);
356 }
357
358 // Fill solution vectors by evaluating mesh functions on sampling mesh
359 for (const auto var_num : index_range(_mesh_functions[sys_num]))
360 {
361 // we serialized the mesh and the solution vector, we might as well just do this only on
362 // processor 0.
363 if (_serialize && processor_id() > 0)
364 break;
365
366 const auto original_var_num = _variable_numbers_in_system[sys_num][var_num];
367 const FEType & fe_type = source_sys.variable_type(original_var_num);
368 // we use the original variable block restriction for sampling
369 const auto * var_blocks = &source_sys.variable(original_var_num).active_subdomains();
370 // NOTE: if we have overlapping domains between the sampling mesh and the source mesh
371 // we would get a value from the source mesh domain. We could further restrict this
372 // block restriction with the sampling mesh block restriction to prevent this.
373
374 // Loop over the mesh, nodes for nodal data, elements for element data
375 if (isSampledAtNodes(fe_type))
376 {
377 for (const auto & node : (_serialize ? _mesh_ptr->getMesh().node_ptr_range()
378 : _mesh_ptr->getMesh().local_node_ptr_range()))
379 {
380 // Avoid working on ghosted dofs
381 if (node->n_dofs(sys_num, var_num) &&
382 (_serialize || processor_id() == node->processor_id()))
383 {
384 // the node has to be within the domain of the mesh function
385 DenseVector<Real> value(1);
386 if (var_blocks->size())
387 (*_mesh_functions[sys_num][var_num])(
388 *node - _position, /*time*/ 0., value, var_blocks);
389 else
390 value[0] = (*_mesh_functions[sys_num][var_num])(*node - _position);
391
392 if (value[0] != -1e6)
393 dest_sys.solution->set(node->dof_number(sys_num, var_num, /*comp=*/0), value[0]);
394 else
395 mooseDoOnce(mooseWarning(
396 "Sampling at location ",
397 *node - _position,
398 " by process ",
399 std::to_string(processor_id()),
400 " was outside the problem mesh.\nThis message will not be repeated"));
401 }
402 }
403 }
404 else
405 {
406 const auto elem_range = _serialize
407 ? _mesh_ptr->getMesh().active_element_ptr_range()
408 : _mesh_ptr->getMesh().active_local_element_ptr_range();
409 for (const auto & elem : elem_range)
410 {
411 if (elem->n_dofs(sys_num, var_num) &&
412 (_serialize || processor_id() == elem->processor_id()))
413 {
414 DenseVector<Real> value(1);
415 if (var_blocks->size())
416 (*_mesh_functions[sys_num][var_num])(
417 elem->true_centroid() - _position, /*time*/ 0., value, var_blocks);
418 else
419 value[0] = (*_mesh_functions[sys_num][var_num])(elem->true_centroid() - _position);
420
421 if (value[0] != -1e6)
422 dest_sys.solution->set(elem->dof_number(sys_num, var_num, /*comp=*/0), value[0]);
423 else
424 mooseDoOnce(mooseWarning(
425 "Sampling at location ",
426 elem->true_centroid() - _position,
427 " was outside the problem mesh.\nThis message will not be repeated."));
428 }
429 }
430 }
431 }
432
433 // We modified the solution vector directly, we have to close it
434 dest_sys.solution->close();
435 }
436 }
437
438 // Set this to false so that new output files are not created, since the sampling mesh
439 // doesn't actually change
441}
442
443void
445{
446 // Create the new mesh from a file
447 if (isParamValid("file"))
448 {
449 InputParameters mesh_params = _app.getFactory().getValidParams("FileMesh");
450 mesh_params.applyParameters(parameters(), {}, true);
451 mesh_params.set<bool>("nemesis") = false;
453 _app.getFactory().createUnique<MooseMesh>("FileMesh", "output_problem_mesh", mesh_params);
454 _sampling_mesh_ptr->allowRecovery(false); // We actually want to reread the initial mesh
455 _sampling_mesh_ptr->init();
456 }
457 // Clone the existing mesh
458 else
459 {
460 if (_app.isRecovering())
461 mooseWarning("Recovering or Restarting with oversampling may not work (especially with "
462 "adapted meshes)!! Refs #2295");
464 }
465
466 // Remove unspecified blocks
467 if (isParamValid("sampling_blocks"))
468 {
469 // Remove all elements not in the blocks
470 const auto & blocks_to_keep_names = getParam<std::vector<SubdomainName>>("sampling_blocks");
471 const auto & blocks_to_keep = _sampling_mesh_ptr->getSubdomainIDs(blocks_to_keep_names);
472 for (const auto & elem_ptr : _sampling_mesh_ptr->getMesh().element_ptr_range())
473 if (std::find(blocks_to_keep.begin(), blocks_to_keep.end(), elem_ptr->subdomain_id()) ==
474 blocks_to_keep.end())
475 _sampling_mesh_ptr->getMesh().delete_elem(elem_ptr);
476
477 // Deleting elements and isolated nodes would cause renumbering. Not renumbering might help
478 // user examining the sampling mesh and the regular mesh. Also if we end up partitioning the
479 // elements, the node partitioning is unlikely to match if the element numbering is different.
480 // Still not enough of a guarantee, because of deleted elements the node partitioning could be
481 // different. We will rely on ghosting to make it work
482 _sampling_mesh_ptr->getMesh().allow_renumbering(false);
483 }
484
485 // Set a partitioner
486 if (!_serialize)
487 {
488 _sampling_mesh_ptr->setIsCustomPartitionerRequested(true);
489 InputParameters partition_params = _app.getFactory().getValidParams("CopyMeshPartitioner");
490 partition_params.set<MooseMesh *>("mesh") = _sampling_mesh_ptr.get();
491 partition_params.set<MooseMesh *>("source_mesh") = _mesh_ptr;
492 std::shared_ptr<MoosePartitioner> mp = _factory.create<MoosePartitioner>(
493 "CopyMeshPartitioner", "sampled_output_part", partition_params);
494 _sampling_mesh_ptr->setCustomPartitioner(mp.get());
495
496 _sampling_mesh_ptr->getMesh().prepare_for_use();
497 // this should be called by prepare_for_use, but is not.
498 // it also requires a prior call to prepare_for_use()
499 mp->partition(_sampling_mesh_ptr->getMesh(), comm().size());
500 }
501
502 // Prepare mesh, needed for the mesh functions
504 _sampling_mesh_ptr->prepare();
505 else if (_serialize && isParamValid("sampling_blocks"))
506 // TODO: constraints have not been initialized?
507 _sampling_mesh_ptr->getMesh().prepare_for_use();
508
509 if (_serialize)
510 // we want to avoid re-partitioning, as we will serialize anyway
511 _sampling_mesh_ptr->getMesh().skip_partitioning(true);
512
513 // Make sure that the mesh pointer points to the newly cloned mesh
515
516 // Check the source and target mesh in case their subdomains match
517 const std::vector<SubdomainID> mesh_subdomain_ids_vec(_mesh_ptr->meshSubdomains().begin(),
518 _mesh_ptr->meshSubdomains().end());
519 const std::vector<SubdomainID> initial_mesh_subdomain_ids_vec(
523 _mesh_ptr->getSubdomainNames(mesh_subdomain_ids_vec) ==
524 _problem_ptr->mesh().getSubdomainNames(initial_mesh_subdomain_ids_vec));
526 mooseInfoRepeated("Variable block restriction disabled in sampled output due to non-matching "
527 "subdomain names and ids");
528}
529
530void
531SampledOutput::setFileBaseInternal(const std::string & file_base)
532{
534 // ** DEPRECATED SUPPORT **
535 if (getParam<bool>("append_oversample"))
536 _file_base += "_oversample";
537}
538
539bool
540SampledOutput::isSampledAtNodes(const FEType & fe_type) const
541{
542 // This is the same criterion as in MooseVariableData
543 const auto continuity = FEInterface::get_continuity(fe_type);
544 return (continuity == C_ZERO || continuity == C_ONE);
545}
void mooseInfoRepeated(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition MooseError.h:409
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition MooseError.h:345
const ExecFlagType EXEC_FORCED
Definition Moose.C:50
const ExecFlagType EXEC_INITIAL
Definition Moose.C:31
const ExecFlagType EXEC_NONE
Definition Moose.C:30
const ExecFlagType EXEC_FINAL
Definition Moose.C:49
void ErrorVector unsigned int
Based class for output objects.
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
virtual void initialSetup()
Call init() method on setup.
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
const std::set< std::string > & getElementalVariableOutput()
The list of elemental nonlinear variables names that are set for output.
void hideAdditionalVariable(const std::string &category, const std::string &var_name)
Add an additional variable to the hide list.
const std::set< std::string > & getNodalVariableOutput()
The list of nodal nonlinear variables names that are set for output.
static InputParameters validParams()
virtual libMesh::EquationSystems & es() override
virtual MooseMesh & mesh() override
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Definition Factory.C:142
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Definition Factory.C:68
std::unique_ptr< MooseObject > createUnique(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>())
Definition Factory.C:128
std::string _file_base
The base filename from the input paramaters.
Definition FileOutput.h:89
virtual void setFileBaseInternal(const std::string &file_base)
Internal function that sets the file_base.
Definition FileOutput.C:137
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
Method for applying common parameters.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition MooseApp.h:407
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition MooseApp.C:1674
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:406
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
Class for containing MooseEnum item information.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
void allowRecovery(bool allow)
Set whether or not this mesh is allowed to read a recovery file.
Definition MooseMesh.h:1171
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3557
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
Definition MooseMesh.C:1765
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition MooseMesh.C:3280
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.
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
Base class for MOOSE partitioner.
bool _allow_output
Flag for disabling output.
Definition Output.h:268
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition Output.h:185
ExecFlagType _current_execute_flag
Current execute on flag.
Definition Output.h:211
virtual bool onInterval()
Returns true if the output interval is satisfied.
Definition Output.C:280
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition Output.h:194
Real & _time
The current time for output purposes.
Definition Output.h:214
Real & _last_output_simulation_time
last simulation time an output has occured
Definition Output.h:280
MooseMesh * _mesh_ptr
A convenience pointer to the current mesh (reference or displaced depending on "use_displaced")
Definition Output.h:197
std::chrono::time_point< std::chrono::steady_clock > _last_output_wall_time
last wall time an output has occured
Definition Output.h:283
Factory & _factory
The Factory associated with the MooseApp.
bool _use_sampled_output
Flag indicating that the sampled output should be used to re-sample the underlying EquationSystem of ...
std::unique_ptr< EquationSystems > _sampling_es
Equation system holding the solution vectors for the sampled variables.
bool isSampledAtNodes(const FEType &fe_type) const
Used to decide which variable is sampled at nodes, then output as a nodal variable for (over)sampling...
virtual void outputStep(const ExecFlagType &type) override
A single call to this function should output all the necessary data for a single timestep.
void cloneMesh()
Clone mesh in preperation for re-positioning or oversampling.
bool _sampling_mesh_changed
A flag indicating that the mesh has changed and the sampled mesh needs to be re-initialized.
const bool _using_external_sampling_file
Flag indicating another file is being used for the sampling.
std::vector< std::vector< std::unique_ptr< libMesh::MeshFunction > > > _mesh_functions
A vector of pointers to the mesh functions on the sampled mesh This is only populated when the initSa...
std::unique_ptr< NumericVector< Number > > _serialized_solution
Sample solution vector.
void initSample()
Setups the output object to produce re-positioned and/or sampled results.
const unsigned int _refinements
The number of oversampling refinements.
virtual void setFileBaseInternal(const std::string &file_base) override
Appends the base class's file base string.
virtual void updateSample()
Performs the update of the solution vector for the sample/re-positioned mesh.
bool _mesh_subdomains_match
A flag tracking whether the sampling and source meshes match in terms of subdomains.
const bool _change_position
Flag for re-positioning.
virtual ~SampledOutput()
virtual void initialSetup() override
Call init() method on setup.
bool _serialize
Flag indicating whether we are outputting in serial or parallel.
virtual void meshChanged() override
Called on this object when the mesh changes.
std::vector< std::vector< unsigned int > > _variable_numbers_in_system
A vector of vectors that keeps track of the variable numbers in each system for each mesh function.
std::unique_ptr< MooseMesh > _sampling_mesh_ptr
Mesh used for sampling. The Output class' _mesh_ptr will refer to this mesh if sampling is being used...
Point _position
When oversampling, the output is shift by this amount.
static InputParameters validParams()
SampledOutput(const InputParameters &parameters)
void paramWarning(const std::string &param, Args... args) const
processor_id_type size() const
unsigned int n_systems() const
void uniformly_refine(unsigned int n=1)
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
virtual void partition(MeshBase &mesh, const unsigned int n)