1. Trang chủ
  2. » Ngoại Ngữ

Analysis and improvement of the nonlinear iterative techniques for groundwater flow modelling utilising MODFLOW

136 151 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 136
Dung lượng 771,85 KB

Nội dung

Analysis and improvement of the nonlinear iterative techniques for groundwater flow modelling utilising MODFLOW Andrew Michael Durick B Eng (EnvEng) – Bachelor of Engineering in Environmental Engineering – Griffith University 1995 Master of Applied Science (Research) Centre of Statistical Science and Industrial Mathematics Queensland University of Technology Brisbane, Australia July 2004 Statement of Original Authorship The work contained in this thesis has not been previously submitted for a degree or diploma at any other higher education institution To the best of my knowledge and belief, the thesis contains no material previously published or written by another person except where due reference is made Signed: Date: ii Acknowledgements Firstly and most importantly I would like to extend my gratitude to my supervisor Dr Ian Turner, whose enthusiasm and extensive knowledge made this research possible in so many instances Especially appreciated is the extra effort he put in to ensure work was progressing even during personal crises for both of us I would also like to thank my associate supervisor Dr John Doherty, who provided necessary feedback when required and has always provided me with a reality check in the discipline of groundwater modelling The author also acknowledges the partial funding provided by the Queensland Department of Natural Resources & Mines for course fees, the use of resources, and the flexibility to take leave and work around study commitments The author would also like to thank the School of Mathematics at QUT for a scholarship to ensure enrolment was active at the time of submission and adding the required time to ensure quality in the work undertaken Thanks also go to Dr Kiran Bajracharya for his comments on the research Finally, but no less importantly is the support of my family It has been the support of my wife Leisa, who has shouldered the majority of the household chores and the caring for our children, which has allowed me to undertake and complete this work as it was undertaken on a part-time basis For this I am extremely grateful iii Abstract As groundwater models are being used increasingly in the area of resource allocation, there has been an increase in the level of complexity in an attempt to capture heterogeneity, complex geometries and detail in interaction between the model domain and the outside hydraulic influences As models strive to represent the real world in ever increasing detail, there is a strong likelihood that the boundary conditions will become nonlinear Nonlinearities exist in the groundwater flow equation even in simple models when watertable (unconfined) conditions are simulated This thesis is concerned with how these nonlinearities are treated numerically, with particular focus on the MODFLOW groundwater flow software and the nonlinear nature of the unconfined condition simulation One of the limitations of MODFLOW is that it employs a first order fixed point iterative scheme to linearise the nonlinear system that arises as a result of the finite difference discretisation process, which is well known to offer slow convergence rates for highly nonlinear problems However, Newton’s method can achieve quadratic convergence and is more effective at dealing with higher levels of nonlinearity Consequently, the main objective of this research is to investigate the inclusion of Newton’s method to the suite of computational tools in MODFLOW to enhance its flexibility in dealing with the increasing complexity of real world problems, as well as providing a more competitive and efficient solution methodology Furthermore, the underpinning linear iterative solvers that MODFLOW currently utilises are targeted at symmetric systems and a consequence of using Newton’s method would be the requirement to solve non-symmetric Jacobian systems Therefore, another important aspect of this work is to investigate linear iterative solution techniques that handle such systems, including the newer Krylov style solvers GMRES and BiCGSTAB To achieve these objectives a number of simple benchmark problems involving nonlinearities through the simulation of unconfined conditions were established to compare the computational performance of the existing MODFLOW solvers to the iv new solution strategies investigated here One of the highlights of these comparisons was that Newton’s method when combined with an appropriately preconditioned Krylov solver was on average greater than 40% more CPU time efficient than the Picard based solution techniques Furthermore, a significant amount of this time saving came from the reduction in the number of nonlinear iterations due to the quadratic nature of Newton’s method It was also found that Newton’s method benefited more from improved initial conditions than Picard’s method Of all the linear iterative solvers tested, GMRES required the least amount of computational effort While the Newton method involves more complexity in its implementation, this should not be interpreted as prohibitive in its application The results here show that the extra work does result in performance increase, and thus the effort is certainly worth it v Contents Introduction 1.1 Literature Review 1.1.1 The Problem 1.1.2 MODFLOW 1.1.3 Review of Previous Work 1.2 Objectives of the Thesis 11 1.3 Overview of the Thesis 12 Computational Techniques for Groundwater Flow Modelling 14 2.1 Nonlinear Techniques 14 2.1.1 Fixed Point Iteration 16 2.1.2 Newton Iteration (Newton’s Method) 18 2.1.3 Summary of Nonlinear Methods 25 2.2 Numerical Solution Techniques of the Linearised System 26 2.2.1 Gaussian Elimination 27 2.2.2 GMRES 28 2.2.3 Bi-CGSTAB 31 2.2.4 LU Decomposition and Solve 34 2.2.5 Preconditioning 35 2.3 Overview of Mathematical Model 38 2.3.1 2.4 General Groundwater Flow Equation 39 Overview of Computational Model 43 2.4.1 Discretisation 43 2.4.2 Finite Difference Equations 46 2.5 The Two-dimensional Steady State Unconfined Flow Equation 52 2.6 Current Fixed-point Iteration within MODFLOW 54 vi 2.7 Code Implementation 55 3.1 Approach 55 3.2 Coding Philosophy 56 3.3 Code Options 57 3.4 Details of MODTest 58 3.4.1 Model used in the development of the code 62 3.4.2 Reflections on Picard and Newton Implementation 62 Results and Discussion 65 4.1 Benchmark Problems 65 4.2 Benchmark Problem 66 4.3 Benchmark Problem 71 4.4 Benchmark Problem 76 4.5 Discussion of Picard Method Results 80 4.5.1 Solver statistics for the Picard Method 80 4.5.2 Summary of the Picard Method 89 4.6 Discussion of Newton Method Results 91 4.6.1 Solver Statistics for the Newton Method 91 4.6.2 Summary of the Newton Method 101 4.7 Issues in Applying Newton Method to MODFLOW 54 Comparison of Picard and Newton Results 102 Conclusions and Future Work 110 5.1 Conclusions 110 5.2 Future Research Directions 113 Bibliography 115 Appendix 119 File and Subroutine Descriptions 119 Appendix 123 Key Subroutines written for Study 123 vii List of Figures Figure 2.1 – Neighbour Coordinates 45 Figure 2.2– Row, column and layer ordering 45 Figure 2.3– Face at location (i,j+1/2,k) 47 Figure 3.1 – Flowchart for MODTest 59 Figure 3.2 – Example of Solver_ops.in 60 Figure 4.1 – Active model grid and boundary conditions in Benchmark Problem 68 Figure 4.2 – Head solution contours for Benchmark Problem 69 Figure 4.3 – Model grid for Benchmark Problem 72 Figure 4.4 – Head solution contours for Benchmark Problem 73 Figure 4.5 – Head solution surface for Benchmark Problem 74 Figure 4.6 – Model grid for Benchmark Problem 76 Figure 4.7 – Head solution contours for Benchmark Problem 77 Figure 4.8 – Head solution surface for Benchmark Problem 78 Figure 4.9 – Comparison of Subspace and Time Required for Solution of PicardGMRES(m) 86 Figure 4.10 – Comparison of Subspace and Time Required for Solution of Newton – GMRES(m) 95 Figure 4.11 – Outer Iteration Count and Total CPU time 99 Figure 4.12 – Outer Iteration Count Compared to F 105 Figure 4.13 – Comparison of Changes in F for Successive Iterations 107 Figure 4.14 – Outer Iteration Count Compared to Maximum Head Change 108 viii List of Tables Table 3.1 – Combinations of Nonlinear Techniques and Linear Solution Schemes 57 Table 4.1 – Best Performance for each solver for Benchmark Problem 70 Table 4.2 - Best Performance for each solver for Benchmark Problem 74 Table 4.3 - Best Performance for each solver for Benchmark Problem using improved initial conditions 75 Table 4.4 - Best Performance for each solver for Benchmark Problem 78 Table 4.5 - Best Performance for each solver for Benchmark Problem using improved initial conditions 79 Table 4.6 – Results of Picard and Gaussian Elimination 81 Table 4.7 – Results of Picard and Gaussian Elimination using closer Initial Conditions 81 Table 4.8 – Results of Picard and GMRES 81 Table 4.9 – Results of Picard and GMRES with the closer Initial Conditions 83 Table 4.10 – Results of Picard and GMRES Restarted 84 Table 4.11 – Results of Picard and GMRES Restarted with the closer Initial Conditions 87 Table 4.12 – Results of Picard and BiCGSTAB 88 Table 4.13 – Results of Picard and BiCGSTAB with the closer Initial Conditions 88 Table 4.14 – Results of Picard and LUDecomp 89 Table 4.15 – Results of Picard and LUDecomp with the closer Initial Conditions 89 Table 4.16 – Results of Newton and Gaussian Elimination 91 Table 4.17 – Results of Newton and Gaussian Elimination with the closer Initial Conditions 91 Table 4.18 – Results of Newton and GMRES 92 Table 4.19 – Summary of Krylov Subspace Dimension for each Outer Iteration 93 Table 4.20 – Results of Newton and GMRES with the closer Initial Conditions 93 Table 4.21 – Results of Newton and GMRES Restarted 94 Table 4.22 – Results of Newton and GMRES Restarted with the closer Initial Conditions 96 ix Table 4.23 – Results of Newton and BiCGSTAB 97 Table 4.24 – Results of Newton and BiCGSTAB with the closer Initial Conditions 97 Table 4.25 –Results of Newton and LUDecomp 98 Table 4.26 – Results of Newton and LUDecomp with the Improved Initial Conditions 100 Table 4.27 – Summary of Average Solver Improvement from Improved Initial Conditions (Benchmark Problem 2) 103 Table 4.28 – Ratio of successive F between Picard and Newton methods 106 x 74.2% respectively), than from the iterative methods (50.3%, 40.5%, and 53.7% respectively) This result is probably indicative of the vastly different model run times realised between the direct and iterative methods Of the linear solvers utilised during the inner iterations, the iterative methods (GMRES, GMRES(m), and BiCGSTAB) outperformed the direct methods (Gaussian Elimination and LUDecomp) in solving the linearised system of equations for all three benchmark problems as can be noted from Tables 4.1, 4.2, and 4.4 Given the nature of the finite difference problem being solved and the size of the problem this was an expected result Some of the inefficiency in the direct methods can be attributed to the utilisation of non-sparse storage schemes and the associated non-sparse processing of the arrays These effects can also be observed in the application of the preconditioners used in conjunction with the iterative solvers The effects of the non-sparse storage schemes have been acknowledged within Chapters and 4, where its use was justified in this situation, as the research focus concerned the comparison of the nonlinear techniques and consistency was desired between the solvers and preconditioners This research has shown that Newton’s method can be applied to the nonlinear equations formulated in MODFLOW to simulate unconfined groundwater flow to overcome the nonlinearities with good success Furthermore, the method is on average greater than 40% more CPU time efficient than the Picard method based on the solvers and various benchmark problems tested While the Newton method involves more complexity in its coding, storage and processing of non-symmetric systems, this complexity should not be interpreted as prohibitive in its application Obviously the results here show that the extra work does result in performance increase and as a consequence, the effort is certainly worth it In fact the author found the coding that tracked cell neighbour relationships more difficult to plan and write than the application of Newton’s method (including the formulation of the Jacobian) 112 5.2 Future Research Directions In the process of undertaking and completing the objectives of this thesis, a number of issues arose that were outside the scope of this work that however warrant mention here for further investigation The immediate limitation of the work undertaken here is the non-sparse storage schemes and subsequent non-sparse processing within the linear solvers and preconditioners This limitation has been adequate for this research, as the focus has always been on the implementation of Newton’s method and comparison with the Picard method in the solution of nonlinearities emanating from the groundwater flow equation utilised in MODFLOW The non-sparse nature of the processing for the linear solvers and preconditioners has no effect on the findings that compare the two nonlinear techniques Due to the obvious improvements to the outer iterations from the Newton variants (Shamanskii and Definitive), some more effort could be focused on making the factorisation of the Jacobian matrix in the outer iterations more time efficient This could be done through a more efficient decomposition method taking advantage of the sparsity pattern in the Jacobian, and / or through application of a Newton-Krylov method where the action of the Jacobian on a vector is approximated (such as Newton-GMRES) The next step could be to scale up the work to include three-dimensional models and run them in transient mode Transient models, if the appropriate time discretisation is chosen, conform to the requirement of Newton to have a close initial iterate, as this typically comes from the previous time step Due to the slow moving nature of groundwater flow, the waterlevel data in the previous timestep is likely to be close to the solution of the current time step, and thus ideally suited as a candidate for the Newton method initial approximation 113 As was discussed at the end of Chapter 4, another avenue for further research is the possibility of combining the methods (Picard and Newton) to produce a hybrid version that takes advantage of each method’s strength This would involve the solution process commencing with the Picard method to obtain a solution close enough to enable the Newton method to converge rapidly to the solution This would probably be the most robust way of dealing with the nonlinearities in the MODFLOW code 114 [1] Bibliography Anderson, M.P., Woessner, W.W., 1992, Applied Groundwater Modeling – Simulation of Flow and Advective Transport Academic Press Inc [2] McDonald, M.G., Harbaugh, A.W., 1988, A Modular Three Dimensional Finite Difference Ground-Water Flow Model, Techniques of Water Resources Investigations 06-A1, USGS [3] Mehl, S.W., Hill, M.C., 2001, MODFLOW 2000, The U.S Geological Survey Modular Groundwater Model – User Guide to the LINK-AMG (LMG) Package for Solving Matrix Equations using an Algebraic Multigrid Solver, USGS Open File Report 01-177, Denver Colorado [4] Hill, M C., 1990, Preconditioned Conjugate Gradient (PCG2) – A Computer Program for Solving Ground-water Flow Equations, U.S Geological Survey, Denver [5] Kuiper, L K., 1981, A comparison of the incomplete Cholesky-conjugate gradient method with the strongly implicit method as applied to the solution of twodimensional groundwater flow equations, Water Resources Research Vol 17, No 4, ppg1082-1086, 1981 [6] Kuiper, L.K , 1987, A comparison of iterative methods as applied to the solution of the non-linear three-dimensional groundwater flow equations SIAM Journal on Scientific and Statistical Computing – Vol 8, No.4 July 1987 115 [7] Saad, Y., Schultz, M H., 1986, GMRES: A generalised minimal residual algorithm for solving nonsymmetric linear systems SIAM Journal on Scientific and Statistical Computing – Vol No pp856-869, July 1986 [8] Van der Vorst, H A., 1992, BiCGSTAB: A fast and smoothly converging variant of BiCG for the solution of nonsymmetric linear systems SIAM Journal on Scientific and Statistical Computing – Vol 13 No pp631-644, March 1992 [9] Paniconi, C., Putti, M., 1994, A comparison of Picard and Newton iteration in the numerical solution of multidimensional varibly saturated flow problems Water Resources Research – Vol 30, No 12 pp3357-3374, December 1994 [10] Therrien, R., Sudicky, E A., 1996, Three-dimensional analysis of variably-saturated flow and solute transport in discretely-fractured porous media Journal of Contaminant Hydrology – Vol 23(1996) pp1-44 [11] Paniconi, C., Aldama, A.A., Wood, E.F., 1991, Numerical Evaluation of Iterative and Noniterative Methods for the Solution of the Nonlinear Richards Equation Water Resources Research – Vol 27, No 6, pp1147 – 1163, June 1991 [12] Li, C.W., 1993, A Simplified Iteration Method With Linear Finite Elements For Transient Unsaturated Flow Water Resources Research, Vol 29, No 4, April – 1993, pp965-97 [13] Panday, S., Huyakorn, P.S., Therrien, R., Nichols, R.L., 1993, Improved three dimensional finite-element techniques for field simulation of variably saturated flow and transport Journal of Contaminant Hydrology – Vol 12 (1993) pp3-33 [14] Kelley, C.T., 1995, Iterative Methods for Linear and Nonlinear Equations – SIAM Frontiers in Applied Mathematics 16 Society for Industrial and Applied Mathematics, Philadelphia 116 [15] Hydrogeologic Inc, 1996, MODFLOW-Surfact software (Version 2.2) : Overview, Installation, Registration and Running Procedures, Hydrogeologic Inc, Herndon, VA, USA [16] Barrett, R., Berry, M., Chan, T.F., Demmel, J., Donato, J., Dongarra, J., Eijkhout, V., Pozo, R., Romine, C., Van der Vorst, H., 1994, Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods Society for Industrial and Applied Mathematics, Philadelphia [17] Detwiler, R.L., Mehl, S., Rajaram, H., Cheung, W.W., 2002, Comparison of an Algebraic Multigrid Algorithm to Two Iterative Solvers Used for Modelling Ground Water Flow and Transport Ground Water, Vol 40, No 3, May – June 2002 pp267-272 [18] Saad, Y., Van der Vorst, H., 2000, Iterative solution of linear systems in the 20th century J Comput Appl Math., 123 (2000) 1-33 [19] Meyer, P.D., Valocchi, A.J., Ashbey, S.F., Saylor, P.E., 1989, A numerical investigation of the conjugate gradient method as applied to three-dimensional groundwater flow problems in randomly heterogeneous porous media Water Resources Research Vol 25, No 6, pp 1440-1446, June 1989 [20] Y Saad, 2003, Iterative Methods for Sparse Linear Systems, 2nd edition, SIAM, Philadelphia, PA [21] Press, W H., Teukolsky, S A., Vetterling, W T., Flannery, B P., 1992, Numerical Recipes in FORTRAN – The Art of Scientific Computing Second Edition Cambridge University Press, New York [22] Bear, J and Verruijt, A , 1998, Modelling Groundwater Flow and Pollution, D Reidel Publishing Co Dordrecht, Holland 117 [23] Goode, D.J and Appel, C.A., 1992, Finite difference interblock transmissivity for unconfined aquifers and for aquifers having smoothly varying transmissivity : US Geological Survey Water-Resources Investigations Report 92-4124 [24] Stone, L., 1968, Iterative solution of implicit approximations of multidimensional partial differential equations, SIAM J Numer Anal., Vol ppg 530-558, 1968 118 Appendix File and Subroutine Descriptions The subroutines contained within the various files used in the compilation of MODTest MODTest.f90 Main Program: The activities of the main program are detailed in Figure 3.1, and in short it is where the problem setup, reading in of input data, calling of subroutines and outputting of results occurs Upd_well: This subroutine takes the WEL data representing groundwater extraction and adds the relevant volumes to the RHS term in equation(2.67) Upd_rech This subroutine takes the RCH data representing groundwater recharge to the model domain and adds this volume to the RHS term in equation (2.67) Upd_riv: This subroutine takes the RIV data responsible for simulating groundwater interaction with surface water, and as this relationship forms a head dependant boundary, both the RHS and HCOF terms in equation (2.67) are updated Upd_drn: 119 This subroutine takes the DRN data responsible for simulating surface drainage of groundwater and as this relationship forms a head dependant boundary, both the RHS and HCOF terms in equation (2.67) are updated Picard_form_eq: This subroutine generates the COEFF matrix and RHS of equation (2.67) for the Picard method It uses the most recent values of head to calculate the branch conductance terms, and then updates the diagonal and off diagonal terms of COEFF It utilises the RHS and HCOF terms updated from previous subroutines Newt_form_eq: This subroutine processes the model input and creates the Jacobian matrix and jac_RHS vector for use in Newton’s method The calculations that take place here to generate the elements of the Jacobian through finite difference methods are detailed in Appendix Eval_current_f: This routine is used to update the jac_RHS vector during the inner Chord steps in the Chord and Shamanskii methods It utilises the current set of head values and recalculates the branch conductances and head dependant boundary conditions krylov.f90 Krylov module contains the GMRES solver options and all the associated subroutines called by the GMRES solver Gmres: This subroutine performs the solve routine for the GMRES solver It reads in the problem dimensions, the preconditioning option, and the coefficient matrix and right hand side vector of the system of equations being solved and returns the solution for the current iteration The subroutine can also apply the SSOR and ILU (left and right) preconditioning to the solution process The subroutine calls on norm2, ssor_solve_array, lu_solve_array, and ilu_zero_full, which are in the Krylov module and discussed below 120 Gmresm: This subroutine implements the restarted version of GMRES It is passed the same arguments and calls the same subroutines as the gmres routine above The steps involved in the restarted GMRES are outlined in Algorithm Norm2: This subroutine reads in a vector and calculates the 2-norm off the vector Ssor_solve_array: This routine implements the SSOR process on the system of equations for the purposes of preconditioning It reads in the system of equations and returns a vector resulting from a SSOR cycle for use in the solution method calling the preconditioner Ilu_zero_full: This subroutine performs the ILU decomposition of the coefficient matrix The matrix is read into the subroutine, which then performs the decomposition, over writes and then returns the same named matrix Lu_solve_array: This subroutine performs a forward – backward solve on a system of equations passed into the subroutine In its application within GMRES it is passed the output from the ILU decomposition (ilu_zero_full) It returns the vector containing the solution after the forward – backward solve cg.f90 This module contains the BiCGSTAB solver and calls upon subroutines in the Krylov module to implement the SSOR and ILU(0) preconditioners Bicgstab: This subroutine performs the solve routine for the BiCGSTAB solver It reads in the problem dimensions, the preconditioning option, and the coefficient matrix and right hand side vector of the system of equations being solved and returns the solution for the current iteration The subroutine can also apply the SSOR and ILU (left and right) preconditioning to the solution process The subroutine calls on norm2, vec_mult, mat_vec_mult, ssor_solve_array, lu_solve_array, and ilu_zero_full, some of which are in the 121 Krylov module The steps involved in the BiCGSTAB solver appear in Algorithm Vec_mult: This subroutine reads in two vectors, calculates their dot product and then returns the resulting vector Mat_vec_mult: This subroutine multiplies a matrix and vector and returns the resulting vector Other files used in the code are linsol.f90, lu.f90, nutil.f90, and ntype.f90 and these were gathered from other sources including the World Wide Web and Numerical Recipes 122 Appendix Key Subroutines written for Study 123 Formulation of the matrix system resulting from the PICARD implementation ! -! ! PICARD FORMULATION OF SYSTEM OF EQUATIONS ! ! -! Subroutine picard_form_eq(HCOF,coeff,RHS) implicit none integer :: i,j,n_r, n_c real(kind(0d0)) :: sat_thick_current, sat_thick_neigh, t_neigh, t_current, c real(kind(0d0)),dimension(var_count) :: HCOF,RHS real(kind(0d0)),dimension(var_count,var_count) :: coeff intent(in) :: HCOF intent(out) :: coeff intent(in out) :: RHS coeff = 0.0d0 i = 1,var_count ! -Work through each row sat_thick_current = h(i) - bot(var_row(i),var_col(i)) t_current = sat_thick_current * hc(var_row(i),var_col(i)) coeff(i,i) = coeff(i,i) + HCOF(i) j = 1,4 if (neigh(i,j).ne.0) then !neighbour exists sat_thick_neigh = t_neigh = c=0 !calculate transmisivity if ((neigh(i,j).gt.0).and.(neigh(i,j).gt.i)) then ! -neighbour cell is variable head sat_thick_neigh = h(neigh(i,j)) - bot(var_row(neigh(i,j)),var_col(neigh(i,j))) t_neigh = sat_thick_neigh * hc(var_row(neigh(i,j)),var_col(neigh(i,j))) if (j.lt.3) then ! -north - south conductance c = 2.0d0 * delr(var_col(i)) * ((t_current * t_neigh)/ & & ((t_current * delc(var_row(neigh(i,j)))) + & & (t_neigh *delc(var_row(i))))) else ! -east - west conductance c = 2.0d0 * delc(var_row(i)) * ((t_current * t_neigh)/ & & ((t_current * delr(var_col(neigh(i,j)))) + & & (t_neigh *delr(var_col(i))))) end if coeff(i,i) = coeff(i,i) - c coeff(i,neigh(i,j)) = coeff(i,neigh(i,j)) + c coeff(neigh(i,j),i) = coeff(neigh(i,j),i) + c coeff(neigh(i,j),neigh(i,j)) = coeff(neigh(i,j),neigh(i,j)) - c end if if ((neigh(i,j).gt.((-1*ncell)-1)).and.(neigh(i,j).lt.0)) then ! -neighbour cell is fixed head n_r = act_row((-1)*neigh(i,j)) n_c = act_col((-1)*neigh(i,j)) sat_thick_neigh = shead(n_r,n_c) - bot(n_r,n_c) t_neigh = sat_thick_neigh * hc(n_r,n_c) if (j.lt.3) then ! -north - south conductance c = 2.0d0 * delr(var_col(i)) * ((t_current * t_neigh)/ & & ((t_current * delc(n_r)) + & & (t_neigh *delc(var_row(i))))) else ! -east - west conductance c = 2.0d0 * delc(var_row(i)) * ((t_current * t_neigh)/ & & ((t_current * delr(n_c)) + & & (t_neigh *delr(var_col(i))))) end if coeff(i,i) = coeff(i,i) - c RHS(i) = RHS(i) - (shead(n_r,n_c) * c) end if end if end end end subroutine picard_form_eq 124 Formulation of the matrix system resulting from the NEWTON implementation ! -! ! NEWTON FORMULATION OF SYSTEM OF EQUATIONS ! ! -! Subroutine newt_form_eq(p,var,n,r,c,sh,var_r,var_c,h_in,HCOF,RHS,jac,jac_RHS) implicit none integer :: i,j,r,c,var,np, temp_neigh_id integer :: n(var,4) integer :: var_r(ncell),var_c(ncell) real(kind(0d0)) :: p,t,tp,tn real(kind(0d0)),dimension(4) :: tc,tcn,tcp,tcpn,tcnp,tcnpn real(kind(0d0)),dimension(var) :: HCOF, RHS,fstd, fpert, jac_RHS, h_in, fstd_tmp real(kind(0d0)),dimension(var,4) :: fnpert,fnpert_tmp real(kind(0d0)),dimension(r,c) :: ce, cs, cep, csp, cenp, csnp real(kind(0d0)),dimension(r,c) :: sh,h,hp real(kind(0d0)),dimension(var,var) :: jac intent(in) :: p,r,c,sh,var_c,var_r,h_in,var,HCOF,RHS,n intent(out) :: jac, jac_RHS jac = 0.0d0 jac_RHS = 0.0d0 ce = 0.0d0 cep = 0.0d0 cenp = 0.0d0 cs = 0.0d0 csp = 0.0d0 csnp = 0.0d0 fstd = 0.0d0 fpert = 0.0d0 fnpert = 0.0d0 h = sh hp = h i = 1,var h(var_r(i),var_c(i)) = h_in(i) hp(var_r(i),var_c(i)) = h_in(i) + p end ! -Populate the conductance east and conductance south arrays i = 1,r j = 1,c if (ibound(i,j).ne.0) then ! -cell is active (could be variable or fixed) t = (h(i,j) - bot(i,j)) * hc(i,j) = (hp(i,j) - bot(i,j)) * hc(i,j) if (j.lt.c) then if (ibound(i,j+1).ne.0) then ! -eastern neighbour is active tn = (h(i,j+1) - bot(i,j+1)) * hc(i,j+1) ce(i,j) = 2.0d0*delc(i)*((t*tn)/((t*delr(j+1))+(tn*delr(j)))) cep(i,j) = 2.0d0*delc(i)*((tp*tn)/((tp*delr(j+1))+(tn*delr(j)))) tn = (hp(i,j+1) - bot(i,j+1)) * hc(i,j+1) cenp(i,j) = 2.0d0*delc(i)*((t*tn)/((t*delr(j+1))+(tn*delr(j)))) end if end if if (i.lt.r) then if (ibound(i+1,j).ne.0) then ! -southern neighbour is active tn = (h(i+1,j) - bot(i+1,j)) * hc(i+1,j) cs(i,j) = 2.0d0*delr(j)*((t*tn)/((t*delc(i+1))+(tn*delc(i)))) csp(i,j) = 2.0d0*delr(j)*((tp*tn)/((tp*delc(i+1))+(tn*delc(i)))) tn = (hp(i+1,j) - bot(i+1,j)) * hc(i+1,j) csnp(i,j) = 2.0d0*delr(j)*((t*tn)/((t*delc(i+1))+(tn*delc(i)))) end if end if end if end end ! -Populate the Jacobian matrix and RHS vector of the Jacobian System i = 1,var fstd(i) = (HCOF(i)*h(var_r(i),var_c(i))) - RHS(i) fpert(i) = (HCOF(i)*hp(var_r(i),var_c(i))) - RHS(i) j = 1,4 if ((n(i,j).gt.(-ncell-1)).and.(n(i,j).ne.0)) then fnpert(i,j) = (HCOF(i)*h(var_r(i),var_c(i))) - RHS(i) end if end tc = 0.0d0 tcn = 0.0d0 tcp = 0.0d0 tcpn = 0.0d0 tcnp = 0.0d0 tcnpn = 0.0d0 j = 1,4 if ((n(i,j).gt.(-ncell-1)).and.(n(i,j).ne.0)) then 125 if (j.eq.1) then tc(j) = cs(var_r(i)-1,var_c(i))*h(var_r(i)-1,var_c(i)) tcn(j) = cs(var_r(i)-1,var_c(i))*h(var_r(i),var_c(i)) tcp(j) = csnp(var_r(i)-1,var_c(i))*h(var_r(i)-1,var_c(i)) tcpn(j) = csnp(var_r(i)-1,var_c(i))*hp(var_r(i),var_c(i)) tcnp(j) = csp(var_r(i)-1,var_c(i))*hp(var_r(i)-1,var_c(i)) tcnpn(j) = csp(var_r(i)-1,var_c(i))*h(var_r(i),var_c(i)) fstd(i) = fstd(i) + tc(j) - tcn(j) fpert(i) = fpert(i) + tcp(j) - tcpn(j) elseif (j.eq.2) then tc(j) = cs(var_r(i),var_c(i))*h(var_r(i)+1,var_c(i)) tcn(j) = cs(var_r(i),var_c(i))*h(var_r(i),var_c(i)) tcp(j) = csp(var_r(i),var_c(i))*h(var_r(i)+1,var_c(i)) tcpn(j) = csp(var_r(i),var_c(i))*hp(var_r(i),var_c(i)) tcnp(j) = csnp(var_r(i),var_c(i))*hp(var_r(i)+1,var_c(i)) tcnpn(j) = csnp(var_r(i),var_c(i))*h(var_r(i),var_c(i)) fstd(i) = fstd(i) + tc(j) - tcn(j) fpert(i) = fpert(i) + tcp(j) - tcpn(j) elseif (j.eq.3) then tc(j) = ce(var_r(i),var_c(i))*h(var_r(i),var_c(i)+1) tcn(j) = ce(var_r(i),var_c(i))*h(var_r(i),var_c(i)) tcp(j) = cep(var_r(i),var_c(i))*h(var_r(i),var_c(i)+1) tcpn(j) = cep(var_r(i),var_c(i))*hp(var_r(i),var_c(i)) tcnp(j) = cenp(var_r(i),var_c(i))*hp(var_r(i),var_c(i)+1) tcnpn(j) = cenp(var_r(i),var_c(i))*h(var_r(i),var_c(i)) fstd(i) = fstd(i) + tc(j) - tcn(j) fpert(i) = fpert(i) + tcp(j) - tcpn(j) elseif (j.eq.4) then tc(j) = ce(var_r(i),var_c(i)-1)*h(var_r(i),var_c(i)-1) tcn(j) = ce(var_r(i),var_c(i)-1)*h(var_r(i),var_c(i)) tcp(j) = cenp(var_r(i),var_c(i)-1)*h(var_r(i),var_c(i)-1) tcpn(j) = cenp(var_r(i),var_c(i)-1)*hp(var_r(i),var_c(i)) tcnp(j) = cep(var_r(i),var_c(i)-1)*hp(var_r(i),var_c(i)-1) tcnpn(j) = cep(var_r(i),var_c(i)-1)*h(var_r(i),var_c(i)) fstd(i) = fstd(i) + tc(j) - tcn(j) fpert(i) = fpert(i) + tcp(j) - tcpn(j) end if !end if end if end do j = 1,4 np = 1,4 if ((n(i,j).gt.(-ncell-1)).and.(n(i,j).ne.0)) then if (np.eq.j) then fnpert(i,j) = fnpert(i,j) + tcnp(j) - tcnpn(j) else fnpert(i,j) = fnpert(i,j) + tc(np) - tcn(np) end if end if end end end do i = 1,var jac(i,i) = (fpert(i) - fstd(i)) / p jac_RHS(i) = -fstd(i) j = 1,4 if (n(i,j).gt.0) then jac(i,n(i,j)) = (fnpert(i,j) - fstd(i)) / p end if end end end subroutine newt_form_eq 126 ... with how these nonlinearities are treated numerically, with particular focus on the MODFLOW groundwater flow software and the nonlinear nature of the unconfined condition simulation One of the limitations... specifically for the simulation of groundwater flow Some of this code is written to address concise aspects of groundwater flow, while others facilitate the simulation of a variety of conditions Of all the. .. Thesis The main objective of this thesis is to investigate the use of Newton’s method to overcome the nonlinearities formed from the equations used in MODFLOW Current official releases of MODFLOW

Ngày đăng: 07/08/2017, 15:33

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN