PLaSK library
Loading...
Searching...
No Matches
therm.py
Go to the documentation of this file.
1#!/usr/bin/env python3
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
14import unittest
15
16from numpy import *
17
18from plask import *
19from plask import material, geometry, mesh
20from thermal.static import Static2D
21
23
24@material.simple()
26
27 def thermk(self, T, h):
28 return h
29
30
32
33 def setUp(self):
34 srect = geometry.Rectangle(2, 1.0, Strange())
35 other = geometry.Rectangle(2, 0.2, 'GaAs')
36 stack = geometry.Stack2D()
37 stack.prepend(other)
38 stack.prepend(srect)
39 stack.prepend(srect)
40 stack.prepend(other)
41 geom = geometry.Cartesian2D(stack)
42 self.solver = Static2D("therm2d")
43 self.solver.geometry = geom
45 self.solver.mesh = msh
46
48 msh = mesh.Rectangular2D([1.], [0.7, 1.7])
49 for p in self.solver.mesh.elements.mesh:
50 print(self.solver.geometry.get_material(p))
51 conds = self.solver.outThermalConductivity(msh)
52 self.assertAlmostEqual(conds[0][0], 2.000000, 6)
53 self.assertAlmostEqual(conds[1][0], 2.000000, 6)