Commit 099fad7f authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

updated ref on mpp

parent 88511e0b
Pipeline #110045 passed with stages
in 9 minutes and 1 second
...@@ -43,6 +43,18 @@ public: ...@@ -43,6 +43,18 @@ public:
Vector fineSolution; Vector fineSolution;
Vector coarseSolution; Vector coarseSolution;
/*
* Ultimativ braucht die MC nur noch level dM und baseLevel
* außerdem einmal Assemble! Die Assemble kennt das Problem und das
* Problem zieht ein neues Sample mit SampleID
*
*
* Meshes Objekt sollte sowieso hier erzeugt werden!
*
* Brauche Funktion CreateSampleID
*/
MonteCarloTransport(int l, int dM, bool baseLevel, MonteCarloTransport(int l, int dM, bool baseLevel,
Meshes *meshes, StochasticField *stochFields, Meshes *meshes, StochasticField *stochFields,
DGTransportAssemble *assemble) : DGTransportAssemble *assemble) :
......
...@@ -41,3 +41,50 @@ void HybridFluxGenerator::initialize(bool fineField) { ...@@ -41,3 +41,50 @@ void HybridFluxGenerator::initialize(bool fineField) {
} }
*flux = 0.0, *u = 0.0; *flux = 0.0, *u = 0.0;
} }
//HybridMainForPollutionProblem::HybridMainForPollutionProblem(Meshes &meshes) {
// config.get("HybridVerbose", verbose);
// Initialize(meshes);
// PrintInfo();
// ResetVectors();
// Solve();
//}
//
//void HybridMainForPollutionProblem::Initialize(Meshes &meshes) {
// disc = std::make_shared<RTLagrangeDiscretization>(meshes, 0, 0);
// problem = std::make_shared<Laplace2D>();
// assemble = std::make_shared<HybridEllipticAssemble>(disc.get(), problem.get());
// mGraphs = std::make_shared<MatrixGraphs>(meshes, dof("face", 1));
// pc = std::shared_ptr<Preconditioner>(GetPC("SuperLU"));
// solver = std::make_shared<Solver>(pc.get(), "GMRES");
// newton = std::make_shared<Newton>(*solver);
// u = std::make_shared<Vector>(mGraphs->fine());
// normalFlux = std::make_shared<Vector>(mGraphs->fine());
//}
//
//void HybridMainForPollutionProblem::PrintInfo() const {
// if (verbose == 0) return;
// assemble->PrintInfo();
// solver->PrintInfo();
//}
//
//void HybridMainForPollutionProblem::ResetVectors() const {
// (*u) = 0.0;
// (*normalFlux) = 0.0;
//}
//
//void HybridMainForPollutionProblem::Solve() const {
// mout.StartBlock("Hybrid Flux Problem");
// mout << "Solve" << endl;
// (*newton)(*assemble, *u);
// assemble->SetNormalFlux(*u, *normalFlux);
// mout.EndBlock();
// mout << endl;
//}
//
//void HybridMainForPollutionProblem::EquipHybridFluxTransport(
// StochasticHybridFluxTransport *hybridFluxTransport) {
// hybridFluxTransport->SetHybridEllipticAssemble(assemble.get());
// hybridFluxTransport->SetFlux(normalFlux.get());
//}
...@@ -3,10 +3,13 @@ ...@@ -3,10 +3,13 @@
#include "SampleGenerator.hpp" #include "SampleGenerator.hpp"
#include "CirculantEmbedding.hpp" #include "CirculantEmbedding.hpp"
#include "assemble/HybridEllipticAssemble.hpp"
#include "problem/StochasticEllipticProblem.hpp" #include "problem/StochasticEllipticProblem.hpp"
#include "assemble/HybridEllipticAssemble.hpp"
#include "problem/StochasticHybridFlux.hpp"
#include "problem/StochasticTransportProblem.hpp"
#include "discretization/RTLagrangeDiscretization.hpp" #include "discretization/RTLagrangeDiscretization.hpp"
#include "solver/Newton.h" #include "solver/Newton.h"
#include <memory>
class HybridFluxGenerator : public SampleGenerator { class HybridFluxGenerator : public SampleGenerator {
...@@ -22,7 +25,7 @@ private: ...@@ -22,7 +25,7 @@ private:
void initialize(bool fineField); void initialize(bool fineField);
protected: protected:
shared_ptr<IDiscretization> disc; shared_ptr<RTLagrangeDiscretization> disc;
shared_ptr<StochasticEllipticProblem> problem; shared_ptr<StochasticEllipticProblem> problem;
unique_ptr<HybridEllipticAssemble> assemble; unique_ptr<HybridEllipticAssemble> assemble;
unique_ptr<CirculantEmbedding> permeabilityGenerator; unique_ptr<CirculantEmbedding> permeabilityGenerator;
...@@ -74,4 +77,48 @@ public: ...@@ -74,4 +77,48 @@ public:
} }
}; };
/*
* This is class just serves as a helper to equip
* advection problems with the results of an hybrid
* flux computation.
*/
class HybridMainForPollutionProblem {
private:
std::shared_ptr<RTLagrangeDiscretization> disc;
std::shared_ptr<StochasticLaplace2D> problem;
std::shared_ptr<MatrixGraphs> mGraphs;
std::shared_ptr<Preconditioner> pc;
std::shared_ptr<Solver> solver;
std::shared_ptr<Newton> newton;
public:
HybridMainForPollutionProblem(Meshes &meshes);
void Initialize(Meshes &meshes);
void PrintInfo() const;
void ResetVectors() const;
void Solve() const;
void EquipHybridFluxTransport(StochasticHybridFlux *hybridFluxTransport);
std::shared_ptr<Vector> u;
std::shared_ptr<Vector> normalFlux;
std::shared_ptr<HybridEllipticAssemble> assemble;
};
#endif //HYBRIDFLUXGENERATOR_HPP #endif //HYBRIDFLUXGENERATOR_HPP
Subproject commit 43574d9bab2f43250ff41934280738a0e1de8708 Subproject commit a5aba5d30097c5b827477fdce1afb4f1df936f4d
This diff is collapsed.
...@@ -246,7 +246,7 @@ class MLMCMpp(Mpp): ...@@ -246,7 +246,7 @@ class MLMCMpp(Mpp):
plt.show() plt.show()
def perm_potential_plot_1d(self, sample_ids, perm="kappa.vtk", u="u.vtk", def perm_potential_plot_1d(self, sample_ids, perm="kappa.vtk", u="u.vtk",
dpi=200.0, save_only=False, same_plot=True): dpi=200.0, save_only=False, same_plot=True, color='black'):
if isinstance(sample_ids, str): if isinstance(sample_ids, str):
sample_ids = [sample_ids] sample_ids = [sample_ids]
...@@ -260,9 +260,9 @@ class MLMCMpp(Mpp): ...@@ -260,9 +260,9 @@ class MLMCMpp(Mpp):
if not os.path.exists(path): if not os.path.exists(path):
raise FileNotFoundError('Sample folder {} not found'.format(path)) raise FileNotFoundError('Sample folder {} not found'.format(path))
p.set_wd(path) p.set_wd(path)
p.add_1d_vtk(perm, ax=p.ax1) p.add_1d_vtk(perm, ax=p.ax1, color=color)
p.ax1.set_title('Permeability') p.ax1.set_title('Permeability')
p.add_1d_vtk(u, ax=p.ax2) p.add_1d_vtk(u, ax=p.ax2, color=color)
p.ax2.set_title('Potential') p.ax2.set_title('Potential')
png_file = os.path.abspath(os.path.join(mpp.PROJECT_PY_DATA_DIR, png_file = os.path.abspath(os.path.join(mpp.PROJECT_PY_DATA_DIR,
'perm_potential.png')) 'perm_potential.png'))
......
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