PLaSK library

Loading...
Searching...
No Matches
femT2d.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
19#include <plask/common/fem.hpp>
20
21 namespace plask { namespace thermal { namespace dynamic {
22
26 template<typename Geometry2DType>
27 struct PLASK_SOLVER_API DynamicThermalFem2DSolver: public FemSolverWithMaskedMesh<Geometry2DType, RectangularMesh<2>> {
28
29 protected:
30
31 double maxT;
32
33 DataVector<double> temperatures;
34
35 DataVector<double> thickness;
36
37 DataVector<Vec<2,double>> fluxes;
38
40 void setMatrix(FemMatrix& A, FemMatrix& B, DataVector<double>& F,
41 const BoundaryConditionsWithMesh<RectangularMesh<2>::Boundary,double>& btemperature
42 );
43
45 void saveHeatFluxes(); // [W/m^2]
46
48 void onInitialize() override;
49
51 void onInvalidate() override;
52
53 public:
54
55 // Boundary conditions
56 BoundaryConditions<RectangularMesh<2>::Boundary,double> temperature_boundary;
57
58 typename ProviderFor<Temperature, Geometry2DType>::Delegate outTemperature;
59
60 typename ProviderFor<HeatFlux, Geometry2DType>::Delegate outHeatFlux;
61
62 typename ProviderFor<ThermalConductivity, Geometry2DType>::Delegate outThermalConductivity;
63
64 ReceiverFor<Heat, Geometry2DType> inHeat;
65
66 double inittemp;
67 double methodparam;
68 double timestep;
69 double elapstime;
70 bool lumping;
71 size_t rebuildfreq;
72 size_t logfreq;
73
78 double compute(double time);
79
81 double getElapsTime() const { return elapstime; }
82
83 void loadConfiguration(XMLReader& source, Manager& manager) override; // for solver configuration (see: *.xpl file with structures)
84
85 DynamicThermalFem2DSolver(const std::string& name="");
86
87 std::string getClassName() const override;
88
89 ~DynamicThermalFem2DSolver();
90
91 protected:
92
93 struct ThermalConductivityData: public LazyDataImpl<Tensor2<double>> {
94 const DynamicThermalFem2DSolver* solver;
95 shared_ptr<const MeshD<2>> dest_mesh;
96 InterpolationFlags flags;
97 LazyData<double> temps;
98 ThermalConductivityData(const DynamicThermalFem2DSolver* solver, const shared_ptr<const MeshD<2>>& dst_mesh);
99 Tensor2<double> at(std::size_t i) const override;
100 std::size_t size() const override;
101 };
102
103 const LazyData<double> getTemperatures(const shared_ptr<const MeshD<2>>& dest_mesh, InterpolationMethod method) const;
104
105 const LazyData<Vec<2>> getHeatFluxes(const shared_ptr<const MeshD<2>>& dest_mesh, InterpolationMethod method);
106
107 const LazyData<Tensor2<double>> getThermalConductivity(const shared_ptr<const MeshD<2>>& dst_mesh, InterpolationMethod method);
108
109};
110
111}} //namespaces
112
113} // namespace plask
114
115#endif