https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NumericalFlux1D.C
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#include "NumericalFlux1D.h"
11#include "THMUtils.h"
12
19
21 : ThreadedGeneralUserObject(parameters),
22
23 _cached_flux_elem_id(libMesh::invalid_uint),
24 _cached_flux_side_id(libMesh::invalid_uint),
25
26 _last_region_index(0)
27{
28}
29
30void
36
37void
41
42void
46
47void
51
52const std::vector<ADReal> &
53NumericalFlux1D::getFlux(const unsigned int iside,
54 const dof_id_type ielem,
55 bool res_side_is_left,
56 const std::vector<ADReal> & UL_1d,
57 const std::vector<ADReal> & UR_1d,
58 Real nLR_dot_d) const
59{
60 if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside)
61 {
64
65 const auto UL_3d = convert1DInputTo3D(UL_1d);
66 const auto UR_3d = convert1DInputTo3D(UR_1d);
67
68 const RealVectorValue nLR(nLR_dot_d, 0, 0);
69 RealVectorValue t1, t2;
71
72 calcFlux(UL_3d, UR_3d, nLR, t1, t2, _FL_3d, _FR_3d);
73
76
79 }
80
81 if (res_side_is_left)
82 return _FL_1d;
83 else
84 return _FR_1d;
85}
86
87const std::vector<ADReal> &
88NumericalFlux1D::getFlux3D(const unsigned int iside,
89 const dof_id_type ielem,
90 const std::vector<ADReal> & UL_3d,
91 const std::vector<ADReal> & UR_3d,
92 const RealVectorValue & nLR,
93 const RealVectorValue & t1,
94 const RealVectorValue & t2) const
95{
96 if (_cached_flux_elem_id != ielem || _cached_flux_side_id != iside)
97 {
100
101 calcFlux(UL_3d, UR_3d, nLR, t1, t2, _FL_3d, _FR_3d);
102 }
103
104 return _FL_3d;
105}
static InputParameters validParams()
virtual const std::vector< ADReal > & getFlux(const unsigned int iside, const dof_id_type ielem, bool res_side_is_left, const std::vector< ADReal > &UL_1d, const std::vector< ADReal > &UR_1d, Real nLR_dot_d) const
Gets the 1D flux vector for an element/side combination.
static InputParameters validParams()
std::vector< ADReal > _FR_1d
flux vector for the "right" cell for 1D
unsigned int _cached_flux_elem_id
element ID of the cached flux values
std::vector< ADReal > _FR_3d
flux vector for the "right" cell for 3D
virtual std::vector< ADReal > convert1DInputTo3D(const std::vector< ADReal > &U_1d) const =0
Converts a 1D flux input vector to a 3D flux input vector.
unsigned int _cached_flux_side_id
side ID of the cached flux values
virtual void transform3DFluxDirection(std::vector< ADReal > &F_3d, Real nLR_dot_d) const =0
Applies direction transformation to a 3D flux vector.
virtual std::vector< ADReal > convert3DFluxTo1D(const std::vector< ADReal > &F_3d) const =0
Converts a 3D flux vector to a 1D flux vector.
std::vector< ADReal > _FL_3d
flux vector for the "left" cell for 3D
virtual void calcFlux(const std::vector< ADReal > &UL_3d, const std::vector< ADReal > &UR_3d, const RealVectorValue &nLR, const RealVectorValue &t1, const RealVectorValue &t2, std::vector< ADReal > &FL, std::vector< ADReal > &FR) const =0
Calculates the 3D flux vectors given "left" and "right" states.
virtual const std::vector< ADReal > & getFlux3D(const unsigned int iside, const dof_id_type ielem, const std::vector< ADReal > &UL_3d, const std::vector< ADReal > &UR_3d, const RealVectorValue &nLR, const RealVectorValue &t1, const RealVectorValue &t2) const
Gets the 3D flux vector for an element/side combination on the left side.
virtual void finalize() override
virtual void initialize() override
virtual void threadJoin(const UserObject &) override
virtual void execute() override
NumericalFlux1D(const InputParameters &parameters)
std::vector< ADReal > _FL_1d
flux vector for the "left" cell for 1D
void computeOrthogonalDirections(const RealVectorValue &n_unnormalized, RealVectorValue &t1, RealVectorValue &t2)
Computes two unit vectors orthogonal to the given vector.
Definition THMUtils.C:22
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const unsigned int invalid_uint