Debian Codegraph @

src/num/aslCrystalGrowthBC.h

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #ifndef ASLCRYSTALGROWTHBC_H
25 #define ASLCRYSTALGROWTHBC_H
26
27 #include "aslBCond.h"
28 #include <data/aslDataWithGhostNodes.h>
29 #include <acl/aclMath/aclVectorOfElementsDef.h>
30
31
32 namespace acl
33 {
34 class Kernel;
35 typedef std::shared_ptr<Kernel> SPKernel;
36 }
37
38 namespace asl
39 {
40 class PositionFunction;
41 typedef std::shared_ptr<PositionFunction> SPPositionFunction;
42
43
44 /** Boundary condition that makes gradient proportional to a surface concentration
45 \ingroup BoundaryConditions */
46 class BCLinearGrowthMap:public BCondWithMap
47 {
48 public:
49 typedef SPAbstractDataWithGhostNodes Data;
50 acl::SPKernel kernel;
51 protected:
52 Data data;
53 acl::VectorOfElements cEq;
54 acl::VectorOfElements beta;
55 public:
56 BCLinearGrowthMap(Data d,
57 const acl::VectorOfElements & cEq,
58 const acl::VectorOfElements & beta,
59 Data map,
60 const VectorTemplate *const t);
61 BCLinearGrowthMap(Data d,
62 const acl::VectorOfElements & cEq,
63 const acl::VectorOfElements & beta,
64 Data map,
65 Data computationalDomain,
66 const VectorTemplate *const t);
67 ~BCLinearGrowthMap();
68 virtual void execute();
69 virtual void init();
70 };
71
72 /// Boundary condition that makes gradient proportional to a surface concentration
73 /**
74 \ingroup BoundaryConditions
75 The boundary condition corresponds to different system with surface reaction.
76
77 Fist system is temperature reliase during the crystal growth process from melt.
78 There growth velocity defined by the following equation
79 \f[ \vec v = \vec n \beta (T -T^{eq}) \f]
80 where \f$ \beta \f$ is a kinetic coefficient and \f$ T^{eq} \f$ is an equilibrium temperature.
81 This condition can be expressed in terms of flux for puarlly diffusion equation
82 \f[ \vec j = D \vec \nabla T, \f]
83 \f[ \vec j = v L, \f]
84 where \f$ L \f$ is latent heat. These two equation allow to write an expression for temperature
85 on the boundary as follows:
86 \f[ \beta^* (T-T^{eq}) = \vec n \cdot \vec \nabla T, \f]
87 where \f$ \beta^* \equiv \frac{\beta L}{D} \f$ it corresponds to \p ::beta.
88 In the discrete case the two eequations for flux can not be combines so simply.
89 Fist of all let us introduce two help values surface area per ghost node and
90 flux per ghost point. There is set of template directions dirrectod towards computational domain
91 \f$ \Omega\f$. The flux per ghost point can be expressed as follows
92 \f[ j^{gh} = \sum_{i \in \Omega} w_i(T_i - T_0) \f]
93 It is seen that this equation doen not contains the surface area explicetely.
94 \f[ j^{gh} = S^{gh} \beta^* (T-T^{eq}) \f]. Note, \f$ T \f$ is temperature on the surface
95 It can be expressed as alinear combunation of \f$ T_0 \f$ and \f$ T_i \f$ like this:
96 \f[ T = A T_0 + \sum_{i \in \Omega} B_i T_i \f]
97 Than the \f$ T_0 \f$ can be computed as follows:
98 \f[ T_0 = \frac{ \sum_{i\in \Omega} (w_i - S^{gh}\beta^* B_i ) T_i + S^{gh}\beta^* T^{eq} }
99 {S^{gh}\beta^* A + \sum_{i\in \Omega} w_i} \f]
100
101 The coefficients \f$ A \f$ and \f$ B_i \f$ can be chosen as follows.
102 \f[ T = \left(\sum_{i \in \Omega}\vec n \cdot\vec a_i\right)^{-1}
103 \sum_{i \in \Omega} (T_0(1-x_i) + T_i x_i) \vec n \cdot\vec a_i
104
105 \f]
106 thus
107 \f[ A = \left(\sum_{i \in \Omega}\vec n \cdot\vec a_i\right)^{-1}
108 \sum_{i \in \Omega} (1-x_i) \vec n \cdot\vec a_i
109
110 \f]
111 \f[ B_i = \left(\sum_{i \in \Omega}\vec n \cdot\vec a_i\right)^{-1}
112 x_i \vec n \cdot\vec a_i
113
114 \f]
115
116 \note The function is realized for 1 component only!
117
118 */
119
120 class BCLinearGrowthMap1:public BCondWithMap
121 {
122 public:
123 typedef SPAbstractDataWithGhostNodes Data;
124 acl::SPKernel kernel;
125 protected:
126 Data data;
127 acl::VectorOfElements cEq;
128 acl::VectorOfElements beta;
129 public:
130 BCLinearGrowthMap1(Data d,
131 const acl::VectorOfElements & cEq,
132 const acl::VectorOfElements & beta,
133 Data map,
134 const VectorTemplate *const t);
135 BCLinearGrowthMap1(Data d,
136 const acl::VectorOfElements & cEq,
137 const acl::VectorOfElements & beta,
138 Data map,
139 Data computationalDomain,
140 const VectorTemplate *const t);
141 ~BCLinearGrowthMap1();
142 virtual void execute();
143 virtual void init();
144 };
145
146 /** Boundary condition that makes gradient proportional to a surface concentration, second order
147 \ingroup BoundaryConditions */
148 class BCLinearGrowthMap2:public BCondWithMap
149 {
150 public:
151 typedef SPAbstractDataWithGhostNodes Data;
152 acl::SPKernel kernelCN;
153 acl::SPKernel kernelGN;
154 protected:
155 Data data;
156 acl::VectorOfElements cEq;
157 acl::VectorOfElements beta;
158 public:
159 BCLinearGrowthMap2(Data d,
160 const acl::VectorOfElements & cEq,
161 const acl::VectorOfElements & beta,
162 Data map,
163 const VectorTemplate *const t);
164 BCLinearGrowthMap2(Data d,
165 const acl::VectorOfElements & cEq,
166 const acl::VectorOfElements & beta,
167 Data map,
168 Data computationalDomain,
169 const VectorTemplate *const t);
170 ~BCLinearGrowthMap2();
171 virtual void execute();
172 virtual void init();
173 };
174
175
176
177 SPNumMethod generateBCLinearGrowth(SPAbstractDataWithGhostNodes d,
178 double cEq,
179 double beta,
180 SPAbstractDataWithGhostNodes map,
181 const VectorTemplate *const t);
182
183 SPNumMethod generateBCLinearGrowth(SPAbstractDataWithGhostNodes d,
184 double cEq,
185 double beta,
186 SPAbstractDataWithGhostNodes map,
187 SPAbstractDataWithGhostNodes computationalDomain,
188 const VectorTemplate *const t);
189
190 SPNumMethod generateBCLinearGrowth2(SPAbstractDataWithGhostNodes d,
191 double cEq,
192 double beta,
193 SPAbstractDataWithGhostNodes map,
194 const VectorTemplate *const t);
195
196 SPNumMethod generateBCLinearGrowth2(SPAbstractDataWithGhostNodes d,
197 double cEq,
198 double beta,
199 SPAbstractDataWithGhostNodes map,
200 SPAbstractDataWithGhostNodes computationalDomain,
201 const VectorTemplate *const t);
202
203 } //asl
204
205 #endif //ASLCRYSTALGROWTHBC_H