PLaSK library

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