https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVGrayLambertBC.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
11#include "HeatConductionNames.h"
13
15
18{
21 "Applies a surface-to-surface Gray-Lambert radiation heat flux boundary "
22 "condition to a linear finite-volume energy equation.");
23 params.addRequiredParam<MooseFunctorName>(
24 "temperature_radiation",
25 "Temperature functor used to reconstruct the local surface emission.");
26 params.addRequiredParam<MooseFunctorName>(
27 "coeff_diffusion",
28 "Diffusion coefficient used by the corresponding LinearFVDiffusion kernel.");
29 params.addRequiredParam<UserObjectName>("surface_radiation_object_name",
30 "Name of the GrayLambertSurfaceRadiationBase UO");
31 params.addParam<bool>(
32 "reconstruct_emission",
33 true,
34 "Flag to apply constant heat flux on sideset or reconstruct emission by T^4 law.");
35
36 return params;
37}
38
41 _temperature_radiation(getFunctor<Real>("temperature_radiation")),
42 _coeff_diffusion(getFunctor<Real>("coeff_diffusion")),
43 _glsr_uo(getUserObject<GrayLambertSurfaceRadiationBase>("surface_radiation_object_name")),
44 _reconstruct_emission(getParam<bool>("reconstruct_emission"))
45{
46 // Request the previous state. This assumes the BC acts on the temperature variable
47 _var.sys().needSolutionState(1, Moose::SolutionIterationType::Nonlinear);
48}
49
50Real
52{
53 const Elem * const elem = _current_face_type == FaceInfo::VarFaceNeighbors::ELEM
56
57 mooseAssert(elem, "The boundary face must have an adjacent element.");
58
59 const auto elem_arg = makeElemArg(elem);
60 // First order extrapolation to the face
61 const auto state = determineState();
62 return -_coeff_diffusion(elem_arg, state);
63}
64
65Real
67{
68
70 return 0.0;
71
72 std::vector<BoundaryID> matching_boundary_ids;
73
74 for (const auto boundary_id : _current_face_info->boundaryIDs())
75 if (hasBoundary(boundary_id))
76 matching_boundary_ids.push_back(boundary_id);
77
78 mooseAssert(
79 matching_boundary_ids.size() == 1,
80 "LinearFVGrayLambertBC expected exactly one matching boundary ID on the current face.");
81
82 const BoundaryID boundary_id = matching_boundary_ids.front();
83 const Real emissivity = _glsr_uo.getSurfaceEmissivity(boundary_id);
84
85 // Evaluate the radiation temperature on the adjacent element rather than
86 // asking the variable for its value on the boundary face.
87 const Elem * const elem = _current_face_type == FaceInfo::VarFaceNeighbors::ELEM
90
91 mooseAssert(elem, "The radiating boundary face must have an adjacent element.");
92
93 const auto elem_arg = makeElemArg(elem);
94
95 // First order extrapolation to the face
96 const auto state = determineState();
97 const Real lagged_temperature = _temperature_radiation(elem_arg, state);
98
99 return -emissivity * HeatConduction::Constants::sigma * Utility::pow<3>(lagged_temperature);
100}
101
102Real
104{
105 const auto & all_face_bids = face.fi->boundaryIDs();
106 const auto & all_bc_bids = boundaryIDs();
107 std::set<BoundaryID> current_bid;
108 set_intersection(all_face_bids.begin(),
109 all_face_bids.end(),
110 all_bc_bids.begin(),
111 all_bc_bids.end(),
112 std::inserter(current_bid, current_bid.begin()));
113 if (current_bid.size() != 1)
114 paramError("boundary",
115 std::to_string(current_bid.size()) +
116 " boundaries overlap. This is not currently supported");
117
119 return _glsr_uo.getSurfaceHeatFluxDensity(*current_bid.begin());
120
121 Real eps = _glsr_uo.getSurfaceEmissivity(*current_bid.begin());
122 const auto gamma = -eps * _glsr_uo.getSurfaceIrradiation((*current_bid.begin()));
123 return gamma;
124}
boundary_id_type BoundaryID
registerMooseObject("HeatTransferApp", LinearFVGrayLambertBC)
bool hasBoundary(const BoundaryName &name) const
virtual const std::set< BoundaryID > & boundaryIDs() const
const std::set< BoundaryID > & boundaryIDs() const
const Elem * neighborPtr() const
const Elem * elemPtr() const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
GrayLambertSurfaceRadiationBase computes the heat flux on a set of surfaces in radiative heat transfe...
Real getSurfaceIrradiation(BoundaryID id) const
public interface of this UserObject
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
FaceInfo::VarFaceNeighbors _current_face_type
MooseLinearVariableFV< Real > & _var
Applies a Gray-Lambert surface-to-surface radiative heat-flux boundary condition to a linear finite-v...
const GrayLambertSurfaceRadiationBase & _glsr_uo
User object providing surface emissivity, irradiation, and net radiative heat flux.
static InputParameters validParams()
virtual Real getAlpha(Moose::FaceArg face, Moose::StateArg state) const override
const Moose::Functor< Real > & _coeff_diffusion
Diffusion coefficient multiplying the outward normal temperature gradient.
const Moose::Functor< Real > & _temperature_radiation
Temperature variable used to reconstruct the local-lagged surface emission.
virtual Real getGamma(Moose::FaceArg face, Moose::StateArg state) const override
virtual Real getBeta(Moose::FaceArg face, Moose::StateArg state) const override
LinearFVGrayLambertBC(const InputParameters &parameters)
Class constructor.
bool _reconstruct_emission
Whether to reconstruct the local emitted heat flux using the boundary-face temperature.
void paramError(const std::string &param, Args... args) const
SystemBase & sys()
virtual void needSolutionState(const unsigned int state, Moose::SolutionIterationType iteration_type=Moose::SolutionIterationType::Time, libMesh::ParallelType parallel_type=GHOSTED)
const FaceInfo * fi