Permalink
Browse files

Merge pull request #12640 from tophmatthews/ad_mat_12633

Move ADMatDiffusion to ADMatDiffusionTest
  • Loading branch information...
lindsayad committed Jan 3, 2019
2 parents f0170c2 + a2eb5b0 commit ffb4222b3f54b20717b5303c911bb51d07b0031c
@@ -22,7 +22,7 @@ source and header files can be found
[here](test/src/materials/ADCoupledMaterial.C) and
[here](test/include/materials/ADCoupledMaterial.h); example kernel source and
header files that use AD material properties can be found
[here](test/src/kernels/ADMatDiffusion.C) and [here](test/include/kernels/ADMatDiffusion.h).
[here](test/src/kernels/ADMatDiffusionTest.C) and [here](test/include/kernels/ADMatDiffusionTest.h).

## Traditional Hand-coded Jacobians

@@ -26,8 +26,8 @@ More documentation will be added as AD percolates through the framework
(e.g. addition of `ADInterfaceKernel`, `ADDGKernel`, `ADIntegratedBC`, `ADNodalBC`). For
now the best documentation is the existing tests. Some example input files include:
[ad_material.i], [ad_coupled_convection.i], and [ad_simple_diffusion.i]. For
examples of writing `ADKernels`, see [ADCoupledConvection.h], [ADMatDiffusion.h]
headers and [ADCoupledConvection.C], [ADMatDiffusion.C] source files. An example
examples of writing `ADKernels`, see [ADCoupledConvection.h], [ADMatDiffusionTest.h]
headers and [ADCoupledConvection.C], [ADMatDiffusionTest.C] source files. An example
of an `ADMaterial` can be found in [ADCoupledMaterial.h], [ADCoupledMaterial.C].

Moving forward, the idea is for application developers to be able to develop
@@ -6,23 +6,23 @@
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#ifndef ADMATDIFFUSION_H
#define ADMATDIFFUSION_H
#ifndef ADMATDIFFUSIONTEST_H
#define ADMATDIFFUSIONTEST_H

#include "ADKernel.h"
#include "MaterialProperty.h"

// Forward Declaration
template <ComputeStage compute_stage>
class ADMatDiffusion;
class ADMatDiffusionTest;

declareADValidParams(ADMatDiffusion);
declareADValidParams(ADMatDiffusionTest);

template <ComputeStage compute_stage>
class ADMatDiffusion : public ADKernel<compute_stage>
class ADMatDiffusionTest : public ADKernel<compute_stage>
{
public:
ADMatDiffusion(const InputParameters & parameters);
ADMatDiffusionTest(const InputParameters & parameters);

protected:
virtual ADResidual computeQpResidual();
@@ -36,4 +36,4 @@ class ADMatDiffusion : public ADKernel<compute_stage>
usingKernelMembers;
};

#endif // ADMATDIFFUSION_H
#endif // ADMATDIFFUSIONTEST_H
@@ -6,12 +6,12 @@
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#include "ADMatDiffusion.h"
#include "ADMatDiffusionTest.h"

registerADMooseObject("MooseTestApp", ADMatDiffusion);
registerADMooseObject("MooseTestApp", ADMatDiffusionTest);

defineADValidParams(
ADMatDiffusion,
ADMatDiffusionTest,
ADKernel,
params.addParam<MaterialPropertyName>(
"ad_mat_prop",
@@ -29,7 +29,7 @@ defineADValidParams(
"material."););

template <ComputeStage compute_stage>
ADMatDiffusion<compute_stage>::ADMatDiffusion(const InputParameters & parameters)
ADMatDiffusionTest<compute_stage>::ADMatDiffusionTest(const InputParameters & parameters)
: ADKernel<compute_stage>(parameters),
_ad_diff_from_ad_prop(adGetADMaterialProperty<Real>("ad_mat_prop")),
_regular_diff_from_ad_prop(adGetMaterialProperty<Real>("ad_mat_prop")),
@@ -41,7 +41,7 @@ ADMatDiffusion<compute_stage>::ADMatDiffusion(const InputParameters & parameters

template <ComputeStage compute_stage>
ADResidual
ADMatDiffusion<compute_stage>::computeQpResidual()
ADMatDiffusionTest<compute_stage>::computeQpResidual()
{
if (_prop_to_use == "AdAd")
return _ad_diff_from_ad_prop[_qp] * _grad_test[_i][_qp] * _grad_u[_qp];
@@ -13,7 +13,7 @@

[ADKernels]
[./diff]
type = ADMatDiffusion
type = ADMatDiffusionTest
variable = u
prop_to_use = 'AdAd'
ad_mat_prop = ad_diffusivity
@@ -13,7 +13,7 @@

[ADKernels]
[./diff]
type = ADMatDiffusion
type = ADMatDiffusionTest
variable = u
prop_to_use = 'AdAd'
ad_mat_prop = 'diffusivity'

0 comments on commit ffb4222

Please sign in to comment.