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

Adding logLevel documentation #3089

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

Conversation

arng40
Copy link
Contributor

@arng40 arng40 commented Apr 23, 2024

Currently, we have this output in all Group documentation files:

I.e. SolidMechanics_LagrangianFEM.rsts.rst :.rst` :

========================= ============================ ========== ======================================================================================================================================================================================================================================================================================================================== 
Name                      Type                         Default    Description                                                                                                                                                                                                                                                                                                              
========================= ============================ ========== ======================================================================================================================================================================================================================================================================================================================== 
[...]                                                                                                                                                                                                               
logLevel                  integer                      0          Log level     
[...] 

This PR aims to add more context to the different logLevels of GEOS :

I.e. SolidMechanics_LagrangianFEM.rsts.rst :



========================= ====================================================== =============== ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= 
Name                      Type                                                   Default         Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
========================= ====================================================== =============== ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= 
cflFactor                 real64                                                 0.5             Factor to apply to the `CFL condition <http://en.wikipedia.org/wiki/Courant-Friedrichs-Lewy_condition>`_ when calculating the maximum allowable time step. Values should be in the interval (0,1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
contactRelationName       groupNameRef                                           NOCONTACT       Name of contact relation to enforce constraints on fracture boundary.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
discretization            groupNameRef                                           required        Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
initialDt                 real64                                                 1e+99           Initial time-step value required by the solver to the event manager.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
logLevel                  integer                                                0               | Sets the level of information to write in the standard output (the console typically).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                 | A level of 0 outputs minimal information, higher levels require more.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                                                                                                 | logLevel >= 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                 |  - Information on line search                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                 |  - Information on global solution scaling factor                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                 |  - Information on the timestep                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                                                                                 |  - Print residual norm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                 | logLevel >= 1 and configuration didn't converge                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                 |  - Information about testing new configuration and print the time step                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                 | logLevel >= 1 and incorrect solution                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                 |  - Information about line search failed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                                                                                                 | logLevel >= 1 and linear system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                                                                 |  - Information on number of iterations and residual reduction                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                 | logLevel >= 1 and non linear system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                 |  - Information on each newton Iteration                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                                                                                                 | logLevel >= 1 and residual norm above the max allowed residual norm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                 |  - Indicate allowed residual norm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                                                                                                 | logLevel >= 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                 |  - Output to screen the assembled linear system and solutions (matrices and vectors)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                 |  - Infos on residuals values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                 | logLevel >= 2 and target set is empty                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                                                                                                 |  - Warning about boundary conditions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                 | logLevel >= 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                 |  - Output to file the assembled linear system and solutions (matrices and vectors)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
========================= ================== ======== ================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== 



@MelReyCG MelReyCG changed the title Add a way to expend the description of a wrapper Adding logLevel documentation Apr 24, 2024
Comment on lines 54 to 55
appendLogLevel( { "logLevel >= 1", "Infos about RelpermDriver" } );
appendLogLevel( { "logLevel >= 1", "Indicate if the internal results are consistent" } );
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have expect either this syntax:

  appendLogLevel( { "logLevel >= 1", "Infos about RelpermDriver" },
                  { "logLevel >= 1", "Indicate if the internal results are consistent" } );

Or this one

  appendLogLevel( "logLevel >= 1", "Infos about RelpermDriver" );
  appendLogLevel( "logLevel >= 1", "Indicate if the internal results are consistent" );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The second one is more convenient

Comment on lines 94 to 103
try
{
WrapperBase & wrapper = getWrapperBase( logLevelName );
appendLogLevelToWrapper( wrapper, log );
}catch( std::domain_error const & )
{
WrapperBase & wrapper = registerWrapper( logLevelName, &m_logLevel );
enableLogLevelInput();
appendLogLevelToWrapper( wrapper, log );
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In this project, try-catch is for adding more info to errors, not to recover from an erroneous state.
Use a if-else syntax.

* @brief Append a log level/description to the description of the wrapped object
* @param log An entry (log level/ log Description) to append
*/
void appendLogLevel( std::pair< const std::string, const std::string > log );
Copy link
Contributor

Choose a reason for hiding this comment

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

appendLogLevelDescription( string_view loggingCondition, string_view caseDescription ) ?

Comment on lines 750 to 752
/// Map for building the log level string for each wrapper
/// key : logLevel, values : description(s) for a level
std::map< std::string, std::vector< std::string > > m_logLevelsDescriptions;
Copy link
Contributor

Choose a reason for hiding this comment

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

Only one logLevel per Group = only one map per Group
Every wrapper should not have logLevel functionnalities, Group should.
Those method & attributes you added in Wrapper are not at the right place.

Copy link
Contributor

@MelReyCG MelReyCG left a comment

Choose a reason for hiding this comment

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

Blocking comments

@arng40 arng40 marked this pull request as ready for review May 27, 2024 07:42
@arng40 arng40 requested review from ryar9534 and MelReyCG May 27, 2024 07:45
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