www.mooseframework.org
ThermalConductivity.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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  return params;
25 }
26 
28  : SideAverageValue(parameters),
29  _dx(getParam<Real>("dx")),
30  _flux(getPostprocessorValue("flux")),
31  _T_hot(getPostprocessorValue("T_hot")),
32  _length_scale(getParam<Real>("length_scale")),
33  _k0(getParam<Real>("k0")),
34  _step_zero(declareRestartableData<bool>("step_zero", true)),
35  _value(0.0)
36 {
37 }
38 
39 void
41 {
43 
44  const Real T_cold = _integral_value / _volume;
45  Real Th_cond = 0.0;
46  if (_t_step >= 1)
47  _step_zero = false;
48 
49  // Calculate effective thermal conductivity in W/(length_scale-K)
50  if (std::abs(_T_hot - T_cold) > 1.0e-20)
51  Th_cond = std::abs(_flux) * _dx / std::abs(_T_hot - T_cold);
52 
53  if (_step_zero)
54  _value = _k0;
55  else
56  _value = Th_cond / _length_scale; // In W/(m-K)
57 }
58 
59 Real
61 {
62  return _value;
63 }
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)
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
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()