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

Implemented dispatch for mimetic inner product selection #1190

Merged
merged 22 commits into from
Dec 22, 2020

Conversation

francoishamon
Copy link
Contributor

@francoishamon francoishamon commented Oct 5, 2020

This PR modifies the hybrid/mimetic FVM solver to allow the user to select a mimetic inner product from the input file in the <FiniteVolume> block of the XML file.

To do that I adapted some constructs used in FiniteElementDiscretization, FiniteElementDispatch, and the folder elementFormulations. Each mimetic inner product has its own class with a static member function that implements the calculation of the transmissibility matrix. To select the inner product in SinglePhaseHybridFVM.cpp, I use a dispatch just before launching the FluxKernel (now templated on the inner product type).

Most of the changes of the PR come from the fact that, after the addition of the new template, I was not able to compile with explicit instantiation of the functions in SinglePhaseHybridFVMKernels.cpp anymore (maybe there is a workaround but I could not find it). So I moved all the function implementations to the .hpp.

Related to https://github.com/GEOSX/integratedTests/pull/107.

@francoishamon francoishamon added flag: requires rebaseline Requires rebaseline branch in integratedTests flag: ready for review labels Oct 5, 2020
@francoishamon francoishamon changed the title implemented dispatch for mimetic inner product selection Implemented dispatch for mimetic inner product selection Oct 6, 2020
@francoishamon
Copy link
Contributor Author

@klevzoff @rrsettgast I am done with the work that I wanted to do in this PR. This refactoring PR is not urgent at all and can wait, but if you have some time over the next weeks it is ready for review.

Copy link
Contributor

@klevzoff klevzoff left a comment

Choose a reason for hiding this comment

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

Looks great!

The only issue I have is with the inheritance of HybridMimeticDiscretization from FluxApproximationBase. Or rather the fact that FluxApproximationBase contains the stencils and related methods and HybridMimeticDiscretization has to inherit those and implement stubs. Cleaning up that hierarchy probably should be its own PR though.

}
else
{
GEOSX_ERROR( "mimeticInnerProductDispatch() is not implemented for input of "<<typeid(input).name() );
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably also use LvArray::system::demangleType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
else
{
GEOSX_ERROR( "mimeticInnerProductDispatch() is not implemented for input of "<<LvArray::system::demangleType( &input ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for & in &input I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@francoishamon
Copy link
Contributor Author

Yes I agree with you about the class hierarchy in finiteVolume. I will do the cleanup in a separate PR to avoid making too many changes in this one. Thanks!

@francoishamon
Copy link
Contributor Author

@klevzoff @rrsettgast I modified the HybridMimeticDiscretization class, which now inherits directly from Group and not from FluxApproximationBase anymore. I changed the FiniteVolumeManager to reflect the change (thanks @klevzoff for the help!). I also added some checks in the flow solvers to make sure that the selected discretization is compatible with the solver.

Comment on lines 170 to 175
// 6) compute ( R^T R )^-1
real64 temp[ NF ][ 3 ] = {{ 0 }};
LvArray::tensorOps::copy< NF, 3 >( temp, cellToFaceMat ); // <<-- TODO: ask about this, we could have Rij_eq_AkiAkj instead
LvArray::tensorOps::Rij_eq_AkiBkj< 3, 3, NF >( work_dimByDim,
temp,
cellToFaceMat );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@corbett5 In this function, I need to compute R^T R, where R is a rectangular matrix of size NF x 3. Currently I create a temporary matrix to be able to use LvArray::tensorOps::Rij_eq_AkiBkj. Is there already something in LvArray to do the same thing without the temporary matrix? If not, would it make sense to add something like Rij_eq_AkiAkj?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there is currently anything to do this since the restrict keyword prevents the usage of AkiBkj. But yes given this restriction it would absolutely make sense to add. @rrsettgast and @CusiniM have a PR to do the same thing for other functions.

Copy link
Collaborator

@CusiniM CusiniM Dec 11, 2020

Choose a reason for hiding this comment

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

@francoishamon We can quickly add it to that PR if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that would be great (if you don't mind). Do you want to do it? Or should I do it and commit to your PR? Thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have done it. I just need to add a unit test for it.

@francoishamon francoishamon added ci: run CUDA builds Allows to triggers (costly) CUDA jobs and removed flag: ready for review flag: requires rebaseline Requires rebaseline branch in integratedTests labels Dec 21, 2020
@francoishamon francoishamon merged commit 67befa4 into develop Dec 22, 2020
@francoishamon francoishamon deleted the feature/hamon/newHybridFVMInnerProduct branch December 22, 2020 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: run CUDA builds Allows to triggers (costly) CUDA jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants