Skip to content

Commit

Permalink
changing second order upwind and limitng formulation to work with inc…
Browse files Browse the repository at this point in the history
…ompressible flow Refs #28891
  • Loading branch information
Tano Retamales committed Oct 20, 2024
1 parent b3924ec commit b3ebc22
Show file tree
Hide file tree
Showing 38 changed files with 1,028 additions and 185 deletions.
2 changes: 1 addition & 1 deletion framework/contrib/wasp
Submodule wasp updated from c8c9ce to 42b77e
179 changes: 91 additions & 88 deletions framework/include/base/MooseFunctorArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,94 @@ struct ElemPointArg
ElemArg makeElem() const { return {elem, correct_skewness}; }
};

/**
* Argument for requesting functor evaluation at quadrature point locations on an element side.
* Data in the argument:
* - The element
* - The element side on which the quadrature points are located
* - The quadrature point index, e.g. if there are \p n quadrature points, we are requesting the\n
* evaluation of the i-th point
* - The quadrature rule that can be used to initialize the functor on the given element and side
*/
struct ElemSideQpArg
{
/// The element
const libMesh::Elem * elem;

/// The local side index
unsigned int side;

/// The quadrature point index
unsigned int qp;

/// The qudrature rule
const QBase * qrule;

/// The physical location of the quadrature point
Point point;

/**
* @returns The conceptual physical location of this data structure
*/
Point getPoint() const { return point; }
};

/**
* State argument for evaluating functors. The iteration type indicates whether you want to evaluate
* a functor based on some iterate state of a transient calculation, nonlinear solve, etc. The state
* indicates which iterate of the iterate type we want to evaluate on. A state of 0 indicates
* "current", e.g. the current time or the current nonlinear iteration (which should actually be
* equivalent); a state of 1 indicates the most-recent "old" time or the most recent previous
* nonlinear iteration, etc.
*/

struct StateArg
{
/**
* Prevent implicit conversions from boolean to avoid users accidentally constructing a time
* argument when they meant to construct a skewness argument, etc.
*/
StateArg(bool) = delete;

StateArg(unsigned int state_in) : state(state_in), iteration_type(SolutionIterationType::Time) {}

StateArg(unsigned int state_in, SolutionIterationType iteration_type_in)
: state(state_in), iteration_type(iteration_type_in)
{
}

/// The state. Zero represents the most recent state, so for any kind of iteration type, a zero
/// state represents the current state, e.g. current solution
/// One may represent the 'old' value (one before, in the iteration_type specified), and two an 'older' or two steps away state
unsigned int state;

/// The solution iteration type, e.g. time or nonlinear
SolutionIterationType iteration_type;

private:
StateArg() : state(0), iteration_type(SolutionIterationType::Time) {}

friend StateArg currentState();
};

inline StateArg
currentState()
{
return {};
}

inline StateArg
oldState()
{
return {(unsigned int)1};
}

inline StateArg
previousNonlinearState()
{
return {(unsigned int)1, SolutionIterationType::Nonlinear};
}

/**
* A structure defining a "face" evaluation calling argument for Moose functors
*/
Expand Down Expand Up @@ -104,6 +192,9 @@ struct FaceArg
/// on one side of the face.
const Elem * face_side;

/// A member that can be used to define the instance in which the limiters are executed
const Moose::StateArg * state_limiter;

/**
* @returns The conceptual physical location of this data structure
*/
Expand Down Expand Up @@ -169,92 +260,4 @@ struct ElemQpArg
*/
Point getPoint() const { return point; }
};

/**
* Argument for requesting functor evaluation at quadrature point locations on an element side.
* Data in the argument:
* - The element
* - The element side on which the quadrature points are located
* - The quadrature point index, e.g. if there are \p n quadrature points, we are requesting the\n
* evaluation of the i-th point
* - The quadrature rule that can be used to initialize the functor on the given element and side
*/
struct ElemSideQpArg
{
/// The element
const libMesh::Elem * elem;

/// The local side index
unsigned int side;

/// The quadrature point index
unsigned int qp;

/// The qudrature rule
const QBase * qrule;

/// The physical location of the quadrature point
Point point;

/**
* @returns The conceptual physical location of this data structure
*/
Point getPoint() const { return point; }
};

/**
* State argument for evaluating functors. The iteration type indicates whether you want to evaluate
* a functor based on some iterate state of a transient calculation, nonlinear solve, etc. The state
* indicates which iterate of the iterate type we want to evaluate on. A state of 0 indicates
* "current", e.g. the current time or the current nonlinear iteration (which should actually be
* equivalent); a state of 1 indicates the most-recent "old" time or the most recent previous
* nonlinear iteration, etc.
*/

struct StateArg
{
/**
* Prevent implicit conversions from boolean to avoid users accidentally constructing a time
* argument when they meant to construct a skewness argument, etc.
*/
StateArg(bool) = delete;

StateArg(unsigned int state_in) : state(state_in), iteration_type(SolutionIterationType::Time) {}

StateArg(unsigned int state_in, SolutionIterationType iteration_type_in)
: state(state_in), iteration_type(iteration_type_in)
{
}

/// The state. Zero represents the most recent state, so for any kind of iteration type, a zero
/// state represents the current state, e.g. current solution
/// One may represent the 'old' value (one before, in the iteration_type specified), and two an 'older' or two steps away state
unsigned int state;

/// The solution iteration type, e.g. time or nonlinear
SolutionIterationType iteration_type;

private:
StateArg() : state(0), iteration_type(SolutionIterationType::Time) {}

friend StateArg currentState();
};

inline StateArg
currentState()
{
return {};
}

inline StateArg
oldState()
{
return {(unsigned int)1};
}

inline StateArg
previousNonlinearState()
{
return {(unsigned int)1, SolutionIterationType::Nonlinear};
}
}
3 changes: 2 additions & 1 deletion framework/include/interfaces/FaceArgInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class FaceArgProducerInterface : public FaceArgInterface
Moose::FaceArg makeFace(const FaceInfo & fi,
const Moose::FV::LimiterType limiter_type,
const bool elem_is_upwind,
const bool correct_skewness = false) const;
const bool correct_skewness = false,
const Moose::StateArg * state_limiter = nullptr) const;

/**
* Make a functor face argument with a central differencing limiter, e.g. compose a face
Expand Down
11 changes: 9 additions & 2 deletions framework/include/limiters/CentralDifferenceLimiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ template <typename T>
class CentralDifferenceLimiter : public Limiter<T>
{
public:
T
limit(const T &, const T &, const VectorValue<T> *, const RealVectorValue &) const override final
T limit(const T &,
const T &,
const VectorValue<T> *,
const VectorValue<T> *,
const RealVectorValue &,
const T &,
const T &,
const FaceInfo *,
const bool &) const override final
{
return 1;
}
Expand Down
Loading

0 comments on commit b3ebc22

Please sign in to comment.