-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPoissonSolutions.h
314 lines (243 loc) · 6.75 KB
/
PoissonSolutions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// $Id$
//==============================================================================
//!
//! \file PoissonSolutions.h
//!
//! \date Jul 1 2009
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Analytic solutions for Poisson problems.
//!
//==============================================================================
#ifndef _POISSON_SOLUTIONS_H
#define _POISSON_SOLUTIONS_H
#include "Function.h"
#include "Vec3.h"
/*!
\brief Analytic solution for the Poisson equation on a square domain.
*/
class Square2D : public VecFunc
{
public:
//! \brief Empty constructor.
explicit Square2D(double = 1.0) {}
//! \brief Empty destructor.
~Square2D() override {}
protected:
//! \brief Evaluates the analytic flux vector at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
};
/*!
\brief Heat source for the Poisson equation on a square domain.
*/
class Square2DHeat : public RealFunc
{
public:
//! \brief Empty constructor.
explicit Square2DHeat(double = 1.0) {}
//! \brief Empty destructor.
~Square2DHeat() override {}
protected:
//! \brief Evaluates the heat field at the point \a X.
double evaluate(const Vec3& X) const override;
};
/*!
\brief Analytic solution for the Poisson equation on the L-shape domain.
*/
class LshapePoisson : public VecFunc
{
public:
//! \brief Empty constructor.
LshapePoisson() {}
//! \brief Empty destructor.
~LshapePoisson() override {}
protected:
//! \brief Evaluates the analytic flux vector at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
};
/*!
\brief Sinusoidal solution of the Poisson equation on a square domain.
*/
class SquareSinus : public VecFunc
{
public:
//! \brief Empty constructor.
SquareSinus() {}
//! \brief Empty destructor.
~SquareSinus() override {}
protected:
//! \brief Evaluates the analytic flux vector at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
};
/*!
\brief Heat source for the sinusoidal solution on a square domain.
*/
class SquareSinusSource : public RealFunc
{
public:
//! \brief Empty constructor.
SquareSinusSource() {}
//! \brief Empty destructor.
~SquareSinusSource() override {}
protected:
//! \brief Evaluates the heat field at the point \a X.
double evaluate(const Vec3& X) const override;
};
/*!
\brief Poisson problem with smooth solution and a steep interior layer.
*/
class PoissonInteriorLayer : public VecFunc
{
public:
//! \brief Default constructor.
explicit PoissonInteriorLayer(double s = 60.0) : SLOPE(s) {}
//! \brief Empty destructor.
~PoissonInteriorLayer() override {}
protected:
//! \brief Evaluates the heat flux at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
private:
double SLOPE; //!< layer SLOPE (large value gives problems in adaptive solver)
};
/*!
\brief Analytical primary solution for PoissonInteriorLayer.
*/
class PoissonInteriorLayerSol : public RealFunc
{
public:
//! \brief Default constructor.
explicit PoissonInteriorLayerSol(double s = 60.0) : SLOPE(s) {}
//! \brief Empty destructor.
~PoissonInteriorLayerSol() override {}
protected:
//! \brief Evaluates the exact temperature distribution at the point \a X.
double evaluate(const Vec3& X) const override;
private:
double SLOPE; //!< layer SLOPE
};
/*!
\brief Heat source for PoissonInteriorLayer.
*/
class PoissonInteriorLayerSource : public RealFunc
{
public:
//! \brief Default constructor.
explicit PoissonInteriorLayerSource(double s = 60.0) : SLOPE(s) {}
//! \brief Empty destructor.
~PoissonInteriorLayerSource() override {}
protected:
//! \brief Evaluates the heat field at the point \a X.
double evaluate(const Vec3& X) const override;
private:
double SLOPE; //!< layer SLOPE
};
/*!
\brief Poisson 3D problem with smooth sharp solution and a steep interior layer.
*/
class PoissonWaterfall : public VecFunc
{
public:
//! \brief Default constructor.
explicit PoissonWaterfall(double eps = 0.002) : epsilon(eps) {}
//! \brief Empty destructor.
~PoissonWaterfall() override {}
protected:
//! \brief Evaluates the heat flux at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
private:
double epsilon; //!< layer epsilon (waterfall width approx sqrt(5eps) )
};
/*!
\brief Analytical primary solution for PoissonWaterfall.
*/
class PoissonWaterfallSol : public RealFunc
{
public:
//! \brief Default constructor.
explicit PoissonWaterfallSol(double eps = 0.002) : epsilon(eps) {}
//! \brief Empty destructor.
~PoissonWaterfallSol() override {}
protected:
//! \brief Evaluates the exact temperature distribution at the point \a X.
double evaluate(const Vec3& X) const override;
private:
double epsilon; //!< layer epsilon (waterfall width approx sqrt(5eps) )
};
/*!
\brief Heat source for PoissonWaterfall.
*/
class PoissonWaterfallSource : public RealFunc
{
public:
//! \brief Default constructor.
explicit PoissonWaterfallSource(double eps = 0.002) : epsilon(eps) {}
//! \brief Empty destructor.
~PoissonWaterfallSource() override {}
protected:
//! \brief Evaluates the heat field at the point \a X.
double evaluate(const Vec3& X) const override;
private:
double epsilon; //!< layer epsilon (waterfall width approx sqrt(5eps) )
};
/*!
\brief Analytic solution for the Poisson equation on a cube domain.
*/
class PoissonCube : public VecFunc
{
public:
//! \brief Empty Constructor.
PoissonCube() {}
//! \brief Empty destructor.
~PoissonCube() override {}
protected:
//! \brief Evaluates the analytic flux vector at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
};
/*!
\brief Heat source for the Poisson equation on a cube domain.
*/
class PoissonCubeSource : public RealFunc
{
public:
//! \brief Empty constructor.
PoissonCubeSource() {}
//! \brief Empty destructor.
~PoissonCubeSource() override {}
protected:
//! \brief Evaluates the heat field at the point \a X.
double evaluate(const Vec3& X) const override;
};
/*!
\brief Analytic solution for the Poisson equation on a line domain.
*/
class PoissonLine : public VecFunc
{
public:
//! \brief Default constructor.
explicit PoissonLine(double r = 1.0) : L(r) {}
//! \brief Empty destructor.
~PoissonLine() override {}
protected:
//! \brief Evaluates the analytic flux vector at the point \a X.
Vec3 evaluate(const Vec3& X) const override;
private:
double L; //!< Length parameter
};
/*!
\brief Heat source for the Poisson equation on a line.
*/
class PoissonLineSource : public RealFunc
{
public:
//! \brief Default constructor.
explicit PoissonLineSource(double r = 1.0) : L(r) {}
//! \brief Empty destructor.
~PoissonLineSource() override {}
protected:
//! \brief Evaluates the heat field at the point \a X.
double evaluate(const Vec3& X) const override;
private:
double L; //!< Length parameter
};
#endif