Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
1635767b
Commit
1635767b
authored
Apr 27, 2016
by
Praetorius, Simon
Browse files
Dune::MPIHelper correctly used
parent
339ba6ed
Changes
6
Show whitespace changes
Inline
Side-by-side
dune/amdis/AMDiS.cpp
View file @
1635767b
...
...
@@ -15,10 +15,12 @@ namespace AMDiS
{
// using namespace std;
void
init
(
int
argc
,
char
**
argv
,
std
::
string
initFileName
)
void
init
(
int
&
argc
,
char
**
&
argv
,
std
::
string
initFileName
)
{
// Maybe initialize MPI
std
::
cout
<<
"call MPIHelper::instance..."
;
Dune
::
MPIHelper
&
helper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
std
::
cout
<<
" [ ok ]
\n
"
;
Parameters
::
clearData
();
...
...
dune/amdis/AMDiS.hpp
View file @
1635767b
#pragma once
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
// std c++ headers
#include
<string>
...
...
@@ -7,7 +10,7 @@
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
);
...
...
init/pfc.json.2d
View file @
1635767b
...
...
@@ -3,18 +3,24 @@
"pfcMesh": {
"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": {
"mesh": "pfcMesh",
"solver" : {
"name": "
cg
",
"name": "
bicgstab_ell
",
"max iteration": 1000,
"tolerance": 1e-8,
"info": 10,
"left precon": "diag"
"ell": 3,
"left precon": "ilu"
},
"output": {
...
...
src/CMakeLists.txt
View file @
1635767b
set
(
projects
"heat"
"heat_old"
"pfc"
"stokes"
"navier_stokes"
)
set
(
projects
"heat"
"pfc"
"stokes"
"navier_stokes"
)
foreach
(
project
${
projects
}
)
add_executable
(
${
project
}
${
project
}
.cc
)
...
...
src/heat.cc
View file @
1635767b
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
<iostream>
#include
<dune/amdis/AdaptInstationary.hpp>
#include
<dune/amdis/AMDiS.hpp>
#include
<dune/amdis/AdaptInstationary.hpp>
#include
<dune/amdis/ProblemInstat.hpp>
#include
<dune/amdis/ProblemStat.hpp>
#include
<dune/amdis/Literals.hpp>
...
...
@@ -48,7 +45,6 @@ using HeatProblemInstat = ProblemInstat<HeatParam>;
int
main
(
int
argc
,
char
**
argv
)
{
Dune
::
MPIHelper
&
helper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
AMDiS
::
init
(
argc
,
argv
);
HeatProblem
prob
(
"heat"
);
...
...
src/pfc.cc
View file @
1635767b
...
...
@@ -24,8 +24,27 @@
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
using
PfcParam
=
ProblemStatTraits
<
DIM
,
DOW
,
1
,
1
,
1
>
;
//
using PfcParam = ProblemStatTraits<DIM, DOW, 1, 1, 1>;
using
PfcProblem
=
ProblemStat
<
PfcParam
>
;
using
PfcProblemInstat
=
ProblemInstat
<
PfcParam
>
;
...
...
@@ -37,13 +56,10 @@ int main(int argc, char** argv)
prob
.
initialize
(
INIT_ALL
);
PfcProblemInstat
probInstat
(
"pfc"
,
prob
);
probInstat
.
initialize
();
probInstat
.
initialize
(
INIT_UH_OLD
);
AdaptInfo
adaptInfo
(
"adapt"
);
double
tau
=
adaptInfo
.
getTimestep
();
AMDIS_MSG
(
"timestep = "
<<
tau
);
double
r
=
-
0.4
;
double
psi_mean
=
-
0.3
;
double
M0
=
1.0
;
...
...
@@ -61,7 +77,7 @@ int main(int argc, char** argv)
opLhs02
.
addSOT
(
constant
(
1.0
)
);
Op
opLhs10
,
opLhs11
;
opLhs10
.
addSOT
(
constant
(
M0
*
tau
)
);
opLhs10
.
addSOT
(
constant
(
M0
)
);
opLhs11
.
addZOT
(
constant
(
1.0
)
);
Op
opLhs21
,
opLhs22
;
...
...
@@ -75,7 +91,7 @@ int main(int argc, char** argv)
prob
.
addMatrixOperator
(
opLhs00
,
0
,
0
);
prob
.
addMatrixOperator
(
opLhs01
,
0
,
1
);
prob
.
addMatrixOperator
(
opLhs02
,
0
,
2
);
prob
.
addMatrixOperator
(
opLhs10
,
1
,
0
);
prob
.
addMatrixOperator
(
opLhs10
,
1
,
0
,
adaptInfo
.
getTimestepPtr
()
);
prob
.
addMatrixOperator
(
opLhs11
,
1
,
1
);
prob
.
addMatrixOperator
(
opLhs21
,
2
,
1
);
prob
.
addMatrixOperator
(
opLhs22
,
2
,
2
);
...
...
@@ -87,8 +103,7 @@ int main(int argc, char** argv)
Mu
.
getVector
()
=
0.0
;
Nu
.
getVector
()
=
0.0
;
std
::
srand
(
time
(
0
)
);
for
(
size_t
i
=
0
;
i
<
Psi
.
getSize
();
++
i
)
Psi
[
i
]
=
(
std
::
rand
()
/
double
(
RAND_MAX
)
-
0.5
)
+
psi_mean
;
Psi
.
interpol
([
psi_mean
](
auto
const
&
x
)
{
return
(
std
::
rand
()
/
double
(
RAND_MAX
)
-
0.5
)
+
psi_mean
;
});
// using PreconType = PfcPrecon<typename PfcProblem::SystemMatrixType::MultiMatrix, typename PfcProblem::SystemVectorType::MultiVector>;
// PreconType precon(prob.getSystemMatrix().getMatrix(), &tau, M0);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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