Add feature to find similarity tolerances automatically #103
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.
Currently the similarity distances are computed as
max(similarity_distances)*coarsening_constant
ormax(similarity_distances)*coarsening_constant*refining_constant
.With #64, it requires less active micro-scale simulations per iteration, but sometimes much more iterations to converge when important micro-scale simulations are missed by the stricter similarity condition.
In this PR, the two similarity distances are located by looking for the max-gap in the 1D distance array which is ascending sorted.
The distances could be weighted by a factor which is the exponential function of the right end distance of each gap. The exponent could be constant or some varying value computed from convergence status.
With the tests, this method could locate the threshold values relatively well:
with different adaptivity constants, the runtime varied between 150s to more than 2400s. With this method it took respectively (power = 0,5) 206s and (power = 0,7) 163s.
In these tests only the runtime is compared, not the accuracy. Local adaptivity and serial run for micro-simulations are used.
ToDo: