Skip to content

Commit

Permalink
Merge pull request #2 from lindsayad/mortar-scalar-assembly
Browse files Browse the repository at this point in the history
Simplify residual object code
  • Loading branch information
ttruster committed Jan 11, 2023
2 parents 54f3d3a + 094bc01 commit a77fef9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions framework/include/base/Assembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,6 @@ class Assembly
const std::set<TagID> & 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
Expand All @@ -1754,7 +1753,6 @@ class Assembly
const std::set<TagID> & vector_tags,
const std::set<TagID> & matrix_tags,
Real scaling_factor);
#endif

/**
* Process the \p derivatives() data of a vector of \p ADReals. When using global indexing, this
Expand Down
10 changes: 10 additions & 0 deletions framework/src/base/Assembly.C
Original file line number Diff line number Diff line change
Expand Up @@ -4827,6 +4827,16 @@ Assembly::processResidualsAndJacobian(const std::vector<ADReal> & 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<ADReal> &,
const std::vector<dof_id_type> &,
const std::set<TagID> &,
const std::set<TagID> &,
const Real)
{
mooseError("Assembly::processResidualsAndJacobian is only supported for global AD indexing");
}
#endif

template void coordTransformFactor<Point, Real>(const SubProblem & s,
Expand Down
11 changes: 0 additions & 11 deletions framework/src/kernels/ADKernelScalarBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -77,9 +74,6 @@ ADKernelScalarBase::computeJacobian()
{
ADKernel::computeJacobian();

#ifndef MOOSE_SPARSE_AD
mooseError("ADKernelScalarBase assembly only supported for non-sparse AD");
#else
if (_use_scalar)
{
computeScalarResidualsForJacobian();
Expand All @@ -89,7 +83,6 @@ ADKernelScalarBase::computeJacobian()
_matrix_tags,
_kappa_var_ptr->scalingFactor());
}
#endif
}

void
Expand All @@ -110,9 +103,6 @@ ADKernelScalarBase::computeResidualAndJacobian()
{
ADKernel::computeResidualAndJacobian();

#ifndef MOOSE_SPARSE_AD
mooseError("ADKernelScalarBase assembly only supported for non-sparse AD");
#else
if (_use_scalar)
{
computeScalarResidualsForJacobian();
Expand All @@ -122,7 +112,6 @@ ADKernelScalarBase::computeResidualAndJacobian()
_matrix_tags,
_kappa_var_ptr->scalingFactor());
}
#endif
}

void
Expand Down

0 comments on commit a77fef9

Please sign in to comment.