swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: 312fdf97c1ea0a747221eb491884bfa558b14b2e authored by Shuang Chen on 01 March 2021, 13:52:50 UTC
[HC/docu] fixed the input parameter typo and equation format errors
Tip revision: 312fdf9
Divergence.h
/**
 * \file
 *
 * \copyright
 * Copyright (c) 2012-2021, 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
back to top