Skip to content
Snippets Groups Projects
Commit 05bbe5a0 authored by KeitaYoshioka's avatar KeitaYoshioka Committed by Dmitri Naumov
Browse files

[PL] PF: Add Nodal forces output.

parent 7c24d028
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,8 @@ PhaseFieldProcess<DisplacementDim>::PhaseFieldProcess( ...@@ -40,6 +40,8 @@ PhaseFieldProcess<DisplacementDim>::PhaseFieldProcess(
use_monolithic_scheme), use_monolithic_scheme),
_process_data(std::move(process_data)) _process_data(std::move(process_data))
{ {
_nodal_forces = MeshLib::getOrCreateMeshProperty<double>(
mesh, "NodalForces", MeshLib::MeshItemType::Node, DisplacementDim);
} }
template <int DisplacementDim> template <int DisplacementDim>
...@@ -158,6 +160,8 @@ void PhaseFieldProcess<DisplacementDim>::initializeConcreteProcess( ...@@ -158,6 +160,8 @@ void PhaseFieldProcess<DisplacementDim>::initializeConcreteProcess(
mesh.getElements(), dof_table, _local_assemblers, mesh.getElements(), dof_table, _local_assemblers,
mesh.isAxiallySymmetric(), integration_order, _process_data); mesh.isAxiallySymmetric(), integration_order, _process_data);
_nodal_forces->resize(DisplacementDim * mesh.getNumberOfNodes());
Base::_secondary_variables.addSecondaryVariable( Base::_secondary_variables.addSecondaryVariable(
"sigma_xx", "sigma_xx",
makeExtrapolator(1, getExtrapolator(), _local_assemblers, makeExtrapolator(1, getExtrapolator(), _local_assemblers,
...@@ -327,6 +331,13 @@ void PhaseFieldProcess<DisplacementDim>::assembleWithJacobianConcreteProcess( ...@@ -327,6 +331,13 @@ void PhaseFieldProcess<DisplacementDim>::assembleWithJacobianConcreteProcess(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, dof_tables, t, x, xdot, dxdot_dx, dx_dx, M, K, b, _local_assemblers, dof_tables, t, x, xdot, dxdot_dx, dx_dx, M, K, b,
Jac, _coupled_solutions); Jac, _coupled_solutions);
if (_use_monolithic_scheme || (_coupled_solutions->process_id == 0))
{
b.copyValues(*_nodal_forces);
std::transform(_nodal_forces->begin(), _nodal_forces->end(),
_nodal_forces->begin(), [](double val) { return -val; });
}
} }
template <int DisplacementDim> template <int DisplacementDim>
......
...@@ -114,6 +114,8 @@ private: ...@@ -114,6 +114,8 @@ private:
std::unique_ptr<NumLib::LocalToGlobalIndexMap> std::unique_ptr<NumLib::LocalToGlobalIndexMap>
_local_to_global_index_map_single_component; _local_to_global_index_map_single_component;
MeshLib::PropertyVector<double>* _nodal_forces = nullptr;
/// Sparsity pattern for the phase field equation, and it is initialized /// Sparsity pattern for the phase field equation, and it is initialized
/// only if the staggered scheme is used. /// only if the staggered scheme is used.
GlobalSparsityPattern _sparsity_pattern_with_single_component; GlobalSparsityPattern _sparsity_pattern_with_single_component;
......
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