|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
下载链接:http://eetop.cn/bbs/thread-181408-1-1.html
An Introduction to Scientific Computing Twelve Computational Projects Solved with MATLAB: 2007年!!!!!
通过12个工程项目来介绍科学计算,有matlab代码:
贴个目录:
Contents
1 Numerical Approximation of Model Partial Differential
Equations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Discrete Integration Methods for Ordinary Differential
Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Construction of Numerical Integration Schemes . . . . . . . 2
1.1.2 General Form of Numerical Schemes . . . . . . . . . . . . . . . . . 6
1.1.3 Application to the Absorption Equation . . . . . . . . . . . . . . 8
1.1.4 Stability of a Numerical Scheme . . . . . . . . . . . . . . . . . . . . . 9
1.2 Model Partial Differential Equations . . . . . . . . . . . . . . . . . . . . . . . 11
1.2.1 The Convection Equation . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2.2 The Wave Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2.3 The Heat Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2 Nonlinear Differential Equations: Application to Chemical
Kinetics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.1 Physical Problem and Mathematical Modeling . . . . . . . . . . . . . . 33
2.2 Stability of the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.3 Model for the Maintained Reaction . . . . . . . . . . . . . . . . . . . . . . . . 36
2.3.1 Existence of a Critical Point and Stability . . . . . . . . . . . . 36
2.3.2 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.4 Model of Reaction with a Delay Term. . . . . . . . . . . . . . . . . . . . . . 37
2.5 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3 Polynomial Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 Polynomial Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.2.1 Lagrange Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.2.2 Hermite Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
XII Contents
3.3 Best Polynomial Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.3.1 Best Uniform Approximation . . . . . . . . . . . . . . . . . . . . . . . 59
3.3.2 Best Hilbertian Approximation. . . . . . . . . . . . . . . . . . . . . . 61
3.3.3 Discrete Least Squares Approximation . . . . . . . . . . . . . . . 64
3.4 Piecewise Polynomial Approximation . . . . . . . . . . . . . . . . . . . . . . 65
3.4.1 Piecewise Constant Approximation . . . . . . . . . . . . . . . . . . 66
3.4.2 Piecewise Affine Approximation . . . . . . . . . . . . . . . . . . . . . 67
3.4.3 Piecewise Cubic Approximation . . . . . . . . . . . . . . . . . . . . . 68
3.5 Further Reading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.6 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4 Solving an Advection–Diffusion Equation by a Finite
Element Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.1 Variational Formulation of the Problem . . . . . . . . . . . . . . . . . . . . 85
4.2 A P1 Finite Element Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.3 A P2 Finite Element Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.4 A Stabilization Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.4.1 Computation of the Solution at the Endpoints of the
Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.4.2 Analysis of the Stabilized Method . . . . . . . . . . . . . . . . . . . 95
4.5 The Case of a Variable Source Term . . . . . . . . . . . . . . . . . . . . . . . 97
4.6 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5 Solving a Differential Equation by a Spectral Method. . . . . . 111
5.1 Some Properties of the Legendre Polynomials . . . . . . . . . . . . . . . 112
5.2 Gauss–Legendre Quadrature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.3 Legendre Expansions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.4 A Spectral Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
5.5 Possible Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.6 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
6 Signal Processing: Multiresolution Analysis . . . . . . . . . . . . . . . . 127
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
6.2 Approximation of a Function: Theoretical Aspect . . . . . . . . . . . . 127
6.2.1 Piecewise Constant Functions . . . . . . . . . . . . . . . . . . . . . . . 127
6.2.2 Decomposition of the Space VJ . . . . . . . . . . . . . . . . . . . . . . 129
6.2.3 Decomposition and Reconstruction Algorithms . . . . . . . . 132
6.2.4 Importance of Multiresolution Analysis. . . . . . . . . . . . . . . 133
6.3 Multiresolution Analysis: Practical Aspect . . . . . . . . . . . . . . . . . . 134
6.4 Multiresolution Analysis: Implementation . . . . . . . . . . . . . . . . . . . 135
6.5 Introduction to Wavelet Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
6.5.1 Scaling Functions and Wavelets . . . . . . . . . . . . . . . . . . . . . 137
Contents XIII
6.5.2 The Schauder Wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
6.5.3 Implementation of the Schauder Wavelet . . . . . . . . . . . . . 141
6.5.4 The Daubechies Wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
6.5.5 Implementation of the Daubechies Wavelet D4 . . . . . . . . 144
6.6 Generalization: Image Processing . . . . . . . . . . . . . . . . . . . . . . . . . . 146
6.6.1 Image Processing: Implementation . . . . . . . . . . . . . . . . . . . 147
6.7 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7 Elasticity: Elastic Deformation of a Thin Plate . . . . . . . . . . . . 151
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.2 Modeling Elastic Deformations (Linear Problem) . . . . . . . . . . . . 152
7.3 Modeling Electrostatic Forces (Nonlinear Problem) . . . . . . . . . . 153
7.4 Numerical Discretization of the Problem. . . . . . . . . . . . . . . . . . . . 154
7.5 Programming Tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.5.1 Modular Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.5.2 Program Validation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.6 Solving the Linear Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.7 Solving the Nonlinear Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.7.1 A Fixed-Point Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.7.2 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.8 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.8.1 Further Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
8 Domain Decomposition Using a Schwarz Method . . . . . . . . . . 165
8.1 Principle and Application Field of Domain Decomposition . . . . 165
8.2 One-Dimensional Finite Difference Solution . . . . . . . . . . . . . . . . . 166
8.3 Schwarz Method in One Dimension . . . . . . . . . . . . . . . . . . . . . . . . 167
8.3.1 Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
8.4 Extension to the Two-Dimensional Case . . . . . . . . . . . . . . . . . . . . 171
8.4.1 Finite Difference Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 171
8.4.2 Domain Decomposition in the Two-Dimensional Case . . 175
8.4.3 Implementation of Realistic Boundary Conditions . . . . . 178
8.4.4 Possible Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
8.5 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
9 Geometrical Design: B´ezier Curves and Surfaces . . . . . . . . . . . 193
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
9.2 B´ezier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
9.3 Basic Properties of B´ezier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . 195
9.3.1 Convex Hull of the Control Points . . . . . . . . . . . . . . . . . . . 195
9.3.2 Multiple Control Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
9.3.3 Tangent Vector to a B´ezier Curve . . . . . . . . . . . . . . . . . . . 197
XIV Contents
9.3.4 Junction of B´ezier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . 197
9.3.5 Generation of the Point P(t) . . . . . . . . . . . . . . . . . . . . . . . . 198
9.4 Generation of B´ezier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
9.5 Splitting B´ezier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
9.6 Intersection of B´ezier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
9.6.1 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
9.7 B´ezier Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.8 Basic properties of B´ezier Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.8.1 Convex Hull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.8.2 Tangent Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
9.8.3 Junction of B´ezier Patches. . . . . . . . . . . . . . . . . . . . . . . . . . 207
9.8.4 Construction of the Point P(t) . . . . . . . . . . . . . . . . . . . . . . 208
9.9 Construction of B´ezier Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
9.10 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
10 Gas Dynamics: The Riemann Problem and Discontinuous
Solutions: Application to the Shock Tube Problem. . . . . . . . . 213
10.1 Physical Description of the Shock Tube Problem . . . . . . . . . . . . 213
10.2 Euler Equations of Gas Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . 215
10.2.1 Dimensionless Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
10.2.2 Exact Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
10.3 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
10.3.1 Lax–Wendroff and MacCormack Centered Schemes . . . . 222
10.3.2 Upwind Schemes (Roe’s Approximate Solver) . . . . . . . . . 227
10.4 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
11 Thermal Engineering: Optimization of an Industrial
Furnace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
11.2 Formulation of the Problem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
11.3 Finite Element Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
11.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
11.5 Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
11.5.1 Modular Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
11.5.2 Numerical Solution of the Problem . . . . . . . . . . . . . . . . . . 242
11.6 Inverse Problem Formulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
11.7 Implementation of the Inverse Problem . . . . . . . . . . . . . . . . . . . . . 245
11.8 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
11.8.1 Further Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Contents XV
12 Fluid Dynamics: Solving the Two-Dimensional
Navier–Stokes Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
12.2 The Incompressible Navier–Stokes Equations . . . . . . . . . . . . . . . . 252
12.3 Numerical Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
12.4 Computational Domain, Staggered Grids, and Boundary
Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
12.5 Finite Difference Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
12.6 Flow Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
12.7 Initial Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
12.8 Step-by-Step Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
12.8.1 Solving a Linear System with Tridiagonal, Periodic
Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
12.8.2 Solving the Unsteady Heat Equation . . . . . . . . . . . . . . . . . 271
12.8.3 Solving the Steady Heat Equation Using FFTs . . . . . . . . 275
12.8.4 Solving the 2D Navier–Stokes Equations . . . . . . . . . . . . . 275
12.9 Solutions and Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Chapter References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Index of Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 |
|