Practical Finite Element Modeling in Earth Science using Matlab
By Guy Simpson
()
About this ebook
Mathematical models have become a crucial way for the Earth scientist to understand and predict how our planet functions and evolves through time and space. The finite element method (FEM) is a remarkably flexible and powerful tool with enormous potential in the Earth Sciences. This pragmatic guide explores how a variety of different Earth science problems can be translated and solved with FEM, assuming only basic programming experience.
This book begins with a general introduction to numerical modeling and includes multiple sample Matlab codes to illustrate how FEM is implemented in practice. Textboxes have been included to provide additional detail, such as specialized Matlab usage or advanced topics. Covering all the key aspects, this is essential reading for those looking to master the technique, as well as those simply seeking to increase their basic level of understanding and appreciation of FEM.
Related to Practical Finite Element Modeling in Earth Science using Matlab
Related ebooks
Coupled CFD-DEM Modeling: Formulation, Implementation and Application to Multiphase Flows Rating: 0 out of 5 stars0 ratingsMathematical Modelling: A Graduate Textbook Rating: 0 out of 5 stars0 ratingsExtended Finite Element Method: Theory and Applications Rating: 0 out of 5 stars0 ratingsComputational Continuum Mechanics Rating: 3 out of 5 stars3/5Soil Mechanics Rating: 5 out of 5 stars5/5Statistical Mechanics of Elasticity Rating: 4 out of 5 stars4/5Finite Elements of Nonlinear Continua Rating: 4 out of 5 stars4/5Fundamentals of the Finite Element Method for Heat and Fluid Flow Rating: 0 out of 5 stars0 ratingsElasticity in Engineering Mechanics Rating: 0 out of 5 stars0 ratingsProgramming the Finite Element Method Rating: 0 out of 5 stars0 ratingsPartial Differential Equations of Applied Mathematics Rating: 4 out of 5 stars4/5Essential Computational Fluid Dynamics Rating: 0 out of 5 stars0 ratingsStochastic Structural Dynamics: Application of Finite Element Methods Rating: 0 out of 5 stars0 ratingsFinite Elements and Approximation Rating: 5 out of 5 stars5/5Numerical Methods for Two-Point Boundary-Value Problems Rating: 0 out of 5 stars0 ratingsCyclic Plasticity of Engineering Materials: Experiments and Models Rating: 0 out of 5 stars0 ratingsMathematical Aspects of Subsonic and Transonic Gas Dynamics Rating: 5 out of 5 stars5/5Fundamentals of Structural Dynamics Rating: 5 out of 5 stars5/5Wind Wizard: Alan G. Davenport and the Art of Wind Engineering Rating: 0 out of 5 stars0 ratingsA Survey of Minimal Surfaces Rating: 4 out of 5 stars4/5Vector Calculus Using Mathematica Second Edition Rating: 0 out of 5 stars0 ratingsA History of Geometrical Methods Rating: 0 out of 5 stars0 ratingsFluid Mechanics Rating: 5 out of 5 stars5/5Damage Mechanics in Metal Forming: Advanced Modeling and Numerical Simulation Rating: 4 out of 5 stars4/5Fluid Dynamics of Oil and Gas Reservoirs Rating: 0 out of 5 stars0 ratingsModeling and Dimensioning of Structures: An Introduction Rating: 0 out of 5 stars0 ratingsSolidWorks Flow Simulation 2024 Black Book Rating: 0 out of 5 stars0 ratingsGreen's Functions and Boundary Value Problems Rating: 0 out of 5 stars0 ratings3D Discrete Element Workbench for Highly Dynamic Thermo-mechanical Analysis: GranOO Rating: 5 out of 5 stars5/5Constructed Layered Systems: Measurements and Analysis Rating: 0 out of 5 stars0 ratings
Earth Sciences For You
The Phantom Atlas: The Greatest Myths, Lies and Blunders on Maps Rating: 4 out of 5 stars4/5Devil's Gate: Brigham Young and the Great Mormon Handcart Tragedy Rating: 4 out of 5 stars4/5SAS Survival Handbook, Third Edition: The Ultimate Guide to Surviving Anywhere Rating: 4 out of 5 stars4/5Bushcraft Basics: A Common Sense Wilderness Survival Handbook Rating: 0 out of 5 stars0 ratingsI Contain Multitudes: The Microbes Within Us and a Grander View of Life Rating: 4 out of 5 stars4/5The Witch's Yearbook: Spells, Stones, Tools and Rituals for a Year of Modern Magic Rating: 5 out of 5 stars5/5The Rise and Fall of the Dinosaurs: A New History of a Lost World Rating: 4 out of 5 stars4/5Rockhounding for Beginners: Your Comprehensive Guide to Finding and Collecting Precious Minerals, Gems, Geodes, & More Rating: 0 out of 5 stars0 ratingsSalt: A World History Rating: 4 out of 5 stars4/5Answers to Questions You've Never Asked: Explaining the 'What If' in Science, Geography and the Absurd Rating: 3 out of 5 stars3/5Norwegian Wood: Chopping, Stacking, and Drying Wood the Scandinavian Way Rating: 4 out of 5 stars4/5Nuclear War Survival Skills: Lifesaving Nuclear Facts and Self-Help Instructions Rating: 4 out of 5 stars4/5A Fire Story: A Graphic Memoir Rating: 4 out of 5 stars4/5Young Men and Fire Rating: 4 out of 5 stars4/5Mother of God: An Extraordinary Journey into the Uncharted Tributaries of the Western Amazon Rating: 4 out of 5 stars4/5Rocks and Minerals Rating: 4 out of 5 stars4/5Summary of Bruce H. Lipton's The Biology of Belief 10th Anniversary Edition Rating: 5 out of 5 stars5/5Rocks and Minerals of The World: Geology for Kids - Minerology and Sedimentology Rating: 5 out of 5 stars5/5Fantasy Map Making: Writer Resources, #2 Rating: 4 out of 5 stars4/5How to Lie with Maps Rating: 4 out of 5 stars4/5The Great Deluge: Hurricane Katrina, New Orleans, and the Mississippi Gulf Coast Rating: 4 out of 5 stars4/5The Mother Plane: UFO's Rating: 4 out of 5 stars4/5Southwest Treasure Hunter's Gem and Mineral Guide (6th Edition): Where and How to Dig, Pan and Mine Your Own Gems and Minerals Rating: 0 out of 5 stars0 ratingsThe Lost Book of Dr Sebi Self-Healing Bible Rating: 5 out of 5 stars5/5The Pocket Guide to Prepping Supplies: More Than 200 Items You Can?t Be Without Rating: 5 out of 5 stars5/5
Reviews for Practical Finite Element Modeling in Earth Science using Matlab
0 ratings0 reviews
Book preview
Practical Finite Element Modeling in Earth Science using Matlab - Guy Simpson
Part I
The Finite Element Method with Matlab
Part I has two main purposes. The first purpose is to introduce readers to the Galerkin form of the finite element method (FEM), which is a numerical technique for discretizing partial differential equations (PDEs). The second purpose is to show practically how the resulting equations are programmed and solved on a computer using Matlab. Each chapter builds on the previous one and introduces one or more key concept. We will consider how the FEM is applied in one dimension (1D), two dimension (2D), and three dimension (3D), using a parabolic (diffusion) equation as an example. Chapter 7 generalizes the concepts and extends application of the FEM to systems of equations and to elliptic and hyperbolic problems.
1
Preliminaries
This chapter provides a short introduction to mathematical models consisting of systems of partial differential equations (PDEs) along with auxiliary (boundary and initial) conditions. We discuss how these equations can be solved, either exactly or using numerical methods. We also briefly consider the important issues of precision and stability of a numerical solution. A Matlab script is provided at the end of the chapter to enable readers to compare an analytical solution with its corresponding numerical approximation.
1.1 Mathematical Models
The application of the principles of conservation of mass, momentum, and energy combined with experimentally derived laws produces sets of PDEs that describe variations in velocity (or displacement), pressure, and temperature in space and time. When combined with boundary and initial conditions, these equations constitute mathematical models that can be solved and studied in a way somewhat similar to performing experiments in a laboratory. Whether a model is mathematical or analogue, both are simplified abstractions of reality. However, such models are useful because they can help isolate the influence of certain parameters or scenarios, study complex system interactions, and make predictions.
An example of a mathematical model that has important application in Earth science is the heat conduction equation, often more generally referred to as the diffusion equation. A complete derivation of the heat conduction equation is given in Appendix A. In one dimension (1D), the heat conduction equation can be written as follows:
(1.1)
Here, T is the temperature (K), x is the distance (m), t is the time (s), ρ is the rock density (kg m ), c is the specific heat capacity (J kg K ), k is the thermal conductivity (W m ), and A is the rate of internal heat production per unit volume (J s m ). In Equation 1.1, the temperature (the unknown) is referred to as the dependent variable, while t and x are known as independent variables. This type of equation is called a partial differential equation
since the dependent variable depends on more than one independent variable. The physical parameters ρ, c, k, and A are assumed to be known. Obtaining a solution to the equation means finding the function T(x, t) (i.e., T as a function of x and t) that satisfies the PDE.
More generally, the heat equation just introduced is also referred to mathematically as a parabolic (initial value) problem, which are typically of the form
(1.2)
Parabolic equations involve time‐dependent behavior (term 1) and dissipation (terms 2 and 3), together which tend to smooth the solution with increasing time (at least for linear problems). Note that the signs in front of the second‐order spatial derivatives on the right‐hand side of 2 are necessarily positive; otherwise, the solutions grow rather than decay in time. Note also that the solution to parabolic equations depends on the initial value of the solution at (hence the name initial value problems). The other two major classes of PDEs are elliptic (boundary value) problems and hyperbolic. Elliptic equations are typically associated with steady‐state problems. Examples of elliptic equations are Poisson’s equation,
(1.3)
and Laplace’s equation
(1.4)
which govern incompressible potential flow and steady heat transfer. Note that these equations don’t involve any time derivatives and so their solutions depend only on the boundary conditions (hence the name boundary value problems) and any source (if present). Hyperbolic (initial value) PDEs involve time‐dependent wave‐like solutions. An example of a hyperbolic equation is the first‐order wave equation
(1.5)
Here, the first term accounts for time‐dependent behavior, while the second and third terms translate the solution laterally without any dissipation. Hyperbolic equations are common in problems involving flowing fluids.
1.2 Boundary and Initial Conditions
The solution to a PDE is not unique until boundary conditions are imposed. Boundary conditions essentially ground
the solution to some specific physical scenario. There are four types of boundary conditions commonly encountered in the solution of PDEs:
Dirichlet, where the value of the solution is imposed on the boundary
Neumann boundary conditions, where the derivative of the solution is imposed on the boundary
Robin boundary conditions, where one specifies some linear combination of the solution and its derivative
Periodic (or repeating) boundary conditions, where one assumes that the solution at one end of the model domain is equal to the solution at the other end
The number of boundary conditions necessary to determine a solution to a differential equation matches the order of the highest spatial derivative in the differential equation. For example, Equation 1.1 contains a second‐order spatial derivative and so two boundary conditions must be specified, one at each end of the domain. The equation also contains a first‐order time derivative, so we must also provide an initial condition. This means we must define the value of T everywhere (over the entire domain) at . Equation 1.5 has only first‐order spatial derivatives and so requires only one boundary condition in each direction. In this case, the boundary condition should be imposed at the end of the domain from where flow arrives, whereas the downstream end should be left unconstrained so that the flow can exit uninhibited.
1.3 Analytical Solutions
For relatively simple PDEs and for certain boundary conditions and initial conditions, it may be possible to find an exact (also known as a closed‐form or analytical) solution. As an example, consider 1D heat transfer about a steadily creeping, narrow, planar, vertical fault. In this case, Equation 1.1 needs to be solved with A given by (e.g., see McKenzie and Brune, 1972)
(1.6)
where τ is the (constant) shear stress (Pa) resolved on the fault plane, v is the fault slip rate (m ), and δ(x0) is the Dirac function, that is, when , 0 when 0, and . The initial temperature at is assumed to be 0 C everywhere. The spatial domain extends horizontally from to on either side of the fault located at . The boundary conditions are that the first derivative of the temperature vanishes at . The exact solution to Equation 1.1 combined with 1.6 can be written down directly using the Green’s function for this equation (Morse and Feshbach, 1953, p. 981). The solution is
(1.7)
where κ ( )) is the thermal diffusivity (m² ) and erf is the error function
. This solution can easily be evaluated exactly at any desired x and t once the values for the various physical parameters are specified (as done in the following).
1.4 Numerical Solutions
Although it is normally always desirable to obtain exact solutions to the PDE(s) being investigated, in practice this is often not possible. A closed‐form solution may either not exist, or it may be too complicated to be of practical use. This may be due a number of factors, including nonlinearities in the governing equation, variable material properties, complicated geometries or boundary conditions, and so on. In such cases, one must resort to numerical methods that provide an approximate solution to the governing differential equation(s). Today, with powerful computers, many complicated problems can be solved quickly using numerical techniques.
The process of obtaining a computational solution consists of two stages shown schematically in Figure 1.1. The first stage converts the continuous PDE and auxiliary conditions (boundary and initial conditions) into a discrete system of algebraic equations. This first stage is called discretization
and may be performed using various methods (one of which is the finite element method or FEM). The second stage involves solving the system of algebraic equations (normally performed on a computer, see Appendix B) to obtain an approximate solution to the original PDE. This second stage typically will involve some standard mathematical method such as Gaussian elimination.
Figure 1.1 Major steps involved in obtaining a numerical solution to a PDE.
Two important issues that must be considered when obtaining a numerical solution to PDEs are error and stability. All numerical methods introduce discretization errors, which in principle can be reduced by increasing the spatial and temporal resolution. This can be achieved by increasing the number of nodes (in time or space) where the solution is computed, or equivalently, by decreasing the spacing between nodes. It both cases, this should be performed without changing the total spatial or temporal extent of the model domain. Ideally, a numerical solution will converge to the exact solution as the resolution is increased. Even if an exact solution doesn’t exist, one should always check that the numerical solution doesn’t change significantly as the numerical resolution is changed, indicating that convergence has been achieved. Other errors may also arise (e.g., round‐off errors produced during the solution of systems of linear algebraic equations), though these are usually small in comparison to discretization errors.
The issue of stability concerns whether numerical errors, which are always present, decay or grow with time. A stable solution is one where the errors decay with time. An unstable solution is one where the errors grow with time, something that will eventually lead to large oscillations that have no physical meaning (i.e., they are simply numerical errors). Numerical methods are typically referred to as being either stable, unstable, or conditionally stable (meaning it can exhibit both behaviors depending on certain conditions). A stable method is an essential property of any numerical scheme. However, it is important to emphasize that a stable method can still be inaccurate. Thus, it is also important to assess the precision of a numerical solution. The best way this can be achieved is by directly comparing the numerical solution with an exact solution (as done in Figure 1.2). This approach is desirable because a numerical solution may look correct and may display the expected behavior but may be completely wrong (e.g., due to a simple erroneous factor in the numerical code). When an exact solution is not available, one should attempt to compare the numerical solution with other published numerical results.
Graph of distance vs. temperature illustrating solid curve plots and circles depicting the comparison between the numerical and analytical solution.Figure 1.2 Comparison between the numerical (circles) and analytical solution (line, see Equation 1.7) for the temperature around a creeping fault after 100, 1000, and 5000 years (see Equations 1.1 and 1.6). The fault (located at ) creep generates frictional heat that conducts outward into the surrounding rocks. Only the domain to the right of the fault is shown (the temperature is symmetrical about ). The numerical solution is computed using the FEM. The Matlab script used to compute these results is provided at the end of the chapter.
Figure 1.2 shows a comparison between a numerical solution (computed using the FEM) to Equations 1.1 and 1.6, along with the analytical solution to the same equations (i.e., Equation 1.7). The Matlab code used to generate the figure is reproduced in Section 1.6. In this example, one sees that the agreement between the approximate and exact solutions is very good, indicating that the numerical solution is indeed a faithful representation of the original governing PDE. This comparison illustrates the importance of exact analytical solutions, since they provide a means of verifying the accuracy of a numerical solution.
1.5 Numerical Solution Methods
There are many different numerical methods available for solving PDEs, including the FEM, finite different method, finite volume method, boundary element method, discrete element method, and spectral methods. A comparison between three of these methods for a simple problem is given in Appendix C. In theory, each numerical method should provide the same (correct) solution to the original differential equation. However, in practice, some methods are better suited to certain types of equations and model geometries than others. Often the best approach is to choose the method that best suits the problem being investigated. This approach, however, requires considerable experience. The text focuses entirely on the FEM that is widely regarded as being one of the most powerful, flexible, and robust techniques, while also being mathematically sound (Hughes, 2000; Zienkiewicz and Taylor, 2000a). The technique is slightly harder to learn than, for example, the finite difference technique. However, as you will see later, the effort invested in initially learning the FEM pays off later in the wide range of problems that the method is capable of solving. The FEM is especially well suited (though not restricted) to solving mechanical problems and problems that involve complex shapes. Another advantage of programming with the FEM is that the main structure of the code remains the same even for very different physical problems. Thus, once you learn this basic structure, you can easily modify it to solve various problems with minimal effort.
1.6 Matlab Script
The following is a Matlab script used to compute the numerical and analytical solution for Equations 1.1 and 1.6 presented in Figure 1.2. The reader is advised to reinspect the script after reading Chapters 2 and 3. Details of the time‐stepping scheme are presented in Appendix E.
%--------------------------------------------- % Program diffn1d.m % 1-D FEM solution of diffusion equation % and comparison with analytical solution %--------------------------------------------- clear % clear memory from current workspace seconds_per_yr = 60*60*24*365; % number of seconds in 1 year % physical parameters lx = 2000 ; % length of spatial domain Cp = 1e3 ; % rock heat capacity J/kg/K rho = 2700 ; % rock density K = 3.3 ; % bulk thermal conductivity W/m/K kappa = K/(Cp*rho); % thermal diffusivity tau = 10e6 ; % shear stress resolved on fault (Pa) udot = 10e-3/seconds_per_yr ; % fault slip rate (m/s) dTdx = (1/2)*tau*udot/(rho*Cp*kappa) ; % T gradient at fault % numerical parameters dt = seconds_per_yr ; % time step (s) theta = 1 % time stepping parameter [0,1] ntime = 5000 ; % number of time steps nels = 200 ; % total number of elements nod = 2 ; % number of nodes per element nn = nels+1 % total number of nodes dx = lx/nels ; % element size g_coord = [0:dx:lx] ; % spatial domain (1-D mesh) % explicit time stepping options lumped_explicit = 'N'; if theta==0 % if fully explicit lumped_explicit = input('Would you like to lump the mass matrix? Y/N [N]: ', 's'); if isempty(lumped_explicit) lumped_explicit = 'N'; end end % define boundary conditions bcdof = [nn] ; % boundary nodes bcval = [0] ; % boundary values % define connectivity and equation numbering g_num = zeros(nod,nels) ; g_num(1,:) = [1:nn-1] ; g_num(2,:) = [2:nn] ; % initialise matrices and vectors b = zeros(nn,1); % system rhs vector lhs = sparse(nn,nn); % system lhs matrix rhs = sparse(nn,nn); % system rhs matrix displ = zeros(nn,1); % initial temperature (°C) lumped_diag = zeros(nn,1) ; % storage for lumped diagonal % --------------------------------------------- % matrix assembly % --------------------------------------------- for iel=1:nels % loop over all elements num = g_num(:,iel) ; % retrieve equation number dx = abs(diff(g_coord(num))) ; % length of element MM = dx*[1/3 1/6 ; 1/6 1/3] ;% mass matrix KM = [kappa/dx -kappa/dx ; -kappa/dx kappa/dx];% diffn matrix if lumped_explicit=='N' lhs(num,num) = lhs(num,num) + MM/dt + theta*KM ; % assemble lhs rhs(num,num) = rhs(num,num) + MM/dt - (1-theta)*KM ; % assemble rhs else lumped_diag(num) = lumped_diag(num) + sum(MM) '/dt ; % lumped diagonal rhs(num,num) = rhs(num,num) + diag(sum(MM))/dt - (1-theta)*KM ; % assemble rhs end end % end of element loop % --------------------------------------------- % time loop t = 0 ; % time k = 1 ; % counter ii = [100 1000 5000]; % array used for plotting for n=1:ntime n t = t + dt ; % compute time b = rhs*displ ; % form rhs load vector % impose boundary conditions lhs(bcdof,:) = 0 ; % zero the relevent equations tmp = spdiags(lhs,0) ; % store diagonal tmp(bcdof)=1 ; % place 1 on stored-diagonal lhs=spdiags(tmp,0,lhs); % reinsert diagonal b(bcdof) = bcval ; % set rhs b(1) = b(1) + dTdx*kappa ; % add heat flux at left boundary if lumped_explicit=='N' displ = lhs \ b ; % solve system of equations else displ = b./lumped_diag ; % fully explicit, diagonalised solution end % evaluate analytical solution x = g_coord ; term1 = abs(x).*sqrt(pi).*erf((1/2)*abs(x)./(sqrt(kappa./t).*t)); term2 = 2*t.*exp(-(1/4)*abs(x).^2./(kappa*t)).*sqrt(kappa./t); term3 = abs(x)*sqrt(pi) ; term4 = (tau*udot)/(2*kappa*sqrt(pi)*rho*Cp); Texact = term4*(term1+term2-term3); % plotting if mod(n,ii(k))==0 k = k+1; hold on figure(1) plot(g_coord,displ, 'o-',g_coord,Texact, 'r') title(['Time (kyr) = ', num2str(t/seconds_per_yr/1e3)]) xlabel('Distance away from fault (m) ') ylabel('Temperature (°C) ') drawnow t/seconds_per_yr pause end hold off end % end of time loop % ---------------------------------------------
1.7 Exercises
Depending on the values of the constant coefficients A, B, C, D, E, F, and G, the following PDE
can be classified according to the following scheme (Garabedian, 1964):
Using this scheme, classify the following PDEs: