AuxKernels and ADMaterialPropertiy #17283
-
Hi: The return type for the AuxKernel is simply "Real". But I want to use an AD Property inside it. For example, the initialization has the line: _rho(getADMaterialProperty("density") with the above, I get a compile time error because it can't convert the return type to a double. If I try to initialize with: _rho(getMaterialProperty("density") I get a run time error of symbol not found. So, how can I use an ADMaterialProperty inside an AuxKernel? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Hi Joe, You should add the following include to your AuxKernel src file: and you can access the raw value of your AD material property via: I suppose you could also use directly Antoine |
Beta Was this translation helpful? Give feedback.
-
You are missing a template parameter for the property Same template is required for the non-AD property as well |
Beta Was this translation helpful? Give feedback.
-
oops _rho(getADMaterialProperty("density")) |
Beta Was this translation helpful? Give feedback.
-
_rho(getADMaterialProperty<Real>("density")) |
Beta Was this translation helpful? Give feedback.
-
Thanks everyone. Making sure that I had the template right and using _rho[_qp].value() was the answer. |
Beta Was this translation helpful? Give feedback.
Hi Joe,
You should add the following include to your AuxKernel src file:
#include "metaphysicl/raw_type.h"
and you can access the raw value of your AD material property via:
MetaPhysicL::raw_value(_rho[_qp])
I suppose you could also use directly
_rho[_qp].value()
but to be confirmed.Antoine