moose icon indicating copy to clipboard operation
moose copied to clipboard

Finite Volume PorousFlow

Open cpgr opened this issue 3 years ago • 15 comments

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.

cpgr avatar May 29 '22 07:05 cpgr

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

moosebuild avatar May 29 '22 22:05 moosebuild

Hmm, gcc doesn't like this. It looks like I need lots of this->template's in the code.

cpgr avatar May 30 '22 00:05 cpgr

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!

cpgr avatar May 30 '22 06:05 cpgr

Job Documentation on 7e7ec29 wanted to post the following:

View the site here

This comment will be updated on new commits.

moosebuild avatar May 30 '22 07:05 moosebuild

Job Coverage on 7e7ec29 wanted to post the following:

Framework coverage

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

Diff coverage report

Full coverage report

Modules coverage

Porous flow

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

Diff coverage report

Full coverage report

Full coverage reports

Reports

Warnings

  • framework new line coverage rate 5.26% is less than the suggested 90.0%

This comment will be updated on new commits.

moosebuild avatar May 30 '22 08:05 moosebuild

Hi, I noticed Ferret failed here but when I looked at CIVET, I saw that all tests passed. Anyone know why?

mangerij avatar May 30 '22 11:05 mangerij

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.

loganharbour avatar May 30 '22 22:05 loganharbour

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

moosebuild avatar Jun 11 '22 10:06 moosebuild

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 avatar Jun 15 '22 04:06 cpgr

@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

GiudGiud avatar Jun 19 '22 23:06 GiudGiud

@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 avatar Jun 20 '22 04:06 cpgr

@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.

lindsayad avatar Jul 19 '22 16:07 lindsayad

@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.

cpgr avatar Jul 19 '22 22:07 cpgr

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?

lindsayad avatar Jul 20 '22 00:07 lindsayad

Yes

cpgr avatar Jul 20 '22 00:07 cpgr

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.

cpgr avatar Aug 24 '22 21:08 cpgr

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

lindsayad avatar Aug 25 '22 10:08 lindsayad

I couldn't find an adCoupledDofValues method - before I try and make one can I check that I'm not missing anything?

cpgr avatar Aug 25 '22 22:08 cpgr

you're not missing anything 😄

lindsayad avatar Aug 26 '22 20:08 lindsayad

@cpgr are you waiting for a review on this?

GiudGiud avatar Nov 23 '22 22:11 GiudGiud

@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.

cpgr avatar Nov 23 '22 22:11 cpgr

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

GiudGiud avatar Nov 23 '22 22:11 GiudGiud

Ah I had no idea you were waiting on a review. Sorry @cpgr !

lindsayad avatar Nov 23 '22 23:11 lindsayad

I should have taken the fact that you marked it as ready for review as a cue haha

lindsayad avatar Nov 23 '22 23:11 lindsayad

No worries guys!

cpgr avatar Nov 23 '22 23:11 cpgr

Something has obviously changed - the flux kernel I was using no longer works! Any hints you could give me?

cpgr avatar Dec 15 '22 23:12 cpgr

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

lindsayad avatar Dec 15 '22 23:12 lindsayad

Waiting is fine!

cpgr avatar Dec 16 '22 00:12 cpgr

Alrighty, I'll re-save this and come back once #22130 is merged

lindsayad avatar Dec 16 '22 00:12 lindsayad

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

lindsayad avatar Jan 25 '23 23:01 lindsayad