PLaSK library
Loading...
Searching...
No Matches
therm3d.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__MODULE_THERMAL_TFem_H
15#define PLASK__MODULE_THERMAL_TFem_H
16
17#include <plask/plask.hpp>
18#include <plask/common/fem.hpp>
19
20#include "common.hpp"
21
22namespace plask { namespace thermal { namespace tstatic {
23
27struct PLASK_SOLVER_API ThermalFem3DSolver: public FemSolverWithMaskedMesh<Geometry3D, RectangularMesh<3>> {
28
29 protected:
30
31 int loopno;
32 double maxT;
33 double toterr;
34
36
38
40
50 void setMatrix(FemMatrix& A, DataVector<double>& B,
55 );
56
60 template <typename MatrixT>
61 void applyBC(MatrixT& A, DataVector<double>& B, const BoundaryConditionsWithMesh<RectangularMesh<3>::Boundary,double>& btemperature);
62
64 template <typename MatrixT>
65 MatrixT makeMatrix();
66
68 void saveHeatFluxes(); // [W/m^2]
69
71 void onInitialize() override;
72
74 void onInvalidate() override;
75
76 public:
77
78 double inittemp;
79 double maxerr;
80
81 // Boundary conditions
86
88
90
92
94
100 double compute(int loops=1);
101
102 void loadConfiguration(XMLReader& source, Manager& manager) override; // for solver configuration (see: *.xpl file with structures)
103
104 ThermalFem3DSolver(const std::string& name="");
105
106 std::string getClassName() const override { return "thermal.Static3D"; }
107
109
111 double getErr() const { return toterr; }
112
114 FemMatrixAlgorithm getAlgorithm() const { return algorithm; }
115
120 void setAlgorithm(FemMatrixAlgorithm alg);
121
122 protected:
123
124 struct ThermalConductivityData: public LazyDataImpl<Tensor2<double>> {
126 shared_ptr<const MeshD<3>> dest_mesh;
129 ThermalConductivityData(const ThermalFem3DSolver* solver, const shared_ptr<const MeshD<3>>& dst_mesh);
130 Tensor2<double> at(std::size_t i) const override;
131 std::size_t size() const override;
132 };
133
134 const LazyData<double> getTemperatures(const shared_ptr<const MeshD<3>>& dst_mesh, InterpolationMethod method) const;
135
136 const LazyData<Vec<3>> getHeatFluxes(const shared_ptr<const MeshD<3>>& dst_mesh, InterpolationMethod method);
137
138 const LazyData<Tensor2<double>> getThermalConductivity(const shared_ptr<const MeshD<3>>& dst_mesh, InterpolationMethod method);
139};
140
141}}} //namespaces
142
143#endif