Conversation
Model for spatial evolution within a single vial. Developed by Andraz Kosir, as part of his M.Sc. thesis project.
Revised language of new part on v 2.0
Also updated the general part at the beginning
Added description for V2.0
Added Andraz
updated pallet article from pre-print to final version
updated for v2.0
updated for version 2
bizzinho
left a comment
There was a problem hiding this comment.
Review is still WIP. In particular, snowing.py, utils.py, and single_vial_spatial_model.py have not been reviewed yet. Still, I think the first comments can be of use / allow you to get started.
The main comment are
- there are no new unit tests, which is a gap.
- the purpose of
sample.pyis unclear - I am not convinced that this has been "regression tested", i.e., made sure that the existing functionalities work as expected by the user/explained in the tutorial
| shape: cube | ||
| # length [m] | ||
| # base shape of vial (in the spatial version only cylinder is accepted) | ||
| shape: cylinder |
There was a problem hiding this comment.
Won't this change to the default break snow and snowfall?
There was a problem hiding this comment.
It at least breaks the associated unit test
FAILED tests/test_constants.py::test_warningWrongYamlSchema - assert 7.853981633974483e-07 == ((1 * 0.01) * 0.01)
This is due to the fact that the expectation was that the default shape is a cube
There was a problem hiding this comment.
We cannot really generalize the shape for all models, so my idea was that we keep cube as the default shape for snow and snowfall, but we change it to cylinder for snowing. Then the users have to change this depending on which model they want to use.
sample.py
Outdated
There was a problem hiding this comment.
What is the purpose of this file? Can this be integrated into the tutorial?
There was a problem hiding this comment.
I guess it could be integrated into the tutorial. So far it was actually just for me for quickly running different model dimensionalities while testing the changes. Forgot to remove it
| solution: | ||
| # kg/m^3 density of water / assumed constant for all phases | ||
| # solute mass fraction [-] | ||
| solid_fraction: 0.25 |
There was a problem hiding this comment.
how does this change/increase affect snow and snowfall?
There was a problem hiding this comment.
Sorry, default should stay 0.05. I changed it back.
| # °C equilibrium freezing temperature pure water | ||
| T_eq: 0 | ||
| # initial temperature of the solution | ||
| T_init: 20 |
There was a problem hiding this comment.
you have removed T_init without replacement, does this not break snow and snowfall?
There was a problem hiding this comment.
If I checked everything, T_init is not used anywhere since the pallet update (it's commented out in snowflake
|
|
||
| from typing import Optional, List, Any | ||
|
|
||
| from .__init__ import __citation__, __bibtex__ |
There was a problem hiding this comment.
please don't remove stuff unless you are sure that this is what you want :)
There was a problem hiding this comment.
Don't know what happened here, accidentally I guess, I put it back now.
| @@ -1,36 +1,87 @@ | |||
| # temperature resolution within vial (homogeneous, spatial_1D, spatial_2D) | |||
| temperature: spatial_2D | |||
There was a problem hiding this comment.
I feel that this is not a informative name for this key. How about temp_model?
There was a problem hiding this comment.
or temp_dim or dimensionality
There was a problem hiding this comment.
Fully agree, changed to dimensionality.
src/ethz_snow/constants.py
Outdated
| ) | ||
| ) | ||
|
|
||
| # set up additional parameters for VISF |
There was a problem hiding this comment.
I assume this comment should read "jacket", not VISF?
src/ethz_snow/constants.py
Outdated
| constVars.extend(["lambda_air", "air_gap"]) | ||
|
|
||
| if config["temperature"] != "homogeneous": | ||
| if config["vial"]["geometry"]["shape"] != "cylinder": |
There was a problem hiding this comment.
This should be unit tested
src/ethz_snow/constants.py
Outdated
|
|
||
| elif config["vial"]["geometry"]["shape"].startswith("cyl"): | ||
| geoKeys = config["vial"]["geometry"].keys() | ||
| if ("radius" in geoKeys) and (config["vial"]["geometry"]["radius"] is not None): |
src/ethz_snow/constants.py
Outdated
| k_f = float(config["solution"]["k_f"]) | ||
| M_s = float(config["solution"]["M_s"]) | ||
|
|
||
| # heat conductivity |
There was a problem hiding this comment.
confusing/contradicting comments above and below line
44 fix pipeline
bizzinho
left a comment
There was a problem hiding this comment.
Continuing my review.. I believe there are now quite a few comments. Maybe I make a pause here and let you react before I continue with the meat of snowing
src/ethz_snow/constants.py
Outdated
| config["vial"]["geometry"]["width"] | ||
| ) | ||
|
|
||
| elif config["vial"]["geometry"]["shape"].startswith("cyl"): |
There was a problem hiding this comment.
Correct me if I'm wrong, but if the vial geometry is cylinder, then it has to be a single vial simulation, right? There is no implementation of the intervial heat fluxes for cylinders, is there?
There was a problem hiding this comment.
If I'm right, there should be a check for this here.
There was a problem hiding this comment.
Exactly, if shape is cylinder then it is only a single vial spatial simulation. If cube, then it cannot be a spatial model as it is right now.
There was a problem hiding this comment.
What is the purpose of this file?
There was a problem hiding this comment.
This file is not used in the package, was just used to make a piece of code, which generates a few plots used in a conference abstract public. Should be removed.
|
|
||
|
|
||
| # vapour pressure estimation (temperature in K, pressure in Pa) | ||
| def vapour_pressure_liquid(T_liq): |
There was a problem hiding this comment.
Would be great to have a source or ref for this state eq
|
|
||
|
|
||
| # vapour pressure estimation (temperature in K, pressure in Pa) | ||
| def vapour_pressure_solid(T_sol): |
src/ethz_snow/utils.py
Outdated
|
|
||
| # vapour pressure estimation (temperature in K, pressure in Pa) | ||
| def vapour_pressure_liquid(T_liq): | ||
| """_summary_ |
There was a problem hiding this comment.
I added a docstring skeleton, please fill it out @akosira
src/ethz_snow/snowing.py
Outdated
| raise NotImplementedError( | ||
| ( | ||
| f'Configuration "{self.configuration}" ' | ||
| + "not correctly specified, use shelf, jacket or VISF." |
There was a problem hiding this comment.
Shouldn't it be checked here as well, if II allow passing configuration and model dimensionality as an inputs directly?
There was a problem hiding this comment.
Actually, I now removed configuration, dimensionality as additional parameters to snowing. Everything is specified in configPath now. Only check is in constants.
src/ethz_snow/snowing.py
Outdated
| k: dict = {"int": 0, "ext": 0, "s0": 50, "s_sigma_rel": 0}, | ||
| opcond: OperatingConditions = OperatingConditions(), | ||
| temperature: str = "spatial_1D", | ||
| configuration: str = "shelf", |
There was a problem hiding this comment.
I'm not yet convinced it makes sense to be able to provide configPath and temperature and configuration.
There was a problem hiding this comment.
The idea of keeping temperature and configuration inputs was that once all the relevant constants are specified in the yaml file, the user could run the model for different configurations and thus with different dimensionalities without having to again modify the yaml file constantly. what do you think?
There was a problem hiding this comment.
I now removed configuration, dimensionality as additional parameters to snowing. Everything is specified in configPath now. I think you were right, this makes much more sense!
| self._prop = None | ||
| self._time = None | ||
| self._shelf = None | ||
| self._temp = None |
There was a problem hiding this comment.
For consistency, it would be nice, albeit not critical, to use the same logic with a state variable X that includes both temp and ice, then make temp and ice properties that are derived from X
There was a problem hiding this comment.
I see, but I would leave it like this actually. I find it more clear
src/ethz_snow/snowing.py
Outdated
| return self._simulationStatus | ||
|
|
||
| @property | ||
| def getTime(self) -> np.ndarray: |
There was a problem hiding this comment.
Here, getTime is a property and the @property decorator defines this to be a getter function. A more natural name for this variable would be "time"
There was a problem hiding this comment.
The same holds true for all the other get... properties, of course
src/ethz_snow/snowing.py
Outdated
| return self._time | ||
|
|
||
| else: | ||
| raise AssertionError("Simulation not yet carried out or completed.") |
There was a problem hiding this comment.
If you really want to have this be an assertion error (which I think is fine), it's probably easier to just make the if condition an assert statement instead...
assert False, "This is False"
There was a problem hiding this comment.
Makes sense, thanks. Adapted
Docstrings annotated
…r, warning is printed
Added spatial model article DOI
…to snowing-develop
No description provided.