idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.79k stars 1.05k forks source link

Add `isCompressible()` method to fluid properties #24212

Open joshuahansel opened 1 year ago

joshuahansel commented 1 year ago

Reason

Some equations of state do not make sense to be used in certain flow models. For instance, incompressible equations of state do not make sense to be used with flow models where the density and specific internal energy are solved independently, like the Euler equations.

Design

This would add a method isCompressible() to SinglePhaseFluidProperties. Then flow models can query this method if they need to.

Impact

New virtual method in SinglePhaseFluidProperties.

joshuahansel commented 1 year ago

@GiudGiud

GiudGiud commented 1 year ago

This would be cleaner than erroring on missing T_from_v_e

which is problematic because we (my fault mostly) have been adding many of these T_from_v_e, as long as it was analytically tractable to do so

joshuahansel commented 1 year ago

This also suggests that maybe there's a problem with the design of SinglePhaseFluidProperties. Maybe it should be something like

SinglePhaseFluidPropertiesBase->CompressibleSinglePhaseFluidProperties
SinglePhaseFluidPropertiesBase->IncompressibleSinglePhaseFluidProperties
GiudGiud commented 1 year ago

could be SinglePhaseFluidPropertiesBase->CompressibleSinglePhaseFluidProperties->IncompressibleSinglePhaseFluidProperties

I think the compressible ones work in incompressible solvers as long as the mach number is not too high

joshuahansel commented 1 year ago

Incompressible flow models always confuse me. So there, "incompressible" means more than actually being incompressible - it means constant density, right? But it doesn't require the equation of state to have a constant density?

GiudGiud commented 1 year ago

yeah it depends who you talk to. In my mind now, incompressible means rho(T). not rho constant

as in you cannot compress it, with pressure, or maybe compressure it

lindsayad commented 1 year ago

I do agree that incompressible could be a sub-class of compressible

joshuahansel commented 1 year ago

After more thought, I think the current design plus the method in the description is the right way to go.

joshuahansel commented 1 year ago

The ideal solution is something like:

FluidBlah : public FlowModelACompatible, public FlowModelBCompatible

where FlowModelACompatible would have pure virtual methods for all of the interfaces needed by the flow model A. I don't know off the top of my head the rules of multiple inheritance of virtual methods, since there's overlapping interface needs. If the overlapping works fine, it'd be a nice way to enforce compatibility.

GiudGiud commented 1 year ago

There's definitely overlapping interface needs. diamond inheritance isnt well supported

joshuahansel commented 1 year ago

Yeah, I thought as much. In any case, what we have now is fine. Just need to add isCompressible().