Skip to content

Commit

Permalink
I cleaned up my code and separated classes to make it easier to work …
Browse files Browse the repository at this point in the history
…with. It is not ready yet; if Codecov fails, I will include more tests.
  • Loading branch information
ikrom96git committed Jan 11, 2024
1 parent f9d98e1 commit 4bf0008
Show file tree
Hide file tree
Showing 15 changed files with 908 additions and 1,003 deletions.
8 changes: 4 additions & 4 deletions pySDC/projects/Second_orderSDC/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ If you utilize it, either in whole or in part, for a publication, please provide

## Reproducing Figures from the Publication

- **Fig. 1:** Execute `dampedharmonic_oscillator_run_stability.py` while setting `kappa_max=18` and `mu_max=18`.
- **Fig. 2:** Run `dampedharmonic_oscillator_run_stability.py` with the following configurations:
- **Fig. 1:** Execute `harmonic_oscillator_run_stability.py` while setting `kappa_max=18` and `mu_max=18`.
- **Fig. 2:** Run `harmonic_oscillator_run_stability.py` with the following configurations:
- Set `kappa_max=30` and `mu_max=30`.
- Adjust `maxiter` to 1, 2, 3, or 4 and execute each individually.
- **Table 1:** Execute `dampedharmonic_socillator_run_stab_interval.py`:
- **Table 1:** Execute `harmonic_socillator_run_stab_interval.py`:
- To save the results set: `save_file=True`

- Use the script `dampedharmonic_oscillator_run_points.py` to create a table based on given $(\kappa, \mu)$ points. This table assists in determining suitable values for `M`, `K`, and `quadrature nodes` to ensure stability in the SDC method.
- Use the script `harmonic_oscillator_run_points.py` to create a table based on given $(\kappa, \mu)$ points. This table assists in determining suitable values for `M`, `K`, and `quadrature nodes` to ensure stability in the SDC method.
- To save the results set: `save_file=True`

- **Fig. 3:** Run `penningtrap_run_error.py` (Run local convergence: `conv.run_local_error()`) with `dt=0.015625/4` and `axes=(0,)`.
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import numpy as np
from pySDC.implementations.problem_classes.HarmonicOscillator import harmonic_oscillator
from pySDC.implementations.sweeper_classes.boris_2nd_order import boris_2nd_order
from pySDC.projects.Second_orderSDC.penningtrap_Simulation import Stability_implementation


def dampedharmonic_oscillator_params():

def harmonic_oscillator_params():
"""
Routine to compute modules of the stability function
Expand Down Expand Up @@ -35,23 +35,3 @@ def dampedharmonic_oscillator_params():
}

return description


if __name__ == '__main__':
"""
Damped harmonic oscillator as a test problem for the stability plot:
x' = v
v' = -kappa * x - mu * v
kappa: spring constant
mu: friction
Source: https://beltoforion.de/en/harmonic_oscillator/
"""
# Execute the stability analysis for the damped harmonic oscillator
description = dampedharmonic_oscillator_params()
Stability = Stability_implementation(description, kappa_max=30, mu_max=30, Num_iter=(200, 200))

Stability.run_SDC_stability()
Stability.run_Picard_stability()
Stability.run_RKN_stability()
Stability.run_Ksdc()
# Stability.run_Kpicard
16 changes: 16 additions & 0 deletions pySDC/projects/Second_orderSDC/harmonic_oscillator_run_points.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import numpy as np
from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import harmonic_oscillator_params
from pySDC.projects.Second_orderSDC.stability_simulation import compute_and_check_stability

if __name__ == '__main__':
# Define lists for the number of nodes and maximum iterations
description=harmonic_oscillator_params()
helper_params={'quad_type_list':['GAUSS', 'LOBATTO'],
'Num_iter':(2, 2),
'num_nodes_list':np.arange(3, 6, 1),
'max_iter_list':np.arange(2, 10, 1)}
description['helper_params']=helper_params
points=((1, 100), (3, 100), (10, 100))
# Iterate through points and perform stability check
for ii in points:
compute_and_check_stability(description, ii, check_stability=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import numpy as np
from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import harmonic_oscillator_params
from pySDC.projects.Second_orderSDC.stability_simulation import compute_and_check_stability

if __name__ == '__main__':
# Define lists for the number of nodes and maximum iterations
description=harmonic_oscillator_params()
helper_params={'quad_type_list':['GAUSS'],
'Num_iter':(2000, 1),
'num_nodes_list':np.arange(2, 7, 1),
'max_iter_list':np.arange(1, 11, 1)}
description['helper_params']=helper_params
points=((100, 1e-10),)
# Iterate through points and perform stability check
for ii in points:
compute_and_check_stability(description, ii, compute_interval=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import harmonic_oscillator_params
from pySDC.projects.Second_orderSDC.stability_simulation import StabilityImplementation


if __name__ == '__main__':
"""
Damped harmonic oscillator as a test problem for the stability plot:
x' = v
v' = -kappa * x - mu * v
kappa: spring constant
mu: friction
Source: https://beltoforion.de/en/harmonic_oscillator/
"""
# Execute the stability analysis for the damped harmonic oscillator
description = harmonic_oscillator_params()
model_stab = StabilityImplementation(description, kappa_max=30, mu_max=30, Num_iter=(200, 200))

model_stab.run_SDC_stability()
model_stab.run_Picard_stability()
model_stab.run_RKN_stability()
model_stab.run_Ksdc()
# model_stab.run_Kpicard
Loading

0 comments on commit 4bf0008

Please sign in to comment.