Skip to content

Commit

Permalink
Address more review comments (idaholab#18178)
Browse files Browse the repository at this point in the history
- Removes errant requirement number from new ad newmark and central 
difference tests. 
- Moved method definitions for adUDot and adUDotDot to outside class 
definition (still in header).
  • Loading branch information
cticenhour committed Jul 15, 2021
1 parent 8955b41 commit f3dd8c5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 41 deletions.
60 changes: 34 additions & 26 deletions framework/include/variables/MooseVariableData.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,33 +301,9 @@ class MooseVariableData
return _ad_second_u;
}

const ADTemplateVariableValue<OutputType> & adUDot() const
{
_need_ad = _need_ad_u_dot = true;

if (!_time_integrator)
// If we don't have a time integrator (this will be the case for variables that are a part of
// the AuxiliarySystem) then we have no way to calculate _ad_u_dot and we are just going to
// copy the values from _u_dot. Of course in order to be able to do that we need to calculate
// _u_dot
_need_u_dot = true;

return _ad_u_dot;
}

const ADTemplateVariableValue<OutputType> & adUDotDot() const
{
_need_ad = _need_ad_u_dotdot = true;

if (!_time_integrator)
// If we don't have a time integrator (this will be the case for variables that are a part
// of the AuxiliarySystem) then we have no way to calculate _ad_u_dotdot and we are just
// going to copy the values from _u_dotdot. Of course in order to be able to do that we need
// to calculate _u_dotdot
_need_u_dotdot = true;
const ADTemplateVariableValue<OutputType> & adUDot() const;

return _ad_u_dotdot;
}
const ADTemplateVariableValue<OutputType> & adUDotDot() const;

const FieldVariableValue & uDot() const;

Expand Down Expand Up @@ -828,6 +804,38 @@ MooseVariableData<OutputType>::adNodalValue() const
return _ad_nodal_value;
}

template <typename OutputType>
const ADTemplateVariableValue<OutputType> &
MooseVariableData<OutputType>::adUDot() const
{
_need_ad = _need_ad_u_dot = true;

if (!_time_integrator)
// If we don't have a time integrator (this will be the case for variables that are a part of
// the AuxiliarySystem) then we have no way to calculate _ad_u_dot and we are just going to
// copy the values from _u_dot. Of course in order to be able to do that we need to calculate
// _u_dot
_need_u_dot = true;

return _ad_u_dot;
}

template <typename OutputType>
const ADTemplateVariableValue<OutputType> &
MooseVariableData<OutputType>::adUDotDot() const
{
_need_ad = _need_ad_u_dotdot = true;

if (!_time_integrator)
// If we don't have a time integrator (this will be the case for variables that are a part
// of the AuxiliarySystem) then we have no way to calculate _ad_u_dotdot and we are just
// going to copy the values from _u_dotdot. Of course in order to be able to do that we need
// to calculate _u_dotdot
_need_u_dotdot = true;

return _ad_u_dotdot;
}

////////////////////////// Forward declaration of fully specialized templates //////////////////

template <>
Expand Down
27 changes: 14 additions & 13 deletions framework/include/variables/MooseVariableDataFV.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,7 @@ class MooseVariableDataFV

const ADTemplateVariableValue<OutputType> & adUDot() const;

const ADTemplateVariableValue<OutputType> & adUDotDot() const
{
_need_ad = _need_ad_u_dotdot = true;

if (!_time_integrator)
// If we don't have a time integrator (this will be the case for variables that are a part of
// the AuxiliarySystem) then we have no way to calculate _ad_u_dotdot and we are just going to
// copy the values from _u_dotdot. Of course in order to be able to do that we need to
// calculate _u_dotdot
_need_u_dotdot = true;

return _ad_u_dotdot;
}
const ADTemplateVariableValue<OutputType> & adUDotDot() const;

const FieldVariableValue & uDot() const;

Expand Down Expand Up @@ -551,3 +539,16 @@ MooseVariableDataFV<OutputType>::adUDot() const

return _ad_u_dot;
}

template <typename OutputType>
const ADTemplateVariableValue<OutputType> &
MooseVariableDataFV<OutputType>::adUDotDot() const
{
_need_ad = _need_ad_u_dotdot = true;

if (!safeToComputeADUDot())
// We will just copy the value of _u_dotdot into _ad_u_dotdot
_need_u_dotdot = true;

return _ad_u_dotdot;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# correctly using the Central Difference method for an AD
# variable.
#
# @Requirement F1.30
###########################################################

[Mesh]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Testing that the second time derivative is calculated
# correctly using the Newmark-Beta method for an AD variable
#
# @Requirement F1.30
###########################################################

[Mesh]
Expand Down

0 comments on commit f3dd8c5

Please sign in to comment.