Skip to content

Commit

Permalink
move NearestPointLayeredSideFluxAverage from SAM to MOOSE
Browse files Browse the repository at this point in the history
  • Loading branch information
miaoyinb committed Jun 10, 2022
1 parent 5f2c210 commit aa711bd
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 0 deletions.
@@ -0,0 +1,15 @@
# NearestPointLayeredSideFluxAverage

The domain is virtually divided into a number of subdomains according to the
nearest points provided by users. And then the layered side average flux
is computed for the sides on each individual subdomain separately.

!syntax description /UserObjects/NearestPointLayeredSideFluxAverage

!syntax parameters /UserObjects/NearestPointLayeredSideFluxAverage

!syntax inputs /UserObjects/NearestPointLayeredSideFluxAverage

!syntax children /UserObjects/NearestPointLayeredSideFluxAverage

!bibtex bibliography
31 changes: 31 additions & 0 deletions framework/include/userobject/NearestPointLayeredSideFluxAverage.h
@@ -0,0 +1,31 @@
//* 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 "LayeredSideDiffusiveFluxAverage.h"

/**
* This UserObject computes averages of a variable's flux 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 average flux
* closest to each one of those points.
*/
class NearestPointLayeredSideFluxAverage
: public NearestPointBase<LayeredSideDiffusiveFluxAverage, SideIntegralVariableUserObject>
{
public:
static InputParameters validParams();

NearestPointLayeredSideFluxAverage(const InputParameters & parameters);
};
31 changes: 31 additions & 0 deletions framework/src/userobject/NearestPointLayeredSideFluxAverage.C
@@ -0,0 +1,31 @@
//* 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 "NearestPointLayeredSideFluxAverage.h"
#include "LayeredSideDiffusiveFluxAverage.h"

registerMooseObject("MooseApp", NearestPointLayeredSideFluxAverage);

InputParameters
NearestPointLayeredSideFluxAverage::validParams()
{
InputParameters params = NearestPointBase<LayeredSideDiffusiveFluxAverage,
SideIntegralVariableUserObject>::validParams();

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

return params;
}

NearestPointLayeredSideFluxAverage::NearestPointLayeredSideFluxAverage(
const InputParameters & parameters)
: NearestPointBase<LayeredSideDiffusiveFluxAverage, SideIntegralVariableUserObject>(parameters)
{
}
Binary file not shown.
@@ -0,0 +1,79 @@
[Mesh]
type = GeneratedMesh
dim = 3
nx = 40
ny = 10
nz = 10
[]

[Variables]
[./u]
[../]
[]

[AuxVariables]
[./np_layered_flux_average]
order = CONSTANT
family = MONOMIAL
[../]
[]

[Kernels]
[./diff]
type = Diffusion
variable = u
[../]
[]

[AuxKernels]
[./np_layered_flux_average]
type = SpatialUserObjectAux
variable = np_layered_flux_average
execute_on = timestep_end
user_object = nplsfa
boundary = 'bottom top'
[../]
[]

[UserObjects]
[./nplsfa]
type = NearestPointLayeredSideFluxAverage
direction = x
points='0.25 0 0.25 0.75 0 0.25 0.25 0 0.75 0.75 0 0.75'
num_layers = 10
variable = u
diffusivity = 1.0
execute_on = linear
boundary = 'bottom top'
[../]
[]

[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./one]
type = DirichletBC
variable = u
boundary = 'right back top'
value = 1
[../]
[]



[Executioner]
type = Steady

solve_type = 'PJFNK'

petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]

[Outputs]
exodus = true
[]
@@ -0,0 +1,10 @@
[Tests]
[./test]
type = 'Exodiff'
input = 'nearest_point_layered_side_flux_average.i'
exodiff = 'nearest_point_layered_side_flux_average_out.e'
requirement = 'The system shall compute layered side flux averages that computed from the closest values for a list of points'
design = 'NearestPointLayeredSideFluxAverage.md'
issues = '#21258'
[../]
[]

0 comments on commit aa711bd

Please sign in to comment.