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 Pipe Flow PK #824

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Add Pipe Flow PK #824

wants to merge 15 commits into from

Conversation

gcapodag
Copy link
Contributor

@gcapodag gcapodag commented Apr 3, 2024

This PR adds a pipe flow PK, which solves the 1D Saint Venant equations (in a 2D domain). The pipe flow can be coupled during the time integration step with a junction model that solves the 2D SW equations, with an additional friction term compared to the current SW PK. Pipe flow + junctions form the pipe network, which can be coupled with an overland flow model, where water can move from the surface down into the network and back up, in case overflow occurs. The pipe network model has been tested and is mass conserving, and preserves steady state initial conditions, similarly to the SW model. Tests currently exist to provide continuous integration and will soon be included in an ats-regression-tests suite PR.
The pipe flow model in standalone mode has been tested against experimental data with the hydraulic routing test from Liu and Chen, see pictures below, showing results that are consistent with those in the aforementioned paper. Please also see the companion PR in ATS for the pipe drain evaluator regulating the water exchange between pipe network and overland flow: amanzi/ats#253
hyd1
hyd2

@gcapodag
Copy link
Contributor Author

gcapodag commented Apr 3, 2024

@lipnikov thanks for the suggestion and for looking at the PR. It was easier to close the other PR and re-open it like this, so the commits are squashed and the branch is rebased to the latest commit on master, as you suggested. I also reformatted the code with the clang-format in tools/formatting. Thanks.

Copy link
Contributor

@lipnikov lipnikov left a comment

Choose a reason for hiding this comment

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

I see pictures in the PR description but there are no tests. Typically, we require tests to
support new capability via CI. Can you share files used to create pictures? Can we converter these files to tests in a subsequent PR?

src/pks/shallow_water/PipeFlow_PK.cc Outdated Show resolved Hide resolved
src/pks/shallow_water/PipeFlow_PK.cc Outdated Show resolved Hide resolved
src/pks/shallow_water/PipeFlow_PK.cc Outdated Show resolved Hide resolved
src/pks/shallow_water/PipeFlow_PK.cc Outdated Show resolved Hide resolved
src/pks/shallow_water/PipeFlow_PK_reg.hh Outdated Show resolved Hide resolved
<Parameter name="cfl" type="double" value="0.5"/>
<Parameter name="number of reduced cfl cycles" type="int" value="10"/>
<Parameter name="numerical flux" type="string" value="central upwind"/>

<ParameterList name="boundary conditions">
<ParameterList name="ponded depth">
<ParameterList name="BC 0">
<Parameter name="regions" type="Array(string)" value="{Boundary}"/>
<Parameter name="regions" type="Array(string)" value="{}"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. No region -> remove the whole sublist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think @nvohra0016 did this so I am going to leave that to him.

@@ -50,7 +51,7 @@
</ParameterList>
<ParameterList name="velocity">
<ParameterList name="BC 1">
<Parameter name="regions" type="Array(string)" value="{Boundary}"/>
<Parameter name="regions" type="Array(string)" value="{}"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think @nvohra0016 did this so I am going to leave that to him.

src/pks/shallow_water/pks_shallow_water_registration.hh Outdated Show resolved Hide resolved
src/pks/shallow_water/WaterDepthEvaluator.hh Outdated Show resolved Hide resolved
src/pks/shallow_water/PressureHeadEvaluator.hh Outdated Show resolved Hide resolved
@gcapodag
Copy link
Contributor Author

gcapodag commented Apr 3, 2024

Thanks a lot @lipnikov , I'll start addressing your comments right away

@gcapodag
Copy link
Contributor Author

gcapodag commented Apr 3, 2024

@lipnikov yes, in the future appropriate automated tests will be included in a separate PR. At the moment, all tests are in the branch giacomo/urban_storm_drains of ats-regression-tests, and can be found here. For instance, the plot shown above (only the numerical curve, not the experimental data) is obtained running pipe_flow_hydraulic_routing.xml and then doing a plot over time in Paraview at x=8.89 or x=77.47. There are also several lake_at_rest tests that can be run to verify the preservation of the steady state initial condition. For mass conservation, one can run excalibur_mesh_water_balance.xml, coupled_surface_pipe_model_water_balance.xml or coupled_surface_pipe_model_water_balance_junction.xml. All there of these output an observation file, that can be used as input for Python scripts that sit in this repo that verify that mass is conserved up to machine precision. The observation files have to be renamed and also deprived of the initial headers and quotes before they can be read in by the Python scripts. At some point all this will be automated and included in an appropriate PR, as I mentioned. One important note is that when I try to run these tests with the ats executable that uses the PR code, I get an HDF5 error that prevents me from running. If I use the "old version code" from giacomo/urban_storm_drains that is not up to date with master, then the error does not show and everything runs. @nvohra0016 has seen the same problem. The "old version code" uses the 0.98.6 version of the TPLs.

@lipnikov
Copy link
Contributor

lipnikov commented Apr 3, 2024

"The pipe flow model in standalone mode has been tested against experimental data with the hydraulic routing test from [Liu and Chen]" This could be converted to an Amanzi test if it runs fast enough. Amanzi does not test ATS regressions on a regular basis so it is important to have one-two Amanzi tests to prevent breaking ATS. I presume that experimental data are available from this paper.

Copy link
Contributor

@lipnikov lipnikov left a comment

Choose a reason for hiding this comment

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

Approval is contingent to passing all Amanzi tests.

@lipnikov
Copy link
Contributor

lipnikov commented Apr 3, 2024

I think you need only 1 registration file pks_shallow_water_reg.hh

@jd-moulton
Copy link
Member

jd-moulton commented Apr 3, 2024

I think this is progressing really well. Thanks @gcapodag for updating this code to be consistent with updates to the mesh infrastructure and state on the master branch. Also, thanks @lipnikov for already reviewing the PK and coupling code.

As noted earlier, the final approval will depend on having at least a couple of tests (since there's arguably at least two key models under the pipe flow PK - the pipe flow itself, and the junctions) included in Amanzi's testing framework. I don't think it will take @nvohra0016 long to migrate those from the ats-regression-tests repository to the PK here to run under a separate test binary or amanzi, although he has other deadlines this week. The coupled tests can then be developed under ATS regression testing, but I don't think they need to be completed before we accept this PR.

Also, we would typically want a demonstration of the new PKs in the Amanzi User Guide. This is an interesting case because the new PKs are mostly used under ATS, so a bit of an open question as to where to put all the documentation and how much to worry about duplication.

The underlying issue with hdf5 needs be resolved as well before it makes sense to merge this PR. I don't think this will take all that long, but we have other deadlines this week.

@gcapodag
Copy link
Contributor Author

gcapodag commented Apr 5, 2024

Hi all, I made the necessary changes to have all Amanzi CI tests passing. Interestingly, the shallow_water_Thacker was failing because I had not switched to the new mesh framework a call to setup the ponded depth BC, though it would still compile with no errors. I also integrated @nvohra0016 's changes from last November to one of the mpc tests that was failing. Thanks again @lipnikov for being so quick and helpful!

@gcapodag gcapodag mentioned this pull request Apr 5, 2024
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.

None yet

4 participants