How to Update Input Files for Automated Differentiation (AD)

Components

There are no changes required in the [Components] block.

Materials

If you are using [Materials] block in your input file, refer to Table 1 and Table 2 for which material properties became AD and which stayed non-AD. If your object is using an AD material property, you will need to change its type according to Table 3 to make it work with AD.

Table 1: List of AD and non-AD material properties related to 1-phase flow

Property nameAD?
D_hNO
directionNO
cYES
cpYES
cvYES
eYES
hYES
HYES
kYES
ReYES
rhoYES
rhoAYES
rhouAYES
rhoEAYES
pYES
PrYES
q_wallYES
TYES
T_wallYES
vYES
velYES

Table 2: List of AD and non-AD material properties related to heat conduction

Property nameAD?
densityYES
thermal_conductivityYES
specific_heatYES

Table 3: Corresponding types of non-AD and AD materials.

non-AD typeAD type
ConstantMaterialADConstantMaterial
GenericConstantMaterialADGenericConstantMaterial
ParsedMaterialADParsedMaterial
PrandtlNumberMaterialADPrandtlNumberMaterial
ReynoldsNumberMaterialADReynoldsNumberMaterial
WallHeatTransferCoefficient3EqnDittusBoelterMaterialADWallHeatTransferCoefficient3EqnDittusBoelterMaterial
WallFrictionChurchillMaterialADWallFrictionChurchillMaterial

Postprocessors

If you are using [Postprocessors] block in your input file, use Table 4 to convert the types of postprocessors to AD.

Table 4: Corresponding types of non-AD and AD postprocessors.

non-AD typeAD type
ElementIntegralMaterialPropertyADElementIntegralMaterialProperty
ElementAverageMaterialPropertyADElementAverageMaterialProperty
ElementExtremeMaterialPropertyADElementExtremeMaterialProperty
FlowBoundaryFlux1PhaseADFlowBoundaryFlux1Phase
FlowJunctionFlux1PhaseADFlowJunctionFlux1Phase
HeatRateConvection1PhaseADHeatRateConvection1Phase
HeatStructureEnergyADHeatStructureEnergy
HeatStructureEnergy3DADHeatStructureEnergy3D
HeatStructureEnergyRZADHeatStructureEnergyRZ
SideFluxIntegralRZADSideFluxIntegralRZ
SpecificImpulse1PhaseADSpecificImpulse1Phase

VectorPostprocessors

If you are using [VectorPostprocessors] block in your input file, use Table 5 to convert the types of vector postprocessors to AD.

Table 5: Corresponding types of non-AD and AD vector postprocessors.

non-AD typeAD type
Sampler1DRealADSampler1DReal

Time Integrators

Use Table 6 to convert time integrators. The changes are needed for explicit integration. Implicit integration does not need any changes, but it is listed for completeness. If type is given in the table, you will need to use the time integrator block in your input file like so:


[TimeIntegrator]
  type = ...
  other params
[]

Table 6: Time integrator conversion.

Time integratorHow to update
implicit-eulerNo change
bdf-2No change
explicit-eulertype = ActuallyExplicitEuler
explicit-tvd-rk-2type = ExplicitSSPRungeKutta, order = 2
explicit-midpointtype = ExplicitSSPRungeKutta, order = 2

Executioner

With your input file converted into AD, make sure that you set solve_type = NEWTON in the [Executioner] block.

Custom Closures

Custom closure are closure correlations specified on input file level. The following example shows how to update an input file using those:

Original input file


[Materials]
  [f_wall_mat]
    type = GenericConstantMaterial
    block = 'pipe'
    prop_names = 'f_D df_D/drhoA df_D/drhouA df_D/drhoEA'
    prop_values = '0.123 0 0 0'
  []
[]

New input file


[Materials]
  [f_wall_mat]
    type = ADGenericConstantMaterial
    block = 'pipe'
    prop_names = 'f_D'
    prop_values = '0.123'
  []
[]

Note that with AD, users no longer have to provide dX/dY properties.

If you see any of the following errors, it may indicate that the input file is running non-AD setup. If the above information does not help you to fix the problem, contact THM developers.


*** ERROR ***
The requested regular material property thermal_conductivity is declared as an AD property.
Either retrieve it as an AD property with getADMaterialProperty or declare it as a regular
property with declareProperty