Skip to content
Permalink
Browse files

Merge pull request #12902 from arovinelli/INTERFACEUO

Boundary restrictable InterfaceUserObject (and postprocessor) family
  • Loading branch information...
moosebuild committed Mar 29, 2019
2 parents 601fa88 + 5f09014 commit 3c1dbccc1f9de1b48ae5c25121a2472e100206da
Showing with 1,726 additions and 5 deletions.
  1. +24 −0 framework/doc/content/source/auxkernels/InterfaceValueUserObjectAux.md
  2. +21 −0 framework/doc/content/source/postprocessors/InterfaceAverageVariableValuePostprocessor.md
  3. +21 −0 framework/doc/content/source/postprocessors/InterfaceIntegralVariableValuePostprocessor.md
  4. +27 −0 framework/doc/content/source/userobject/InterfaceQpValueUserObject.md
  5. +17 −0 framework/doc/content/source/utils/InterfaceValueTools.md
  6. +39 −0 framework/include/auxkernels/InterfaceValueUserObjectAux.h
  7. +1 −0 framework/include/base/Attributes.h
  8. +3 −0 framework/include/loops/ComputeUserObjectsThread.h
  9. +34 −0 framework/include/postprocessors/InterfaceAverageVariableValuePostprocessor.h
  10. +47 −0 framework/include/postprocessors/InterfaceIntegralPostprocessor.h
  11. +51 −0 framework/include/postprocessors/InterfaceIntegralVariableValuePostprocessor.h
  12. +58 −0 framework/include/postprocessors/InterfacePostprocessor.h
  13. +3 −2 framework/include/problems/FEProblemBase.h
  14. +45 −0 framework/include/userobject/InterfaceQpValueUserObject.h
  15. +69 −0 framework/include/userobject/InterfaceUserObject.h
  16. +35 −0 framework/include/userobject/InterfaceValueUserObject.h
  17. +37 −0 framework/include/utils/InterfaceValueTools.h
  18. +36 −0 framework/src/auxkernels/InterfaceValueUserObjectAux.C
  19. +2 −0 framework/src/base/Attributes.C
  20. +33 −1 framework/src/loops/ComputeUserObjectsThread.C
  21. +37 −0 framework/src/postprocessors/InterfaceAverageVariableValuePostprocessor.C
  22. +69 −0 framework/src/postprocessors/InterfaceIntegralPostprocessor.C
  23. +58 −0 framework/src/postprocessors/InterfaceIntegralVariableValuePostprocessor.C
  24. +46 −0 framework/src/postprocessors/InterfacePostprocessor.C
  25. +8 −2 framework/src/problems/FEProblemBase.C
  26. +97 −0 framework/src/userobject/InterfaceQpValueUserObject.C
  27. +59 −0 framework/src/userobject/InterfaceUserObject.C
  28. +36 −0 framework/src/userobject/InterfaceValueUserObject.C
  29. +59 −0 framework/src/utils/InterfaceValueTools.C
  30. BIN test/tests/postprocessors/interface_value/gold/interface_average_variable_value_postprocessor_out.e
  31. BIN test/tests/postprocessors/interface_value/gold/interface_integral_variable_value_postprocessor_out.e
  32. +166 −0 test/tests/postprocessors/interface_value/interface_average_variable_value_postprocessor.i
  33. +166 −0 test/tests/postprocessors/interface_value/interface_integral_variable_value_postprocessor.i
  34. +34 −0 test/tests/postprocessors/interface_value/tests
  35. BIN test/tests/userobjects/interface_user_object/gold/interface_value_user_object_QP_out.e
  36. +265 −0 test/tests/userobjects/interface_user_object/interface_value_user_object_QP.i
  37. +23 −0 test/tests/userobjects/interface_user_object/tests
@@ -0,0 +1,24 @@
# InterfaceValueUserObjectAux

## Description

InterfaceValueUserObjectAux is an AuxKernel used to collect values stored in a [InterfaceQpValueUserObject](/InterfaceQpValueUserObject.md) and save them into an aux variable at each quadrature point.
It requires three inputs:

* `variable` is the name of the output AuxVariable
* `boundary` = the name of the boundary to which this AuxKernel applies
* `interface_uo_name` = the name of interface UserObject where data are stored

## Example Input File Syntax

listing test/tests/userobjects/interface_user_object/interface_value_user_object_QP.i block=AuxKernels/interface_avg_qp_aux

!syntax description /AuxKernels/InterfaceValueUserObjectAux

!syntax parameters /AuxKernels/InterfaceValueUserObjectAux

!syntax inputs /AuxKernels/InterfaceValueUserObjectAux

!syntax children /AuxKernels/InterfaceValueUserObjectAux

!bibtex bibliography
@@ -0,0 +1,21 @@
# InterfaceAverageVariableValuePostprocessor

## IMPORTANT NOTE
*** Any derived class of InterfaceUserObject does not support yet getMaterialProperty, please use auxvariables ***

## Description
!syntax description /Postprocessors/InterfaceAverageVariableValuePostprocessor

This post-processor is used to compute an average value across an interface. The type of average to compute is selected by changing the `interface_value_type` parameter. If the parameter `interface_value_type` is omitted it defaults to compute the average value between the two input variables across the interface.
The various types of averages that can be computed are describe in more details in [InterfaceValueTools](/InterfaceValueTools.md).


## Example Input File Syntax

listing test/tests/postprocessors/interface_value/interface_average_variable_value_postprocessor.i block=Postprocessors/diffusivity_average

!syntax parameters /Postprocessors/InterfaceAverageVariableValuePostprocessor

!syntax inputs /Postprocessors/InterfaceAverageVariableValuePostprocessor

!syntax children /Postprocessors/InterfaceAverageVariableValuePostprocessor
@@ -0,0 +1,21 @@
# InterfaceIntegralVariableValuePostprocessor

## IMPORTANT NOTE
*** Any derived class of InterfaceUserObject does not support yet getMaterialProperty, please use auxvariables ***

## Description
!syntax description /Postprocessors/InterfaceIntegralVariableValuePostprocessor

This post-processor is used to compute an integral value of variable on an interface. The type of average to compute is selected by changing the `interface_value_type` parameter. If the parameter `interface_value_type` is omitted it defaults to compute the average value between the two input variables across the interface.
The various types of averages that can be computed are describe in more details in [InterfaceValueTools](/InterfaceValueTools.md).


## Example Input File Syntax

listing test/tests/postprocessors/interface_value/interface_integral_variable_value_postprocessor.i block=Postprocessors/diffusivity_average

!syntax parameters /Postprocessors/InterfaceIntegralVariableValuePostprocessor

!syntax inputs /Postprocessors/InterfaceIntegralVariableValuePostprocessor

!syntax children /Postprocessors/InterfaceIntegralVariableValuePostprocessor
@@ -0,0 +1,27 @@
# InterfaceQpValueUserObject

## IMPORTANT NOTES
*** Any derived class of InterfaceUserObject does not support yet getMaterialProperty, please use auxvariables***

*** This userobejct only support multiprocessing. Threading is not supported at this time ***


## Description
!syntax description /UserObjects/InterfaceQpValueUserObject

InterfaceQpValueUserObject is a user object computing and storing average values across an interface for each quadrature. The kind of average value are the one available in [InterfaceValueTools](/InterfaceValueTools.md).

The stored value can be converted into an AuxVariable by using [InterfaceValueUserObjectAux](/InterfaceValueUserObjectAux.md) AuxKernel.


## Example Input File Syntax

listing test/tests/userobjects/interface_user_object/interface_value_user_object_QP.i block=UserObjects/interface_value_uo

!syntax description /UserObjects/InterfaceQpValueUserObject

!syntax parameters /UserObjects/InterfaceQpValueUserObject

!syntax inputs /UserObjects/InterfaceQpValueUserObject

!syntax children /UserObjects/InterfaceQpValueUserObject
@@ -0,0 +1,17 @@
# InterfaceValueTools

## Description

Basic utility file to compute a single quantity given values on both side of an interface. The value to compute is selected via the input parameter
interface_value_type. This function is not registered and as such should only be used for simplifying the development of other objects.
An example of an object using this utility is [InterfaceAverageVariableValuePostprocessor](/InterfaceAverageVariableValuePostprocessor.md).

Available outputs are:
* average: (value_m-value_s)/2
* jump_master_minus_slave: value_m-value_s
* jump_slave_minus_master: value_s-value_m
* jump_abs: abs(value_m-value_s)
* master: value_m
* slave: value_s

where value_m is the value on the master side of the interface (e.g. where the boundary is defined) and value_s is the value on the slave side of the interface.
@@ -0,0 +1,39 @@
//* 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

#ifndef INTERFACEUSEROBJECTQPAUX_H
#define INTERFACEUSEROBJECTQPAUX_H

#include "AuxKernel.h"
#include "InterfaceQpValueUserObject.h"

// Forward Declarations
class InterfaceValueUserObjectAux;

template <>
InputParameters validParams<InterfaceValueUserObjectAux>();

/**
* AuxKernel creating an AuxVariable from values stored in an InterfaceQpValueUserObject
*/
class InterfaceValueUserObjectAux : public AuxKernel
{
public:
/**
* Factory constructor, takes parameters so that all derived classes can be built using the same
* constructor.
*/
InterfaceValueUserObjectAux(const InputParameters & parameters);

protected:
virtual Real computeValue() override;
const InterfaceQpValueUserObject & _interface_uo;
};

#endif // INTERFACEUSEROBJECTQPAUX_H
@@ -25,6 +25,7 @@ enum class Interfaces
ShapeSideUserObject = 1 << 9,
Postprocessor = 1 << 10,
VectorPostprocessor = 1 << 11,
InterfaceUserObject = 1 << 12,
};

template <>
@@ -18,6 +18,7 @@
class InternalSideUserObject;
class ElementUserObject;
class ShapeElementUserObject;
class InterfaceUserObject;

// libMesh forward declarations
namespace libMesh
@@ -43,6 +44,7 @@ class ComputeUserObjectsThread : public ThreadedElementLoop<ConstElemRange>
virtual void onElement(const Elem * elem) override;
virtual void onBoundary(const Elem * elem, unsigned int side, BoundaryID bnd_id) override;
virtual void onInternalSide(const Elem * elem, unsigned int side) override;
virtual void onInterface(const Elem * elem, unsigned int side, BoundaryID bnd_id) override;
virtual void post() override;
virtual void subdomainChanged() override;

@@ -73,6 +75,7 @@ class ComputeUserObjectsThread : public ThreadedElementLoop<ConstElemRange>

const TheWarehouse::Query _query;
std::vector<InternalSideUserObject *> _internal_side_objs;
std::vector<InterfaceUserObject *> _interface_user_objects;
std::vector<ElementUserObject *> _element_objs;
std::vector<ShapeElementUserObject *> _shape_element_objs;
};
@@ -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

#ifndef INTERFACEAVERAGEVARIABLEVALUEPOSTPROCESSOR_H
#define INTERFACEAVERAGEVARIABLEVALUEPOSTPROCESSOR_H

#include "InterfaceIntegralVariableValuePostprocessor.h"

// Forward Declarations
class InterfaceAverageVariableValuePostprocessor;

template <>
InputParameters validParams<InterfaceAverageVariableValuePostprocessor>();

/**
* This postprocessor computes a spatial average value of the specified variable value on the
* interface. Different kind of averages may be obtaine either by specializing the computeQpIntegral
* or adding a new type of interfaceValue to InterfaceValueTools class
*/
class InterfaceAverageVariableValuePostprocessor
: public InterfaceIntegralVariableValuePostprocessor
{
public:
InterfaceAverageVariableValuePostprocessor(const InputParameters & parameters);
virtual Real getValue() override;
};

#endif /*INTERFACEAVERAGEVARIABLEVALUEPOSTPROCESSOR_H*/
@@ -0,0 +1,47 @@
//* 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

#ifndef INTERFACEINTEGRALPOSTPROCESSOR_H
#define INTERFACEINTEGRALPOSTPROCESSOR_H

#include "InterfacePostprocessor.h"

// Forward Declarations
class InterfaceIntegralPostprocessor;

template <>
InputParameters validParams<InterfaceIntegralPostprocessor>();

/**
* This postprocessor add generel capabilities to the InterfacePostprocessor to compute an
* integral over an interface. To actually compute an integral one must derive from this class,
* specialize computeQpIntegral() and give access to either a varaible or a material property
**/
class InterfaceIntegralPostprocessor : public InterfacePostprocessor
{
public:
InterfaceIntegralPostprocessor(const InputParameters & parameters);

virtual void initialize() override;
virtual void execute() override;
virtual Real getValue() override;
virtual void threadJoin(const UserObject & y) override;

static MooseEnum integralTypeOptions();

protected:
virtual Real computeQpIntegral() = 0; // MUST BE OVERRIDDEN
virtual Real computeIntegral();

unsigned int _qp;

Real _integral_value;
};

#endif
@@ -0,0 +1,51 @@
//* 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

#ifndef INTERFACEINTEGRALVARIABLEPOSTPROCESSOR_H
#define INTERFACEINTEGRALVARIABLEPOSTPROCESSOR_H

#include "InterfaceIntegralPostprocessor.h"
#include "MooseVariableInterface.h"

// Forward Declarations
class InterfaceIntegralVariableValuePostprocessor;

template <>
InputParameters validParams<InterfaceIntegralVariableValuePostprocessor>();

/**
* This postprocessor computes a weighted (by area) integral of the specified variable.
* The type of integral is determined by the _interface_value_type input parameter
* Note that specializations of this integral are possible by deriving from this
* class and overriding computeQpIntegral().
*/
class InterfaceIntegralVariableValuePostprocessor : public InterfaceIntegralPostprocessor,
public MooseVariableInterface<Real>
{
public:
InterfaceIntegralVariableValuePostprocessor(const InputParameters & parameters);

protected:
/// Holds the solution at current quadrature points
const VariableValue & _u;
/// Holds the solution gradient at the current quadrature points
const VariableGradient & _grad_u;
/// Holds the solution at current quadrature points on the neighbor side
const VariableValue & _u_neighbor;
/// Holds the solution gradient at the current quadrature points on the
/// neighbor side
const VariableGradient & _grad_u_neighbor;

/// the type of interface value we want to compute
const MooseEnum _interface_value_type;
/// the contribution of a qp to the integral
virtual Real computeQpIntegral() override;
};

#endif
@@ -0,0 +1,58 @@
//* 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

#ifndef INTERFACEPOSTPROCESSOR_H
#define INTERFACEPOSTPROCESSOR_H

#include "InterfaceUserObject.h"
#include "Postprocessor.h"

// Forward Declarations
class InterfacePostprocessor;

/**
* BASE CLASS FOR IMPLEMENTING INTERFACE POSTRPOCESSOR
* ALL INTERFACE POSTPROCESOR SHOULD DERIVE FROM THIS CLASS
* THIS CALSS ALASO COMPUTE THE INTERFACE AREA
*/

template <>
InputParameters validParams<InterfacePostprocessor>();

class InterfacePostprocessor : public InterfaceUserObject, public Postprocessor
{
public:
InterfacePostprocessor(const InputParameters & parameters);

virtual void initialize() override;
virtual void execute() override;
virtual void threadJoin(const UserObject & y) override;
/**
* This is called _after_ execute() and _after_ threadJoin()! This is probably where you want to
* do MPI communication!
* Finalize is not required for Postprocessor implementations since work may be done in
* getValue().
*/
virtual Real getValue() override
{
// compute the interface area based on the are of the master side
// this come at no cost so why not mek it avaialable for all subclasses
gatherSum(_interface_master_area);
return 0;
}

// becasue getValue already does the work we just override to nothing
virtual void finalize() override {}

protected:
/// the area of the master side of the interface
Real _interface_master_area;
};

#endif
@@ -67,6 +67,7 @@ class SideUserObject;
class NodalUserObject;
class ElementUserObject;
class InternalSideUserObject;
class InterfaceUserObject;
class GeneralUserObject;
class Function;
class Distribution;
@@ -1340,8 +1341,8 @@ class FEProblemBase : public SubProblem, public Restartable
///@{
/**
* These methods are used to determine whether stateful material properties need to be stored on
* internal sides. There are four situations where this may be the case: 1) DGKernels
* 2) IntegratedBCs 3)InternalSideUserObjects 4)ElementalAuxBCs
* internal sides. There are five situations where this may be the case: 1) DGKernels
* 2) IntegratedBCs 3)InternalSideUserObjects 4)ElementalAuxBCs 5)InterfaceUserObjects
*
* Method 1:
* @param bnd_id the boundary id for which to see if stateful material properties need to be
Oops, something went wrong.

0 comments on commit 3c1dbcc

Please sign in to comment.
You can’t perform that action at this time.