Implement Darcy Physics - #620
Conversation
|
@ktbolt i think the majority of these file changes have to do with adding any new physics into the current procedural framework. Unfortunate but expected at this point in my opinion. @mmegally I'll do my review in a few hours when I have some time. From my first glance id say that you should remove the sbatch slurm scripts from the commits. These shouldn't be in the testing infrastructure. I'll give a more formal review in a bit though |
|
@ktbolt I went ahead and added a new comment to issue #616 with some details on the file change split, implementation, and XML usage. Let me know if there is anything else I can clarify. To reiterate my comment from there, 31/47 of the file changes are related to the test cases. I will also go ahead and remove the SLURMs from the test folder as zack mentioned right now |
|
@mmegally Got it, thanks for adding the Issue comments ! |
|
@mmegally The Also rename the |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #620 +/- ##
==========================================
- Coverage 73.45% 73.11% -0.35%
==========================================
Files 267 268 +1
Lines 40041 40241 +200
Branches 6706 6729 +23
==========================================
+ Hits 29413 29423 +10
- Misses 10385 10575 +190
Partials 243 243 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zasexton
left a comment
There was a problem hiding this comment.
Suggested changes for Darcy equation initialization and fiber-flux reconstruction.
…k's suggested changes)
michelebucelli
left a comment
There was a problem hiding this comment.
Thank you @mmegally! I left a few comments.
| void darcy_1d(ComMod& com_mod, const int eNoN, const double w, const Vector<double>& N, const Array<double>& Nx, | ||
| const Array<double>& al, const Array<double>& yl, Array<double>& lR, Array3<double>& lK) | ||
| { | ||
| using namespace consts; | ||
|
|
||
| const int cEq = com_mod.cEq; | ||
| auto& eq = com_mod.eq[cEq]; | ||
| const int cDmn = com_mod.cDmn; | ||
| auto& dmn = eq.dmn[cDmn]; | ||
| const double dt = com_mod.dt; | ||
| const int i = eq.s; | ||
|
|
||
| double k = dmn.prop.at(PhysicalProperyType::permeability); | ||
| double source = dmn.prop.at(PhysicalProperyType::source_term); | ||
| double beta_0 = dmn.prop.at(PhysicalProperyType::media_compressibility); | ||
| double rho_0 = dmn.prop.at(PhysicalProperyType::fluid_density); | ||
| double mu = dmn.prop.at(PhysicalProperyType::darcy_fluid_viscosity); | ||
|
|
||
| double T1 = eq.af * eq.gam * dt; | ||
| double amd = eq.am / T1; | ||
| double wl = w * T1; | ||
|
|
||
| double p_dot = 0.0; | ||
| double Px = 0.0; | ||
|
|
||
| for (int a = 0; a < eNoN; a++) { | ||
| p_dot = p_dot + N(a) * al(i, a); | ||
| Px = Px + Nx(0, a) * yl(i, a); | ||
| } | ||
|
|
||
| for (int a = 0; a < eNoN; a++) { | ||
| lR(0, a) = lR(0, a) + | ||
| w * (rho_0 * N(a) * (beta_0 * p_dot - source) + | ||
| ((k * rho_0) / mu) * Nx(0, a) * Px); | ||
| for (int b = 0; b < eNoN; b++) { | ||
| lK(0, a, b) = lK(0, a, b) + wl * (rho_0 * beta_0 * N(a) * N(b) * amd + | ||
| ((((rho_0 * k) / mu) * (Nx(0, a) * Nx(0, b))))); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
If I am reading this code right, the problem assembled here does not match the one stated in the documentation at the top of this file. The differences I can notice are the following.
- The terms assembled here do not have anything that corresponds to the sink term
$\beta_1 (p - p_{sink})$ . - The term multiplied by
$\beta_0$ is not$\beta_0 (p - p_{source})$ , but rather$\beta_0 \rho_0 \frac{\partial p}{\partial t}$ - There's a couple of coefficients (
$\rho_0$ and$\mu$ ) that rescale the permeability$K$ .
It seems to me that the strong form of the problem assembled here is
Is this right?
If so, I would suggest confirming that this is indeed the problem that is meant to be solved, and update the documentation accordingly.
Additionally, in the above equation
The same comments apply to darcy_2d and darcy_3d below.
There was a problem hiding this comment.
Opting to keep the viscosity and permeability separate at this time since there will likely be some ongoing discussions with the wet-lab experimentalists that will likely want some 1:1 correspondence for their measurements to input parameters. Also keeping the 2d and 3d assembly kernels separate at this time to mirror the other physics files; although I agree that future refactoring should cleanup these to have better concision of code.
There was a problem hiding this comment.
Also yes the equation that we should be solving for this model is:
There was a problem hiding this comment.
Thanks for clarifying! I assume that you opted to keep the density separate for the same reason as viscosity and compressibility, right?
|
About to push some commits to this fork then we can elevate this draft to a full PR. in the meantime @mmegally can you resolve the active comments that you have addressed along with their appropriate commit tags? you've been doing a great job at fixing up the code so far :) |
Resolve remaining Darcy review comments
|
@mmegally let's mark this as "Ready to review" |
zasexton
left a comment
There was a problem hiding this comment.
In my opinion we only piece requiring a bit more review is the zero initialization for the 2D cases to make sure that we are not getting heap error allocations and out-of-bounds. I'll fork this branch and double-check now to make any appropriate changes, if necessary.
michelebucelli
left a comment
There was a problem hiding this comment.
Thanks! I did a second pass, I only have a few minor suggestions left.
| void darcy_1d(ComMod& com_mod, const int eNoN, const double w, const Vector<double>& N, const Array<double>& Nx, | ||
| const Array<double>& al, const Array<double>& yl, Array<double>& lR, Array3<double>& lK) | ||
| { | ||
| using namespace consts; | ||
|
|
||
| const int cEq = com_mod.cEq; | ||
| auto& eq = com_mod.eq[cEq]; | ||
| const int cDmn = com_mod.cDmn; | ||
| auto& dmn = eq.dmn[cDmn]; | ||
| const double dt = com_mod.dt; | ||
| const int i = eq.s; | ||
|
|
||
| double k = dmn.prop.at(PhysicalProperyType::permeability); | ||
| double source = dmn.prop.at(PhysicalProperyType::source_term); | ||
| double beta_0 = dmn.prop.at(PhysicalProperyType::media_compressibility); | ||
| double rho_0 = dmn.prop.at(PhysicalProperyType::fluid_density); | ||
| double mu = dmn.prop.at(PhysicalProperyType::darcy_fluid_viscosity); | ||
|
|
||
| double T1 = eq.af * eq.gam * dt; | ||
| double amd = eq.am / T1; | ||
| double wl = w * T1; | ||
|
|
||
| double p_dot = 0.0; | ||
| double Px = 0.0; | ||
|
|
||
| for (int a = 0; a < eNoN; a++) { | ||
| p_dot = p_dot + N(a) * al(i, a); | ||
| Px = Px + Nx(0, a) * yl(i, a); | ||
| } | ||
|
|
||
| for (int a = 0; a < eNoN; a++) { | ||
| lR(0, a) = lR(0, a) + | ||
| w * (rho_0 * N(a) * (beta_0 * p_dot - source) + | ||
| ((k * rho_0) / mu) * Nx(0, a) * Px); | ||
| for (int b = 0; b < eNoN; b++) { | ||
| lK(0, a, b) = lK(0, a, b) + wl * (rho_0 * beta_0 * N(a) * N(b) * amd + | ||
| ((((rho_0 * k) / mu) * (Nx(0, a) * Nx(0, b))))); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Thanks for clarifying! I assume that you opted to keep the density separate for the same reason as viscosity and compressibility, right?
…laces and adding parameter dimensions to documentation
Fix Darcy initial pressure indexing
…g exceptions from svmp namespace
Current situation
See issue #616 on introducing darcy physics.
Release Notes
Code of Conduct & Contributing Guidelines