Commit 1635767b authored by Praetorius, Simon's avatar Praetorius, Simon

Dune::MPIHelper correctly used

parent 339ba6ed
Pipeline #125 skipped
...@@ -15,10 +15,12 @@ namespace AMDiS ...@@ -15,10 +15,12 @@ namespace AMDiS
{ {
// using namespace std; // using namespace std;
void init(int argc, char** argv, std::string initFileName) void init(int& argc, char**& argv, std::string initFileName)
{ {
// Maybe initialize MPI // Maybe initialize MPI
std::cout << "call MPIHelper::instance...";
Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv); Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv);
std::cout << " [ ok ]\n";
Parameters::clearData(); Parameters::clearData();
......
#pragma once #pragma once
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
// std c++ headers // std c++ headers
#include <string> #include <string>
...@@ -7,7 +10,7 @@ ...@@ -7,7 +10,7 @@
namespace AMDiS namespace AMDiS
{ {
void init(int argc, char** argv, std::string initFileName = ""); void init(int& argc, char**& argv, std::string initFileName = "");
void init(std::string initFileName); void init(std::string initFileName);
......
...@@ -3,18 +3,24 @@ ...@@ -3,18 +3,24 @@
"pfcMesh": { "pfcMesh": {
"macro file name": "./macro/macro.stand.2d", "macro file name": "./macro/macro.stand.2d",
"global refinements": 10 "global refinements": 6,
"min corner": "0,0",
"max corner": "1,1",
"num cells": "2,2",
"dimension": "10,10"
}, },
"pfc": { "pfc": {
"mesh": "pfcMesh", "mesh": "pfcMesh",
"solver" : { "solver" : {
"name": "cg", "name": "bicgstab_ell",
"max iteration": 1000, "max iteration": 1000,
"tolerance": 1e-8, "tolerance": 1e-8,
"info": 10, "info": 10,
"left precon": "diag" "ell": 3,
"left precon": "ilu"
}, },
"output": { "output": {
......
set(projects "heat" "heat_old" "pfc" "stokes" "navier_stokes") set(projects "heat" "pfc" "stokes" "navier_stokes")
foreach(project ${projects}) foreach(project ${projects})
add_executable(${project} ${project}.cc) add_executable(${project} ${project}.cc)
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2: // vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <iostream> #include <iostream>
#include <dune/amdis/AdaptInstationary.hpp>
#include <dune/amdis/AMDiS.hpp> #include <dune/amdis/AMDiS.hpp>
#include <dune/amdis/AdaptInstationary.hpp>
#include <dune/amdis/ProblemInstat.hpp> #include <dune/amdis/ProblemInstat.hpp>
#include <dune/amdis/ProblemStat.hpp> #include <dune/amdis/ProblemStat.hpp>
#include <dune/amdis/Literals.hpp> #include <dune/amdis/Literals.hpp>
...@@ -48,7 +45,6 @@ using HeatProblemInstat = ProblemInstat<HeatParam>; ...@@ -48,7 +45,6 @@ using HeatProblemInstat = ProblemInstat<HeatParam>;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv);
AMDiS::init(argc, argv); AMDiS::init(argc, argv);
HeatProblem prob("heat"); HeatProblem prob("heat");
......
...@@ -24,8 +24,27 @@ ...@@ -24,8 +24,27 @@
using namespace AMDiS; using namespace AMDiS;
class PfcParam
{
template <class Mesh, int deg>
using Lagrange = Dune::Functions::PQkNodalBasis<typename Mesh::LeafGridView, deg>;
template <class Mesh, int... degs>
using FeSpaceTuple = std::tuple<Lagrange<Mesh, degs>...>;
public:
static constexpr int dim = DIM;
static constexpr int dimworld = DOW;
static constexpr int nComponents = 3;
// default values
using Mesh = Dune::YaspGrid<dim>;
using FeSpaces = FeSpaceTuple<Mesh, 2, 2, 2>;
};
// 3 component with polynomial degree 1 // 3 component with polynomial degree 1
using PfcParam = ProblemStatTraits<DIM, DOW, 1, 1, 1>; // using PfcParam = ProblemStatTraits<DIM, DOW, 1, 1, 1>;
using PfcProblem = ProblemStat<PfcParam>; using PfcProblem = ProblemStat<PfcParam>;
using PfcProblemInstat = ProblemInstat<PfcParam>; using PfcProblemInstat = ProblemInstat<PfcParam>;
...@@ -37,13 +56,10 @@ int main(int argc, char** argv) ...@@ -37,13 +56,10 @@ int main(int argc, char** argv)
prob.initialize(INIT_ALL); prob.initialize(INIT_ALL);
PfcProblemInstat probInstat("pfc", prob); PfcProblemInstat probInstat("pfc", prob);
probInstat.initialize(); probInstat.initialize(INIT_UH_OLD);
AdaptInfo adaptInfo("adapt"); AdaptInfo adaptInfo("adapt");
double tau = adaptInfo.getTimestep();
AMDIS_MSG("timestep = " << tau);
double r = -0.4; double r = -0.4;
double psi_mean = -0.3; double psi_mean = -0.3;
double M0 = 1.0; double M0 = 1.0;
...@@ -61,7 +77,7 @@ int main(int argc, char** argv) ...@@ -61,7 +77,7 @@ int main(int argc, char** argv)
opLhs02.addSOT( constant(1.0) ); opLhs02.addSOT( constant(1.0) );
Op opLhs10, opLhs11; Op opLhs10, opLhs11;
opLhs10.addSOT( constant(M0 * tau) ); opLhs10.addSOT( constant(M0) );
opLhs11.addZOT( constant(1.0) ); opLhs11.addZOT( constant(1.0) );
Op opLhs21, opLhs22; Op opLhs21, opLhs22;
...@@ -75,7 +91,7 @@ int main(int argc, char** argv) ...@@ -75,7 +91,7 @@ int main(int argc, char** argv)
prob.addMatrixOperator(opLhs00, 0, 0); prob.addMatrixOperator(opLhs00, 0, 0);
prob.addMatrixOperator(opLhs01, 0, 1); prob.addMatrixOperator(opLhs01, 0, 1);
prob.addMatrixOperator(opLhs02, 0, 2); prob.addMatrixOperator(opLhs02, 0, 2);
prob.addMatrixOperator(opLhs10, 1, 0); prob.addMatrixOperator(opLhs10, 1, 0, adaptInfo.getTimestepPtr());
prob.addMatrixOperator(opLhs11, 1, 1); prob.addMatrixOperator(opLhs11, 1, 1);
prob.addMatrixOperator(opLhs21, 2, 1); prob.addMatrixOperator(opLhs21, 2, 1);
prob.addMatrixOperator(opLhs22, 2, 2); prob.addMatrixOperator(opLhs22, 2, 2);
...@@ -87,8 +103,7 @@ int main(int argc, char** argv) ...@@ -87,8 +103,7 @@ int main(int argc, char** argv)
Mu.getVector() = 0.0; Mu.getVector() = 0.0;
Nu.getVector() = 0.0; Nu.getVector() = 0.0;
std::srand( time(0) ); std::srand( time(0) );
for (size_t i = 0; i < Psi.getSize(); ++i) Psi.interpol([psi_mean](auto const& x) { return (std::rand()/double(RAND_MAX) - 0.5) + psi_mean; });
Psi[i] = (std::rand()/double(RAND_MAX) - 0.5) + psi_mean;
// using PreconType = PfcPrecon<typename PfcProblem::SystemMatrixType::MultiMatrix, typename PfcProblem::SystemVectorType::MultiVector>; // using PreconType = PfcPrecon<typename PfcProblem::SystemMatrixType::MultiMatrix, typename PfcProblem::SystemVectorType::MultiVector>;
// PreconType precon(prob.getSystemMatrix().getMatrix(), &tau, M0); // PreconType precon(prob.getSystemMatrix().getMatrix(), &tau, M0);
......
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