Skip to content
Snippets Groups Projects
Commit bef6168a authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Play around with the StVKA

parent 4f9f1cf6
No related branches found
No related tags found
No related merge requests found
SUBDIRS = SUBDIRS =
check_PROGRAMS = \ check_PROGRAMS = \
...@@ -6,7 +5,11 @@ check_PROGRAMS = \ ...@@ -6,7 +5,11 @@ check_PROGRAMS = \
test-gradient-method test-gradient-method
bin_PROGRAMS = \ bin_PROGRAMS = \
gauss-seidel-sample gauss-seidel-sample \
one-body-sample
one_body_sample_SOURCES = \
one-body-sample.cc
gauss_seidel_sample_SOURCES = \ gauss_seidel_sample_SOURCES = \
gauss-seidel-sample.cc gaussseidel.hh gauss-seidel-sample.cc gaussseidel.hh
......
/* -*- mode:c++; mode:semantic -*- */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <dune/common/exceptions.hh>
#include <dune/common/fmatrix.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/fufem/functionspacebases/p1nodalbasis.hh>
#include <dune/fufem/assemblers/operatorassembler.hh>
#include <dune/fufem/assemblers/localassemblers/stvenantkirchhoffassembler.hh>
#include <exception>
int const dim = 2;
int main() {
try {
typedef Dune::BCRSMatrix<Dune::FieldMatrix<double, dim, dim>> OperatorType;
// FIXME: Random values
double const E = 1e8;
double const nu = 0.3;
int const refinements = 5;
typedef Dune::YaspGrid<dim> GridType;
Dune::FieldVector<double, dim> const end_points(
1); // nth dimension (zero-indexed) goes from 0 to end_points[n]
Dune::FieldVector<int, dim> const elements(
2); // number of elements in each direction
Dune::FieldVector<bool, dim> const periodic(false);
GridType grid(end_points, elements, periodic, 0);
grid.globalRefine(refinements);
typedef P1NodalBasis<GridType::LeafGridView, double> P1Basis;
P1Basis const p1Basis(grid.leafView());
OperatorAssembler<P1Basis, P1Basis> const globalAssembler(p1Basis, p1Basis);
StVenantKirchhoffAssembler<GridType, P1Basis::LocalFiniteElement,
P1Basis::LocalFiniteElement> const
localStiffness(E, nu);
OperatorType stiffnessMatrix;
globalAssembler.assemble(localStiffness, stiffnessMatrix);
return 0;
}
catch (Dune::Exception& e) {
Dune::derr << "Dune reported error: " << e << std::endl;
}
catch (std::exception& e) {
std::cout << "Standard exception: " << e.what() << std::endl;
}
}
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