Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
099fad7f
Commit
099fad7f
authored
Sep 17, 2020
by
niklas.baumgarten
Browse files
updated ref on mpp
parent
88511e0b
Pipeline
#110045
passed with stages
in 9 minutes and 1 second
Changes
6
Pipelines
5
Expand all
Hide whitespace changes
Inline
Side-by-side
mlmc/src/montecarlo/MonteCarloTransport.hpp
View file @
099fad7f
...
...
@@ -43,6 +43,18 @@ public:
Vector
fineSolution
;
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
,
Meshes
*
meshes
,
StochasticField
*
stochFields
,
DGTransportAssemble
*
assemble
)
:
...
...
mlmc/src/stochastics/HybridFluxGenerator.cpp
View file @
099fad7f
...
...
@@ -41,3 +41,50 @@ void HybridFluxGenerator::initialize(bool fineField) {
}
*
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());
//}
mlmc/src/stochastics/HybridFluxGenerator.hpp
View file @
099fad7f
...
...
@@ -3,10 +3,13 @@
#include
"SampleGenerator.hpp"
#include
"CirculantEmbedding.hpp"
#include
"assemble/HybridEllipticAssemble.hpp"
#include
"problem/StochasticEllipticProblem.hpp"
#include
"assemble/HybridEllipticAssemble.hpp"
#include
"problem/StochasticHybridFlux.hpp"
#include
"problem/StochasticTransportProblem.hpp"
#include
"discretization/RTLagrangeDiscretization.hpp"
#include
"solver/Newton.h"
#include
<memory>
class
HybridFluxGenerator
:
public
SampleGenerator
{
...
...
@@ -22,7 +25,7 @@ private:
void
initialize
(
bool
fineField
);
protected:
shared_ptr
<
I
Discretization
>
disc
;
shared_ptr
<
RTLagrange
Discretization
>
disc
;
shared_ptr
<
StochasticEllipticProblem
>
problem
;
unique_ptr
<
HybridEllipticAssemble
>
assemble
;
unique_ptr
<
CirculantEmbedding
>
permeabilityGenerator
;
...
...
@@ -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
mpp
@
a5aba5d3
Compare
43574d9b
...
a5aba5d3
Subproject commit
43574d9bab2f43250ff41934280738a0e1de8708
Subproject commit
a5aba5d30097c5b827477fdce1afb4f1df936f4d
notebooks/Elliptic Experiments.ipynb
View file @
099fad7f
This diff is collapsed.
Click to expand it.
python/mlmc_mppy.py
View file @
099fad7f
...
...
@@ -246,7 +246,7 @@ class MLMCMpp(Mpp):
plt
.
show
()
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
):
sample_ids
=
[
sample_ids
]
...
...
@@ -260,9 +260,9 @@ class MLMCMpp(Mpp):
if
not
os
.
path
.
exists
(
path
):
raise
FileNotFoundError
(
'Sample folder {} not found'
.
format
(
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
.
add_1d_vtk
(
u
,
ax
=
p
.
ax2
)
p
.
add_1d_vtk
(
u
,
ax
=
p
.
ax2
,
color
=
color
)
p
.
ax2
.
set_title
(
'Potential'
)
png_file
=
os
.
path
.
abspath
(
os
.
path
.
join
(
mpp
.
PROJECT_PY_DATA_DIR
,
'perm_potential.png'
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment