diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h b/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h index 28900e122be01f5f354a18f8797ba4c49d9950e7..a9d82f965f1d77689da568e240ff44d9d1b354eb 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess-impl.h @@ -41,6 +41,9 @@ SmallDeformationProcess<DisplacementDim>::SmallDeformationProcess( _nodal_forces = MeshLib::getOrCreateMeshProperty<double>( mesh, "NodalForces", MeshLib::MeshItemType::Node, DisplacementDim); + _material_forces = MeshLib::getOrCreateMeshProperty<double>( + mesh, "MaterialForces", MeshLib::MeshItemType::Node, DisplacementDim); + _integration_point_writer.emplace_back( std::make_unique<SigmaIntegrationPointWriter>( static_cast<int>(mesh.getDimension() == 2 ? 4 : 6) /*n components*/, @@ -91,6 +94,7 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess( // by location order is needed for output NumLib::ComponentOrder::BY_LOCATION); _nodal_forces->resize(DisplacementDim * mesh.getNumberOfNodes()); + _material_forces->resize(DisplacementDim * mesh.getNumberOfNodes()); Base::_secondary_variables.addSecondaryVariable( "free_energy_density", @@ -274,12 +278,11 @@ void SmallDeformationProcess<DisplacementDim>::postTimestepConcreteProcess( &LocalAssemblerInterface::postTimestep, _local_assemblers, *_local_to_global_index_map, x); + std::unique_ptr<GlobalVector> material_forces; ProcessLib::SmallDeformation::writeMaterialForces( - _material_forces, _local_assemblers, *_local_to_global_index_map, x); + material_forces, _local_assemblers, *_local_to_global_index_map, x); - auto material_forces_property = MeshLib::getOrCreateMeshProperty<double>( - _mesh, "MaterialForces", MeshLib::MeshItemType::Node, DisplacementDim); - _material_forces->copyValues(*material_forces_property); + material_forces->copyValues(*_material_forces); } } // namespace SmallDeformation diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/SmallDeformation/SmallDeformationProcess.h index b1d4236dfe10f60a28410e2452efa9ed2e4cc708..349c45f1bc8ab956241297ab541282bf76fe6aa9 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.h @@ -108,7 +108,7 @@ private: std::unique_ptr<NumLib::LocalToGlobalIndexMap> _local_to_global_index_map_single_component; MeshLib::PropertyVector<double>* _nodal_forces = nullptr; - std::unique_ptr<GlobalVector> _material_forces; + MeshLib::PropertyVector<double>* _material_forces = nullptr; }; extern template class SmallDeformationProcess<2>;