https://mooseframework.inl.gov
ThermalConductivity.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 "ThermalConductivity.h"
11 
12 registerMooseObject("HeatTransferApp", ThermalConductivity);
13 
16 {
18  params.addRequiredParam<Real>("dx", "Length between sides of sample in length_scale");
19  params.addRequiredParam<PostprocessorName>(
20  "flux", "Heat flux out of 'cold' boundary in solution units, should always be positive");
21  params.addRequiredParam<PostprocessorName>("T_hot", "Temperature on 'hot' boundary in K");
22  params.addParam<Real>("length_scale", 1e-8, "Length scale of the solution, default is 1e-8");
23  params.addParam<Real>("k0", 0.0, "Initial value of the thermal conductivity");
24  params.addClassDescription("Computes the effective thermal conductivity averaged on a boundary.");
25  return params;
26 }
27 
29  : SideAverageValue(parameters),
30  _dx(getParam<Real>("dx")),
31  _flux(getPostprocessorValue("flux")),
32  _T_hot(getPostprocessorValue("T_hot")),
33  _length_scale(getParam<Real>("length_scale")),
34  _k0(getParam<Real>("k0")),
35  _step_zero(declareRestartableData<bool>("step_zero", true)),
36  _value(0.0)
37 {
38 }
39 
40 void
42 {
44 
45  const Real T_cold = _integral_value / _volume;
46  Real Th_cond = 0.0;
47  if (_t_step >= 1)
48  _step_zero = false;
49 
50  // Calculate effective thermal conductivity in W/(length_scale-K)
51  if (std::abs(_T_hot - T_cold) > 1.0e-20)
52  Th_cond = std::abs(_flux) * _dx / std::abs(_T_hot - T_cold);
53 
54  if (_step_zero)
55  _value = _k0;
56  else
57  _value = Th_cond / _length_scale; // In W/(m-K)
58 }
59 
60 Real
62 {
63  return _value;
64 }
const PostprocessorValue & _T_hot
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
registerMooseObject("HeatTransferApp", ThermalConductivity)
virtual void finalize() override
This postprocessor computes the thermal conductivity of the bulk.
Real _value
The value of this post-processor.
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real getValue() const override
bool & _step_zero
True if this is the zeroth timestep (timestep < 1).
virtual void finalize() override
ThermalConductivity(const InputParameters &parameters)
const PostprocessorValue & _flux
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)