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

Add Entropy Variables to libCEED fluids NS mini-app #1110

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

zatkins-dev
Copy link
Collaborator

@zatkins-dev zatkins-dev commented Dec 7, 2022

This PR introduces physical entropy variables to libCEED fluids (see Hughes et al for full formulation). Support for entropy variables mirrors that of primitive and conservative variables, with conversion and forward physics functions.

Also adds additional unit tests for variable conversion.

@zatkins-dev
Copy link
Collaborator Author

Huh, turns out that waiting 7 months and rebasing can sometimes fix issues... I'm no longer seeing strange artifacts with gaussianwave.yml or with the density current problem.

I will add some tests, but I think this MR actually may be pretty much ready.

@zatkins-dev zatkins-dev changed the title [WIP] Add Entropy Variables to libCEED fluids NS mini-app Add Entropy Variables to libCEED fluids NS mini-app Jul 31, 2023
@zatkins-dev zatkins-dev marked this pull request as ready for review July 31, 2023 17:10
Copy link
Collaborator

@jrwrigh jrwrigh left a comment

Choose a reason for hiding this comment

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

Few comments, particularly regarding the naming of the components. Otherwise looks good to me.

examples/fluids/README.md Outdated Show resolved Hide resolved
examples/fluids/navierstokes.c Outdated Show resolved Hide resolved
examples/fluids/problems/freestream_bc.c Outdated Show resolved Hide resolved
examples/fluids/problems/newtonian.c Outdated Show resolved Hide resolved
Comment on lines 56 to 57
CeedScalar velocity[3];
CeedScalar temperature;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we not have more specific names for these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure. Jed's suggestion in the past was to go the opposite route, and just name them V1, V2, V3 or something like that. I'm starting to think that might be best, since I don't know how to name them otherwise.

e.g.

  • The quantity I'm currently calling temperature is $-\frac{\rho}{P}$, which has units $\frac{kg}{J}$ or $\frac{s^2}{m^2}$.
  • The quantity I'm calling velocity is $\mathbf{U}\cdot\frac{\rho}{P}$, which has units $\frac{s}{m}$.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the units for V1 are $kg$ (since it has $\frac{\rho}{P}(e_{\text{kinetic}} + e_{\text{potential}})$), which seems....interesting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jedbrown should I use similar naming for the state components? E.g.

typedef struct {
  CeedScalar S_density;
  CeedScalar S_momentum[3];
  CeedScalar S_energy;
} StateEntropy;

Copy link
Member

Choose a reason for hiding this comment

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

🤷 Consistency is good so if we're going to name them, may as well make them match. I'm not sure it's easier in the code.

BTW, did you do anything here that may impact performance of the primitive or conservative variable 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.

Minorly, yes. The StateFrom* functions now also compute the entropy variables.

Copy link
Member

Choose a reason for hiding this comment

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

Is that necessary? We added both conservative and primitive to avoid recomputing the equation of state each time that quantity is needed in fluxes, but I don't think entropy variables are used that way so we could probably remove the V member from State.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How would we use entropy variables then? We use StateFromQ and StateFromQ_fwd all over the place, and that relies on the given state variables to be in State

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that's necessary? State is just our internal representation. We can import entropy variables to that representation without making it part of State.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think that I understand what you mean by "import entropy variables to that representation without making it part of State".

Tangentially, one of the major uses for entropy variables is in making the fluxes symmetric, which while not implemented here, would justify storing V in State.

examples/fluids/src/setupdm.c Outdated Show resolved Hide resolved
@zatkins-dev zatkins-dev self-assigned this Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants