Commit 82e8105f authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Add von mises stress visualization to example

parent 7e79f38b
......@@ -2,7 +2,7 @@
#define DUNE_STRUCTURES_VON_MISES_HH
#include<dune/pdelab.hh>
#include<dune/structures/material.hh>
#include<dune/fiber-elasticity/material.hh>
#include<array>
#include<memory>
......
......@@ -9,6 +9,7 @@
// Stuff that I use for setting up the problem
#include<dune/fiber-elasticity/callabletree.hh>
#include<dune/fiber-elasticity/vonmises.hh>
// General Dune stuff
#include<dune/common/parallel/mpihelper.hh>
......@@ -96,7 +97,22 @@ int main(int argc, char** argv)
// Visualization
Dune::SubsamplingVTKWriter vtkwriter(gv, Dune::RefinementIntervals(2));
Dune::PDELab::addSolutionToVTKWriter(vtkwriter, vgfs, body_force , Dune::PDELab::vtk::DefaultFunctionNameGenerator("BF"));
// Add the displacement field visualization
Dune::PDELab::addSolutionToVTKWriter(vtkwriter, vgfs, displacement , Dune::PDELab::vtk::DefaultFunctionNameGenerator("Displacement"));
// Add von Mises stress visualization
using P1FEM = Dune::PDELab::PkLocalFiniteElementMap<EntitySet, double, double, 1>;
using P1GFS = Dune::PDELab::GridFunctionSpace<EntitySet, P1FEM, Dune::PDELab::NoConstraints, LeafVectorBackend>;
using StressVector = Dune::PDELab::Backend::Vector<P1GFS, double>;
P1FEM p1fem(es);
P1GFS p1gfs(es, p1fem);
StressVector stress_container(p1gfs);
VonMisesStressGridFunction<Vector, 2> stress(displacement, material);
Dune::PDELab::interpolate(stress, p1gfs, stress_container);
Dune::PDELab::addSolutionToVTKWriter(vtkwriter, p1gfs, stress_container, Dune::PDELab::vtk::DefaultFunctionNameGenerator("von-Mises stress"));
// Write visualization to file
vtkwriter.write("output", Dune::VTK::appendedraw);
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment