https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FaceArgInterface.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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#pragma once
11
12#include "MooseTypes.h"
13#include "FaceInfo.h"
15#include "libmesh/elem.h"
16
22{
23public:
24 virtual ~FaceArgInterface() = default;
25 virtual bool hasFaceSide(const FaceInfo & fi, const bool fi_elem_side) const = 0;
26};
27
33{
34public:
45 const Moose::FV::LimiterType limiter_type,
46 const bool elem_is_upwind,
47 const bool correct_skewness = false,
48 const Moose::StateArg * state_limiter = nullptr) const;
49
70 template <typename FunctorType>
71 Moose::FaceArg makeFace(const FunctorType & functor,
72 const FaceInfo & fi,
73 const Moose::FV::LimiterType limiter_type,
74 const bool elem_is_upwind,
75 const bool correct_skewness = false,
76 const Moose::StateArg * state_limiter = nullptr) const;
77
86 Moose::FaceArg makeCDFace(const FaceInfo & fi, const bool correct_skewness = false) const;
87};
88
89template <typename FunctorType>
90inline Moose::FaceArg
91FaceArgProducerInterface::makeFace(const FunctorType & functor,
92 const FaceInfo & fi,
93 const Moose::FV::LimiterType limiter_type,
94 const bool elem_is_upwind,
95 const bool correct_skewness,
96 const Moose::StateArg * state_limiter) const
97{
98 const bool defined_on_elem_side = functor.hasFaceSide(fi, true);
99 const bool defined_on_neighbor_side = functor.hasFaceSide(fi, false);
100
101 if (!defined_on_elem_side && !defined_on_neighbor_side)
102 mooseError("The functor '",
103 functor.functorName(),
104 "' is not defined on either side of the face with centroid ",
105 fi.faceCentroid(),
106 ".");
107
108 const Elem * const face_side = defined_on_elem_side && defined_on_neighbor_side
109 ? nullptr
110 : (defined_on_elem_side ? fi.elemPtr() : fi.neighborPtr());
111
112 return {&fi, limiter_type, elem_is_upwind, correct_skewness, face_side, state_limiter};
113}
114
115inline Moose::FaceArg
116FaceArgProducerInterface::makeCDFace(const FaceInfo & fi, const bool correct_skewness) const
117{
118 return makeFace(fi, Moose::FV::LimiterType::CentralDifference, true, correct_skewness);
119}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
A base class interface for both producers and consumers of functor face arguments,...
virtual ~FaceArgInterface()=default
virtual bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const =0
An interface for producers of functor face arguments, e.g.
Moose::FaceArg makeFace(const FaceInfo &fi, const Moose::FV::LimiterType limiter_type, const bool elem_is_upwind, const bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
Create a functor face argument from provided component arguments.
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
Make a functor face argument with a central differencing limiter, e.g.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
const Elem * neighborPtr() const
Definition FaceInfo.h:88
const Elem * elemPtr() const
Definition FaceInfo.h:86
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition FaceInfo.h:75
A structure defining a "face" evaluation calling argument for Moose functors.
State argument for evaluating functors.