Using Partitioning in the Numerical Treatment of ODE Systems with Applications to Atmospheric Modelling Zahari Zlatev National Environmental Research Institute Frederiksborgvej 399, P. O. Box 358 DK-4000 Roskilde, Denmark e-mail: zz@dmu.dk http://www.dmu.dk/AtmosphericEnvironment/staff/zlatev.htm http://www.dmu.dk/AtmosphericEnvironment/DEM http://www.mathpreprints.com Contents 1. Major assumptions 2. Partitioning into strong and week blocks 3. Advantages of the partitioned algorithms 4. “Local” error of the partitioned algorithms 5. “Global” error of the partitioned algorithms 6. Application to some atmospheric models 7. Computing times 8. Open problems Great environmental challenges in the 21st century 1. More detailed information about the pollution levels and the possible damaging effects 2. More reliable information (especially about worst cases) How to resolve these two tasks? By using large-scale mathematical models discretized on a fine resolution grids Mathematical Models cs (uc s ) (vcs ) t x y cs cs K y K x x x y y (k1s k 2 s )c s Es Qs(c1,c2 ,... ,cq ) (wcs ) cs K z z z z s 1,2 ,...,q hor. transport hor. diffusion deposition chem. emis. vert. transport “Non-optimized” code Module Comp. time Percent Chemistry 16147 83.09 Advection 3013 15.51 Initialization 1 0.00 Input operations 50 0.26 Output operation 220 1.13 Total 19432 100.00 It is important to optimize the chemical part for this problem 2-D version on a 96x96 grid (50 km x 50 km) The time-period is one month The situation changes for the fine resolution models (the advection becomes very important) The computing time is measured in seconds One processor is used in this run Methods for the chemical part QSSA (Quasi-Steady-State-Approximation) Classical numerical methods for stiff ODEs Partitionig QSSA dy P (y , y ,..., y ) L (y , y ,..., y ) y dt s s P y L n 1 1 2 q s 2 for s s q s L t 10 s s P P y y e L L y y t P L y n 1 1 s s n t L s s s s n 1 n s s s s s s for 0.01 L t 10 s for L t 0.01 s 1. Major assumptions It will be assumed that the components of the solution vector can be divided into several groups, so that the components belonging to different groups have different properties. In the particular case where the chemical part of a large air pollution models is studied, the reactions are divided into fast reactions and slow reactions yn 2. Partitioning vector dy f (t , y ), y q , f q dt yn 1 yn t f n 1 , yn y (t n ), f n f (t n , yn ) I tJ y [0] n 1 Assume yn is [i ] n 1 yn[ i11] yn t f (t n 1 , yn[i11] ) that : partitione d to NBLOCKS blocks r1 , r2 , ... , rp p q, 1 rk q, k 1, 2, ... , q one of the blocks The paritionin g of yn implies partitioni ng in Two row blocks of Strong and I tJ n[ 0]1 I tJ n[ 0]1 correspond to each block of week blocks (the strong yn blocks are diagonal) 3. Forming the partitioned system A y [0] n 1 [i ] n 1 yn[ i11] yn t f (t n 1 , yn[ i11] ) An[ 0]1 I tJ n[ 0]1 An[ 0]1 S n[ 0]1 Wn[01] Let yn[ 1] obtained A y [0] n 1 [ ] n 1 ~ [ 0] S n[ 0]1 I t S n 1 with be the accepted by y the regular [ 1] n 1 solution Newton method yn t f t n 1 , y [ 1] n 1 S n[ 0]1z n[ i]1 z n[ i11] z n t f t n 1 , z n[ i11] Splitting matrix A A=S+W S W W S W S W 0 W W S 0 11 21 0 12 13 22 23 S 33 0 31 32 A 11 S 0 0 W W 0 W 0 W S W W 0 12 22 13 21 33 23 31 32 W 4. Why partitioned system? Advantages: 1. It is not necessary to compute the non-zero elements of the weak blocks 2. Several small matrices are to be factorized instead of one big matrix 3. Several small systems of linear algebraic equations are to be solved at each Newton iteration (instead of one large system) 5. Requirements A y [ 0] n 1 S z [0] n 1 [i ] n 1 [i ] n 1 y z [ i 1] n 1 [ i 1] n 1 t f t yn t f tn 1 , y zn n 1 ,z [ i 1] n 1 [ i 1] n 1 It is desirable to find the conditions under which the approximate solution of the second problem is close to the approximate solution of the first one y [ ] n 1 z z [ ] n 1 [ ] n 1 0 is small is not is not much larger sufficient Lemma 1 yn[ 1] z n[ i]1 Bn[ i11] yn[ 1] z n[ i11] Cn 1 ( yn z n ) Dn[ i11] yn[ 1] where Cn 1 S [ 0 ] 1 n 1 [ i 1] n 1 t S [ i 1] n 1 S B D Tn[i 11] 1 [ 0 ] 1 n 1 f t [ i 1] ~ [ 0 ] Tn 1 S n 1 [ 0 ] 1 n 1 Wn[01] Bn[ i11] [ 1] [ i 1] y ( 1 ) z n 1, n 1 n 1 yn 1 exact yn[ 1] approximat ion some d y 0 solution numerical of of method yn 1 yn t f (t n 1 , yn 1 ) yn 1 found by Lemma 2 y [ ] n 1 z [i ] n 1 i [ ] [ i j] y n 1 z [n0]1 B n 1 j1 i 1 k [ i j] B n 1 C n 1 ( y n z n ) k j1 i 1 k [ i 1k ] [ i j] [ ] B D y n 1 n 1 n 1 k j1 yn 1 exact solution of yn[ 1] approximat ion of some numerical method yn 1 yn t f (t n 1 , yn 1 ) yn 1 found by “Local” error B n 1 Bn 1 1 Theorem max B 0 j i [ j] n 1 Major assumption [i ] yn 1 z n 1 [ ] [i ] yn 1 z n 1 1. if the number of iterations is sufficiently large and 2. if the error from the previous step is sufficiently small “Global” error Bk[ k ] Ek max B , 0 k n 1 [i ] k 0 i k Ck , [ k ] 1 Bk E max ( E 0 k n 1 k ) Theorem If Bk[ k ] 1 and yn1 z [ n1 ] n 1 E 1 then the inequalities and [ ] n 1 y z [ n1 ] n 1 will be satisfied when sufficiently many iterations are performed “Global” error - continuation If E 1, Theorem yn 1 z n[ vn11 ] E n 1 y yn[ 1] z n[n11 ] E n 1 y If 0 0 z0 z0 1 E n 1 1 E 1 E n 1 1 E E 1, [ v n 1 ] y n 1 z n 1 y0 z 0 n [ n 1 ] [ ] yn z 1 n 1 y0 z 0 n Actual partitioning 1. Matrix S, which is obtained after the partitioning is a block-diagonal matrix containing 23 blocks. 2. The first diagonal block is a 13x13 matrix. 3. The next 22 clocks are 1x1 matrices (a Newton iteration procedure for scalar equations is used in this part). 4. This partitioning was recommended by the chemists (based on their knowledge of the chemical reactions) Variation of the key quantities for different scenarios ( BN ) Scenario 1 2 3 4 5 6 [2.4E-4, 3.3E-2] [3.7E-4, 2.1E-2] [5.8E-3, 5.7E-2] [1.3E-3, 4.3E-2] [4.3E-3, 2.5E-2] [5.6E-3, 6.4E-2] N 1, 2, ... ,1260 ( Bn 1 ) B n 1 , and E 1.03425 1.02179 1.06040 1.04606 1.02522 1.06882 t 30s B n 1 ( Bn 1 ) Variation Variation of of the the key key quantities quantities for for different different stepsizes scenarios Stepsize 30 10 1 0.1 0.01 Scenario 5 B 2.5E-2 1.4E-2 2.6E-3 3.6E-4 5.3E-5 E 1.025 1.014 1.0026 1.00036 1.000053 Numerical Results Method QSSA-1 QSSA-2 Euler Trapez. RK-2 Part. dense Computing time 12.85 11.72 15.11 15.94 28.49 10.09 Based on Euler Better accuracy with the classical numerical methods Accuracy results Numer. Method Scenario 2 Scenario 6 QSSA-1 3.20E-3 4.39E-1 QSSA-2 3.39E-3 3.86E-1 Euler 5.78E-4 3.57E-3 Trapez 5.78E-4 3.57E-3 Part. dense 5.72E-4 3.26E-3 t 30s The chemical compound is ozone Conclusions and open problems 1.We have shown that the physical arguments for achieving successful partitioning can be justified with clear algebraic requirements. 2. There is a drawback: if the chemical scheme is changed, then the whole procedure has to be carried out for the new chemical scheme. 3. Automatic partitioning is desirable.