Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11274 from friedmud/vpp_visualization_11272
Vpp visualization
- Loading branch information
Showing
10 changed files
with
258 additions
and
9 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...content/documentation/systems/AuxKernels/VectorPostprocessorVisualizationAux.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# VectorPostprocessorVisualizationAux | ||
|
||
## Short Description | ||
|
||
!syntax description /AuxKernels/VectorPostprocessorVisualizationAux | ||
|
||
## Description | ||
|
||
This object is intended to let you view VectorPostprocessor vectors that are of lenght `num_procs` (meaning there is one value per MPI process). This object will take those values and fill up an Auxiliary field with them so the values can be visualized. | ||
|
||
## Important Notes | ||
|
||
Note: the VectorPostprocessor must be syncing the vectors it's computing to all processors. By default many just compute to processor 0 (because that's where output occurrs). | ||
|
||
For instance: this is the case for [WorkBalance](WorkBalance.md). By default it only syncs to processor 0, but it has a parameter (`sync_to_all_procs`) to tell it to create copies of the vectors on all processors. | ||
|
||
!syntax parameters /AuxKernels/VectorPostprocessorVisualizationAux | ||
|
||
!syntax inputs /AuxKernels/VectorPostprocessorVisualizationAux | ||
|
||
!syntax children /AuxKernels/VectorPostprocessorVisualizationAux | ||
|
||
!bibtex bibliography |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
framework/include/auxkernels/VectorPostprocessorVisualizationAux.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef VECTORPOSTPROCESSORVISUALIZATIONAUX_H | ||
#define VECTORPOSTPROCESSORVISUALIZATIONAUX_H | ||
|
||
#include "AuxKernel.h" | ||
|
||
// Forward Declarations | ||
class VectorPostprocessorVisualizationAux; | ||
|
||
template <> | ||
InputParameters validParams<VectorPostprocessorVisualizationAux>(); | ||
|
||
/** | ||
* Read values from a VectorPostprocessor that is producing vectors that are "number of processors" | ||
* in length. Puts the value for each processor into an elemental auxiliary field. | ||
*/ | ||
class VectorPostprocessorVisualizationAux : public AuxKernel | ||
{ | ||
public: | ||
VectorPostprocessorVisualizationAux(const InputParameters & parameters); | ||
|
||
protected: | ||
/** | ||
* Note: this used for error checking. It's done very late because VPP's don't fill in their | ||
* vectors until they are computed | ||
*/ | ||
virtual void timestepSetup() override; | ||
|
||
/** | ||
* Get the value from the vector and assign it to the element | ||
*/ | ||
virtual Real computeValue() override; | ||
|
||
/// Holds the values we want to display | ||
const VectorPostprocessorValue & _vpp_vector; | ||
|
||
/// Optimization | ||
processor_id_type _my_pid; | ||
}; | ||
|
||
#endif // VECTORPOSTPROCESSORVISUALIZATIONAUX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
framework/src/auxkernels/VectorPostprocessorVisualizationAux.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "VectorPostprocessorVisualizationAux.h" | ||
|
||
registerMooseObject("MooseApp", VectorPostprocessorVisualizationAux); | ||
|
||
template <> | ||
InputParameters | ||
validParams<VectorPostprocessorVisualizationAux>() | ||
{ | ||
InputParameters params = validParams<AuxKernel>(); | ||
|
||
params.addClassDescription("Read values from a VectorPostprocessor that is producing vectors " | ||
"that are 'number of processors' * in length. Puts the value for " | ||
"each processor into an elemental auxiliary field."); | ||
|
||
params.addRequiredParam<VectorPostprocessorName>( | ||
"vpp", "The name of the VectorPostprocessor to pull the data from."); | ||
params.addRequiredParam<std::string>( | ||
"vector_name", "The name of the vector to use from the VectorPostprocessor"); | ||
|
||
return params; | ||
} | ||
|
||
VectorPostprocessorVisualizationAux::VectorPostprocessorVisualizationAux( | ||
const InputParameters & parameters) | ||
: AuxKernel(parameters), | ||
_vpp_vector(getVectorPostprocessorValue("vpp", getParam<std::string>("vector_name"))), | ||
_my_pid(processor_id()) | ||
{ | ||
} | ||
|
||
void | ||
VectorPostprocessorVisualizationAux::timestepSetup() | ||
{ | ||
if (_vpp_vector.size() != n_processors()) | ||
mooseError("Error in VectorPostprocessor ", | ||
name(), | ||
". Vector ", | ||
getParam<std::string>("vector_name"), | ||
" in VectorPostprocessor ", | ||
getParam<VectorPostprocessorName>("vpp"), | ||
" does not contain num_procs number of entries. num_procs: ", | ||
n_processors(), | ||
" num_entries: ", | ||
_vpp_vector.size()); | ||
} | ||
|
||
Real | ||
VectorPostprocessorVisualizationAux::computeValue() | ||
{ | ||
return _vpp_vector[_my_pid]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+35 KB
...xkernels/vector_postprocessor_visualization/gold/vector_postprocessor_visualization_out.e
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
test/tests/auxkernels/vector_postprocessor_visualization/tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Tests] | ||
[./test] | ||
type = 'Exodiff' | ||
input = 'vector_postprocessor_visualization.i' | ||
exodiff = 'vector_postprocessor_visualization_out.e' | ||
min_parallel = 3 | ||
max_parallel = 3 | ||
mesh_mode = replicated # Just because of the gold file | ||
[../] | ||
[] |
82 changes: 82 additions & 0 deletions
82
.../tests/auxkernels/vector_postprocessor_visualization/vector_postprocessor_visualization.i
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
nx = 10 | ||
ny = 10 | ||
parallel_type = REPLICATED | ||
partitioner = linear | ||
[] | ||
|
||
[Variables] | ||
[u] | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[diff] | ||
type = Diffusion | ||
variable = u | ||
[] | ||
[] | ||
|
||
[BCs] | ||
[left] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 'left' | ||
value = 0 | ||
[] | ||
[right] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 'right' | ||
value = 1 | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
solve_type = PJFNK | ||
petsc_options_iname = '-pc_type -pc_hypre_type' | ||
petsc_options_value = 'hypre boomeramg' | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
[] | ||
|
||
[AuxVariables] | ||
[num_elems] | ||
family = MONOMIAL | ||
order = CONSTANT | ||
[] | ||
[partition_surface_area] | ||
family = MONOMIAL | ||
order = CONSTANT | ||
[] | ||
[] | ||
|
||
[AuxKernels] | ||
[wb_num_elems] | ||
type = VectorPostprocessorVisualizationAux | ||
vpp = 'wb' | ||
vector_name = num_elems | ||
variable = num_elems | ||
execute_on = 'TIMESTEP_END' | ||
[] | ||
[wb_partition_surface_area] | ||
type = VectorPostprocessorVisualizationAux | ||
vpp = 'wb' | ||
vector_name = partition_surface_area | ||
variable = partition_surface_area | ||
execute_on = 'TIMESTEP_END' | ||
[] | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[wb] | ||
type = WorkBalance | ||
sync_to_all_procs = 'true' | ||
execute_on = 'INITIAL' | ||
[] | ||
[] |