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

[WIP] add average/integral/sum diagnostic output #587

Draft
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

BenWibking
Copy link
Collaborator

@BenWibking BenWibking commented Mar 30, 2024

Description

This adds the DiagConditional diagnostic from PelePhysics.

It computes the volume average, volume integral, or sum of a variable. This operation is optionally filtered by and/or conditioned on other variables, and outputs it to a text file at periodic intervals while a simulation is evolved. Only 1D conditional distributions are computed (higher dimensions are not implemented).

Mass-weighted averages or integrals are NOT yet supported for this diagnostic.

If an unconditioned volume average, volume integral, or sum is desired, you can condition on a "dummy variable" and set the number of bins of the conditional distribution to 1. This is equivalent to the unconditioned value. A future PR will remove the need for this workaround.

Example usage to find the (unconditioned) volume average temperature (and standard deviation):

quokka.condTemp.type = DiagConditional             # Diagnostic type
quokka.condTemp.file = condTemp                    # Output file prefix
quokka.condTemp.int  = 10                          # Frequency (as step #) for performing the diagnostic
quokka.condTemp.conditional_type = Average         # Conditional type: Average, Integral or Sum
quokka.condTemp.field_names = temperature          # List of variables to be averaged, integrated, or summed
quokka.condTemp.nBins = 1                          # Number of bins for the conditioning variable
quokka.condTemp.condition_field_name = gasDensity  # Conditioning variable name

Example usage to find the volume average temperature (and standard deviation) conditioned on (i.e., as a function of) gas density:

quokka.condTemp.type = DiagConditional             # Diagnostic type
quokka.condTemp.file = condTemp                    # Output file prefix
quokka.condTemp.int  = 10                          # Frequency (as step #) for performing the diagnostic
quokka.condTemp.conditional_type = Average         # Conditional type: Average, Integral or Sum
quokka.condTemp.field_names = temperature          # List of variables to be averaged, integrated, or summed
quokka.condTemp.nBins = 50                         # Number of bins for the conditioning variable
quokka.condTemp.condition_field_name = gasDensity  # Conditioning variable name

Note: Conditioning always uses linear-spaced bins (log-spaced bins are not yet supported).

Related issues

N/A

Checklist

Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an x inside the square brackets [ ] in the Markdown source below:

  • I have added a description (see above).
  • I have added a link to any related issues see (see above).
  • I have read the Contributing Guide.
  • I have added tests for any new physics that this PR adds to the code.
  • I have tested this PR on my local computer and all tests pass.
  • I have manually triggered the GPU tests with the magic comment /azp run.
  • I have requested a reviewer for this PR.

@BenWibking BenWibking changed the title [WIP] add average/integral/sum var output (optionally conditioned/filtered) [WIP] add average/integral/sum diagnostic output Mar 30, 2024
@BenWibking BenWibking force-pushed the BenWibking/add-DiagConditional branch from c854bdf to 7351761 Compare March 30, 2024 00:47
@BenWibking BenWibking force-pushed the BenWibking/add-DiagConditional branch from 1031703 to 21bbc28 Compare March 30, 2024 00:49
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.

1 participant