Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 Appendix A Cubic Spline We can write the piece-wise continuous function f cubic spline in the following fm: f (x f (x (x +1 (x +1 + f (x +1 (x (x +1 + [a (x (x +1 + b ](x (x +1 (x +1 (A1 The constants {a, b, f 1 n 1} are chosen such that the matching conditions f cubic spline can be fulfilled, ie, and d f (x 1 x x dx d f (x x x +1 dx x x x x d f (x 1 x x d f (x x x +1 d d x x x x One can obtain the following two types of recursion fmula: f 1 + f [ + 1 ]+ f (x +1 1 3 f h 0 (x 1 + ( 1 (A f 1 + f [ + ]+ f (x +1 6 [ f 1 1 h 0 (x f 0 1 ] 1 (A3 where f 0 [ f (x +1 f (x ] / [x +1 ] and x +1 As we can see from equations (A and (A3, the coefficients on the left-hand side depend only on the distribution of grids F a given tabulate data set: { (x, f 1 n }, we can solve equation (A (A3, and evaluate the first and the second derivatives f and f at each grid x, as well as the constants {a, b, f 1 n 1}, based on given boundary conditions at and We can also evaluate the integration value, ie, the area under the cubic-spline curve, Area f (xdx This integration value is useful in inetic plasma simulation to determine mass density, charge density, current density, and thermal pressure at each grid point Exercise A1 Verify Equation (A and Equation (A3 A-1
Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 Verifying Equation (A Let f ( x f 1 x + f x + (x (x (ax + b (1 where f 1 f ( and f f ( To express the undetermined constants, a and b, in terms of the first derivative of f (x at x and x, we tae derivative of Eq (1 It yields f f ( x f + [(x + (x ](ax + b + (x (x a ( Let f 1 f ( and f f ( It yields and f f 1 f + ( (a + b (3 f f f + ( (a + b (4 Solving Eqs (3 and (4 f the unnown constants, a and b, it yields f a 1 + f ( f f 1 ( (5 3 b 1 f 1 f 1 + f ( (x + x + f f 1 1 ( (x + x (6 3 1 Substituting Eqs (5 and (6 into Eqs (3 and (4 to eliminate a and b, it yields Thus, and f ( x f 1 x + f x + (x (x {(x x ( f 1 + (x f f [(x + (x ]} f ( x f + (x (x ( f ( 1 + f f + [(x x + (x x ] 1 {(x x ( f 1 + (x f f f 1 [(x + (x ]} f ( x [(x + (x ] ( f ( 1 + f f + ( {(x x f + (x x f f f 1 1 1 [(x + (x ]} A- (7 (8 (9
Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 Eq (9 can be written as f ( x ( { f [(x x + (x x ]+ f [(x x + (x x ] 1 1 1 3 f [(x + (x ]} (10 Let f 1 f ( and f f ( Eq (10 yields Liewise, f f (x 0 x f 0 x x 0 + f 1 x f 1 4 f f 1 + 6 f f 1 ( (11 f f + 4 f 1 6 f f 1 ( (1 + (x (x {(x x ( 1 f 0 + (x f 1 f 0 [(x + (x ]} it yields f 0 4 f f 0 1 + 6 f 0 ( (13 Eqs (11 and (14 yields f 1 f + 4 f 0 1 6 f 0 ( (14 f 0 1 1 f + ( + f 1 + f 3[ 1 f 0 ( + f f 1 ( ] (15 Let x +1 and ( f 0 ( f +1 f / (x +1 Eq (15 yields 1 f 1 + ( 1 + 1 f + 1 f +1 3[ ( f 0 1 + ( f 0 ] (16 1 1 1 f 1 + ( 1 +1 f + 1 f +1 3[( f 0 1 + 1 ( f 0 ] (17 A-3
Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 Case 1: Step 1: Determine { f, f n 1} from a tabulate data set { (x, f 1 n } with fixed boundary conditions of f at x and x Given f ( and f (, equation (A can be rewritten as f B + f +1 C 1 + C f 1 f 1 + f B + f +1 C 1 + C f 1 + f B 1 + C f +1 C f f 3 n f n 1 (A4 B C 0! 0 1 B 3 C 3 0 0 1 B n C n 0! 0 1 B n 1 f ( f (x 3 f ( f ( + ( C f ( ( + (x 3 C 3 ( 3 + ( C n ( + C n 1 f ( C n 1 (A4' where B ( + 1, C 1, f n 1 Equation (A4 (A4' is the governing equation of { f, f n 1} with a fixed boundary condition of f at x and x Step : Evaluate { f, f 1 n}, {a, b, f 1 n 1}, and Area f (xdx from the results obtained in step 1 Using the matching conditions f the cubic spline, we can show that f 1 n 1, we have a [ f +1 + f f 0 ] b [ f 0 f ] f ( / [ f f +1 ] (A5 (A6 (A7 f n, we have f ( ( / h n 1 [ f + f ( ] (A8 The area under the cubic spline curve between x, is given by A-4
Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 x f (x dx (x +1 [ f (x + f (x +1 a 1 b +1 6 ] (A9 x The Area f (xdx can be obtained by summation of equation (A9 over all intervals Case : Step 1: Determine { f, f 1 n 1} from a tabulate data set { (x, f 1 n } with periodic boundary conditions: f ( f (, f ( f (, and f ( f ( Since f ( f (, we have f 0 (x 0 f 0 Given periodic boundary conditions: f ( f ( and f ( f (, equation (A can be rewritten as f + f B + f +1 C + C f 1 + f B + f +1 C 1 + C f 1 + f B + f ( C 1 + C f 1 f n f n 1 (A10 B 1 C 1 0 0 1 1 B C! 0 0!!! 0 0! 1 B n C n C n 1 0 0 1 B n 1 f ( f ( f ( f + ( C 1 ( + ( C ( 3 + ( C n ( + C n 1 (A10' where B ( + 1, C 1, f 1 n 1 Equation (A10 (A10' is the governing equation of { f, f 1 n 1} with periodic boundary conditions: f ( f ( and f ( f ( Step : Step in Case is the same as Step in Case 1 A-5
Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 Case 3: Step 1: Determine { f, f n 1} from a tabulate data set { (x, f 1 n } with fixed boundary conditions of f at x and x Given f ( and f (, equation (A3 can be rewritten as f B + f +1 C (6 / 1 [ f 0 f 0 1 ] f ( f 1 + f B + f +1 C (6 / 1 [ f 0 f 0 1 ] f 1 + f B (6 / 1 [ f 0 f 0 1 ] f ( C f f 3 n f n 1 (A11 B C 0! 0 1 B 3 C 3 0 0 1 B n C n 0! 0 1 B n 1 f ( f (x 3 f ( f (6 / h 1 [ f 0 ( f 0 ( ] f ( (6 / h [ f 0 (x 3 f 0 ( ] (6 / h n 3 [ f 0 ( f 0 ( 3 ] (6 / h n [ f 0 f 0 ( ] C n 1 f ( (A11' where B ( + 1, C 1, f n 1 Equation (A11 (A11' is the governing equation of { f, f n 1} with a fixed boundary condition of f at x and x Step : Evaluate { f, f 1 n}, {a, b, f 1 n 1}, and Area f (xdx from the results obtained in step 1 Using the matching conditions f the cubic spline, we can show that f 1 n 1, we have a (h / 6[ f +1 f ] b (h / 6[ f +1 + f ] f f 0 ( / 6[ f + f +1 ] (A1 (A13 (A14 f n, we have f ( f 0 + (h n 1 / 6[ f + f ( ] (A15 A-6
Numerical Simulation of Space Plasmas (I [AP-4036] Appendix A by Ling-Hsiao Lyu April 017 Substituting equations (A1 and (A13 into equation (A9, one can obtain the area under the cubic-spline curve between x The Area f (xdx can be obtained by summation of equation (A9 over all intervals Case 4: Step 1: Determine { f, f 1 n 1} from a tabulate data set { (x, f 1 n } with periodic boundary conditions: f ( f (, f ( f (, and f ( f ( Since f ( f (, we have f 0 (x 0 f 0 Given periodic boundary conditions: f ( f (, and f ( f (, equation (A3 can be rewritten as f + f B + f +1 C (6 / h n 1 [ f 0 f 0 ] f 1 + f B + f +1 C (6 / 1 [ f 0 f 0 1 ] f 1 + f B + f ( C (6 / 1 [ f 0 f 0 1 ] f 1 f n f n 1 (A16 B 1 C 1 0 0 1 1 B C! 0 0!!! 0 0! 1 B n C n C n 1 0 0 1 B n 1 f ( f ( f ( f (6 / h n 1 [ f 0 ( f 0 ] (6 / h 1 [ f 0 ( f 0 ( ] (6 / h n 3 [ f 0 ( f 0 ( 3 ] (6 / h n [ f 0 f 0 ( ] (A16' where B ( + 1, C 1, f 1 n 1 Equation (A16 (A16' is the governing equation of { f, f 1 n 1} with periodic boundary conditions: f ( f ( and f ( f ( Step : Step in Case 4 is the same as Step in Case 3 A-7