Commit 1f6ccdf0 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

started to re- implement transport

parent c9b17e5f
Pipeline #83913 failed with stages
in 5 minutes and 57 seconds
......@@ -9,13 +9,12 @@
class DGTAssemble : public TAssemble, public DGUtils {
public:
DGDiscretization *disc;
Plot *plot;
int plot_tStep = 1;
Scalar gamma = 1.0;
explicit DGTAssemble(DGDiscretization *disc, Plot *plot) :
disc(disc), plot(plot) {};
explicit DGTAssemble(DGDiscretization *disc) :
disc(disc) {};
const char *Name() const override { return "DGTAssemble"; }
......
......@@ -5,19 +5,22 @@
#include "utils/IndentedLogger.hpp"
#include <memory>
class DGTransportAssemble : public DGTAssemble {
public:
StochasticTransportProblem *problem;
IndentedLogger *logger;
// std::shared_ptr<IDiscretizationT<>> disc;
std::shared_ptr<StochasticTransportProblem> problem;
string sampleDir = "";
IndentedLogger *logger;
double flux_alpha = 1.0;
double diffusion = 0.0;
DGTransportAssemble(Discretization *disc, StochasticTransportProblem *problem,
Plot *plot) : DGTAssemble(dynamic_cast<DGDiscretization *>(disc),
plot), problem(problem) {
// Todo Super Hacky!
DGTransportAssemble(std::shared_ptr<IDiscretizationT<>> disc,
std::shared_ptr<StochasticTransportProblem> problem)
: DGTAssemble(dynamic_cast<DGDiscretization *>(disc.get())),
problem(move(problem)) {
ReadConfig(Settings, "flux_alpha", flux_alpha);
logger = IndentedLogger::GetInstance();
}
......@@ -245,35 +248,37 @@ public:
}
void VtkPlotting(double t, const Vector &u) const override {
const Mesh &Mp = plot->GetMesh();
const Mesh &Mu = u.GetMesh();
if (Mp.Cells::size() != Mu.Cells::size()) return;
vout (2) << " => VtkPlotting result of step " << step << ".\n";
char filename[128];
VtkPlotting_cell(t, u, filename);
// Todo
// const Mesh &Mp = plot->GetMesh();
// const Mesh &Mu = u.GetMesh();
// if (Mp.Cells::size() != Mu.Cells::size()) return;
// vout (2) << " => VtkPlotting result of step " << step << ".\n";
// char filename[128];
// VtkPlotting_cell(t, u, filename);
}
void VtkPlotting_cell(double t, const Vector &u, char *filename) const {
Vector u_tmp(u);
for (cell c = u_tmp.cells(); c != u_tmp.cells_end(); ++c) {
DGElement elem(*disc, u_tmp, c);
Scalar U = 0.0;
double a = 0;
for (int q = 0; q < elem.nQ(); ++q) {
double w = elem.QWeight(q);
U += w * elem.Value(q, u);
a += w;
}
U *= (1 / a);
row r = u.find_row(c());
u_tmp(r)[0] = U;
}
plot->celldata(u_tmp, 1);
string name = "";
name = name.append(sampleDir).append("/U");
NumberName(const_cast<char *>(name.c_str()), filename, step);
plot->vtk_celldata(filename, 0);
plot->gnu_celldata(filename, 0);
// Todo
// Vector u_tmp(u);
// for (cell c = u_tmp.cells(); c != u_tmp.cells_end(); ++c) {
// DGElement elem(*disc, u_tmp, c);
// Scalar U = 0.0;
// double a = 0;
// for (int q = 0; q < elem.nQ(); ++q) {
// double w = elem.QWeight(q);
// U += w * elem.Value(q, u);
// a += w;
// }
// U *= (1 / a);
// row r = u.find_row(c());
// u_tmp(r)[0] = U;
// }
// plot->celldata(u_tmp, 1);
// string name = "";
// name = name.append(sampleDir).append("/U");
// NumberName(const_cast<char *>(name.c_str()), filename, step);
// plot->vtk_celldata(filename, 0);
// plot->gnu_celldata(filename, 0);
}
void PrintMatrixInfo(Matrix &A, int diagonal) const override {
......
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