Commit a7a97ac9 authored by Gräser, Carsten's avatar Gräser, Carsten
Browse files

Implement difference method for functionals

parent 97f291e4
Pipeline #8804 passed with stage
in 5 minutes and 15 seconds
......@@ -411,6 +411,26 @@ public:
return value;;
}
Range difference(const Scalar& z) const
{
// The global position of where the directional derivative
// is to be evaluated is v = origin_ + z*direction. However,
// in the following we only need B*(origin + z*direction) = Bv
auto BXv = evaluationMatrixTimesDirection_;
BXv *= z;
BXv += evaluationMatrixTimesOrigin_;
auto&& density = f_->density();
auto&& weights = f_->quadratureWeights();
Range value = 0;
for (std::size_t i=0; i<f_->evaluationMatrix().N(); ++i)
value += (density(BXv[i]) - density(evaluationMatrixTimesOrigin_[i]))*weights[i];
return value;;
}
/** \brief The set of points where the functional takes finite values
*
* It is supposed that the domain is an interval, which holds in particular
......
......@@ -84,6 +84,11 @@ namespace Dune::FracturePhasefields
return J_(temp);
}
double difference(const double& z) const
{
return damagedElasticityFunctional_.difference(z) + damageFunctional_.difference(z);
}
friend auto derivative(const ScalarSumFunctional& sumFunctional)
{
// Using a lambda would lead to an incomplete type warning
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment