A numerical solution for the diffusion equation in hydrogeologic systems

Water-Resources Investigations Report 89-4027

, , and ORCID iD



The documentation of a computer code for the numerical solution of the linear diffusion equation in one or two dimensions in Cartesian or cylindrical coordinates is presented. Applications of the program include molecular diffusion, heat conduction, and fluid flow in confined systems. The flow media may be anisotropic and heterogeneous. The model is formulated by replacing the continuous linear diffusion equation by discrete finite-difference approximations at each node in a block-centered grid. The resulting matrix equation is solved by the method of preconditioned conjugate gradients. The conjugate gradient method does not require the estimation of iteration parameters and is guaranteed convergent in the absence of rounding error. The matrixes are preconditioned to decrease the steps to convergence. The model allows the specification of any number of boundary conditions for any number of stress periods, and the output of a summary table for selected nodes showing flux and the concentration of the flux quantity for each time step. The model is written in a modular format for ease of modification. The model was verified by comparison of numerical and analytical solutions for cases of molecular diffusion, two-dimensional heat transfer, and axisymmetric radial saturated fluid flow. Application of the model to a hypothetical two-dimensional field situation of gas diffusion in the unsaturated zone is demonstrated. The input and output files are included as a check on program installation. The definition of variables, input requirements, flow chart, and program listing are included in the attachments. (USGS)

Additional publication details

Publication type:
Publication Subtype:
USGS Numbered Series
A numerical solution for the diffusion equation in hydrogeologic systems
Series title:
Water-Resources Investigations Report
Series number:
Year Published:
U.S. Geological Survey ; Copies of the report can be purchased from Books and Open-File Reports Section,
viii, 86 p. :ill. ;28 cm.