|
|
Earth and Space Sciences ESS 590 B
Introduction to Heat and Mass Flow Modelling in Earth Sciences Sample codes
This page links to sample matlab codes that illustrate ideas in class on heat and mass flow. Steady Heat Flow - I These m-files find 2-D steady-state temperature using the Finite-Volume method.
Steady Heat Flow - II Updated steady-state 2-D heat flow and both Finite Volumes and Finite Difference solutions are implemented (choice based on value of variable "fvm").
Transient Heat Flow - I 2-D transient diffusion with implicit time stepping.
This code solves steady advective-diffusion in 1-D using a central-difference representation of advection. This method can have negative coefficients when F=F/D>2. Don't use it for real problems!
m-file diffusion_SS_1D_adv.m runs several different values of nz, number of finite volumes in z direction. Different Peclet numbers are associated with each dz. Some are >2, some are <2. Execution "Pauses" after each nz is selected. Press any key to continue. SS 1-D Advective Diffusion, Power-Law scheme Solves steady 1-D advective diffusion for a series of models with various Peclet numbers and grid sizes. and for either central-difference scheme (bad) or power-law scheme (good). Hits "pause" after each plot - press any key to resume. SS 2-D Advective Diffusion This code puts finite-volume edges on boundaries, but also includes extra nodes on those boundaries to facilitate incorporation of eithe phi-value or phi-gradient Boundary Conditions at every boundary node. (Patankar Practice B, p. 69). Patankar's Power-law advective scheme is used. SS Illustration of False Diffusion in 2-D SS 2-D Adv-Diff code above is used to run a sequence of models illustrating false diffusion when strong flow is not aligned with coordinate axes. Transient 2-D Advective Diffusion By incorporating minor changes to the SS 2-D Advective Diffusion code above, this code solves transient problems. phi-Dependent Coefficients This variation on 2-D advective diffusive code solves a steady 1-D problem where teh coefficient Gamma depends on solution phi Internal BC Sometimes you may want to fix the value of phi at volumes remote from the actual domain boundary. Following Patankar (1980) p. 145, this can be done with the source term. The example uses the 2-D transient advective diffusive code, with a block of volumes held at a constant value of phi. SH Wave Propagation By converting the first tme derivative into a second time derivative, the diffusion equation can be transformed into a wave equation, applicable to SH waves traveling through the Earth. phi becomes displacement u, and Gamma becomes shear modulus. This code finds wavenumber transfer functions for 1D transient diffusion, for specified kappa, dx, and dt. It then carries out a corresponding 1D time-domain finite difference simulation. Users can see how the transfer functions are useful. Code evaluates the response of a single node when adjacent points are held fixed. Solutions are shown for 3 levels of discretization:
|
|
|
Send mail to: Contact Email
Last modified: 5/13/2008 9:25 AM |
||