-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Coupling FE Scalar Field Variable to FV Kernels #29106
base: next
Are you sure you want to change the base?
Conversation
Job Documentation, step Docs: sync website on 8bc7e25 wanted to post the following: View the site here This comment will be updated on new commits. |
when you say scalar, you mean scalar field right? Because MOOSE has scalar variables whose values are independent of position on the mesh |
@lindsayad you're absolutely correct. I use the term scalar to denote that vector variables (like Nédélec variables) are not considered in this PR, but I forgot about MOOSE's Scalar variable and kernel objects. I renamed the PR to clarify scalar field. |
I figured but just wanted to check. I'll start reviewing once more tests are passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks promising
can you add a section in the Coupleable.md (most likely?) on coupling FE variables in FV objects
@@ -283,6 +283,12 @@ class Assembly | |||
*/ | |||
const QBase * const & qRuleFace() const { return constify_ref(_current_qrule_face); } | |||
|
|||
/** | |||
* Returns the reference to the current FV quadrature being used on a current face |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Returns the reference to the current FV quadrature being used on a current face | |
* Returns the reference to a pointer to the current FV quadrature being used on a current face |
@@ -691,7 +697,7 @@ class Assembly | |||
*/ | |||
void reinit(const Elem * elem, unsigned int side, const std::vector<Point> & reference_points); | |||
|
|||
void reinitFVFace(const FaceInfo & fi); | |||
void reinitFVFace(const FaceInfo & fi, bool areFE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring, what does areFE mean
@@ -630,6 +630,17 @@ class Coupleable | |||
virtual const ArrayVariableValue & coupledArrayValueOlder(const std::string & var_name, | |||
unsigned int comp = 0) const; | |||
|
|||
/** | |||
* Returns gradient of a coupled variable at an element face for FV Kernel / BC coupling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally coupleable does not mention "FV" as all routines would work for all variables? (just need to be implemented)
/// Whether the MooseObject is a finite volume object | ||
const bool _is_fv; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Whether the MooseObject is a finite volume object | |
const bool _is_fv; |
use the Coupleable is_fv attribute (make it protected if it s not)
// FE coupled variables. If there are some FE variables, then FE reinit is | ||
// necessary. | ||
bool areFE = false; | ||
for (auto var : _fv_vars) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (auto var : _fv_vars) | |
for (auto var : _vars) |
} | ||
|
||
// NOTES: GhostValues for FE variable with equal the Face average value | ||
// of the neighbor side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this inside the routine
_element_data->computeGhostValuesFace(fi, *_neighbor_data); | ||
} | ||
else | ||
mooseError("FE to FV coupling broken."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mooseError("FE to FV coupling broken."); | |
mooseAssert(false, "FE to FV coupling broken."); |
We dont expect to hit this in production
void | ||
MooseVariableFE<OutputType>::computeAdGradFaceAvg(const FaceInfo & /*fi*/) | ||
{ | ||
mooseError("computeAdGradFaceAvg(const FaceInfo & fi) are only for MooseVariableFE<Real>."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mooseError("computeAdGradFaceAvg(const FaceInfo & fi) are only for MooseVariableFE<Real>."); | |
mooseError("computeAdGradFaceAvg(const FaceInfo & fi) are only implemented for MooseVariableFE<Real>."); |
VectorValue<ADReal> | ||
MooseVariableFE<OutputType>::adGradSln(const FaceInfo & /*fi*/, const Moose::StateArg & /*state*/) | ||
{ | ||
mooseError("adGradSln(const FaceInfo & fi) are only for MooseVariableFE<Real>."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mooseError("adGradSln(const FaceInfo & fi) are only for MooseVariableFE<Real>."); | |
mooseError("adGradSln(const FaceInfo & fi) are only implemented for MooseVariableFE<Real>."); |
|
||
_ad_grad_u_face = adGradSlnAvg(); | ||
_ad_grad_neighbor_u_face = adGradSlnAvgNeighbor(); | ||
_ad_grad_face_avg = (_ad_grad_u_face[0] + _ad_grad_neighbor_u_face[0]) / 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for a FE variable right
can you think of a reason to not have equal weights?
_ad_zero = 0; | ||
unsigned int nqp = _current_qrule->n_points(); | ||
// NOTES: This seems like a lot of if statements. Maybe there is better way | ||
// to seperate face vs element averaging... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could split it in computeADElementAveraging and computeADFaceAveraging
void | ||
MooseVariableData<OutputType>::computeADAveraging() | ||
{ | ||
_ad_zero = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
/// FV quadrature rule used on faces | ||
QBase * _current_FV_qrule_face; | ||
/// The current arbitrary quadrature rule used on element faces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is another solution here than doubling up the attribute, it'd be good
Maybe some high level questions,
|
Reason
This PR will enable the coupling of FE scalar field variable values and gradients to FV kernels. This PR directly addresses issue #15062
Design
This PR includes the following:
adCoupledGradientFace
, which returns gradient of a coupled variable at an element face for FV Kernel.Impact
This PR will allow for great degree of user flexibility when solving multiphysics problems where some physics are favorable towards FE and other physics are favorable towards FE (e.g. coupling FE electromagnetics to FV conducting fluids).