KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
992 stars 244 forks source link

Newton Raphson Output #4268

Open RiccardoRossi opened 5 years ago

RiccardoRossi commented 5 years ago

Dear All, i am reporting here some comments that were made by Prof. Oliver when looking at the output of our NR strategy:

1 - it should be possible to have the convergence shown but not to show build and solve times 2 - output of convergence ratio should be in exponential format (1.5e-2) and not in the standard output of cout (@pooyan-dadvand here i tried to add std::precision to the logger input without success. Any suggestion?) 3 - absolute tolerance should be set to zero or very small number by default 4 - if absolute tolerance is set to zero, it would be good not to have this shown in the output

I definitely agree on this points, particularly about the points 1,2,3

could we agree exactly of what should be shown at the different echo levels?

philbucher commented 5 years ago
  1. I think we can increase the echo-lvl of when the times are printed. Or we can select/filter messages through the logger but I am not sure if this is supported yet...
  2. I agree
  3. makes sense to me
  4. I am not sure if I understand correctly, could explain a bit more in detail?
loumalouomega commented 5 years ago

Dear All, i am reporting here some comments that were made by Prof. Oliver when looking at the output of our NR strategy:

1 - it should be possible to have the convergence shown but not to show build and solve times

The echo level of convergence criteria and strategy should be different. The build time is shows if the echo level of strategy is greater than 0. The convergences is shown if the echo level of the convergence criteria is set.

This is what I do in my fancy output in the contact structural mechanics. i still have pending to do something similar in the core.

2 - output of convergence ratio should be in exponential format (1.5e-2) and not in the standard output of cout (@pooyan-dadvand here i tried to add std::precision to the logger input without success. Any suggestion?)

I do that in my fancy output too

3 - absolute tolerance should be set to zero or very small number by default

Agree

4 - if absolute tolerance is set to zero, it would be good not to have this shown in the output

Agree

I definitely agree on this points, particularly about the points 1,2,3

could we agree exactly of what should be shown at the different echo levels?

This can be done easily if we advance with solving strategies factories...ping https://github.com/KratosMultiphysics/Kratos/pull/3185

loumalouomega commented 5 years ago

I got a scientific output, but it requires a lot o modification of the current logger interface, better to think a better idea (for now I can only think in specialize the template of the logger for doubles):

std::stringstream string_out;
string_out
<< " :: [ Obtained ratio = "
<< std::setiosflags(std::ios::scientific)
<< std::setprecision(3)
<< std::uppercase
<< ratio << "; Expected ratio = "
<< std::setiosflags(std::ios::scientific)
<< std::setprecision(3)
<< std::uppercase
<< mRatioTolerance << "; Absolute norm = "
<< std::setiosflags(std::ios::scientific)
<< std::setprecision(3)
<< std::uppercase
<< absolute_norm << "; Expected norm =  "
<< std::setiosflags(std::ios::scientific)
<< std::setprecision(3)
<< std::uppercase
<< mAlwaysConvergedNorm << "]" << std::endl;

std::string string_to_print = string_out.str();
KRATOS_INFO_IF("RESIDUAL CRITERION", this->GetEchoLevel() > 0 && rModelPart.GetCommunicator().MyPID() == 0) << string_to_print;

Result:

SolvingStrategy:  MESH MOVED 
ResidualBasedBlockBuilderAndSolver: Build time: 0.00270605
ResidualBasedBlockBuilderAndSolver: System solve time: 0.1167
SolvingStrategy:  MESH MOVED 
RESIDUAL CRITERION:  :: [ Obtained ratio = 1.000E+00; Expected ratio = 1.000E-06; Absolute norm = 9.722E-01; Expected norm =  1.000E-09]
ResidualBasedBlockBuilderAndSolver: Build time: 0.0030179
ResidualBasedBlockBuilderAndSolver: System solve time: 0.00258398
SolvingStrategy:  MESH MOVED 
RESIDUAL CRITERION:  :: [ Obtained ratio = 7.332E+03; Expected ratio = 1.000E-06; Absolute norm = 7.129E+03; Expected norm =  1.000E-09]
ResidualBasedBlockBuilderAndSolver: Build time: 0.00380111
ResidualBasedBlockBuilderAndSolver: System solve time: 0.00679779
SolvingStrategy:  MESH MOVED 
RESIDUAL CRITERION:  :: [ Obtained ratio = 3.394E+00; Expected ratio = 1.000E-06; Absolute norm = 3.300E+00; Expected norm =  1.000E-09]
ResidualBasedBlockBuilderAndSolver: Build time: 0.00286198
ResidualBasedBlockBuilderAndSolver: System solve time: 0.00655317
SolvingStrategy:  MESH MOVED 
RESIDUAL CRITERION:  :: [ Obtained ratio = 6.148E-05; Expected ratio = 1.000E-06; Absolute norm = 5.978E-05; Expected norm =  1.000E-09]
ResidualBasedBlockBuilderAndSolver: Build time: 0.002738
ResidualBasedBlockBuilderAndSolver: System solve time: 0.00742292
RiccardoRossi commented 5 years ago

+1 for the idea of having a different echo level for convergence criteria and for the timings. We may well want to have

RESIDUAL CRITERION:  :: [ Obtained ratio = 1.000E+00; Expected ratio = 1.000E-06; Absolute norm = 9.722E-01; Expected norm =  1.000E-09]
RESIDUAL CRITERION:  :: [ Obtained ratio = 7.332E+03; Expected ratio = 1.000E-06; Absolute norm = 7.129E+03; Expected norm =  1.000E-09]
RESIDUAL CRITERION:  :: [ Obtained ratio = 3.394E+00; Expected ratio = 1.000E-06; Absolute norm = 3.300E+00; Expected norm =  1.000E-09]
RESIDUAL CRITERION:  :: [ Obtained ratio = 6.148E-05; Expected ratio = 1.000E-06; Absolute norm = 5.978E-05; Expected norm =  1.000E-09]

instead of the output you posted. also nice the formatting why the "upper case"?

I am not sure if we want to show the expected ratios and norm at each iteration

philbucher commented 5 years ago

It would be more comprehensive if we show it only at the beginning of the time-step :+1:

loumalouomega commented 5 years ago

The uppercase because I like the 1E10 more than 1e10

The idea of different echo levels can be solved easily with the factories...

El mié., 27 feb. 2019 7:51, Riccardo Rossi notifications@github.com escribió:

+1 for the idea of having a different echo level for convergence criteria and for the timings. We may well want to have

RESIDUAL CRITERION: :: [ Obtained ratio = 1.000E+00; Expected ratio = 1.000E-06; Absolute norm = 9.722E-01; Expected norm = 1.000E-09] ResidualBasedBlockBuilderAndSolver: Build time: 0.0030179 ResidualBasedBlockBuilderAndSolver: System solve time: 0.00258398 SolvingStrategy: MESH MOVED RESIDUAL CRITERION: :: [ Obtained ratio = 7.332E+03; Expected ratio = 1.000E-06; Absolute norm = 7.129E+03; Expected norm = 1.000E-09] ResidualBasedBlockBuilderAndSolver: Build time: 0.00380111 RESIDUAL CRITERION: :: [ Obtained ratio = 3.394E+00; Expected ratio = 1.000E-06; Absolute norm = 3.300E+00; Expected norm = 1.000E-09] RESIDUAL CRITERION: :: [ Obtained ratio = 6.148E-05; Expected ratio = 1.000E-06; Absolute norm = 5.978E-05; Expected norm = 1.000E-09]

instead of the output you posted. also nice the formatting why the "upper case"?

I am not sure if we want to show the expected ratios and norm at each iteration

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/4268#issuecomment-467745701, or mute the thread https://github.com/notifications/unsubscribe-auth/ATEMgJcFhJ7rTfV7V6VzkT61jXavNtbmks5vRir8gaJpZM4bSC0r .

RiccardoRossi commented 4 years ago

in yesterday's meeting the @KratosMultiphysics/technical-committee was suggesting to ask @KratosMultiphysics/implementation-committee for a suggestion on this.

loumalouomega commented 4 years ago

in yesterday's meeting the @KratosMultiphysics/technical-committee was suggesting to ask @KratosMultiphysics/implementation-committee for a suggestion on this.

I gave my suggestions, but I am not longer a member of @KratosMultiphysics/implementation-committee

GuillermoCasas commented 4 years ago
  1. OK: the build times should go to a higher echo_level
  2. Agree
  3. 0? 0 cannot work. And what is a small number? I would again resort to #4305
  4. I do not see a use for such an exception. It is always good to know the tolerance.
GuillermoCasas commented 4 years ago

On behalf of the @KratosMultiphysics/implementation-committee, since we see that the issue has been taken up by the @KratosMultiphysics/technical-committee , we agree with 1,2,3,4 with the original proposal by @RiccardoRossi, except for requiring that the build times should go to a higher echo level.

pooyan-dadvand commented 4 years ago

@KratosMultiphysics/technical-committee agrees with @KratosMultiphysics/implementation-committee.

The only comment is the fact that the number 3 is changing the behavior of the strategy.

RiccardoRossi commented 4 years ago

guys, what is the status of this? anyone taking over the TODOs? @marandra ?