Commit 6fcedb17 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

Introduced PDESolver

parent 9f617e8c
#include "PDESolver.hpp"
#include "assemble/LagrangeEllipticAssemble.hpp"
void EllipticPDESolver::run(IAssemble *assemble, SampleSolution &solution) {
newton(*assemble, solution.U);
// Todo functional
// Todo plotting
}
void TransportPDESolver::run(IAssemble *assemble, SampleSolution &solution) {
TimeSeries timeSeries;
timeInt(dynamic_cast<TAssemble *>(assemble), timeSeries, solution.U);
// Todo functional
// Todo plotting
}
#ifndef PDESOLVER_HPP
#define PDESOLVER_HPP
#include "utility/SampleID.hpp"
#include "solver/Solver.h"
#include "solver/Newton.h"
#include "timestepping/TimeIntegrator.hpp"
class PDESolver {
protected:
int verbose = 1;
virtual void run(IAssemble *assemble, SampleSolution &solution) = 0;
public:
PDESolver() {
config.get("PDESolverVerbose", verbose);
}
void Run(IAssemble *assemble, SampleSolution &solution) {
mout.StartBlock("PDESolver");
vout(1) << solution.id.Str() << endl;
run(assemble, solution);
vout(1) << "Q=" << solution.Q << " cost=" << solution.Cost << endl;
mout.EndBlock(verbose == 0);
}
};
class EllipticPDESolver : public PDESolver {
private:
Solver solver;
Newton newton;
protected:
void run(IAssemble *assemble, SampleSolution &solution) override;
public:
EllipticPDESolver() :
PDESolver(),
solver(Solver(GetPC("SuperLU"), "GMRES")),
newton(Newton(solver)) {}
};
class TransportPDESolver : public PDESolver {
private:
Solver solver;
TimeIntegrator timeInt;
protected:
void run(IAssemble *assemble, SampleSolution &solution) override;
TransportPDESolver() :
PDESolver(),
solver(Solver(GetPC("PointBlockGaussSeidel"), "GMRES")),
timeInt(TimeIntegrator(solver)) {}
};
#endif //PDESOLVER_HPP
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