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 13, 2021
1 parent d2e11b8 commit 6eee15b
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 54 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
60 changes: 34 additions & 26 deletions framework/include/variables/MooseVariableDataFV.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,33 +167,9 @@ class MooseVariableDataFV
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 @@ -532,3 +508,35 @@ MooseVariableDataFV<OutputType>::adDofValues() const
_need_ad = true;
return _ad_dof_values;
}

template <typename OutputType>
const ADTemplateVariableValue<OutputType> &
MooseVariableDataFV<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> &
MooseVariableDataFV<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;
}
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 6eee15b

Please sign in to comment.