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

New error when two different ICs are specified #29672

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

DanielYankura
Copy link
Contributor

-Error thrown if an initial_condition parameter is provided along with an initial_from_file_var parameter for the same variable.

closes #20944

Reason

This added error check will make debugging input files easier.

Design

Previously an error was only thrown if two initial_condition parameters were supplied for the same variable. Now an error is also thrown if an initial_from_file_var is also provided.

Impact

@moosebuild
Copy link
Contributor

moosebuild commented Jan 10, 2025

Job Documentation, step Docs: sync website on 1b4c5a7 wanted to post the following:

View the site here

This comment will be updated on new commits.

Copy link
Contributor

@GiudGiud GiudGiud left a comment

Choose a reason for hiding this comment

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

Good idea!

Comment on lines 138 to 140
mooseError("Two initial conditions have been provided for the variable ",
name(),
". One from the user and one from the restart input file.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
mooseError("Two initial conditions have been provided for the variable ",
name(),
". One from the user and one from the restart input file.");
paramError("initial_condition", "Two initial conditions have been provided for the variable ",
name(),
" using the 'initial_condition' and 'initial_from_file_var' parameters. Please remove one of them.");

@GiudGiud GiudGiud self-assigned this Jan 10, 2025
@@ -56,6 +56,7 @@ AddVariableAction::validParams()
"Specifies a scaling factor to apply to this variable");
params.addParam<std::vector<Real>>("initial_condition",
"Specifies a constant initial condition for this variable");
params.addParam<std::string>("initial_from_file_var", "Initial from file");
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use transferParam here (see examples in the Navier Stokes physics for example). So the names stay in sync

@DanielYankura
Copy link
Contributor Author

DanielYankura commented Jan 14, 2025

So the other day I noticed there was one test that was failing with this new error message, and that was the restart/restart_diffusion.restart_error_with_ics test since my new error will get thrown before checkICRestartError does. The only case I could find where this doesn't happen is if you have two variables with one being restarted while the other is given an initial condition. If that is something we want to test for I can go ahead an modify that one test to have two variables instead. If not I have a few ideas for modifying my error check so that it doesn't interfere with the other one.

@GiudGiud
Copy link
Contributor

GiudGiud commented Jan 14, 2025

you ll have to modify that test to hit the error, but through a different code path since you covered this one

so yes the 2 variables idea is good!

@GiudGiud
Copy link
Contributor

GiudGiud commented Jan 14, 2025

let's squash formatting commits with the commit introducing the formatting problem

or (and) even better, install the format hooks (see scripts/) to avoid failing the precheck

@moosebuild
Copy link
Contributor

moosebuild commented Jan 15, 2025

Job Coverage, step Generate coverage on 1b4c5a7 wanted to post the following:

Framework coverage

b45164 #29672 1b4c5a
Total Total +/- New
Rate 85.25% 85.25% -0.00% 100.00%
Hits 108039 108043 +4 5
Misses 18699 18700 +1 0

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

This comment will be updated on new commits.

type = 'RunException'
input = part3.i
expect_err = 'Two initial conditions have been provided for the variable v using the \'initial_condition\' and \'initial_from_file_var\' parameters. Please remove one of them.'
[]
Copy link
Contributor

Choose a reason for hiding this comment

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

missing the detail field here


ERRORS:
/tmp/build/moose/test/tests/restart/scalar-var/tests:part3:19
No 'detail' supplied
Control this message using: 'log_missing_detail' 

-Error thrown if an initial_condition parameter is provided along with an initial_from_file_var parameter for the same variable.

closes idaholab#20944
-error message is worded more clearly now
-initial_from_file_var is now a transfer param
-test was updated to reflect new error message
- previously this test failed because a mutliple ic error was returned before a restart with ic error was
- now this test has two variables (u and v)
- to get the proper error thrown one variable is restarted from a file and the other is given an ic
- removed trailing whitespace for Civet precheck
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not regold those files.

you can either:

  • keep your new test design but use Outputs/hide='v' to avoid needing to regold
  • return back to the previous test and simply add the variable v in the command line to the test that is checking for restart + ics

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I tried both of those methods and in both cases the simulation ran instead of erroring out. I'm wondering if adding the variable later by command line, or by hiding it in previous simulations, it doesn't get recognized as being a restarted variable and so it never errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if instead I change my error into a warning saying that one of the input parameters will be overwritten. Then for this test case I can use the original input files and get the same error?

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.

No error or warning on specifying two different initial conditions
3 participants