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("HeatConductionApp", ThermalConductivity);
13 
15 
16 InputParameters
18 {
19  InputParameters params = SideAverageValue::validParams();
20  params.addRequiredParam<Real>("dx", "Length between sides of sample in length_scale");
21  params.addRequiredParam<PostprocessorName>(
22  "flux", "Heat flux out of 'cold' boundary in solution units, should always be positive");
23  params.addRequiredParam<PostprocessorName>("T_hot", "Temperature on 'hot' boundary in K");
24  params.addParam<Real>("length_scale", 1e-8, "Length scale of the solution, default is 1e-8");
25  params.addParam<Real>("k0", 0.0, "Initial value of the thermal conductivity");
26  return params;
27 }
28 
29 ThermalConductivity::ThermalConductivity(const InputParameters & parameters)
30  : SideAverageValue(parameters),
31  _dx(getParam<Real>("dx")),
32  _flux(getPostprocessorValue("flux")),
33  _T_hot(getPostprocessorValue("T_hot")),
34  _length_scale(getParam<Real>("length_scale")),
35  _k0(getParam<Real>("k0")),
36  _step_zero(declareRestartableData<bool>("step_zero", true))
37 {
38 }
39 
40 Real
42 {
43  const Real T_cold = SideAverageValue::getValue();
44  Real Th_cond = 0.0;
45  if (_t_step >= 1)
46  _step_zero = false;
47 
48  // Calculate effective thermal conductivity in W/(length_scale-K)
49  if (std::abs(_T_hot - T_cold) > 1.0e-20)
50  Th_cond = std::abs(_flux) * _dx / std::abs(_T_hot - T_cold);
51 
52  if (_step_zero)
53  return _k0;
54  else
55  return Th_cond / _length_scale; // In W/(m-K)
56 }
ThermalConductivity::_T_hot
const PostprocessorValue & _T_hot
Definition: ThermalConductivity.h:35
ThermalConductivity::_dx
const Real _dx
Definition: ThermalConductivity.h:33
ThermalConductivity::ThermalConductivity
ThermalConductivity(const InputParameters &parameters)
Definition: ThermalConductivity.C:29
ThermalConductivity::_step_zero
bool & _step_zero
True if this is the zeroth timestep (timestep < 1).
Definition: ThermalConductivity.h:44
ThermalConductivity::_k0
const Real _k0
Definition: ThermalConductivity.h:37
defineLegacyParams
defineLegacyParams(ThermalConductivity)
ThermalConductivity.h
ThermalConductivity::validParams
static InputParameters validParams()
Definition: ThermalConductivity.C:17
ThermalConductivity::_flux
const PostprocessorValue & _flux
Definition: ThermalConductivity.h:34
registerMooseObject
registerMooseObject("HeatConductionApp", ThermalConductivity)
ThermalConductivity
This postprocessor computes the thermal conductivity of the bulk.
Definition: ThermalConductivity.h:23
validParams
InputParameters validParams()
ThermalConductivity::_length_scale
const Real _length_scale
Definition: ThermalConductivity.h:36
ThermalConductivity::getValue
virtual Real getValue()
Definition: ThermalConductivity.C:41