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

Add transformation in acceleration methods to treat bounded values #1952

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

Fujikawas
Copy link
Contributor

@Fujikawas Fujikawas commented Feb 15, 2024

Main changes of this PR

Add cropping and (possible) transformations in acceleration methods, to limit the post-processed data inside the required range.

Motivation and additional information

Motivation

When we are modelling physical scenarios, we live with bounded values, such as concentration(in [0,1]) of phase etc.

If the user involves these values into acceleration methods, there exists the possibility, that the output from acceleration methods would go beyond the certain range. Then we will send irrational input into the solver, which might result in an error info from solver.

Ideas

Our basic idea is to transform the bounded data into infinity before they are post-processed, and do backward transformation after the acceleration. This is similar to pre-conditioning, but a non-linear one.

To do the transformation from the actual interval is not possible when the interval is closed(e.g. for concentration), so I extend the interval at both sides a little bit further to execute the transformation and after the backward transformation, I crop the part which exceed the actual interval.
Currently, I have only implemented the transformation and cropping for QN-methods for both-sides bounded values, later I want to extend the method for one-side bounded values. For under-relaxation methods, we don't have problem with bounded-values.

I compared only cropping and transformation+cropping for IQN-IMVJ with simple test case tests/quasi-newton/serial/TestQN11.xml and also with more complex multi-phase porous-media simulation. These two methods could both work for the test case, even when I adjusted the shape of the function. But for the porous-media case, I observed that the transformation+cropping helped with the convergence, when pure cropping couldn't do this (so it only stopped the solver from breaking down). But these are only data-based conclusions, not analytic ones.

Different transformation functions and extended interval widths are also compared. The logistic function with 0.1 extension on both sides works well for most occasions.

Appendix:
For the multi-phase porous media simulation, the saturation of one phase is involved in the QN-methods. And a over large saturation can cause the micro-scale solver to break down. One group of tests give the results like:
without any modification, the iterations per time window are: 6-11-11-30(max. iter. num.)-break,
with cropping, they are 6-11-11-30-30-...(further not measured)
with given transformation and cropping, it's 6-12-19-8-8-7; this could vary according to the transformation function and intervals.
A proper way to predict the influence of the modification on the convergence rate is still in search ;)

Author's checklist

  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I added a changelog file with make changelog if there are user-observable changes since the last release.
  • I added a test to cover the proposed changes in our test suite.
  • For breaking changes: I documented the changes in the appropriate porting guide.
  • I squashed / am about to squash all commits that should be seen as one.
  • I removed the unnecessary code snippets in comments.

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?

Copy link
Member

@uekerman uekerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition!
Needs some work concerning test coverage and usability, but nothing critical.

See also the generated Wreorder warnings.

Could you (briefly) document your porous-media results here as well? Iteration / convergence data.

src/acceleration/config/AccelerationConfiguration.cpp Outdated Show resolved Hide resolved
tests/quasi-newton/serial/TestQN11.xml Outdated Show resolved Hide resolved
tests/quasi-newton/helpers.cpp Outdated Show resolved Hide resolved
tests/quasi-newton/helpers.cpp Outdated Show resolved Hide resolved
Comment on lines 265 to 267
outValues[0] = sin(inValues[0] * inValues[1]);
outValues[1] = cos(inValues[0] * inValues[1]);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test actually converge or does it iterate till 200?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could converge when it's not stopped (while exceeding the bounds).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by stopped you mean reaching the 200, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By stopped I mean when normal IMVJ is used, the values after post-processing will go beyond the range and the test will fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but with the transformation it converges?

src/acceleration/IQNILSAcceleration.cpp Outdated Show resolved Hide resolved
src/acceleration/BaseQNAcceleration.cpp Outdated Show resolved Hide resolved
src/acceleration/BaseQNAcceleration.cpp Outdated Show resolved Hide resolved
src/acceleration/BaseQNAcceleration.cpp Outdated Show resolved Hide resolved
src/acceleration/BaseQNAcceleration.cpp Show resolved Hide resolved
@Fujikawas Fujikawas marked this pull request as ready for review April 3, 2024 15:50
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.

None yet

2 participants