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

MyConvexProblem -> ConvexProblem

parent 0241b115
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ class GlobalNonlinearity {
public:
using MatrixType = MatrixTypeTEMPLATE;
using VectorType = VectorTypeTEMPLATE;
using LocalMatrixType = typename MatrixType::block_type;
using LocalVectorType = typename VectorType::block_type;
static const int block_size = LocalVectorType::dimension;
using FrictionType = LocalFriction<block_size>;
......
// Based on dune/tnnmg/problem-classes/convexproblem.hh
// Allows phi to be const; does away with everything we do not need
#ifndef MY_CONVEX_PROBLEM_HH
#define MY_CONVEX_PROBLEM_HH
// Just for debugging
#include "dune/solvers/computeenergy.hh"
#include "globalnonlinearity.hh"
template <class MatrixTypeTEMPLATE, class VectorTypeTEMPLATE>
class MyConvexProblem {
public:
using VectorType = VectorTypeTEMPLATE;
using MatrixType = MatrixTypeTEMPLATE;
using LocalVectorType = typename VectorType::block_type;
using LocalMatrixType = typename MatrixType::block_type;
int static const block_size = VectorType::block_type::dimension;
/** \brief Constructor with the problem components
\param A The matrix of the quadratic part
\param f The linear functional
\param u The solution vector
*/
MyConvexProblem(MatrixType const &A,
Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi,
VectorType const &f)
: A(A), phi(phi), f(f) {}
/* Just for debugging */
double operator()(VectorType const &x) const {
return phi(x) + computeEnergy(A, x, f);
}
MatrixType const &A;
Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi;
VectorType const &f;
};
#endif
......@@ -12,14 +12,16 @@
#include <dune/solvers/transferoperators/compressedmultigridtransfer.hh>
#include <dune/fufem/assemblers/transferoperatorassembler.hh>
#include <dune/tnnmg/iterationsteps/tnnmgstep.hh>
#include <dune/tnnmg/problem-classes/convexproblem.hh>
#include "dune/tectonic/myblockproblem.hh"
#include "dune/tectonic/myconvexproblem.hh"
#include "dune/tectonic/globalnonlinearity.hh"
template <int dim, class MatrixType, class VectorType, class GridType>
class MySolver {
private:
using ConvexProblemType = MyConvexProblem<MatrixType, VectorType>;
using ConvexProblemType = ConvexProblem<
Dune::GlobalNonlinearity<MatrixType, VectorType>, MatrixType>;
using BlockProblemType = MyBlockProblem<ConvexProblemType>;
using NonlinearSmootherType = GenericNonlinearGS<BlockProblemType>;
using SolverType = TruncatedNonsmoothNewtonMultigrid<BlockProblemType,
......
......@@ -8,9 +8,6 @@
#include <dune/istl/bcrsmatrix.hh>
#include <dune/istl/bvector.hh>
#include <dune/tectonic/myblockproblem.hh>
#include <dune/tectonic/myconvexproblem.hh>
using SmallVector = Dune::FieldVector<double, DIM>;
using SmallMatrix = Dune::FieldMatrix<double, DIM, DIM>;
using VectorType = Dune::BlockVector<SmallVector>;
......
......@@ -63,9 +63,9 @@
#include <dune/solvers/norms/sumnorm.hh>
#include <dune/solvers/solvers/loopsolver.hh>
#include <dune/solvers/solvers/solver.hh> // Solver::FULL
#include <dune/tnnmg/problem-classes/convexproblem.hh>
#include <dune/tectonic/myblockproblem.hh>
#include <dune/tectonic/myconvexproblem.hh>
#include "assemblers.hh"
#include "mysolver.hh"
......@@ -411,11 +411,14 @@ int main(int argc, char *argv[]) {
SingletonVectorType const &_alpha) {
myGlobalNonlinearity->updateState(_alpha);
using MyConvexProblemType = MyConvexProblem<MatrixType, VectorType>;
MyConvexProblemType const myConvexProblem(
problem_AB, *myGlobalNonlinearity, problem_rhs);
MyBlockProblem<MyConvexProblemType> velocityProblem(parset,
myConvexProblem);
using ConvexProblemType = ConvexProblem<
Dune::GlobalNonlinearity<MatrixType, VectorType>, MatrixType>;
// FIXME: Do we really need to pass u here?
ConvexProblemType const myConvexProblem(1.0, problem_AB,
*myGlobalNonlinearity,
problem_rhs, _problem_iterate);
MyBlockProblem<ConvexProblemType> velocityProblem(parset,
myConvexProblem);
multigridStep->setProblem(_problem_iterate, velocityProblem);
velocityProblemSolver.preprocess();
......
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