diff --git a/framework/doc/content/source/userobject/NearestPointLayeredSideIntegral.md b/framework/doc/content/source/userobject/NearestPointLayeredSideIntegral.md new file mode 100644 index 000000000000..1f0fb8371afd --- /dev/null +++ b/framework/doc/content/source/userobject/NearestPointLayeredSideIntegral.md @@ -0,0 +1,15 @@ +# NearestPointLayeredSideIntegral + +The domain is virtually divided into a number of subdomains according to the +nearest points provided by users. And then the layered side integral +is computed for the sides on each individual subdomain separately. + +!syntax description /UserObjects/NearestPointLayeredSideIntegral + +!syntax parameters /UserObjects/NearestPointLayeredSideIntegral + +!syntax inputs /UserObjects/NearestPointLayeredSideIntegral + +!syntax children /UserObjects/NearestPointLayeredSideIntegral + +!bibtex bibliography diff --git a/framework/include/userobject/NearestPointLayeredSideIntegral.h b/framework/include/userobject/NearestPointLayeredSideIntegral.h new file mode 100644 index 000000000000..34eadefcf437 --- /dev/null +++ b/framework/include/userobject/NearestPointLayeredSideIntegral.h @@ -0,0 +1,37 @@ +//* 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 + +// MOOSE includes +#include "SideIntegralVariableUserObject.h" +#include "NearestPointBase.h" +#include "LayeredSideIntegral.h" + +// Forward Declarations +class NearestPointLayeredSideIntegral; + +template <> +InputParameters validParams(); + +/** + * This UserObject computes integrals of a variable storing partial + * sums for the specified number of intervals in a direction (x,y,z). + * + * Given a list of points this object computes the layered integral + * closest to each one of those points. + */ +class NearestPointLayeredSideIntegral + : public NearestPointBase +{ +public: + static InputParameters validParams(); + + NearestPointLayeredSideIntegral(const InputParameters & parameters); +}; diff --git a/framework/src/userobject/NearestPointLayeredSideIntegral.C b/framework/src/userobject/NearestPointLayeredSideIntegral.C new file mode 100644 index 000000000000..c101c1efa645 --- /dev/null +++ b/framework/src/userobject/NearestPointLayeredSideIntegral.C @@ -0,0 +1,32 @@ +//* 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 + +// MOOSE includes +#include "NearestPointLayeredSideIntegral.h" +#include "LayeredSideIntegral.h" + +registerMooseObject("MooseApp", NearestPointLayeredSideIntegral); + +defineLegacyParams(NearestPointLayeredSideIntegral); + +InputParameters +NearestPointLayeredSideIntegral::validParams() +{ + InputParameters params = + nearestPointBaseValidParams(); + + params.addClassDescription("Compute layered side integrals for nearest-point based subdomains"); + + return params; +} + +NearestPointLayeredSideIntegral::NearestPointLayeredSideIntegral(const InputParameters & parameters) + : NearestPointBase(parameters) +{ +} diff --git a/test/tests/userobjects/nearest_point_layered_side_integral/gold/nearest_point_layered_side_integral_out.e b/test/tests/userobjects/nearest_point_layered_side_integral/gold/nearest_point_layered_side_integral_out.e new file mode 100644 index 000000000000..ab73c3dddbe6 Binary files /dev/null and b/test/tests/userobjects/nearest_point_layered_side_integral/gold/nearest_point_layered_side_integral_out.e differ diff --git a/test/tests/userobjects/nearest_point_layered_side_integral/nearest_point_layered_side_integral.i b/test/tests/userobjects/nearest_point_layered_side_integral/nearest_point_layered_side_integral.i new file mode 100644 index 000000000000..17f639b8684f --- /dev/null +++ b/test/tests/userobjects/nearest_point_layered_side_integral/nearest_point_layered_side_integral.i @@ -0,0 +1,99 @@ +# This input computes both a layered average and layered integral with the +# same direction, points, and number of layers. The layered integral for "bin" +# i is directly equal to the layered average for "bin" i multiplied by +# by 0.05 (side length of 1 divided by 10 layers X side length of 1 divided by 2 points). + +[Mesh] + type = GeneratedMesh + dim = 3 + nx = 10 + ny = 10 + nz = 10 +[] + +[Variables] + [dummy] + [] +[] + +[Kernels] + [diffusion] + type = Diffusion + variable = dummy + [] +[] + +[AuxVariables] + [u] + [] +[] + +[AuxVariables] + [np_layered_integral] + order = CONSTANT + family = MONOMIAL + [] + [np_layered_average] + order = CONSTANT + family = MONOMIAL + [] +[] + +[AuxKernels] + [u] + type = FunctionAux + variable = u + function = u + [] + [np_layered_integral] + type = SpatialUserObjectAux + variable = np_layered_integral + user_object = npli + boundary = 'front' + execute_on = timestep_end + [] + [np_layered_average] + type = SpatialUserObjectAux + variable = np_layered_average + user_object = npla + boundary = 'front' + execute_on = timestep_end + [] +[] + +[Functions] + [u] + type = ParsedFunction + value = 'x+2*y+3*z' + [] +[] + +[UserObjects] + [npla] + type = NearestPointLayeredSideAverage + direction = x + points = '0.5 0.25 0.5 + 0.5 0.75 0.5' + num_layers = 10 + variable = u + boundary = 'front' + [] + [npli] + type = NearestPointLayeredSideIntegral + direction = x + points = '0.5 0.25 0.5 + 0.5 0.75 0.5' + num_layers = 10 + variable = u + boundary = 'front' + [] +[] + +[Executioner] + type = Steady +[] + +[Outputs] + exodus = true + hide = 'dummy' +[] diff --git a/test/tests/userobjects/nearest_point_layered_side_integral/tests b/test/tests/userobjects/nearest_point_layered_side_integral/tests new file mode 100644 index 000000000000..afeb5ae40b5a --- /dev/null +++ b/test/tests/userobjects/nearest_point_layered_side_integral/tests @@ -0,0 +1,10 @@ +[Tests] + [./test] + type = Exodiff + input = nearest_point_layered_side_integral.i + exodiff = nearest_point_layered_side_integral_out.e + requirement = 'The system shall compute layered side integrals that computed from the closest values for a list of points' + design = 'NearestPointLayeredSideIntegral.md' + issues = '#18702' + [../] +[]