Coverage for pySDC/projects/Second_orderSDC/harmonic_oscillator_run_stab_interval.py: 0%
3 statements
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-20 14:51 +0000
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-20 14:51 +0000
1import numpy as np
2from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import get_default_harmonic_oscillator_description
3from pySDC.projects.Second_orderSDC.stability_simulation import compute_and_generate_table
5if __name__ == '__main__':
6 '''
7 Main script to compute maximum stable values for SDC and Picard iterations for the purely oscillatory case with no damping (mu=0).
9 Additional parameters in the `compute_and_generate_table` function:
10 - To save the stability table, set `save_interval_file=True`.
11 - To change the filename, set `interval_filename='FILENAME'`. Default is './data/stab_interval.txt'.
13 Output:
14 The script generates data to compare different values of M (number of nodes) and K (maximal number of iterations).
15 '''
16 # This code checks if the "data" folder exists or not.
17 exec(open("check_data_folder.py").read())
18 # Get default parameters for the harmonic oscillator
19 description = get_default_harmonic_oscillator_description()
21 # Additional parameters to compute stability interval on the kappa
22 # =============================================================================
23 # To get exactly the same as table in the paper set:
24 # 'Num_iter': (500, 1) for the SDC iteration
25 # 'Num_iter': (2000, 1) for the Picard iteration
26 # =============================================================================
27 helper_params = {
28 'quad_type_list': ('GAUSS',), # Type of quadrature
29 'Num_iter': (500, 1), # Number of iterations
30 'num_nodes_list': np.arange(2, 7, 1), # List of number of nodes
31 'max_iter_list': np.arange(1, 11, 1), # List of maximum iterations
32 }
34 points = ((100, 1e-10),) # Stability parameters: (Num_iter, mu)
36 # Iterate through points and perform stability check
37 for ii in points:
38 # If you want to get the table for the Picard iteration set Picard=True
39 compute_and_generate_table(
40 description, helper_params, ii, compute_interval=True, Picard=False, save_interval_file=True
41 )