Commit 7e1f499c authored by chinsp's avatar chinsp
Browse files

figured out the issues with qptotal sparse grid

parent fb38b753
Pipeline #159785 failed with stages
in 11 minutes and 27 seconds
......@@ -27,6 +27,8 @@ CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshe
return new SparseGrid2DPolyDeg2Problem(meshes);
if (problemName == "SparseGrid2DPD2qptotProblem")
return new SparseGrid2DPD2qptotProblem(meshes);
if (problemName == "SparseGrid2DhermiteProblem")
return new SparseGrid2DhermiteProblem(meshes);
if (problemName == "SparseGrid2DPD2qptotProblemFail")
return new SparseGrid2DPD2qptotProblemFail(meshes);
if (problemName == "SparseGrid2DPD3qptotProblemFail")
......
......@@ -283,6 +283,24 @@ public:
}
};
class SparseGrid2DhermiteProblem : public SparseGridGeneratorProblem {
public:
explicit SparseGrid2DhermiteProblem(const Meshes &meshes) :
SparseGridGeneratorProblem(meshes, SparseGridGenerator(meshes, 1, 0, 5, TasGrid::type_qptotal, TasGrid::rule_gausshermite)) {}
double FunctionEvaluation() override {
RVector sample = this->generator.EvalSample();
//double y1 = sample[0];
return 1;
}
string Name() const override {
return "SparseGrid2DhermiteProblem";
}
};
// this test is meant to fail. We are using a sparse grid that only integrates functions exactly upto degree 1 or less
class SparseGrid2DPD2qptotProblemFail : public SparseGridGeneratorProblem {
public:
......@@ -293,7 +311,7 @@ public:
RVector sample = this->generator.EvalSample();
double y1 = sample[0];
double y2 = sample[1];
return 3.0 * (1 + y1 + pow(y1,3) + y2 + pow(y1,3) + y1 * y2);
return 1 + y1 + pow(y1,4) + y2 + pow(y2,5) + y1 * y2;
}
string Name() const override {
......@@ -304,13 +322,13 @@ public:
class SparseGrid2DPD3qptotProblemFail : public SparseGridGeneratorProblem {
public:
explicit SparseGrid2DPD3qptotProblemFail(const Meshes &meshes) :
SparseGridGeneratorProblem(meshes, SparseGridGenerator(meshes, 2, 0, 3, TasGrid::type_iptotal)) {}
SparseGridGeneratorProblem(meshes, SparseGridGenerator(meshes, 2, 0, 4, TasGrid::type_qptotal)) {}
double FunctionEvaluation() override {
RVector sample = this->generator.EvalSample();
double y1 = sample[0];
double y2 = sample[1];
return y2 * pow(y1,19 ) + y1 * pow(y2,19);
return pow(y1,4) + pow(y2,6);
}
string Name() const override {
......
......@@ -12,18 +12,21 @@ INSTANTIATE_TEST_SUITE_P(
TestParams{"SparseGrid2DPolyDeg2Problem", "FunctionEvaluation",
"DummyPDESolver", 20.0},
TestParams{"SparseGrid2DPD2qptotProblem", "FunctionEvaluation",
"DummyPDESolver", 20.0}
"DummyPDESolver", 20.0},
TestParams{"SparseGrid2DhermiteProblem", "FunctionEvaluation",
"DummyPDESolver", 1.0}
// Todo add more test cases
));
INSTANTIATE_TEST_SUITE_P(
TestStochasticCollocation, TestStochasticCollocationFailingTests, Values(
TestParams{"SparseGrid2DPD2qptotProblemFail", "FunctionEvaluation",
"DummyPDESolver", 12.0},
"DummyPDESolver", 4.2},
//Though the test below is supposed to fail the test doesn't
//Don't know why it is not failing
TestParams{"SparseGrid2DPD3qptotProblemFail", "FunctionEvaluation",
"DummyPDESolver", 0.0}
"DummyPDESolver", 0.9523809523}
// Todo add more test cases
));
......@@ -43,11 +46,13 @@ TEST_P(TestStochasticCollocationWithoutEpsilon, TestSeriellAgainstParallel) {
TEST_P(TestStochasticCollocationFailingTests, Test) {
mout << GetParam() << endl;
mout.StartBlock("Stochastic Collocation seriell");
mout << "Start" << endl;
scSeriell->Method();
mout.EndBlock();
mout << endl;
EXPECT_NEAR(scSeriell->aggregate.mean.Q, GetParam().refValue, SC_TEST_TOLERANCE);
}
......
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