https://mooseframework.inl.gov
ADJunctionOneToOne1PhaseBC.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 
12 #include "THMIndicesVACE.h"
13 
14 registerMooseObject("ThermalHydraulicsApp", ADJunctionOneToOne1PhaseBC);
15 
18 {
20 
21  params.addRequiredParam<unsigned int>("connection_index", "Index of the connected flow channel");
22  params.addRequiredParam<UserObjectName>("junction_uo", "1-phase one-to-one junction user object");
23 
24  params.addRequiredCoupledVar("rhoA", "Flow channel variable: rho*A");
25  params.addRequiredCoupledVar("rhouA", "Flow channel variable: rho*u*A");
26  params.addRequiredCoupledVar("rhoEA", "Flow channel variable: rho*E*A");
27 
28  params.addClassDescription(
29  "Adds boundary fluxes for flow channels connected to a 1-phase one-to-one junction");
30 
31  return params;
32 }
33 
35  : ADOneDIntegratedBC(params),
36 
37  _connection_index(getParam<unsigned int>("connection_index")),
38  _junction_uo(getUserObject<ADJunctionOneToOne1PhaseUserObject>("junction_uo")),
39 
40  _rhoA_jvar(coupled("rhoA")),
41  _rhouA_jvar(coupled("rhouA")),
42  _rhoEA_jvar(coupled("rhoEA")),
43 
44  _jvar_map(getIndexMapping()),
45  _equation_index(_jvar_map.at(_var.number()))
46 {
47 }
48 
49 ADReal
51 {
52  const auto & flux = _junction_uo.getFlux(_connection_index);
53 
54  return flux[_equation_index] * _normal * _test[_i][_qp];
55 }
56 
57 std::map<unsigned int, unsigned int>
59 {
60  std::map<unsigned int, unsigned int> jvar_map;
61  jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoA_jvar, THMVACE1D::MASS));
62  jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhouA_jvar, THMVACE1D::MOMENTUM));
63  jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoEA_jvar, THMVACE1D::ENERGY));
64 
65  return jvar_map;
66 }
const unsigned int _rhoA_jvar
rho*A coupled variable index
ADJunctionOneToOne1PhaseBC(const InputParameters &params)
virtual ADReal computeQpResidual() override
static InputParameters validParams()
const unsigned int _equation_index
Index within local system of the equation upon which this object acts.
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
std::map< unsigned int, unsigned int > getIndexMapping() const
Creates mapping of coupled variable index to local equation system index.
const std::vector< ADReal > & getFlux(const unsigned int &connection_index) const override
Gets the flux vector for a connection.
static InputParameters validParams()
const unsigned int _rhouA_jvar
rho*u*A coupled variable index
Computes flux between two subdomains for 1-phase one-to-one junction.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const unsigned int _connection_index
Index of connected flow channel.
const ADTemplateVariableTestValue< T > & _test
Adds boundary fluxes for flow channels connected to a 1-phase one-to-one junction.
void addClassDescription(const std::string &doc_string)
const Real _normal
Component of outward normals along 1-D direction.
const unsigned int _rhoEA_jvar
rho*E*A coupled variable index
registerMooseObject("ThermalHydraulicsApp", ADJunctionOneToOne1PhaseBC)
Base class for integrated boundary conditions for 1D problems in 3D space.
void ErrorVector unsigned int
const ADJunctionOneToOne1PhaseUserObject & _junction_uo
1-phase one-to-one junction user object