Repository navigation
Fix the deferred findings K22-K25, add CotangentLiftSVD, move the Lorenz plots to a script #65
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2b77536
Fix the deferred findings K22-K25, add CotangentLiftSVD, move the Lor…
michakraus e094a97
Keep integer snapshots working, complete the POD basis, give one solu…
michakraus 569936e
Merge rcm09/part-m11 into rcm09/followup-preexisting
michakraus 8a293cd
Store the CotangentLiftEVD basis in the model's element type
michakraus dd81a74
Type the fields of the data structs concretely, clamp the samples of …
michakraus 5947f05
Merge main into rcm09/followup-preexisting
michakraus 455a726
Address the review of #65: EVD limits, Hermitian Gram, QR completion
michakraus ac3d768
CHANGELOG: qualify the CotangentLiftEVD entries after the review of #65
michakraus 4a4a5dc
Document the complex-snapshot case of the cotangent lifts and test it
michakraus 2a99199
Reduce the Lorenz script to two modes, document its setup, qualify th…
michakraus cfaf808
Restrict the cotangent lifts to real snapshots
michakraus 609b096
Restrict ComplexSVD to real snapshots
michakraus 3ed838b
Scale the snapshot before the Gram matrix of CotangentLiftEVD
michakraus 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -38,3 +38,6 @@ Presentations/*.png | |
| Presentations/*.pdf | ||
| runs/*.h5 | ||
| runs/*.pdf | ||
|
|
||
| # Output of the scripts | ||
| /results | ||
This file contains hidden or 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 hidden or 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 hidden or 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,12 @@ | ||
| [deps] | ||
| CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" | ||
| GeometricIntegrators = "dcce2d33-59f6-5b8d-9047-0defad88ae06" | ||
| GeometricProblems = "18cb22b4-ad41-5c80-9c5f-710df63fbdc9" | ||
| ReducedComplexityModeling = "abb4722c-1d8e-48eb-a3bd-45b3116bfaba" | ||
|
|
||
| [compat] | ||
| CairoMakie = "0.15" | ||
| GeometricProblems = "0.10" | ||
|
|
||
| [sources] | ||
| ReducedComplexityModeling = {path = ".."} |
This file contains hidden or 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,50 @@ | ||
| # Proper orthogonal decomposition of the Lorenz system: the full solution, the solution of the | ||
| # reduced problem and its projection back to the full space. | ||
| # | ||
| # julia --project=scripts -e 'using Pkg; Pkg.instantiate()' | ||
| # julia --project=scripts scripts/pod_lorenz.jl [--results-dir DIR] | ||
| # | ||
| # `DIR` defaults to `results`. The script writes `pod_lorenz_original.png`, | ||
| # `pod_lorenz_reduced.png` and `pod_lorenz_remade.png` there. | ||
|
|
||
| using CairoMakie | ||
| using GeometricIntegrators | ||
| using GeometricProblems.LorenzAttractor | ||
| using ReducedComplexityModeling | ||
| using ReducedComplexityModeling: POD, reduce!, compose | ||
|
|
||
| function results_dir(args) | ||
| i = findfirst(==("--results-dir"), args) | ||
| i === nothing || i < lastindex(args) || | ||
| throw(ArgumentError("--results-dir needs a directory")) | ||
| dir = i === nothing ? "results" : args[i + 1] | ||
| mkpath(dir) | ||
| end | ||
|
|
||
| dir = results_dir(ARGS) | ||
|
|
||
| # The same setup as test/integration/pod_lorenz.jl: a short time span, because on (0, 100) the | ||
| # Lorenz system is chaotic and grows the round-off of the reduced integration to O(1). | ||
| prob = LorenzAttractor.odeproblem([1.0, 0.0, 0.0]; timespan = (0.0, 1.0)) | ||
| sol = integrate(prob, ExplicitEuler()) | ||
| data = GeometricIntegratorData(sol) | ||
|
|
||
| # two of the three modes: the reduced problem has two components, and the figure shows both | ||
| k = 2 | ||
| alg = POD() | ||
| model = ReducedBasisModel(alg, data.snapshot) | ||
| reduce!(model, k, alg) | ||
| red_sol = integrate(compose(prob, model), ExplicitEuler()) | ||
| psol = project(red_sol, model) | ||
|
|
||
| save(joinpath(dir, "pod_lorenz_original.png"), LorenzAttractor.plot_phase_portrait(sol)) | ||
|
|
||
| fig = Figure(size = (600, 600)) | ||
| ax = Axis(fig[1, 1]; title = "Reduced basis", xlabel = "u₁", ylabel = "u₂") | ||
| lines!(ax, [u[1] for u in red_sol.q], [u[2] for u in red_sol.q]) | ||
| save(joinpath(dir, "pod_lorenz_reduced.png"), fig) | ||
|
|
||
| fig = Figure(size = (600, 600)) | ||
| ax = Axis3(fig[1, 1]; title = "Remade", xlabel = "x", ylabel = "y", zlabel = "z") | ||
| lines!(ax, psol[1, :], psol[2, :], psol[3, :]) | ||
| save(joinpath(dir, "pod_lorenz_remade.png"), fig) | ||
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.