Closed vlipovac closed 2 weeks ago
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
I reworked the concept of constant reference pressure and temperature values:
models/abstract_equations.py
where the VariableMixin is found.A-A_ref
tests/models
and tests/functional
)VariableMixin.reference_*
is removed, and the abomination of model.fluid.reference_component.pressure
should be replaced everywhere by model.reference_variable_values.pressure
.I think a test dedicated to the reference values alone, the evaluation of the perturbation from reference and so on, is called for.
@vlipovac: Regarding the tutorials, could you run these on a system with pypardiso installed, so that we don't introduce more error messages in the notebook output?
@vlipovac: Regarding the tutorials, could you run these on a system with pypardiso installed, so that we don't introduce more error messages in the notebook output?
Done. There is one last error after the last Python cell in stress_discretization,ipynb
coming from a matplotlib.Axes
object, which I am not sure how to remove.
The latest changes involve:
MaterialConstants
to Constants
FluidConstants
to FluidComponent
and adding compositional.base.Component
to its inheritance tree__setattr__
to imitate the frozen
functionality of dataclass
, but limited to the constants fields declares with SI units (also, inheriting from Component the Component.fraction
must not be frozen)Adding generic typing to Fluid
, Phase
, Compound
such that custom material parameters are found by linters and static type checkers:
Compound[FluidComponent]
says the tracers in the compound are of type FluidComponent
Phase[FluidComponent]
: says this is a phase composed of FluidComponent
Fluid[FluidComponent, Phase[FluidComponent]]
: says this is a fluid mixture of fluid-like component and respectively phases.Minor open todos:
compositional.materials.Constants
and compositional.materials.ReferenceVariableValues
there or find a better spot (maybe porepy.utils
?)Constants
, check for freezing of constants and proper unit conversion (though the conversion is to some degree tested separately in each model)perturbation_from_reference
which now accesses the reference variable values.If you think one of the last two points is not necessary, please let me know.
Thanks @vlipovac. I'll have a look now.
@vlipovac The changes look good to me, I have no further comments to that part.
As for the remaining todos:
There are three unresolved conversations that all seem to point to the creation of one (or more?) issue. I suggest we make this and then resolve. Please let me know if I misread some of the conversations.
I think we are done.
tests/models/test_constitutive_laws/test_perturbation_from_reference
tests/compositional/test_materials
(formerly called test_material_constants
)Constants
and ReferenceVariableValues
are left for now in compositional/materials
.
But in future we might want to put these two somewhere else (also having #1249 in mind)
Closes #1240 Closes #1247
Replaces #1244 for reasons of clarity.
Proposed changes
Reworking the concept of
model.fluid
to be a general fluid with phases and components, instead of just a data collection of constants.Breaking change with a multiple minor changes throughout the packages. The essential changes are summarized in a self-review in #1244.
porepy.compositional.ChemicalSpecies
was merged intoFluidConstants
, including data class functionality. This led to some changes forSolidConstants
as well for inheritance reasons.The default model set-up is changed to provide a 1-phase, 1-component fluid, where the single component is based on the user-provided
FluidConstants
in themodel.params
. The interface to various fluid properties (e.g.,fluid_density
) is replaced by the generalFluid
class.Types of changes
Checklist
pytest
was run with the--run-skipped
flag.