Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
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,34 @@ | ||
//* 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 | ||
|
||
#pragma once | ||
|
||
#include "SidePostprocessor.h" | ||
|
||
// Forward Declarations | ||
class AverageBID; | ||
|
||
template <> | ||
InputParameters validParams<AverageBID>(); | ||
|
||
class AverageBID : public SidePostprocessor | ||
{ | ||
public: | ||
AverageBID(const InputParameters & parameters); | ||
|
||
virtual PostprocessorValue getValue() override; | ||
virtual void execute() override; | ||
virtual void initialize() override; | ||
virtual void finalize() override; | ||
virtual void threadJoin(const UserObject & uo) override; | ||
|
||
protected: | ||
Real _sum_bid; | ||
unsigned int _n_summands; | ||
}; |
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,59 @@ | ||
//* 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 "AverageBID.h" | ||
|
||
#include "Assembly.h" | ||
|
||
registerMooseObject("MooseTestApp", AverageBID); | ||
|
||
template <> | ||
InputParameters | ||
validParams<AverageBID>() | ||
{ | ||
InputParameters params = validParams<SidePostprocessor>(); | ||
return params; | ||
} | ||
|
||
AverageBID::AverageBID(const InputParameters & parameters) : SidePostprocessor(parameters) {} | ||
|
||
void | ||
AverageBID::initialize() | ||
{ | ||
_sum_bid = 0; | ||
_n_summands = 0; | ||
} | ||
|
||
void | ||
AverageBID::execute() | ||
{ | ||
_sum_bid += _current_boundary_id; | ||
++_n_summands; | ||
} | ||
|
||
void | ||
AverageBID::finalize() | ||
{ | ||
gatherSum(_sum_bid); | ||
gatherSum(_n_summands); | ||
} | ||
|
||
Real | ||
AverageBID::getValue() | ||
{ | ||
return _sum_bid / _n_summands; | ||
} | ||
|
||
void | ||
AverageBID::threadJoin(const UserObject & y) | ||
{ | ||
const AverageBID & pps = static_cast<const AverageBID &>(y); | ||
_sum_bid += pps._sum_bid; | ||
_n_summands += pps._n_summands; | ||
} |
57 changes: 57 additions & 0 deletions
57
test/tests/postprocessors/current_boundary_id/current_boundary_id.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,57 @@ | ||
# | ||
# This is used to create the mesh but it does not work with --distributed-mesh flag | ||
# and the parallel test bombs. | ||
# | ||
#[Mesh] | ||
# type = MeshGeneratorMesh | ||
# | ||
# [./cartesian] | ||
# type = CartesianMeshGenerator | ||
# dim = 2 | ||
# dx = '1 1' | ||
# dy = '1' | ||
# subdomain_id = '1 2' | ||
# [../] | ||
# | ||
# [./interior_bc] | ||
# type = SideSetsBetweenSubdomainsGenerator | ||
# master_block = 1 | ||
# paired_block = 2 | ||
# new_boundary = 12 | ||
# input = cartesian | ||
# [../] | ||
#[] | ||
|
||
[Mesh] | ||
type = FileMesh | ||
file = current_boundary_id_in.e | ||
[] | ||
|
||
[Problem] | ||
kernel_coverage_check = false | ||
[] | ||
|
||
[Variables] | ||
[./u] | ||
[../] | ||
[] | ||
|
||
[Postprocessors] | ||
[./interior_boundary] | ||
type = AverageBID | ||
boundary = 12 | ||
[../] | ||
|
||
[./top_boundary] | ||
type = AverageBID | ||
boundary = top | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
[] | ||
|
||
[Outputs] | ||
csv = true | ||
[] |
Binary file added
BIN
+3.11 KB
test/tests/postprocessors/current_boundary_id/current_boundary_id_in.e
Binary file not shown.
3 changes: 3 additions & 0 deletions
3
test/tests/postprocessors/current_boundary_id/gold/current_boundary_id_out.csv
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,3 @@ | ||
time,interior_boundary,top_boundary | ||
0,0,0 | ||
1,12,2 |
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] | ||
issues = '#13953' | ||
design = 'Assembly.md' | ||
[current_boundary_id] | ||
type = CSVDiff | ||
input = current_boundary_id.i | ||
csvdiff = 'current_boundary_id_out.csv' | ||
requirement = "The current boundary id shall be available in objects evaluated on boundaries." | ||
[] | ||
[] |