From a88c6a7ef64eac6df3448f0551b219a02f99fec7 Mon Sep 17 00:00:00 2001 From: lijas Date: Tue, 31 Oct 2023 13:30:15 +0100 Subject: [PATCH] add output for material states in fe part --- src/parts/fepart.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/parts/fepart.jl b/src/parts/fepart.jl index f36f822..1c20f8d 100644 --- a/src/parts/fepart.jl +++ b/src/parts/fepart.jl @@ -321,6 +321,28 @@ function eval_part_node_data(part::Part, nodeoutput::VTKNodeOutput{<:StressOutpu return data[part.geometry.nodemapper] end +function eval_part_node_data(part::Part, nodeoutput::VTKNodeOutput{<:MaterialStateOutput{MaterialState_t}}, state, globaldata) where MaterialState_t + + #Extract stresses to interpolate + _cellid = first(part.cellset) + first_state = first(state.partstates[_cellid].materialstates) + if !hasproperty(first_state, nodeoutput.type.field) + return + end + + qpdata = Vector{MaterialState_t}[] + for (ic, cellid) in enumerate(part.cellset) + matstates = state.partstates[cellid].materialstates + field_states = getproperty.(matstates, nodeoutput.type.field) + push!(qpdata, field_states) + end + + data = zeros(MaterialState_t, getnnodes(globaldata.grid)) + _collect_nodedata!(data, part, qpdata, globaldata) + return data[part.geometry.nodemapper] + +end + function post_part!(dh, part::Part, states::StateVariables) end