8000 736 warnings for function ncore by chris-ashe · Pull Request #3060 · ukaea/PROCESS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

736 warnings for function ncore #3060

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

Merged
merged 10 commits into from
Feb 20, 2024
Merged

Conversation

chris-ashe
Copy link
Collaborator
@chris-ashe chris-ashe commented Feb 15, 2024

Description

The logging of the ncore error to the terminal during iterations has been removed and replaced with a level 2 error that is shown at the end of the run. This warns the user to raise the lower bound of dene to prevent VMCON going near negative calculated values of n0. This is only shown when the run is finished.

Documentation has been added warning the user to use constraint 81 to prevent un-realistic profiles and to be weary about setting the lower bound of dene too low.

The bounds in iteration_variables.f90 for fgwped, fgwsep & dene have been varied to represent the values found in realistic solutions.

Long term solution is being discussed in #3059

Checklist

I confirm that I have completed the following checks:

  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@chris-ashe chris-ashe self-assigned this Feb 15, 2024
@chris-ashe chris-ashe linked an issue Feb 15, 2024 that may be closed by this pull request
@chris-ashe chris-ashe changed the title 736 warnings for function ncore WIP:736 warnings for function ncore Feb 15, 2024
@mkovari
10000 Copy link
Collaborator
mkovari commented Feb 15, 2024

I would still like the warning to be explicit about what sort of lower and upper bounds people should set.

For example:
dene Recommended value of boundl(6) > 80% of expected volume-averaged density.

It might also help to narrow the default bounds as follows.

Separatrix density

lablxc(152) = 'fgwsep '
boundl(152) = 0.001D0
boundu(152) = 1.000D0
Change to:

    lablxc(152) = 'fgwsep        '
    boundl(152) = 0.001D0
    boundu(152) = 0.1D0

Pedestal density

    lablxc(145) = 'fgwped        '
    boundl(145) = 0.500D0
    boundu(145) = 1.000D0

Change to

    lablxc(145) = 'fgwped        '
    boundl(145) = 0.100D0
    boundu(145) = 0.75D0
    lablxc(6) = 'dene          '
    boundl(6) = 1.00D19
    boundu(6) = 1.00D21

Change to

    lablxc(6) = 'dene          '
    boundl(6) = 2.00D19
    boundu(6) = 1.00D21

@chris-ashe chris-ashe changed the title WIP:736 warnings for function ncore 736 warnings for function ncore Feb 20, 2024
Copy link
Contributor
@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

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

@chris-ashe if you answer my comment I will approve it subject to your reply

if ncore < 0.0:
# Allows solver to continue and
# warns the user to raise the lower bound on dene if the run did not converge
error_handling.report_error(282)
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the reason this was not done before? What was the point of the kludge if the solver can deal with a negative ncore? I always thought this was to stop NaNs further down the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Running the files it dosent seem to make a difference as they all fail eventually anyway. It seems better to have it fail quickly and the user updates the lower bound to prevent it going negative again in future runs

Copy link
Contributor

Choose a reason for hiding this comment

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

I probably need @jonmaddock to comment on this, as he is the one that wrote the kludge. For now, since this is a level 2 error, I will approve it but will make a follow-up issue to check that this fix is ok with the UQ tools (which is why the kludge was added)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If needs be we could put the kludge back in without adding back the logger output as it just slows down the terminal output

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably a good idea, and then #3059 can address making this model more robust

@@ -3377,7 +3377,7 @@ subroutine init_itv_152
implicit none
lablxc(152) = 'fgwsep '
boundl(152) = 0.001D0
boundu(152) = 1.000D0
boundu(152) = 0.1D0
end subroutine init_itv_152
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little concerned about changing the default bounds as this could lead to existing input files (that use the default bounds) starting outside of the feasible region. In this instance, the 3 changes are minor so I think I am happy with it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The output values in the large tokamak regression are 0.85 and 0.5 for pedestal and separatrix respectively. @mkovari
Which is outside the bounds recommended

Copy link
Collaborator

Choose a reason for hiding this comment

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

Output values? Have you calculated neped/nGW and nesep/nGW from the data in the output file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Electron density at separatrix / nGW (fgwsep_out) 5.000E-01
Electron density at pedestal / nGW (fgwped_out) 8.500E-01

From the output file of the large tokamak regression test

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would still like the warning to be explicit about what sort of lower and upper bounds people should set.

For example:
dene Recommended value of boundl(6) > 80% of expected volume-averaged density.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this true for all cases? Even for a stellerator?
The output warning are limited to one line so I will need to amend the current one as I cant add it under unless we change their length

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe point people to a section in the documentation with the warning? And have a longer explanation in the docs.

< 8000 div class="js-socket-channel js-updatable-content" data-channel="eyJjIjoicmVwbzo2NjIxODE5MjM6Y29tbWl0OjE1Njc3NTI4ZGU1MzdhYjNhMWMwZDhlZTcxODI5YjVkNTIzOGRhNTQiLCJ0IjoxNzQ3NjU5NTk3fQ==--66e2844d9a38baf8166edf5bdee54bbc32d789413da94c2957d602f3979d5730" data-url="/ukaea/PROCESS/pull/3060/partials/commit_status_icon?oid=15677528de537ab3a1c0d8ee71829b5d5238da54">
@mkovari
Copy link
Collaborator
mkovari commented Feb 20, 2024

With all due respect, I find this approach slightly annoying. Wouldn't it be best to agree first on what should be done?

@chris-ashe
Copy link
Collaborator Author
chris-ashe commented Feb 20, 2024

@mkovari This is a temporary fix for papercuts and a more robust future solution can be discussed in #3059

@mkovari
Copy link
Collaborator
mkovari commented Feb 20, 2024

So what has actually changed?

@chris-ashe
Copy link
Collaborator Author
chris-ashe commented Feb 20, 2024
  • Kludging ncore is no longer spammed to the terminal when PROCESS is iterating.
  • A level 2 error is raised if ncore now goes negative telling the user to raise the value of dene and or its lower bound.
  • Updates to the pedestal documentation about how to set up a file with constraint 81

@timothy-nunn
Copy link
Contributor

I agree that the solution to this issue and the papercut is to remove the warning "spam" and providing help in the documentation. Subsequent discussions can decide a long-term solution to our profiles and will be able to consider how best we can stop unphysical profiles from occurring.

@chris-ashe
Copy link
Collaborator Author

@mkovari Are you happy with the changes as of now that provide a route to solving the negative problems by pointing to the documentation and raising new warning?
We can discuss a longer term and more robust solution with @jonmaddock that will work in a range of different scenarios that doesn't affect convergence.

@mkovari
Copy link
Collaborator
mkovari commented Feb 20, 2024

I am happy in the sense that I don't think these changes are going to make the situation any worse.

@timothy-nunn timothy-nunn merged commit 51307a5 into main Feb 20, 2024
@timothy-nunn timothy-nunn deleted the 736-warnings-for-function-ncore branch February 20, 2024 12:02
chris-ashe added a commit that referenced this pull request Apr 22, 2024
* ncore warning

* syntax fix

* return ncore

* change error type

* tidy up

* update docs

* updated bounds of pedestal params

* add ncore = 1E-6 back in

* re-update pedestal bounds
chris-ashe added a commit that referenced this pull request May 1, 2024
* ncore warning

* syntax fix

* return ncore

* change error type

* tidy up

* update docs

* updated bounds of pedestal params

* add ncore = 1E-6 back in

* re-update pedestal bounds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings for function ncore
3 participants
0