From b285c691c542bd95d9fc8adc5acdc3d3e7df045a Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Fri, 11 Nov 2022 12:39:30 -0800 Subject: [PATCH 1/3] Revert "Add other error checks to see if that works." This reverts commit b4dd527f479d973a2ca89778367e873d37c78931. --- framework/src/kernels/ADKernelScalarBase.C | 8 -------- 1 file changed, 8 deletions(-) diff --git a/framework/src/kernels/ADKernelScalarBase.C b/framework/src/kernels/ADKernelScalarBase.C index bdbf593ede16..6cbbfcf09fd8 100644 --- a/framework/src/kernels/ADKernelScalarBase.C +++ b/framework/src/kernels/ADKernelScalarBase.C @@ -77,9 +77,6 @@ ADKernelScalarBase::computeJacobian() { ADKernel::computeJacobian(); -#ifndef MOOSE_SPARSE_AD - mooseError("ADKernelScalarBase assembly only supported for non-sparse AD"); -#else if (_use_scalar) { computeScalarResidualsForJacobian(); @@ -89,7 +86,6 @@ ADKernelScalarBase::computeJacobian() _matrix_tags, _kappa_var_ptr->scalingFactor()); } -#endif } void @@ -110,9 +106,6 @@ ADKernelScalarBase::computeResidualAndJacobian() { ADKernel::computeResidualAndJacobian(); -#ifndef MOOSE_SPARSE_AD - mooseError("ADKernelScalarBase assembly only supported for non-sparse AD"); -#else if (_use_scalar) { computeScalarResidualsForJacobian(); @@ -122,7 +115,6 @@ ADKernelScalarBase::computeResidualAndJacobian() _matrix_tags, _kappa_var_ptr->scalingFactor()); } -#endif } void From aa6ce99cfca376462962f487a4dac098b9956a2f Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Fri, 11 Nov 2022 12:39:41 -0800 Subject: [PATCH 2/3] Revert "Add error check for non-sparse AD" This reverts commit 0b460308431d78dfc545cfa5827eb316d03eaf00. --- framework/src/kernels/ADKernelScalarBase.C | 3 --- 1 file changed, 3 deletions(-) diff --git a/framework/src/kernels/ADKernelScalarBase.C b/framework/src/kernels/ADKernelScalarBase.C index 6cbbfcf09fd8..1d822a7b96e7 100644 --- a/framework/src/kernels/ADKernelScalarBase.C +++ b/framework/src/kernels/ADKernelScalarBase.C @@ -44,9 +44,6 @@ ADKernelScalarBase::ADKernelScalarBase(const InputParameters & parameters) #ifndef MOOSE_GLOBAL_AD_INDEXING mooseError("ADKernelScalarBase only supported for global AD indexing"); #endif -#ifndef MOOSE_SPARSE_AD - mooseError("ADKernelScalarBase assembly only supported for non-sparse AD"); -#endif } void From 094bc013baf8ebaa6c5c4f6c8b288e2d82012c23 Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Fri, 11 Nov 2022 12:48:50 -0800 Subject: [PATCH 3/3] Simplify residual object code Make it so that residual objects residuals and Jacobian routines don't have to be interwoven with pound defines --- framework/include/base/Assembly.h | 2 -- framework/src/base/Assembly.C | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/include/base/Assembly.h b/framework/include/base/Assembly.h index c41804b79ce4..888ae1d8253e 100644 --- a/framework/include/base/Assembly.h +++ b/framework/include/base/Assembly.h @@ -1741,7 +1741,6 @@ class Assembly const std::set & vector_tags, Real scaling_factor); -#ifdef MOOSE_GLOBAL_AD_INDEXING /** * Process the value and \p derivatives() data of a vector of \p ADReals. When using global * indexing, this method simply caches the value (residual) for the provided \p vector_tags and @@ -1754,7 +1753,6 @@ class Assembly const std::set & vector_tags, const std::set & matrix_tags, Real scaling_factor); -#endif /** * Process the \p derivatives() data of a vector of \p ADReals. When using global indexing, this diff --git a/framework/src/base/Assembly.C b/framework/src/base/Assembly.C index c33633fb1d7a..0df57741d581 100644 --- a/framework/src/base/Assembly.C +++ b/framework/src/base/Assembly.C @@ -4827,6 +4827,16 @@ Assembly::processResidualsAndJacobian(const std::vector & residuals, for (const auto j : index_range(column_indices)) cacheJacobian(row_indices[i], column_indices[j], element_matrix(i, j), matrix_tags); } +#else +void +Assembly::processResidualsAndJacobian(const std::vector &, + const std::vector &, + const std::set &, + const std::set &, + const Real) +{ + mooseError("Assembly::processResidualsAndJacobian is only supported for global AD indexing"); +} #endif template void coordTransformFactor(const SubProblem & s,