diff --git a/ProcessLib/SmallDeformation/SmallDeformationFEM.h b/ProcessLib/SmallDeformation/SmallDeformationFEM.h index d0e1d6d1a55f71c747285b11f6ad06e4a8be3022..58e9e755aae2be0e2098af565aaa544f4e6c0c4e 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationFEM.h +++ b/ProcessLib/SmallDeformation/SmallDeformationFEM.h @@ -88,7 +88,6 @@ struct SecondaryData struct SmallDeformationLocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, - public ProcessLib::SmallDeformation::NodalForceCalculationInterface, public NumLib::ExtrapolatableElement { virtual std::vector<double> const& getIntPtSigmaXX( @@ -283,16 +282,6 @@ public: } } - std::vector<double> const& getNodalForces( - std::vector<double>& nodal_values) const override - { - return ProcessLib::SmallDeformation::getNodalForces< - DisplacementDim, ShapeFunction, ShapeMatricesType, - NodalDisplacementVectorType, typename BMatricesType::BMatrixType>( - nodal_values, _integration_method, _ip_data, _element, - _is_axially_symmetric); - } - Eigen::Map<const Eigen::RowVectorXd> getShapeMatrix( const unsigned integration_point) const override { diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/SmallDeformation/SmallDeformationProcess.h index f2d4c98cf74c152daf194368462ff5f1866db7bf..7cfc20a71d3df7a6fafa77ffe0f860972a69fed3 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.h @@ -13,7 +13,6 @@ #include "ProcessLib/Process.h" #include "ProcessLib/SmallDeformation/CreateLocalAssemblers.h" -#include "ProcessLib/SmallDeformationCommon/Common.h" #include "SmallDeformationFEM.h" #include "SmallDeformationProcessData.h" @@ -186,6 +185,10 @@ private: _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, dx_dx, M, K, b, Jac, coupling_term); + + b.copyValues(*_nodal_forces); + std::transform(_nodal_forces->begin(), _nodal_forces->end(), + _nodal_forces->begin(), [](double val) { return -val;}); } void preTimestepConcreteProcess(GlobalVector const& x, double const t, @@ -201,14 +204,6 @@ private: _local_assemblers, *_local_to_global_index_map, x, t, dt); } - void postTimestepConcreteProcess(GlobalVector const&) override - { - DBUG("PostTimestep SmallDeformationProcess."); - - ProcessLib::SmallDeformation::writeNodalForces( - *_nodal_forces, _local_assemblers, *_local_to_global_index_map); - } - private: SmallDeformationProcessData<DisplacementDim> _process_data; diff --git a/ProcessLib/SmallDeformation/Tests.cmake b/ProcessLib/SmallDeformation/Tests.cmake index e57c6bd6e7ce3e60556161efc530d2e977c30e6a..d99afdcb63038b8009c4e53be8ed21d3d731aac0 100644 --- a/ProcessLib/SmallDeformation/Tests.cmake +++ b/ProcessLib/SmallDeformation/Tests.cmake @@ -232,3 +232,18 @@ AddTest( uc_01_pcs_0_ts_5000_t_5.000000.vtu uc_01_pcs_0_ts_5000_t_5.000000.vtu displacement displacement uc_01_pcs_0_ts_5000_t_5.000000.vtu uc_01_pcs_0_ts_5000_t_5.000000.vtu sigma_yy sigma_yy ) + +#With PETSc +AddTest( + NAME Parallel_Mechanics_SDL_disc_with_hole + PATH Mechanics/Linear + EXECUTABLE_ARGS disc_with_hole.prj + WRAPPER mpirun + WRAPPER_ARGS -np 4 + TESTER vtkdiff + REQUIREMENTS OGS_USE_MPI + ABSTOL 1e-16 RELTOL 1e-16 + DIFF_DATA + disc_with_hole_pcs_0_ts_4_t_1_000000_0.vtu disc_with_hole_pcs_0_ts_4_t_1_000000_0.vtu displacement displacement + VIS disc_with_hole_pcs_0_ts_0_t_0_000000.pvtu +) diff --git a/ProcessLib/SmallDeformationCommon/Common.h b/ProcessLib/SmallDeformationCommon/Common.h deleted file mode 100644 index 5b65b7e31aed95cda56b1238d5d61fb1d11ba1f4..0000000000000000000000000000000000000000 --- a/ProcessLib/SmallDeformationCommon/Common.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * \file - * - * \copyright - * Copyright (c) 2012-2017, 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 - -#include <cassert> -#include <vector> - -#include "MathLib/LinAlg/Eigen/EigenMapTools.h" -#include "NumLib/DOF/DOFTableUtil.h" -#include "ProcessLib/Deformation/BMatrixPolicy.h" -#include "ProcessLib/Deformation/LinearBMatrix.h" -#include "ProcessLib/Utils/InitShapeMatrices.h" - -namespace ProcessLib -{ -namespace SmallDeformation -{ -struct NodalForceCalculationInterface -{ - virtual std::vector<double> const& getNodalForces( - std::vector<double>& nodal_values) const = 0; - - virtual ~NodalForceCalculationInterface() = default; -}; - -template <int DisplacementDim, typename ShapeFunction, - typename ShapeMatricesType, typename NodalDisplacementVectorType, - typename BMatrixType, typename IPData, typename IntegrationMethod> -std::vector<double> const& getNodalForces( - std::vector<double>& nodal_values, - IntegrationMethod const& _integration_method, IPData const& _ip_data, - MeshLib::Element const& element, bool const is_axially_symmetric) -{ - nodal_values.clear(); - auto local_b = MathLib::createZeroedVector<NodalDisplacementVectorType>( - nodal_values, ShapeFunction::NPOINTS * DisplacementDim); - - unsigned const n_integration_points = - _integration_method.getNumberOfPoints(); - - SpatialPosition x_position; - x_position.setElementID(element.getID()); - - for (unsigned ip = 0; ip < n_integration_points; ip++) - { - x_position.setIntegrationPoint(ip); - auto const& w = _ip_data[ip].integration_weight; - - auto const x_coord = - interpolateXCoordinate<ShapeFunction, ShapeMatricesType>( - element, _ip_data[ip].N); - auto const B = - LinearBMatrix::computeBMatrix<DisplacementDim, - ShapeFunction::NPOINTS, BMatrixType>( - _ip_data[ip].dNdx, _ip_data[ip].N, x_coord, - is_axially_symmetric); - auto& sigma = _ip_data[ip].sigma; - - local_b.noalias() += B.transpose() * sigma * w; - } - - return nodal_values; -} - -template <typename LocalAssemblerInterface> -void writeNodalForces( - MeshLib::PropertyVector<double>& nodal_forces, - std::vector<std::unique_ptr<LocalAssemblerInterface>> const& - local_assemblers, - NumLib::LocalToGlobalIndexMap const& local_to_global_index_map) -{ - DBUG("Compute nodal forces for small deformation process."); - - // Zero-out the output vector before averaging. - std::fill(std::begin(nodal_forces), std::end(nodal_forces), 0); - - GlobalExecutor::executeDereferenced( - [](const std::size_t mesh_item_id, - LocalAssemblerInterface& local_assembler, - const NumLib::LocalToGlobalIndexMap& dof_table, - std::vector<double>& node_values) { - auto const indices = NumLib::getIndices(mesh_item_id, dof_table); - std::vector<double> local_data; - - local_assembler.getNodalForces(local_data); - - assert(local_data.size() == indices.size()); - for (std::size_t i = 0; i < indices.size(); ++i) - node_values[indices[i]] += local_data[i]; - }, - local_assemblers, local_to_global_index_map, nodal_forces); -} - -} // namespace SmallDeformation -} // namespace ProcessLib diff --git a/Tests/Data b/Tests/Data index 590a03ee5da20e8243d559b843e36709e54a8973..2ce27ff2742f92e216c124bf92429916dd9b0aca 160000 --- a/Tests/Data +++ b/Tests/Data @@ -1 +1 @@ -Subproject commit 590a03ee5da20e8243d559b843e36709e54a8973 +Subproject commit 2ce27ff2742f92e216c124bf92429916dd9b0aca