-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review #388
Merged
Merged
Review #388
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
33aaee8
Bug is fixed and added new code
ikrom96git d147666
new code for the table
ikrom96git 645e337
Edits in markdown file
ikrom96git 5d6d754
some edits in test
ikrom96git 638bd3c
Bugs fix
ikrom96git f9d98e1
Codecov
ikrom96git 4bf0008
I cleaned up my code and separated classes to make it easier to work …
ikrom96git 3d04ad1
forgot black
ikrom96git ef4291b
flake8
ikrom96git bfa5113
bug fix
ikrom96git b08307e
Edits codes according to the comments
ikrom96git 5b30c49
Edited codes according to the comments in the GitHub
ikrom96git 1a7e35d
Merge branch 'review' of github.com:ikrom96git/pySDC into review
ikrom96git c543234
Defined new function in stability_simulation.py to check stability for
ikrom96git a8b1322
small edits for codecov
ikrom96git cb34c1a
removed no cover
ikrom96git File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 0 additions & 67 deletions
67
pySDC/projects/Second_orderSDC/dampedharmonic_oscillator_run_stability.py
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
pySDC/projects/Second_orderSDC/harmonic_oscillator_params.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 | ||
|
||
|
||
def get_default_harmonic_oscillator_description(): | ||
""" | ||
Routine to compute modules of the stability function | ||
|
||
Returns: | ||
description (dict): A dictionary containing parameters for the damped harmonic oscillator problem | ||
""" | ||
|
||
# Initialize level parameters | ||
level_params = {'restol': 1e-16, 'dt': 1.0} | ||
|
||
# Initialize problem parameters for the Damped harmonic oscillator problem | ||
problem_params = {'k': 0, 'mu': 0, 'u0': np.array([1, 1])} | ||
|
||
# Initialize sweeper parameters | ||
sweeper_params = {'quad_type': 'GAUSS', 'num_nodes': 3, 'do_coll_update': True, 'picard_mats_sweep': True} | ||
|
||
# Initialize step parameters | ||
step_params = {'maxiter': 5} | ||
|
||
# Fill description dictionary for easy step instantiation | ||
description = { | ||
'problem_class': harmonic_oscillator, | ||
'problem_params': problem_params, | ||
'sweeper_class': boris_2nd_order, | ||
'sweeper_params': sweeper_params, | ||
'level_params': level_params, | ||
'step_params': step_params, | ||
} | ||
|
||
return description |
27 changes: 27 additions & 0 deletions
27
pySDC/projects/Second_orderSDC/harmonic_oscillator_run_points.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import numpy as np | ||
from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import get_default_harmonic_oscillator_description | ||
from pySDC.projects.Second_orderSDC.stability_simulation import compute_and_generate_table | ||
|
||
|
||
if __name__ == '__main__': | ||
''' | ||
This script generates table for the given points to compare in what quadrature type, | ||
number of nodes and number of iterations the SDC iteration is stable or not. | ||
Additional parameter: | ||
To save the table set: save_points_table=True | ||
Change filename: points_table_filename='FILENAME' by default: './data/point_table.txt' | ||
''' | ||
# Get default parameters for the harmonic osicillator problem | ||
description = get_default_harmonic_oscillator_description() | ||
# Additonal params to compute stability points | ||
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), | ||
} | ||
|
||
points = ((1, 100), (3, 100), (10, 100)) | ||
# Iterate through points and perform stability check | ||
for ii in points: | ||
compute_and_generate_table(description, helper_params, ii, check_stability_point=True) |
29 changes: 29 additions & 0 deletions
29
pySDC/projects/Second_orderSDC/harmonic_oscillator_run_stab_interval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import numpy as np | ||
from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import get_default_harmonic_oscillator_description | ||
from pySDC.projects.Second_orderSDC.stability_simulation import compute_and_generate_table | ||
|
||
|
||
if __name__ == '__main__': | ||
''' | ||
To compute maximum stable values for SDC and Picard iterations for the purely oscillatory case with | ||
no damping (mu=0) | ||
Additional parameter: | ||
To save the table set: save_interval_file=True | ||
Change filename: interval_filename='FILENAME' by default: './data/stab_interval.txt' | ||
Output: | ||
it generates to compare with different values of M (number of nodes) and K (maximal number of iterations) | ||
''' | ||
# Ger default parameters | ||
description = get_default_harmonic_oscillator_description() | ||
# Additional parameters to compute stability interval on the kappa | ||
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), | ||
} | ||
|
||
points = ((100, 1e-10),) | ||
# Iterate through points and perform stability check | ||
for ii in points: | ||
compute_and_generate_table(description, helper_params, ii, compute_interval=True) |
26 changes: 26 additions & 0 deletions
26
pySDC/projects/Second_orderSDC/harmonic_oscillator_run_stability.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from pySDC.projects.Second_orderSDC.harmonic_oscillator_params import get_default_harmonic_oscillator_description | ||
from pySDC.projects.Second_orderSDC.stability_simulation import StabilityImplementation | ||
|
||
|
||
if __name__ == '__main__': | ||
""" | ||
To implement Stability region for the Harmonic Oscillator problem | ||
Run for | ||
SDC stability region: model_stab.run_SDC_stability() | ||
Picard stability region: model_stab.run_Picard_stability() | ||
Runge-Kutta-Nzström stability region: model_run_RKN_stability() | ||
To implement spectral radius of iteration matrix | ||
Run: | ||
Iteration matrix of SDC method: model_stab.run_Ksdc() | ||
Iteration matrix of Picard method: model_stab.run_Kpicard() | ||
|
||
""" | ||
# Execute the stability analysis for the damped harmonic oscillator | ||
description = get_default_harmonic_oscillator_description() | ||
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() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this function tell us about the harmonic oscillator? I am not wondering what the harmonic oscillator does, but what this file is about. The documentation of the harmonic oscillator should go into the harmonic oscillator problem class and nowhere else.