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

Added NaNReporter and HighMaReporter to LettuceCFD #248

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

MaxBille
Copy link
Collaborator

@MaxBille MaxBille commented Sep 2, 2024

Description

Closes #174
Adding two reporters, that check for signs of simulation crashes (NaN in f or Ma > 0.3 in u) and abort simulation with respective abort messages, optional final vtk-frame and (in case of HighMaReporter) optional output file with locations of the 100 highest velocity magnitudes for crash-troubleshooting and analysis.

NaNReporter:

  • checks f in interval steps for any NaN value. If NaN is found, simulation is aborted.
  • if outdir is provided, lists indices q,x,y,[z] for all found NaN values (attention: produces large files for large intervals, because NaN replicates through the domain fast.
  • "old" argument (True, False) is for backwards compatibility with lettuce that has no aborting functionality in the simulation.py class. No vtk output in this case...
  • vtk argument (True, False) allows for vtk output of the current single flow state frame to outdir (if vtk_dir is not specified) or vtk_dir (if specified)

HighMaReporter:

  • calculates mach number from norm(u(f)) every interval steps and checks if Ma > 0.3 occurs. If Ma > 0.3 is found, simulation is aborted. The location (in LU coordinates) of up to 100 highest Ma numbers in the domain are reported to a file in outdir, if outdir argument is provided.
  • "old" argument (True, False) is for backwards compatibility with lettuce that has no aborting functionality in the simulation.py class. No vtk output in this case...
  • vtk argument (True, False) allows for vtk output of the current single flow state frame to outdir (if vtk_dir is not specified) or vtk_dir (if specified)
  • relies on unravel_index() method for torch.tensors, defined in the same file, for sorting and selection of high-Ma-locations.

DISCLAIMER: originally written for a modified version of lettuceCFD, based on Version 0.2.3; Adaptation for new Lettuce Master pending...

Checklist

  • This pull request is associated to an issue
  • This PR contains a description
  • Did you add a new method? If so, you need to
    • add method description
    • maybe mention class in the corresponding __init__
    • add an example using the method in examples/advanced_flows/ or examples/simple_flows/
    • add a test in tests/
  • Add someone else as reviewer and wait for approval before merging.

@pep8speaks
Copy link

pep8speaks commented Sep 2, 2024

Hello @MaxBille! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 7:29: E128 continuation line under-indented for visual indent
Line 14:80: E501 line too long (111 > 79 characters)

Comment last updated at 2024-09-05 09:53:25 UTC

@MaxBille MaxBille added the enhancement New feature or request label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reporter to interrupt simulation
3 participants