Skip to content

Commit

Permalink
Added NearestPointLayeredSideAverageFunctor
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahansel committed Aug 14, 2023
1 parent e0888a6 commit b75901e
Show file tree
Hide file tree
Showing 21 changed files with 2,931 additions and 0 deletions.
@@ -0,0 +1,14 @@
# LayeredSideAverageFunctor

This object is the same as [LayeredSideAverage.md], but the average may be taken
of any [functor](Functors/index.md), not just a variable.

!alert note title=Functor requirements
This object requires the `ElemSideQpArg` [functor spatial argument](Functors/index.md) to be
implemented for the [!param](/UserObjects/LayeredSideAverageFunctor/functor) parameter.

!syntax parameters /UserObjects/LayeredSideAverageFunctor

!syntax inputs /UserObjects/LayeredSideAverageFunctor

!syntax children /UserObjects/LayeredSideAverageFunctor
@@ -0,0 +1,14 @@
# LayeredSideIntegralFunctor

This object is the same as [LayeredSideIntegral.md], but the side integral may be taken
of any [functor](Functors/index.md), not just a variable.

!alert note title=Functor requirements
This object requires the `ElemSideQpArg` [functor spatial argument](Functors/index.md) to be
implemented for the [!param](/UserObjects/LayeredSideIntegralFunctor/functor) parameter.

!syntax parameters /UserObjects/LayeredSideIntegralFunctor

!syntax inputs /UserObjects/LayeredSideIntegralFunctor

!syntax children /UserObjects/LayeredSideIntegralFunctor
@@ -0,0 +1,14 @@
# NearestPointLayeredSideAverageFunctor

This object is the same as [NearestPointLayeredSideAverage.md], but the layered average may be taken
of any [functor](Functors/index.md), not just a variable.

!alert note title=Functor requirements
This object requires the `ElemSideQpArg` [functor spatial argument](Functors/index.md) to be
implemented for the [!param](/UserObjects/NearestPointLayeredSideAverageFunctor/functor) parameter.

!syntax parameters /UserObjects/NearestPointLayeredSideAverageFunctor

!syntax inputs /UserObjects/NearestPointLayeredSideAverageFunctor

!syntax children /UserObjects/NearestPointLayeredSideAverageFunctor
24 changes: 24 additions & 0 deletions framework/include/userobjects/LayeredSideAverageFunctor.h
@@ -0,0 +1,24 @@
//* 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 "LayeredSideAverageBase.h"
#include "LayeredSideIntegralFunctor.h"

/**
* Computes layered side averages of a functor.
*/
class LayeredSideAverageFunctor : public LayeredSideAverageBase<LayeredSideIntegralFunctor>
{
public:
static InputParameters validParams();

LayeredSideAverageFunctor(const InputParameters & parameters);
};
24 changes: 24 additions & 0 deletions framework/include/userobjects/LayeredSideIntegralFunctor.h
@@ -0,0 +1,24 @@
//* 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 "LayeredSideIntegralBase.h"
#include "SideIntegralFunctorUserObject.h"

/**
* Computes layered side integrals of a functor.
*/
class LayeredSideIntegralFunctor : public LayeredSideIntegralBase<SideIntegralFunctorUserObject>
{
public:
static InputParameters validParams();

LayeredSideIntegralFunctor(const InputParameters & parameters);
};
@@ -0,0 +1,26 @@
//* 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 "SideIntegralFunctorUserObject.h"
#include "NearestPointBase.h"
#include "LayeredSideAverageFunctor.h"

/**
* Computes layered side averages of a functor nearest to a set of points.
*/
class NearestPointLayeredSideAverageFunctor
: public NearestPointBase<LayeredSideAverageFunctor, SideIntegralFunctorUserObject>
{
public:
static InputParameters validParams();

NearestPointLayeredSideAverageFunctor(const InputParameters & parameters);
};
33 changes: 33 additions & 0 deletions framework/include/userobjects/SideIntegralFunctorUserObject.h
@@ -0,0 +1,33 @@
//* 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 "SideIntegralUserObject.h"
#include "NonADFunctorInterface.h"

/**
* Computes a side integral of the specified functor.
*
* Note that specializations of this integral are possible by deriving from this
* class and overriding computeQpIntegral().
*/
class SideIntegralFunctorUserObject : public SideIntegralUserObject, public NonADFunctorInterface
{
public:
static InputParameters validParams();

SideIntegralFunctorUserObject(const InputParameters & parameters);

protected:
virtual Real computeQpIntegral() override;

/// Functor to integrate
const Moose::Functor<Real> & _functor;
};
25 changes: 25 additions & 0 deletions framework/src/userobjects/LayeredSideAverageFunctor.C
@@ -0,0 +1,25 @@
//* 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 "LayeredSideAverageFunctor.h"

registerMooseObject("MooseApp", LayeredSideAverageFunctor);

InputParameters
LayeredSideAverageFunctor::validParams()
{
InputParameters params = LayeredSideAverageBase<LayeredSideIntegralFunctor>::validParams();
params.addClassDescription("Computes layered side averages of a functor.");
return params;
}

LayeredSideAverageFunctor::LayeredSideAverageFunctor(const InputParameters & parameters)
: LayeredSideAverageBase<LayeredSideIntegralFunctor>(parameters)
{
}
25 changes: 25 additions & 0 deletions framework/src/userobjects/LayeredSideIntegralFunctor.C
@@ -0,0 +1,25 @@
//* 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 "LayeredSideIntegralFunctor.h"

registerMooseObject("MooseApp", LayeredSideIntegralFunctor);

InputParameters
LayeredSideIntegralFunctor::validParams()
{
InputParameters params = LayeredSideIntegralBase<SideIntegralFunctorUserObject>::validParams();
params.addClassDescription("Computes layered side integrals of a functor.");
return params;
}

LayeredSideIntegralFunctor::LayeredSideIntegralFunctor(const InputParameters & parameters)
: LayeredSideIntegralBase<SideIntegralFunctorUserObject>(parameters)
{
}
30 changes: 30 additions & 0 deletions framework/src/userobjects/NearestPointLayeredSideAverageFunctor.C
@@ -0,0 +1,30 @@
//* 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 "NearestPointLayeredSideAverageFunctor.h"

registerMooseObject("MooseApp", NearestPointLayeredSideAverageFunctor);

InputParameters
NearestPointLayeredSideAverageFunctor::validParams()
{
InputParameters params =
NearestPointBase<LayeredSideAverageFunctor, SideIntegralFunctorUserObject>::validParams();

params.addClassDescription(
"Computes layered side averages of a functor nearest to a set of points.");

return params;
}

NearestPointLayeredSideAverageFunctor::NearestPointLayeredSideAverageFunctor(
const InputParameters & parameters)
: NearestPointBase<LayeredSideAverageFunctor, SideIntegralFunctorUserObject>(parameters)
{
}
34 changes: 34 additions & 0 deletions framework/src/userobjects/SideIntegralFunctorUserObject.C
@@ -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

#include "SideIntegralFunctorUserObject.h"

InputParameters
SideIntegralFunctorUserObject::validParams()
{
InputParameters params = SideIntegralUserObject::validParams();
params += NonADFunctorInterface::validParams();
params.addRequiredParam<MooseFunctorName>("functor", "The functor to be integrated");
return params;
}

SideIntegralFunctorUserObject::SideIntegralFunctorUserObject(const InputParameters & parameters)
: SideIntegralUserObject(parameters),
NonADFunctorInterface(this),

_functor(getFunctor<Real>("functor"))
{
}

Real
SideIntegralFunctorUserObject::computeQpIntegral()
{
Moose::ElemSideQpArg elem_side_qp = {_current_elem, _current_side, _qp, _qrule};
return _functor(elem_side_qp, determineState());
}
8 changes: 8 additions & 0 deletions modules/doc/content/newsletter/2023/2023_08.md
Expand Up @@ -23,6 +23,14 @@ This makes it ideal for situations in which one of the surfaces is 2D, or if
thermal expansion is provided as a direct user model instead of having the mesh
be deformable. Additionally, the use of functors makes this model very flexible.

### Nearest-point layered side averages for functors

[LayeredSideIntegralFunctor.md], [LayeredSideAverageFunctor.md], and
[NearestPointLayeredSideAverageFunctor.md] have been added, which extend
[LayeredSideIntegral.md], [LayeredSideAverage.md], and
[NearestPointLayeredSideAverage.md] to accept any [functor](Functors/index.md),
not just variables.

## libMesh-level Changes

## PETSc-level Changes
Expand Down

0 comments on commit b75901e

Please sign in to comment.