Closed cpgr closed 1 year ago
Job Precheck on 0e2ea04 wanted to post the following:
Your code requires style changes.
A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:
curl -s https://mooseframework.inl.gov/docs/PRs/21172/clang_format/style.patch | git apply -v
Alternatively, with your repository up to date and in the top level of your repository:
git clang-format ed91e1d359fd3b10c258835ee1d38105a7fc8140
Hmm, gcc doesn't like this. It looks like I need lots of this->template
's in the code.
Hmm, gcc doesn't like this. It looks like I need lots of
this->template
's in the code.
Luckily not too many this->templates
were required!
Job Documentation on 7e7ec29 wanted to post the following:
View the site here
This comment will be updated on new commits.
Job Coverage on 7e7ec29 wanted to post the following:
b9fd6b | #21172 7e7ec2 | ||||
---|---|---|---|---|---|
Total | Total | +/- | New | ||
Rate | 84.79% | 84.77% | -0.01% | 5.26% | |
Hits | 83682 | 83683 | +1 | 1 | |
Misses | 15012 | 15029 | +17 | 18 |
b9fd6b | #21172 7e7ec2 | ||||
---|---|---|---|---|---|
Total | Total | +/- | New | ||
Rate | 96.44% | 96.52% | +0.08% | 98.40% | |
Hits | 10519 | 10652 | +133 | 552 | |
Misses | 388 | 384 | -4 | 9 |
framework
new line coverage rate 5.26% is less than the suggested 90.0%This comment will be updated on new commits.
Hi, I noticed Ferret failed here but when I looked at CIVET, I saw that all tests passed. Anyone know why?
Hi, I noticed Ferret failed here but when I looked at CIVET, I saw that all tests passed. Anyone know why?
Unrelated issue. Should be good now.
@loganharbour, would you mind taking a look at this when you get chance before I go too far down the rabbit hole.
👍🏼 on my list.
Job Precheck on eeb4cdd wanted to post the following:
A change of the following file(s) triggered this check:
libmesh
The following file(s) are unchanged:
conda/mpich/conda_build_config.yaml conda/libmesh/meta.yaml
The libmesh submodule or configuration was changed but the conda build config was not
I've just realised that it doesn't seem like there is any way to find the documentation (https://mooseframework.inl.gov/docs/PRs/21172/site/automatic_differentiation/templated_objects.html) I wrote. It follows on from https://mooseframework.inl.gov/docs/PRs/21172/site/automatic_differentiation/ but I can't find out where this links from. It should possibly be listed in 'Application development'?
@cpgr the AD page is linked to from some of the systems using AD https://mooseframework.inl.gov/syntax/Kernels/ or https://mooseframework.inl.gov/syntax/Materials/ for example
@cpgr the AD page is linked to from some of the systems using AD https://mooseframework.inl.gov/syntax/Kernels/ or https://mooseframework.inl.gov/syntax/Materials/ for example
Thanks! I was wondering how anyone would find this.
@cpgr I was wondering if you looked at our porous Navier-Stokes slides at https://mooseframework.inl.gov/slides/index.html#/ whether you could tell me what the difference between that and the equations solved by the porous_flow
module is? I'm hoping there is a difference haha, and if so we should think about documenting that somewhere so our users know where to go for what application/modeling-assumptions is relevant to them.
@cpgr I was wondering if you looked at our porous Navier-Stokes slides at https://mooseframework.inl.gov/slides/index.html#/ whether you could tell me what the difference between that and the equations solved by the
porous_flow
module is? I'm hoping there is a difference haha, and if so we should think about documenting that somewhere so our users know where to go for what application/modeling-assumptions is relevant to them.
The governing equations for the porous_flow
module are outlined here -https://mooseframework.inl.gov/modules/porous_flow/governing_equations.html
They are basically conservation of mass of a fluid component + Darcy's law.
I think the main difference would be that this module is set up for more classical reservoir engineering cases, and can model an arbitrary number of fluid phases (most common use case would be 2 I imagine - a gas phase and a liquid phase), but each phase can have an arbitrary number of fluid components (eg, the liquid can be water + salt + dissolved gas component etc).
The FV stuff here (which is basically an FV equivalent to the FE objects already in this module) is to make it much easier to model cases where there are discontinuities in one of the variables, such as gas saturation , due to the reservoir properties.
It's fun learning about this. A really dumb question that I haven't answered for myself yet: if you were to model a single phase single component problem, what would your nonlinear variable(s) be? Is it just the pressure?
Yes
I've been using this for a little while now and it all seems to be working.
The only part I'm not certain on is in Coupleable.C
. I needed to template coupledDofValues
to template all the porous flow materials, so added
template <>
const GenericVariableValue<false> &
Coupleable::coupledGenericDofValue<false>(const std::string & var_name, unsigned int comp) const
{
return coupledDofValues(var_name, comp);
}
template <>
const GenericVariableValue<true> &
Coupleable::coupledGenericDofValue<true>(const std::string & var_name, unsigned int comp) const
{
return adCoupledValue(var_name, comp);
}
but I'm not sure on the AD one.
Yea that's probably not quite right. The dof values should return all the degree of freedom values in the solution vector associated with a given element, whereas the coupled value api's return the finite element solution evaluated at the element quadrature points
I couldn't find an adCoupledDofValues
method - before I try and make one can I check that I'm not missing anything?
you're not missing anything 😄
@cpgr are you waiting for a review on this?
@cpgr are you waiting for a review on this?
Yeah, but no rush. This was to check that what I have done so far is ok. I know that there is a lot of work to make it work with all of the exiting PorousFlow objects, I just don't have time until next month to keep going.
If you or @loganharbour could just take a quick look and let me know if there is anything that I am not doing right that would be great.
Sounds good. I ll add it to my list and I think @lindsayad will want to have a look as well since this is FV
Ah I had no idea you were waiting on a review. Sorry @cpgr !
I should have taken the fact that you marked it as ready for review as a cue haha
No worries guys!
Something has obviously changed - the flux kernel I was using no longer works! Any hints you could give me?
Hmm I think with @grmnptr's recent changes to remove ghost cells this might have plunged your neighbor material property evaluations when you're on a boundary into oblivion. What I would suggest, if you're wiling to wait, is to let #22130 go in, and then I can come push a commit to your PR updating your flux kernel. Would that be ok? I know you've already waited a long time, so if you're eager to have this in, then I can probably come up with a patch now
Waiting is fine!
Alrighty, I'll re-save this and come back once #22130 is merged
Ok #22130 is in. Want the follow-on #23233 to get through and with those two I have a pretty good idea about where I want to take this. I don't think it'll be a massive re-write like I initially thought
Let me know if there is anything I can do!
You've done plenty @cpgr. It's up to us to make sure your hard work doesn't go to waste
Ok @cpgr I finally got around to it! Sorry it took forever! I rebased onto a more recent MOOSE commit and then added one of my own. The important change is that we've removed ghost cells; so you have to be careful to avoid indexing into data that logically corresponds to a ghost cell, e.g. a "neighbor" when you are on a boundary face. In order to circumvent this change, I added a new FVFluxBC
class that mimics the FVFluxKernel
class you created but makes sure to avoid that out-of-bounds indexing.
I tried to read about the porous flow module a bit, but I think it would be best if you looked at that new BC class and decided whether there might be a way to generalize it to more phases like you have for the flux kernel. Anyway hopefully this is helpful and you can develop on top of this and we can get this merged soon!
Thanks so much @lindsayad. I'll take a look over the next few days
I'm trying to understand why making a new flux bc fixes this? Does a FVFluxKernel not evaluate on the boundary faces anymore, meaning that a flux in/out must be added using a BC?
If a FVFluxBC object exists on a boundary, then the FVFluxKernel does not execute on that boundary. Here is the logic
bool
FVFluxKernel::skipForBoundary(const FaceInfo & fi) const
{
// Boundaries to avoid come first, since they are always obeyed
if (avoidBoundary(fi))
return true;
// We're not on a boundary, so in practice we're not 'skipping'
if (!onBoundary(fi))
return false;
// Blanket forcing on boundary
if (_force_boundary_execution)
return false;
// Selected boundaries to force
for (const auto bnd_to_force : _boundaries_to_force)
if (fi.boundaryIDs().count(bnd_to_force))
return false;
// If we have flux bcs then we do skip
const auto & flux_pr = _var.getFluxBCs(fi);
if (flux_pr.first)
return true;
// If we don't have flux bcs *and* we do have dirichlet bcs then we don't skip. If we don't have
// either then we assume natural boundary condition and we should skip
return !_var.getDirichletBC(fi).first;
}
Does the FVBC you made need to add a Dirichlet BC as well? In my admittedly limited understanding of how the FV system works won't specifying the flux naturally lead to that boundary pressure? I did the scientific thing and commented out the bit that adds a Dirichlet BC and the results appeared identical hahaha.
Edit: this bit of code
auto diri_params = FVDirichletBC::validParams();
diri_params.applySpecificParameters(_pars, {"variable", "boundary"});
diri_params.addPrivateParam("_moose_app", &_app);
diri_params.set<Real>("value") = _pp_value;
_fv_problem.addFVBC("FVDirichletBC", name() + "_diri", diri_params);
_fv_problem.fvBCsIntegrityCheck(false);
One would hope. The reason I added it is for cell gradients. Cell gradients use Green-Gauss for their calculation so they need face values. If a Dirichlet BC exists then it will use that as the face value; if not, then by default we will use a two term extrapolation to determine the boundary face value based on the cell gradient (so this is actually an implicit calculation) and the cell center value. So practically speaking this extrapolated value probably won't match the Dirichlet value exactly, but hopefully it's close and is only an error of O(h^2).
You are certainly welcome to remove that code if you are happy with the results as they are
oops - accidentally closed this!
The missing markdown documentation I can fix. The failing Modules parallel
test throws an error when it runs the --n-threads=2
tests
A 'FVBoundaryCondition' object already exists with the name 'left_diri'.
Does this just need an
if (_tid == 0)
add Dirichlet BC here
Yes; that was a stupid oversight by me.
I'd still like to see a Jacobian test, but otherwise this is good to go as far as I'm concerned.
I just added a Jacobian test of the FV kernels
Above and beyond on that last commit @cpgr 😄
sed
and some search and replace!
@lindsayad do you need an external review on your commit or are we below the "significance" threshold?
I don't think it's very significant, so I don't think it needs it. Feel free to review if you wish obviously, but I think we're good to move forward without more review
@cpgr please let me know when you want this merged
I bet he's ready to have it merged now 😄
Haha - what's a few extra days!
Thanks @lindsayad for your help getting this through!
You're welcome! Thanks for your patience in the process!
This is the initial work to support FV in the PorousFlow module.
@loganharbour, would you mind taking a look at this when you get chance before I go too far down the rabbit hole. 😆 I think this was the minimum I could do to get a working FV test problem while having all of the current tests in PorousFlow still working.