https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PressureJumpInterface.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
9#pragma once
10
11#include "MooseTypes.h"
12#include "libmesh/int_range.h"
13
14#include <cmath>
15
16namespace NS
17{
18namespace FV
19{
20
23{
24 bool is_baffle = false;
25 Real elem_jump = 0.0;
26 Real elem_conductance = 0.0;
28 Real elem_correction = 0.0;
31 Real elem_hbya_flux = 0.0;
33 Real transmissibility = 0.0;
34 Real correction = 0.0;
39 Real face_area = 0.0;
40 bool valid = false;
41};
42
48pressureJumpInterfaceData(const RealVectorValue & normal,
49 const Point & elem_to_face,
50 const Point & face_to_neighbor,
51 const RealVectorValue & elem_diffusion,
52 const RealVectorValue & neighbor_diffusion,
53 const RealVectorValue & elem_gradient,
54 const RealVectorValue & neighbor_gradient,
55 const RealVectorValue & elem_rho_hbya,
56 const RealVectorValue & neighbor_rho_hbya,
57 const Real face_area,
58 const bool use_nonorthogonal_correction,
59 const Real elem_jump)
60{
62 data.is_baffle = true;
63 data.elem_jump = elem_jump;
64 data.face_area = face_area;
65
66 const auto side_data = [&](const Point & half_cell,
67 const RealVectorValue & diffusion,
68 const RealVectorValue & gradient,
69 Real & conductance,
70 Real & correction,
71 Real & normal_distance,
72 Real & normal_diffusion)
73 {
74 RealVectorValue diffusion_normal;
75 for (const auto i : make_range(Moose::dim))
76 diffusion_normal(i) = diffusion(i) * normal(i);
77
78 normal_diffusion = normal * diffusion_normal;
79 normal_distance = half_cell * normal;
80 if (!std::isfinite(normal_distance) || normal_distance <= 0.0 ||
81 !std::isfinite(normal_diffusion) || normal_diffusion <= 0.0 || face_area <= 0.0)
82 return false;
83
84 conductance = face_area * normal_diffusion / normal_distance;
85
86 RealVectorValue correction_vector = diffusion_normal - normal_diffusion * normal;
87 if (use_nonorthogonal_correction)
88 correction_vector += normal_diffusion * (normal - half_cell / normal_distance);
89
90 correction = face_area * correction_vector * gradient;
91 return std::isfinite(conductance) && conductance > 0.0 && std::isfinite(correction);
92 };
93
94 const bool elem_valid = side_data(elem_to_face,
95 elem_diffusion,
96 elem_gradient,
98 data.elem_correction,
101 const bool neighbor_valid = side_data(face_to_neighbor,
102 neighbor_diffusion,
103 neighbor_gradient,
108 if (!elem_valid || !neighbor_valid)
109 return data;
110
111 data.elem_hbya_flux = face_area * (elem_rho_hbya * normal);
112 data.neighbor_hbya_flux = face_area * (neighbor_rho_hbya * normal);
113 // conductance in series
114 data.transmissibility = 1.0 / (1.0 / data.elem_conductance + 1.0 / data.neighbor_conductance);
117 data.valid = std::isfinite(data.transmissibility) && data.transmissibility > 0.0 &&
118 std::isfinite(data.correction) && std::isfinite(data.elem_hbya_flux) &&
119 std::isfinite(data.neighbor_hbya_flux);
120 return data;
121}
122
128inline Real
134
137inline Real
139 const Real elem_pressure,
140 const Real neighbor_pressure)
141{
142 return data.transmissibility * (elem_pressure - neighbor_pressure - data.elem_jump) -
143 data.correction;
144}
145
153inline Real
155 const Real cell_pressure,
156 const Real mass_flux,
157 const bool elem_side)
158{
159 if (elem_side)
160 return cell_pressure -
162
163 return cell_pressure + (mass_flux + data.neighbor_hbya_flux + data.neighbor_correction) /
165}
166}
167}
static constexpr std::size_t dim
PressureJumpInterfaceData pressureJumpInterfaceData(const RealVectorValue &normal, const Point &elem_to_face, const Point &face_to_neighbor, const RealVectorValue &elem_diffusion, const RealVectorValue &neighbor_diffusion, const RealVectorValue &elem_gradient, const RealVectorValue &neighbor_gradient, const RealVectorValue &elem_rho_hbya, const RealVectorValue &neighbor_rho_hbya, const Real face_area, const bool use_nonorthogonal_correction, const Real elem_jump)
Construct the conservative half-cell interface coefficients for a diagonal diffusion tensor.
Real pressureJumpOneSidedFaceValue(const PressureJumpInterfaceData &data, const Real cell_pressure, const Real mass_flux, const bool elem_side)
Recover one side's face pressure from the common oriented face mass flux.
Real pressureJumpHbyAFlux(const PressureJumpInterfaceData &data)
Compute the H/A part of the face mass flux after eliminating the interface pressures.
Real pressureJumpFlux(const PressureJumpInterfaceData &data, const Real elem_pressure, const Real neighbor_pressure)
Compute the pressure part of the element-to-neighbor flux after eliminating the interface pressures.
static const std::string mass_flux
Definition NS.h:176
Complete face operator obtained by eliminating the two one-sided interface pressures.
Real elem_hbya_flux
One-sided H/A mass fluxes A rho_s (H/A)_s . n, oriented along the face normal.