Commit 834b0974 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

started with test problem

parent d3e09269
......@@ -3,13 +3,15 @@
IStochasticEllipticProblem *
CreateStochasticEllipticProblem(const string &problemName, Meshes &meshes) {
if (problemName == "StochasticLaplace1D")
return new StochasticLaplace1D(meshes);
if (problemName == "Laplace1D")
return new Laplace1D(meshes);
if (problemName == "StochasticLaplace2D")
return new StochasticLaplace2D(meshes);
if (problemName == "Laplace2D")
return new Laplace2D(meshes);
Exit(problemName + " not found")
if (problemName == "StochasticLaplace1D")
return new StochasticLaplace1D(meshes);
if (problemName == "Laplace1D")
return new Laplace1D(meshes);
if (problemName == "StochasticLaplace2D")
return new StochasticLaplace2D(meshes);
if (problemName == "Laplace2D")
return new Laplace2D(meshes);
if (problemName == "StochasticLaplace2DTest")
return new StochasticLaplace2DTest(meshes);
Exit(problemName + " not found")
}
\ No newline at end of file
......@@ -6,106 +6,137 @@
class IStochasticEllipticProblem : public IStochasticProblem {
public:
IStochasticEllipticProblem(Meshes &meshes, GeneratorNames genNames = {})
: IStochasticProblem(meshes, genNames) {}
IStochasticEllipticProblem(Meshes &meshes, GeneratorNames genNames = {})
: IStochasticProblem(meshes, genNames) {}
virtual Scalar Solution(const Point &x) const = 0;
virtual Scalar Solution(const Point &x) const = 0;
virtual VectorField Flux(const Point &x) const = 0;
virtual VectorField Flux(const Point &x) const = 0;
virtual Scalar Load(const Point &x) const = 0;
virtual Scalar Load(const Point &x) const = 0;
virtual Tensor Permeability(const cell &c) const = 0;
virtual Tensor Permeability(const cell &c) const = 0;
};
class StochasticLaplace1D : public IStochasticEllipticProblem {
public:
StochasticLaplace1D(Meshes &meshes) :
IStochasticEllipticProblem(meshes, GeneratorNames{"CirculantEmbedding"}) {};
StochasticLaplace1D(Meshes &meshes) :
IStochasticEllipticProblem(meshes, GeneratorNames{"CirculantEmbedding"}) {};
Scalar Solution(const Point &x) const override {
return 1 - x[0];
}
Scalar Solution(const Point &x) const override {
return 1 - x[0];
}
VectorField Flux(const Point &x) const override {
return VectorField(1.0, 0.0);
}
VectorField Flux(const Point &x) const override {
return VectorField(1.0, 0.0);
}
Scalar Load(const Point &x) const override {
return 0.0;
}
Scalar Load(const Point &x) const override {
return 0.0;
}
Tensor Permeability(const cell &c) const override {
return this->genContainer.tensorGenerator->EvalSample(c);
}
Tensor Permeability(const cell &c) const override {
return this->genContainer.tensorGenerator->EvalSample(c);
}
string Name() const override { return "StochasticLaplace1D"; }
string Name() const override { return "StochasticLaplace1D"; }
};
class Laplace1D : public IStochasticEllipticProblem {
public:
Laplace1D(Meshes &meshes) : IStochasticEllipticProblem(meshes) {};
Laplace1D(Meshes &meshes) : IStochasticEllipticProblem(meshes) {};
Scalar Solution(const Point &x) const override {
return 1 - x[0];
}
Scalar Solution(const Point &x) const override {
return 1 - x[0];
}
VectorField Flux(const Point &x) const override {
return VectorField(-1.0, 0.0);
}
VectorField Flux(const Point &x) const override {
return VectorField(-1.0, 0.0);
}
Scalar Load(const Point &x) const override {
return 0.0;
}
Scalar Load(const Point &x) const override {
return 0.0;
}
Tensor Permeability(const cell &c) const override {
return One;
}
Tensor Permeability(const cell &c) const override {
return One;
}
string Name() const override { return "Laplace1D"; }
string Name() const override { return "Laplace1D"; }
};
class StochasticLaplace2D : public IStochasticEllipticProblem {
public:
StochasticLaplace2D(Meshes &meshes) :
IStochasticEllipticProblem(meshes, GeneratorNames{"CirculantEmbedding"}) {}
StochasticLaplace2D(Meshes &meshes) :
IStochasticEllipticProblem(meshes, GeneratorNames{"CirculantEmbedding"}) {}
Scalar Solution(const Point &x) const override {
return -x[1];
}
Scalar Solution(const Point &x) const override {
return -x[1];
}
VectorField Flux(const Point &x) const override {
return VectorField(0.0, -1.0);
}
VectorField Flux(const Point &x) const override {
return VectorField(0.0, -1.0);
}
Scalar Load(const Point &x) const override { return 0.0; }
Scalar Load(const Point &x) const override { return 0.0; }
Tensor Permeability(const cell &c) const override {
return this->genContainer.tensorGenerator->EvalSample(c);
}
Tensor Permeability(const cell &c) const override {
return this->genContainer.tensorGenerator->EvalSample(c);
}
string Name() const override { return "StochasticLaplace2D"; }
string Name() const override { return "StochasticLaplace2D"; }
};
class Laplace2D : public IStochasticEllipticProblem {
class StochasticLaplace2DTest : public IStochasticEllipticProblem {
public:
Laplace2D(Meshes &meshes) : IStochasticEllipticProblem(meshes) {}
StochasticLaplace2DTest(Meshes &meshes) :
IStochasticEllipticProblem(meshes, GeneratorNames{"UniformDistributionReal"}) {}
Scalar Solution(const Point &x) const override {
return -x[1];
}
Scalar Solution(const Point &x) const override {
return -x[1];
}
VectorField Flux(const Point &x) const override {
return VectorField(0.0, -1.0);
}
VectorField Flux(const Point &x) const override {
return VectorField(0.0, -1.0);
}
Scalar Load(const Point &x) const override { return 0.0; }
Scalar Load(const Point &x) const override { return 0.0; }
Tensor Permeability(const cell &c) const override {
Tensor Permeability(const cell &c) const override {
if (c()[1] > 0.125 && c()[1] < 0.375) {
if (c()[0] > 0.125 && c()[0] < 0.375)
// return this->genContainer.scalarGenerator->EvalSample() * One;
return 2 * One;
else {
return One;
}
} else {
return One;
}
}
string Name() const override { return "StochasticLaplace2D"; }
};
class Laplace2D : public IStochasticEllipticProblem {
public:
Laplace2D(Meshes &meshes) : IStochasticEllipticProblem(meshes) {}
Scalar Solution(const Point &x) const override {
return -x[1];
}
VectorField Flux(const Point &x) const override {
return VectorField(0.0, -1.0);
}
Scalar Load(const Point &x) const override { return 0.0; }
Tensor Permeability(const cell &c) const override {
return One;
}
string Name() const override { return "Laplace2D"; }
string Name() const override { return "Laplace2D"; }
};
IStochasticEllipticProblem *
......
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