PLaSK library

Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef PLASK__SOLVER__THERMAL_STATIC_COMMON_H
15#define PLASK__SOLVER__THERMAL_STATIC_COMMON_H
16
17#include <plask/plask.hpp>
18
19 namespace plask { namespace thermal { namespace tstatic {
20
21 constexpr double BIG = 1e16;
22
23
25 struct Convection
26{
27 double coeff;
28 double ambient;
29 Convection(double coeff, double amb): coeff(coeff), ambient(amb) {}
30 Convection() = default;
31 friend inline std::ostream& operator<<(std::ostream& out, const Convection& to_print) {
32 return out << to_print.coeff << "(" << to_print.ambient << "K)";
33 }
34};
35
37 struct Radiation
38{
39 double emissivity;
40 double ambient;
41 Radiation(double emiss, double amb): emissivity(emiss), ambient(amb) {}
42 Radiation() = default;
43 friend inline std::ostream& operator<<(std::ostream& out, const Radiation& to_print) {
44 return out << to_print.emissivity << "(" << to_print.ambient << "K)";
45 }
46};
47
48}} // # namespace thermal::tstatic
49
50 template <> inline thermal::tstatic::Convection parseBoundaryValue<thermal::tstatic::Convection>(const XMLReader& tag_with_value)
51{
52 return thermal::tstatic::Convection(tag_with_value.requireAttribute<double>("coeff"), tag_with_value.requireAttribute<double>("ambient"));
53}
54
55 template <> inline thermal::tstatic::Radiation parseBoundaryValue<thermal::tstatic::Radiation>(const XMLReader& tag_with_value)
56{
57 return thermal::tstatic::Radiation(tag_with_value.requireAttribute<double>("emissivity"), tag_with_value.requireAttribute<double>("ambient"));
58}
59
60
61} // # namespace plask
62
63#endif // PLASK__SOLVER__THERMAL_STATIC_COMMON_H