Skip to content
Permalink
Browse files

Merge pull request #12958 from tophmatthews/ad_heatconduction_cleanup…

…_12633

AD heat conduction cleanup
  • Loading branch information...
lindsayad committed Feb 27, 2019
2 parents a175542 + 23bfee0 commit cee6aaddce7991b1fcbe37b5d8916562352f0296
Showing with 423 additions and 375 deletions.
  1. +1 −1 framework/src/base/Assembly.C
  2. +7 −6 modules/heat_conduction/src/kernels/ADHeatConduction.C
  3. +3 −2 modules/heat_conduction/src/kernels/ADMatHeatSource.C
  4. +144 −0 modules/heat_conduction/test/tests/recover/ad_recover.i
  5. +1 −0 modules/heat_conduction/test/tests/recover/gold/ad_recover_out.e
  6. BIN modules/heat_conduction/test/tests/recover/gold/recover_out.e
  7. +1 −7 modules/heat_conduction/test/tests/recover/recover.i
  8. +46 −3 modules/heat_conduction/test/tests/recover/tests
  9. +2 −15 modules/heat_conduction/test/tests/verify_against_analytical/1D_transient.i
  10. +71 −0 modules/heat_conduction/test/tests/verify_against_analytical/2d_steady_state.i
  11. +0 −119 modules/heat_conduction/test/tests/verify_against_analytical/2d_steady_state_final_prob.i
  12. +3 −19 modules/heat_conduction/test/tests/verify_against_analytical/ad_1D_transient.i
  13. +71 −0 modules/heat_conduction/test/tests/verify_against_analytical/ad_2d_steady_state.i
  14. +0 −115 modules/heat_conduction/test/tests/verify_against_analytical/ad_2d_steady_state_final_prob.i
  15. BIN ...t/tests/verify_against_analytical/gold/{2d_steady_state_final_prob_out.e → 2d_steady_state_out.e}
  16. +0 −1 ...les/heat_conduction/test/tests/verify_against_analytical/gold/ad_2d_steady_state_final_prob_out.e
  17. +1 −0 modules/heat_conduction/test/tests/verify_against_analytical/gold/ad_2d_steady_state_out.e
  18. +32 −6 modules/heat_conduction/test/tests/verify_against_analytical/tests
  19. +2 −15 modules/misc/test/tests/kernels/diffusion/1D_transient.i
  20. +2 −21 modules/misc/test/tests/kernels/diffusion/{2d_steady_state_final_prob.i → 2d_steady_state.i}
  21. +2 −18 modules/misc/test/tests/kernels/diffusion/ad_1D_transient.i
  22. +3 −22 modules/misc/test/tests/kernels/diffusion/{ad_2d_steady_state_final_prob.i → ad_2d_steady_state.i}
  23. BIN ...misc/test/tests/kernels/diffusion/gold/{2d_steady_state_final_prob_out.e → 2d_steady_state_out.e}
  24. +0 −1 modules/misc/test/tests/kernels/diffusion/gold/ad_2d_steady_state_final_prob_out.e
  25. +1 −0 modules/misc/test/tests/kernels/diffusion/gold/ad_2d_steady_state_out.e
  26. +30 −4 modules/misc/test/tests/kernels/diffusion/tests
@@ -1558,7 +1558,7 @@ Assembly::computeCurrentFaceVolume()
_current_qrule_face, _current_q_points_face, _coord);
if (_computing_jacobian && _calculate_face_xyz)
setCoordinateTransformation<ComputeStage::JACOBIAN>(
_current_qrule, _ad_q_points_face, _ad_coord);
_current_qrule_face, _ad_q_points_face, _ad_coord);

_current_side_volume = 0.;
for (unsigned int qp = 0; qp < _current_qrule_face->n_points(); qp++)
@@ -10,12 +10,13 @@

registerADMooseObject("HeatConductionApp", ADHeatConduction);

defineADValidParams(ADHeatConduction,
ADDiffusion,
params.addRequiredParam<MaterialPropertyName>(
"thermal_conductivity",
"the name of the thermal conductivity material property");
params.set<bool>("use_displaced_mesh") = true;);
defineADValidParams(
ADHeatConduction,
ADDiffusion,
params.addParam<MaterialPropertyName>("thermal_conductivity",
"thermal_conductivity",
"the name of the thermal conductivity material property");
params.set<bool>("use_displaced_mesh") = true;);

template <ComputeStage compute_stage>
ADHeatConduction<compute_stage>::ADHeatConduction(const InputParameters & parameters)
@@ -14,8 +14,9 @@ defineADValidParams(
ADMatHeatSource,
ADKernel,
params.addParam<Real>("scalar", 1.0, "Scalar multiplied by the body force term");
params.addRequiredParam<MaterialPropertyName>("material_property",
"Material property describing the body force"););
params.addParam<MaterialPropertyName>("material_property",
1.0,
"Material property describing the body force"););

template <ComputeStage compute_stage>
ADMatHeatSource<compute_stage>::ADMatHeatSource(const InputParameters & parameters)
@@ -0,0 +1,144 @@
[GlobalParams]
order = SECOND
family = LAGRANGE
[]

[Problem]
coord_type = RZ
[]

[Mesh]
file = recover_in.e
[]

[Variables]
[./temp]
initial_condition = 580.0
[../]
[]

[AuxVariables]
[./gap_cond]
order = CONSTANT
family = MONOMIAL
[../]
[]

[Kernels]
[./heat]
type = ADHeatConduction
variable = temp
[../]
[./heat_source]
type = ADMatHeatSource
material_property = volumetric_heat
variable = temp
scalar = 1e3
block = pellet_type_1
[../]
[]

[ThermalContact]
[./thermal_contact]
type = GapHeatTransfer
variable = temp
master = 5
slave = 10
quadrature = true
[../]
[]

[BCs]
[./outside]
type = DirichletBC
value = 580
boundary = '1 2 3'
variable = temp
[../]
[./edge]
type = PresetBC
value = 700
boundary = 10
variable = temp
[../]
[]

[Materials]
[./volumetric_heat]
type = GenericFunctionMaterial
prop_names = 'volumetric_heat'
prop_values = 't'
[../]
[./thermal_3]
type = HeatConductionMaterial
block = 3
thermal_conductivity = 5
specific_heat = 12
[../]
[./thermal_1]
type = HeatConductionMaterial
block = 1
thermal_conductivity = 16.0
specific_heat = 330.0
[../]
[]

[Executioner]
type = Transient
solve_type = 'PJFNK'

petsc_options = '-snes_ksp_ew'
petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
petsc_options_value = ' lu superlu_dist'

nl_rel_tol = 1e-9
nl_abs_tol = 1e-11

start_time = -200
n_startup_steps = 1
end_time = 1.02e5
num_steps = 10

dtmax = 2e6
dtmin = 1

[./TimeStepper]
type = IterationAdaptiveDT
dt = 2.0e2
optimal_iterations = 15
iteration_window = 2
[../]

[./Quadrature]
order = FIFTH
side_order = SEVENTH
[../]
[]

[Postprocessors]
[./ave_temp_interior]
type = SideAverageValue
boundary = 9
variable = temp
execute_on = 'initial linear'
[../]
[./avg_clad_temp]
type = SideAverageValue
boundary = 7
variable = temp
execute_on = 'initial timestep_end'
[../]
[./flux_from_clad]
type = SideFluxIntegral
variable = temp
boundary = 5
diffusivity = thermal_conductivity
[../]
[./_dt]
type = TimestepSize
[../]
[]

[Outputs]
exodus = true
[]
Binary file not shown.
@@ -33,7 +33,7 @@
type = BodyForce
variable = temp
block = pellet_type_1
value = 1e-2
value = 1e3
function = 't'
[../]
[]
@@ -128,18 +128,12 @@
variable = temp
boundary = 5
diffusivity = thermal_conductivity
execute_on = timestep_end
[../]
[./_dt]
type = TimestepSize
execute_on = timestep_end
[../]
[]

[Outputs]
exodus = true
[./console]
type = Console
max_rows = 25
[../]
[]
@@ -1,19 +1,21 @@
[Tests]
design = "\restart_recover"
issues = "#10079"
[./recover_1]
type = Exodiff
input = recover.i
exodiff = recover_out.e
superlu = true
requirement = 'MOOSE shall run a simulation with heat conduction, a heat source, thermal contact, and boundary conditions.'
[../]

[./recover_2]
type = RunApp
input = recover.i
prereq = recover_1
cli_args = 'Outputs/checkpoint=true Executioner/num_steps=5'
superlu = true
requirement = 'MOOSE shall run a short simulation with heat conduction, a heat source, thermal contact, and boundary conditions.'
[../]

[./recover_3]
type = Exodiff
input = recover.i
@@ -22,6 +24,47 @@
delete_output_before_running = false
cli_args = '--recover recover_out_cp/0005'
superlu = true
skip = 'Non-deterministic on Intel compiler #10737'
requirement = 'MOOSE shall be able to recover from a short simulation and reproduce a the full time scale simulation with heat conduction, a heat source, thermal contact, and boundary conditions.'
[../]

[./ad_recover_1]
type = Exodiff
input = ad_recover.i
exodiff = ad_recover_out.e
superlu = true
requirement = 'MOOSE shall run a simulation with heat conduction, a heat source, thermal contact, and boundary conditions with automatic differentiation.'
[../]
[./ad_recover_2]
type = RunApp
input = ad_recover.i
prereq = ad_recover_1
cli_args = 'Outputs/checkpoint=true Executioner/num_steps=5'
superlu = true
requirement = 'MOOSE shall run a short simulation with heat conduction, a heat source, thermal contact, and boundary conditions with automatic differentiation.'
[../]
[./ad_recover_3]
type = Exodiff
input = ad_recover.i
exodiff = ad_recover_out.e
prereq = ad_recover_2
delete_output_before_running = false
cli_args = '--recover ad_recover_out_cp/0005'
superlu = true
requirement = 'MOOSE shall be able to recover from a short simulation and reproduce a the full time scale simulation with heat conduction, a heat source, thermal contact, and boundary conditions with automatic differentiation.'
[../]

[./ad_recover_jacobian]
type = 'PetscJacobianTester'
input = 'ad_recover.i'
ratio_tol = 1e-7
difference_tol = 1e-5
run_sim = True
petsc_version = '>=3.9'
method = 'OPT'
cli_args = 'Executioner/num_steps=2 Outputs/exodus=false'
skip = 'AD Thermal Contact not yet implemented'
requirement = 'AD heat conduction and the Jacobian shall be beautiful'
design = "jacobian_definition.md"
issues = "#5658 #12633"
[../]
[]
@@ -37,16 +37,10 @@
[]

[BCs]
[./left]
[./sides]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
boundary = 'left right'
value = 0
[../]
[]
@@ -56,19 +50,16 @@
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '0.95' #copper in cal/(cm sec C)
block = 0
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '0.092' #copper in cal/(g C)
block = 0
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '8.92' #copper in g/(cm^3)
block = 0
[../]
[]

@@ -83,15 +74,11 @@
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]

[Outputs]
exodus = true
perf_graph = true
[]
Oops, something went wrong.

0 comments on commit cee6aad

Please sign in to comment.
You can’t perform that action at this time.