Skip to content
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

Playground: Residual components in DAE case when using SDC-DAE sweeper arised from epsilon-embedding #455

Merged

Conversation

lisawim
Copy link
Collaborator

@lisawim lisawim commented Jul 3, 2024

The $\varepsilon$-embedding can be used to derive reasonable schemes for (semi-explicit) DAEs that are close to stiff ODEs. When we consider a scalar problem of the form $$y'=f(y, z),$$ $$\varepsilon z' = g(y,z),$$ for $0 < \varepsilon \ll 1$, then setting $\varepsilon=0$ results in the semi-explicit DAE $$y'=f(y, z),$$ $$0 = g(y,z).$$ Thus, when SDC is applied to the ODE we get the scheme $$\mathbf{y}^{k+1} = \mathbf{y}_0 + \Delta t (\mathbf{Q}-\mathbf{Q}_d) f(\mathbf{y}^k,\mathbf{z}^k) + \Delta t \mathbf{Q}_d f(\mathbf{y}^{k+1},\mathbf{z}^{k+1}),$$ $$\varepsilon\mathbf{z}^{k+1} = \varepsilon\mathbf{z}_0 + \Delta t (\mathbf{Q}-\mathbf{Q}_d) g(\mathbf{y}^k,\mathbf{z}^k) + \Delta t \mathbf{Q}_d g(\mathbf{y}^{k+1},\mathbf{z}^{k+1}).$$ Again, setting $\varepsilon=0$ results in a first possible SDC scheme to solve the DAE: $$\mathbf{y}^{k+1} = \mathbf{y}_0 + \Delta t (\mathbf{Q}-\mathbf{Q}_d) f(\mathbf{y}^k,\mathbf{z}^k) + \Delta t \mathbf{Q}_d f(\mathbf{y}^{k+1},\mathbf{z}^{k+1}),$$ $$0 = \Delta t (\mathbf{Q}-\mathbf{Q}_d) g(\mathbf{y}^k,\mathbf{z}^k) + \Delta t \mathbf{Q}_d g(\mathbf{y}^{k+1},\mathbf{z}^{k+1}).$$ which is called $\mathtt{SDC-E}$ or genericImplicitEmbedded. [E. Hairer, G. Wanner, eq. (1.12) on p. 375] suggested treating the algebraic constraints directly. Thus, another reasonable SDC scheme is $$\mathbf{y}^{k+1} = \mathbf{y}_0 + \Delta t (\mathbf{Q}-\mathbf{Q}_d) f(\mathbf{y}^k,\mathbf{z}^k) + \Delta t \mathbf{Q}_d f(\mathbf{y}^{k+1},\mathbf{z}^{k+1}),$$ $$0 = g(\mathbf{y}^{k+1},\mathbf{z}^{k+1}),$$ called $\mathtt{SDC-C}$ or genericImplicitConstrained. Here, no quadrature is applied to the algebraic parts.

This PR contains these both sweepers to solve semi-explicit DAEs. In the playground the residual components are plotted for both sweepers for a new implemented problem LinearTestDAEMinion which is a stiff linear one. Moreover, the original SDC-ODE sweeper generic_implicit sweeper can also be applied to the DAE problem (where we ignore the unnecessary computations). This can be done as long as the solve_system in the problem class does the correct things. Then, when you run the script residual_components.py it generates plots for different time step sizes $\Delta t$ where the residual components on last collocation node $\tau_M$ are plotted along iterations. I recommend playing around here to see how it does behave. And then in the plots corresponding to generic_implicit's solves you see that the residual in the algebraic component is always large. And the reason here for that is that in compute_residual the residual is not computed correctly. To check this consider the compute_residual methods of the two new sweepers in this PR.

However, words above are not set in stone. This is only my assumption, since @brownbaerchen already mentioned issues in convergence when using the residual and you also mentioned that @Ouardghi has issues with the residual. This playground is thus for ..playing around (Who would have thought it?) and see how the residual behaves in the different treatments. Moreover, it could serve as basis for discussion when we three will meet for that.

Since this is only a playground there are no tests here, but I'll submit them later for sure. I already tried to make everything clean. I know it is not perfect (as usual) but when transferring the sweepers + problems to the projects folder we can discuss how to make it cleaner. For playing around this should be enough I hope.

Oh, I forgot to mention that I added genericImplicitOriginal which is in principle generic_implicit only overload the compute_residual method and having an attribute residual_components which is used for logging and plotting in the playground. I didn't want to clutter up generic_implicit..

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.83%. Comparing base (18989d3) to head (4dd2600).
Report is 32 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #455      +/-   ##
==========================================
+ Coverage   77.38%   77.83%   +0.44%     
==========================================
  Files         327      332       +5     
  Lines       26085    25843     -242     
==========================================
- Hits        20187    20114      -73     
+ Misses       5898     5729     -169     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pancetta pancetta merged commit 9ad4830 into Parallel-in-Time:master Jul 3, 2024
86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants