www.mooseframework.org
InterfaceValueTools.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "InterfaceValueTools.h"
11 
12 // MOOSE includes
13 #include "MooseEnum.h"
14 #include "MooseError.h"
15 
16 namespace InterfaceValueTools
17 {
18 
21 {
22  return MooseEnum("average jump_primary_minus_secondary jump_secondary_minus_primary "
23  "jump_abs primary secondary",
24  "average");
25 }
26 
27 Real
28 getQuantity(const MooseEnum interface_value_type,
29  const Real value_primary,
30  const Real value_secondary)
31 {
32  Real result = 0.;
33 
34  switch (interface_value_type)
35  {
36  case 0: /*average*/
37  result = (value_primary + value_secondary) * 0.5;
38  break;
39  case 1: /*jump_primary_minus_secondary*/
40  result = (value_primary - value_secondary);
41  break;
42  case 2: /*jump_secondary_minus_primary*/
43  result = (value_secondary - value_primary);
44  break;
45  case 3: /*jump_abs*/
46  result = std::abs(value_secondary - value_primary);
47  break;
48  case 4: /*primary*/
49  result = value_primary;
50  break;
51  case 5: /*secondary*/
52  result = value_secondary;
53  break;
54  default:
55  mooseError("InterfaceIntegralMaterialPropertyPostprocessor: the supplied integral "
56  "type is not in the list. Available options are: ",
57  InterfaceAverageOptions().getRawNames());
58  }
59  return result;
60 }
61 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
MooseEnum InterfaceAverageOptions()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real getQuantity(const MooseEnum, const Real, const Real)