Skip to content
Snippets Groups Projects
Commit 9d74678f authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge branch 'DivergenceComputation' into 'master'

[PL/SDN] Move divergence computation

See merge request ogs/ogs!5213
parents ba64eccc 342484fa
No related branches found
No related tags found
No related merge requests found
/**
* \file
*
* \copyright
* Copyright (c) 2012-2025, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#pragma once
namespace ProcessLib
{
namespace Deformation
{
/// Divergence of displacement, the volumetric strain.
template <int DisplacementDim, int NPOINTS, typename DNDX_Type>
double divergence(
const Eigen::Ref<Eigen::Matrix<double, NPOINTS * DisplacementDim, 1> const>&
u,
DNDX_Type const& dNdx)
{
double divergence = 0;
for (int i = 0; i < DisplacementDim; ++i)
{
divergence += dNdx.template block<1, NPOINTS>(i, 0) *
u.template segment<NPOINTS>(i * NPOINTS);
}
return divergence;
}
} // namespace Deformation
} // namespace ProcessLib
......@@ -29,7 +29,6 @@
#include "NumLib/Fem/ShapeMatrixPolicy.h"
#include "ParameterLib/Parameter.h"
#include "ProcessLib/Deformation/BMatrixPolicy.h"
#include "ProcessLib/Deformation/Divergence.h"
#include "ProcessLib/Deformation/LinearBMatrix.h"
#include "ProcessLib/LocalAssemblerTraits.h"
#include "ProcessLib/Utils/SetOrGetIntegrationPointData.h"
......@@ -575,8 +574,9 @@ public:
auto const& w = _ip_data[ip].integration_weight;
double const div_u =
Deformation::divergence<DisplacementDim,
ShapeFunction::NPOINTS>(u, dNdx);
(dNdx.template topRows<DisplacementDim>() *
u.reshaped(ShapeFunction::NPOINTS, DisplacementDim))
.trace();
crack_volume += div_u * d * w;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment