Skip to content

Commit

Permalink
Add nearest point side layered integral user object. Refs idaholab#18702
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilnovak committed Aug 25, 2021
1 parent 33797fc commit 0e269b8
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 0 deletions.
@@ -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
37 changes: 37 additions & 0 deletions 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<NearestPointLayeredSideIntegral>();

/**
* 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<LayeredSideIntegral, SideIntegralVariableUserObject>
{
public:
static InputParameters validParams();

NearestPointLayeredSideIntegral(const InputParameters & parameters);
};
32 changes: 32 additions & 0 deletions 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<LayeredSideIntegral, SideIntegralVariableUserObject>();

params.addClassDescription("Compute layered side integrals for nearest-point based subdomains");

return params;
}

NearestPointLayeredSideIntegral::NearestPointLayeredSideIntegral(const InputParameters & parameters)
: NearestPointBase<LayeredSideIntegral, SideIntegralVariableUserObject>(parameters)
{
}
Binary file not shown.
@@ -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'
[]
10 changes: 10 additions & 0 deletions 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'
[../]
[]

0 comments on commit 0e269b8

Please sign in to comment.