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

Convert warning to info message when adding additional controls/terms to trajectory #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

richeldichel
Copy link
Contributor

The message to be changed was introduced to warn the user in the special case when terms/controls of the same type are added twice (e.g. when a term_propagation is added to a trajectory with a term_propagation). This can lead to unwanted behavior. However, with the current implementation the user is warned even when a term/control of different type is added to the trajectory. As the ability to add multiple different terms/controls to the trajectory is an intended feature of Kassiopeia, this warning message created confusion when the feature is used correctly.

This change, therefore, converts the warning message to an info message, which only states that an additional term/control is added to the trajectory. This should eliminate confusion while maintaining the level of information needed to troubleshoot the simulation.

Thanks to @pslocum for bringing up this topic!

… to trajectory

The message was introduced to warn the user in the special case when terms/controls of the same type are added twice (e.g. when a term_propagation is added to a trajectory with a term_propagation). However, with the current implementation the user is warned even when a term/control of different type is added to the trajectory.

This change converts the warning message to an info message, which only states that an additional term/control is added to the trajectory.
@richeldichel richeldichel requested a review from 2xB October 5, 2023 11:28
Copy link
Member

@2xB 2xB left a comment

Choose a reason for hiding this comment

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

Since we know that FindElementByType(aTerm) will just return true if the element is not the first, I am wondering if reading this in an info message has any benefit for users above reading this in the XML configuration directly. I think we don't need to just dump parts of the XML configuration into the console, therefore the remark.

Potentially I would understand if this was a debug message or it explained a bit more about why it is special enough to have a dedicated message for it.

@2xB
Copy link
Member

2xB commented Oct 6, 2023

One could btw. potentially add a TermType fType; member with an enum TermType to controls/terms that classifies which type the control has, and then check if this type is equal to the type of any existing control/term to fix the messages with the intended result. Potentially that is worth it?

One should also be able to compare subclasses by using typeid(*aTerm) inside FindElementByType, fixing the current code. In that case however, if two subclasses could at one point be different propagators, one would not get the warning even though one probably should. Using typeid should however be a quick fix that I think can be implemented without much work.


For context, here is the original internal comment on the relevant commit that added this:

Kassiopeia: warn when adding multiple trajectory terms of same type

  • Show warning wenn term/control of same type is added more than once to
    a trajectory.
  • Also show names of terms/controls/etc. instead of pointer address.

For example, the configuration

    <kstraj_trajectory_exact name="trajectory_exact">
        <integrator_rk8 name="integrator_rk8"/>
        <term_propagation name="term_propagation_1"/>
<control_cyclotron name="control_cyclotron" fraction="{1. /
40.}"/>
        <term_propagation name="term_propagation_2"/>
    </kstraj_trajectory_exact>

results in wrongly computed step sizes, because the propagation term is
applied twice.

2xB added a commit to 2xB/Kassiopeia that referenced this pull request May 8, 2024
Before this commit, some controls/interactions showed warnings
about being added twice even if just the same parent type was
added twice.

This is an alternative approach to
KATRIN-Experiment#76 ,
just showing the messages if relevant instead of changing their
log level and content.
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