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
iwr
amdis
Commits
0879bc18
Commit
0879bc18
authored
Feb 11, 2014
by
Praetorius, Simon
Browse files
some baseproblems extended
parent
f429edf0
Changes
13
Hide whitespace changes
Inline
Side-by-side
extensions/base_problems/CahnHilliard.cc
View file @
0879bc18
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include
"HL_SignedDistTraverse.h"
#include
"HL_SignedDistTraverse.h"
#include
"Recovery.h"
#include
"Recovery.h"
#include
"GenericZeroOrderTerm.h"
using
namespace
AMDiS
;
using
namespace
AMDiS
;
...
@@ -153,53 +154,67 @@ void CahnHilliard<P>::fillOperators()
...
@@ -153,53 +154,67 @@ void CahnHilliard<P>::fillOperators()
{
{
const
FiniteElemSpace
*
feSpace
=
self
::
prob
->
self
::
getFeSpace
();
const
FiniteElemSpace
*
feSpace
=
self
::
prob
->
self
::
getFeSpace
();
int
degree
=
feSpace
->
getBasisFcts
()
->
getDegree
();
int
degree
=
feSpace
->
getBasisFcts
()
->
getDegree
();
DOFVector
<
double
>*
c
=
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
);
DOFVector
<
double
>*
mu
=
self
::
prob
->
getSolution
()
->
getDOFVector
(
1
);
// c
// c
Operator
*
opChMnew
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMnew
=
new
Operator
(
feSpace
,
feSpace
);
opChMnew
->
addTerm
(
new
Simple_ZOT
);
addZOT
(
opChMnew
,
constant
(
1.0
));
// opChMnew->addTerm(new Simple_ZOT);
Operator
*
opChMold
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMold
=
new
Operator
(
feSpace
,
feSpace
);
opChMold
->
addTerm
(
new
VecAtQP_ZOT
(
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)));
addZOT
(
opChMold
,
valueOf
(
c
));
// opChMold->addTerm(new VecAtQP_ZOT(self::prob->getSolution()->getDOFVector(0)));
// -nabla*(grad(c))
// -nabla*(grad(c))
Operator
*
opChL
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChL
=
new
Operator
(
feSpace
,
feSpace
);
opChL
->
addTerm
(
new
Simple_SOT
);
addSOT
(
opChL
,
constant
(
1.0
)
);
// opChL->addTerm(new Simple_SOT);
// div(M(c)grad(mu)), with M(c)=gamma/4*(c^2-1)^2
// div(M(c)grad(mu)), with M(c)=gamma/4*(c^2-1)^2
Operator
*
opChLM
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChLM
=
new
Operator
(
feSpace
,
feSpace
);
if
(
useMobility
)
{
if
(
useMobility
)
{
if
(
doubleWell
==
0
)
if
(
doubleWell
==
0
)
opChLM
->
addTerm
(
new
VecAtQP_SOT
(
addSOT
(
opChLM_
,
function_
(
MobilityCH0_
(
gamma
),
valueOf
(
c
))
);
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
// opChLM->addTerm(new VecAtQP_SOT(
new
MobilityCH0
(
gamma
,
degree
)));
// self::prob->getSolution()->getDOFVector(0),
// new MobilityCH0(gamma, degree)));
else
else
opChLM
->
addTerm
(
new
VecAtQP_SOT
(
addSOT
(
opChLM
,
function_
(
MobilityCH1_
(
gamma
),
valueOf
(
c
))
);
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
// opChLM->addTerm(new VecAtQP_SOT(
new
MobilityCH1
(
gamma
,
degree
)));
// self::prob->getSolution()->getDOFVector(0),
// new MobilityCH1(gamma, degree)));
}
else
}
else
opChLM
->
addTerm
(
new
Simple_SOT
(
gamma
));
addSOT
(
opChLM
,
constant
(
gamma
)
);
// opChLM->addTerm(new Simple_SOT(gamma));
// -2*c_old^3 + 3/2*c_old^2
// -2*c_old^3 + 3/2*c_old^2
Operator
*
opChMPowExpl
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMPowExpl
=
new
Operator
(
feSpace
,
feSpace
);
opChMPowExpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowExpl
,
-
2.0
*
pow
<
3
>
(
valueOf
(
c
)));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
// opChMPowExpl->addTerm(new VecAtQP_ZOT(
new
AMDiS
::
Pow
<
3
>
(
-
2.0
,
3
*
degree
)));
// self::prob->getSolution()->getDOFVector(0),
// new AMDiS::Pow<3>(-2.0, 3*degree)));
if
(
doubleWell
==
0
)
{
if
(
doubleWell
==
0
)
{
opChMPowExpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowExpl
,
(
3.0
/
2.0
)
*
pow
<
2
>
(
valueOf
(
c
)));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
// opChMPowExpl->addTerm(new VecAtQP_ZOT(
new
AMDiS
::
Pow
<
2
>
(
3.0
/
2.0
,
2
*
degree
)));
// self::prob->getSolution()->getDOFVector(0),
// new AMDiS::Pow<2>(3.0/2.0, 2*degree)));
}
}
// -3*c_old^2 * c
// -3*c_old^2 * c
Operator
*
opChMPowImpl
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMPowImpl
=
new
Operator
(
feSpace
,
feSpace
);
opChMPowImpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowImpl
,
-
3.0
*
pow
<
2
>
(
valueOf
(
c
)));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
// opChMPowImpl->addTerm(new VecAtQP_ZOT(
new
AMDiS
::
Pow
<
2
>
(
-
3.0
,
2
*
degree
)));
// self::prob->getSolution()->getDOFVector(0),
// new AMDiS::Pow<2>(-3.0, 2*degree)));
if
(
doubleWell
==
0
)
{
if
(
doubleWell
==
0
)
{
opChMPowImpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowImpl
,
3.0
*
valueOf
(
c
)
-
0.5
);
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
// opChMPowImpl->addTerm(new VecAtQP_ZOT(
NULL
,
3.0
));
// self::prob->getSolution()->getDOFVector(0),
// NULL, 3.0));
opChMPowImpl
->
addTerm
(
new
Simple_ZOT
(
-
0.5
));
opChMPowImpl
->
addTerm
(
new
Simple_ZOT
(
-
0.5
));
}
else
{
}
else
{
opChMPowImpl
->
addZeroOrderTerm
(
new
Simple_ZOT
(
1.0
));
addZOT
(
opChMPowImpl
,
constant
(
1.0
));
// opChMPowImpl->addZeroOrderTerm(new Simple_ZOT(1.0));
}
}
// mu + eps^2*laplace(c) + c - 3*(c_old^2)*c = -2*c_old^3 [+ BC]
// mu + eps^2*laplace(c) + c - 3*(c_old^2)*c = -2*c_old^3 [+ BC]
...
...
extensions/base_problems/CahnHilliard.h
View file @
0879bc18
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include
"AMDiS.h"
#include
"AMDiS.h"
#include
"BaseProblem.h"
#include
"BaseProblem.h"
#include
"chns.h"
#include
"chns.h"
#include
"GenericOperatorTerm.h"
namespace
detail
{
namespace
detail
{
...
@@ -64,6 +65,51 @@ namespace detail {
...
@@ -64,6 +65,51 @@ namespace detail {
double
epsSqr
;
double
epsSqr
;
double
minusEpsSqr
;
double
minusEpsSqr
;
};
};
class
MobilityCH0_
:
public
FunctorBase
//: public AbstractFunction<double,double>
{
public:
MobilityCH0_
(
double
gamma_
=
1.0
)
:
gamma
(
gamma_
),
delta
(
1.e-6
)
{
}
typedef
double
value_type
;
int
getDegree
(
int
d0
)
const
{
return
d0
*
4
;
}
double
operator
()(
const
double
&
ch
)
const
{
double
phase
=
std
::
max
(
0.0
,
std
::
min
(
1.0
,
ch
));
double
mobility
=
0.25
*
sqr
(
phase
)
*
sqr
(
phase
-
1.0
);
return
gamma
*
std
::
max
(
mobility
,
delta
);
}
protected:
double
gamma
;
double
delta
;
};
class
MobilityCH1_
:
public
FunctorBase
// : public AbstractFunction<double,double>
{
public:
MobilityCH1_
(
double
gamma_
=
1.0
)
:
gamma
(
gamma_
),
delta
(
1.e-6
)
{
}
typedef
double
value_type
;
int
getDegree
(
int
d0
)
const
{
return
d0
*
4
;
}
double
operator
()(
const
double
&
ch
)
const
{
double
phase
=
std
::
max
(
-
1.0
,
std
::
min
(
1.0
,
ch
));
double
mobility
=
0.25
*
sqr
(
sqr
(
phase
)
-
1.0
);
return
gamma
*
std
::
max
(
mobility
,
delta
);
}
protected:
double
gamma
;
double
delta
;
};
}
// end namespace detail
}
// end namespace detail
...
...
extensions/base_problems/CahnHilliard.hh
View file @
0879bc18
...
@@ -153,55 +153,43 @@ void CahnHilliard<P>::fillOperators()
...
@@ -153,55 +153,43 @@ void CahnHilliard<P>::fillOperators()
{
{
const
FiniteElemSpace
*
feSpace
=
self
::
prob
->
getFeSpace
();
const
FiniteElemSpace
*
feSpace
=
self
::
prob
->
getFeSpace
();
int
degree
=
feSpace
->
getBasisFcts
()
->
getDegree
();
int
degree
=
feSpace
->
getBasisFcts
()
->
getDegree
();
DOFVector
<
double
>*
c
=
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
);
DOFVector
<
double
>*
mu
=
self
::
prob
->
getSolution
()
->
getDOFVector
(
1
);
// c
// c
Operator
*
opChMnew
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMnew
=
new
Operator
(
feSpace
,
feSpace
);
opChMnew
->
addTerm
(
new
Simple_ZOT
);
addZOT
(
opChMnew
,
constant
(
1.0
)
);
Operator
*
opChMold
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMold
=
new
Operator
(
feSpace
,
feSpace
);
opChMold
->
addTerm
(
new
VecAtQP_ZOT
(
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
));
addZOT
(
opChMold
,
valueOf
(
c
));
// -nabla*(grad(c))
// -nabla*(grad(c))
Operator
*
opChL
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChL
=
new
Operator
(
feSpace
,
feSpace
);
opChL
->
addTerm
(
new
Simple_SOT
);
addSOT
(
opChL
,
constant
(
1.0
)
);
// div(M(c)grad(mu)), with M(c)=gamma/4*(c^2-1)^2
// div(M(c)grad(mu)), with M(c)=gamma/4*(c^2-1)^2
Operator
*
opChLM
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChLM
=
new
Operator
(
feSpace
,
feSpace
);
if
(
useMobility
)
{
if
(
useMobility
)
{
if
(
doubleWell
==
0
)
if
(
doubleWell
==
0
)
opChLM
->
addTerm
(
new
VecAtQP_SOT
(
addSOT
(
opChLM
,
function_
(
MobilityCH0_
(
gamma
),
valueOf
(
c
))
);
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
MobilityCH0
(
gamma
,
degree
)));
else
else
opChLM
->
addTerm
(
new
VecAtQP_SOT
(
addSOT
(
opChLM
,
function_
(
MobilityCH1_
(
gamma
),
valueOf
(
c
))
);
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
MobilityCH1
(
gamma
,
degree
)));
}
else
}
else
opChLM
->
addTerm
(
new
Simple_SOT
(
gamma
));
addSOT
(
opChLM
,
constant
(
gamma
)
);
// -2*c_old^3 + 3/2*c_old^2
// -2*c_old^3 + 3/2*c_old^2
Operator
*
opChMPowExpl
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMPowExpl
=
new
Operator
(
feSpace
,
feSpace
);
opChMPowExpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowExpl
,
-
2.0
*
pow
<
3
>
(
valueOf
(
c
)));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
if
(
doubleWell
==
0
)
new
AMDiS
::
Pow
<
3
>
(
-
2.0
,
3
*
degree
)));
addZOT
(
opChMPowExpl
,
(
3.0
/
2.0
)
*
pow
<
2
>
(
valueOf
(
c
)));
if
(
doubleWell
==
0
)
{
opChMPowExpl
->
addTerm
(
new
VecAtQP_ZOT
(
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
AMDiS
::
Pow
<
2
>
(
3.0
/
2.0
,
2
*
degree
)));
}
// -3*c_old^2 * c
// -3*c_old^2 * c
Operator
*
opChMPowImpl
=
new
Operator
(
feSpace
,
feSpace
);
Operator
*
opChMPowImpl
=
new
Operator
(
feSpace
,
feSpace
);
opChMPowImpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowImpl
,
-
3.0
*
pow
<
2
>
(
valueOf
(
c
)));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
if
(
doubleWell
==
0
)
new
AMDiS
::
Pow
<
2
>
(
-
3.0
,
2
*
degree
)));
addZOT
(
opChMPowImpl
,
3.0
*
valueOf
(
c
)
-
0.5
);
if
(
doubleWell
==
0
)
{
else
opChMPowImpl
->
addTerm
(
new
VecAtQP_ZOT
(
addZOT
(
opChMPowImpl
,
constant
(
1.0
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
NULL
,
3.0
));
opChMPowImpl
->
addTerm
(
new
Simple_ZOT
(
-
0.5
));
}
else
{
opChMPowImpl
->
addZeroOrderTerm
(
new
Simple_ZOT
(
1.0
));
}
// mu + eps^2*laplace(c) + c - 3*(c_old^2)*c = -2*c_old^3 [+ BC]
// mu + eps^2*laplace(c) + c - 3*(c_old^2)*c = -2*c_old^3 [+ BC]
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
self
::
prob
->
addMatrixOperator
(
*
opChMPowImpl
,
0
,
0
);
/// < -3*phi*c*c_old^2 , psi >
self
::
prob
->
addMatrixOperator
(
*
opChMPowImpl
,
0
,
0
);
/// < -3*phi*c*c_old^2 , psi >
...
@@ -217,7 +205,6 @@ void CahnHilliard<P>::fillOperators()
...
@@ -217,7 +205,6 @@ void CahnHilliard<P>::fillOperators()
self
::
prob
->
addMatrixOperator
(
*
opChLM
,
1
,
1
);
/// < phi*grad(mu) , grad(psi) >
self
::
prob
->
addMatrixOperator
(
*
opChLM
,
1
,
1
);
/// < phi*grad(mu) , grad(psi) >
// . . . vectorOperators . . . . . . . . . . . . . . .
// . . . vectorOperators . . . . . . . . . . . . . . .
self
::
prob
->
addVectorOperator
(
*
opChMold
,
1
,
self
::
getInvTau
());
/// < phi*c^old/tau , psi >
self
::
prob
->
addVectorOperator
(
*
opChMold
,
1
,
self
::
getInvTau
());
/// < phi*c^old/tau , psi >
}
}
...
...
extensions/base_problems/CouplingBaseProblem.h
View file @
0879bc18
...
@@ -47,8 +47,8 @@ public:
...
@@ -47,8 +47,8 @@ public:
~
CouplingBaseProblem
()
{
}
~
CouplingBaseProblem
()
{
}
void
initialize
(
Flag
initFlag
,
void
initialize
(
Flag
initFlag
,
ProblemStatSeq
*
adoptProblem
=
NULL
,
ProblemStatSeq
*
adoptProblem
=
NULL
,
Flag
adoptFlag
=
INIT_NOTHING
)
override
Flag
adoptFlag
=
INIT_NOTHING
)
override
{
{
for
(
size_t
i
=
0
;
i
<
baseProblems
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
baseProblems
.
size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
baseProblems
[
i
]
->
getNumProblems
();
j
++
)
for
(
size_t
j
=
0
;
j
<
baseProblems
[
i
]
->
getNumProblems
();
j
++
)
...
...
extensions/base_problems/CouplingBaseProblem2.h
View file @
0879bc18
...
@@ -66,6 +66,30 @@ namespace detail {
...
@@ -66,6 +66,30 @@ namespace detail {
/// Functor for generic loops. Method fillBoundaryConditions() is called for each element in a sequence.
/// Functor for generic loops. Method fillBoundaryConditions() is called for each element in a sequence.
struct
FillBoundaryConditions
{
template
<
typename
B
>
static
void
call
(
B
&
b
)
{
b
.
fillBoundaryConditions
();
}
};
struct
FillBoundaryConditions
{
template
<
typename
B
>
static
void
call
(
B
&
b
)
{
b
.
fillBoundaryConditions
();
}
};
struct
FindProblem
{
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
ProblemType
&
prob
)
{
if
(
baseProblem
.
getName
()
==
name
)
prob
=
baseProblem
.
getProblem
();
}
};
struct
FindBaseProblem
{
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
ProblemType
&
prob
)
{
typedef
typename
boost
::
mpl
::
if_
<
typename
boost
::
is_same
<
BaseProblemType
,
ProblemType
>::
type
,
boost
::
mpl
::
int_
<
true
>
,
boost
::
mpl
::
bool_
<
false
>
>::
type
assign
;
call
(
baseProblem
,
name
,
prob
,
assign
());
}
template
<
typename
BaseProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
BaseProblemType
&
prob
,
boost
::
mpl
::
int_
<
true
>
)
{
if
(
baseProblem
.
getName
()
==
name
)
prob
=
&
baseProblem
;
}
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
BaseProblemType
&
prob
,
boost
::
mpl
::
int_
<
false
>
)
{}
};
}
// end namespace detail
}
// end namespace detail
/**
/**
...
@@ -156,7 +180,7 @@ public:
...
@@ -156,7 +180,7 @@ public:
template
<
int
i
>
template
<
int
i
>
DOFVector
<
double
>
*
getSolution
(
int
j
)
DOFVector
<
double
>
*
getSolution
(
int
j
)
{
FUNCNAME
(
"CouplingBaseProblem::getSolution<i>(j)"
);
{
FUNCNAME
(
"CouplingBaseProblem::getSolution<i>(j)"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"BaseProblem-index out of range"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"
********** ERROR:
BaseProblem-index out of range
**********
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
return
_GET_
<
i
>
(
baseProblems
).
getSolution
()
->
getDOFVector
(
j
);
return
_GET_
<
i
>
(
baseProblems
).
getSolution
()
->
getDOFVector
(
j
);
...
@@ -167,13 +191,35 @@ public:
...
@@ -167,13 +191,35 @@ public:
template
<
int
i
>
template
<
int
i
>
inline
const
FiniteElemSpace
*
getFeSpace
(
int
j
=
0
)
inline
const
FiniteElemSpace
*
getFeSpace
(
int
j
=
0
)
{
FUNCNAME
(
"CouplingBaseProblem::getFeSpace<i>(j)"
);
{
FUNCNAME
(
"CouplingBaseProblem::getFeSpace<i>(j)"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"BaseProblem index out of range"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"
********** ERROR:
BaseProblem index out of range
**********
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
return
_GET_
<
i
>
(
baseProblems
).
getFeSpace
(
j
);
return
_GET_
<
i
>
(
baseProblems
).
getFeSpace
(
j
);
}
}
std
::
string
getName
()
{
return
name
;
}
std
::
string
getName
()
{
return
name
;
}
template
<
typename
BaseProblemType
>
BaseProblemType
*
getBaseProblem
(
std
::
string
name_
)
{
BaseProblemType
*
prob
=
NULL
;
tools
::
FOR_EACH
<
detail
::
FindBaseProblem
>::
loop1
(
baseProblems
,
name_
,
prob
);
if
(
prob
)
return
prob
;
else
throw
(
std
::
runtime_error
(
"problem with given name '"
+
name_
+
"' does not exist"
));
}
ProblemType
*
getProblem
(
std
::
string
name_
)
{
ProblemType
*
prob
=
NULL
;
tools
::
FOR_EACH
<
detail
::
FindProblem
>::
loop1
(
baseProblems
,
name_
,
prob
);
if
(
prob
)
return
prob
;
else
throw
(
std
::
runtime_error
(
"problem with given name '"
+
name_
+
"' does not exist"
));
}
protected:
protected:
BaseProblemsTupleType
baseProblems
;
BaseProblemsTupleType
baseProblems
;
...
...
extensions/base_problems/CouplingBaseProblem2_cxx11.h
View file @
0879bc18
...
@@ -68,6 +68,32 @@ namespace detail {
...
@@ -68,6 +68,32 @@ namespace detail {
static
void
call
(
BaseProblemType
&
baseProblem
)
{
baseProblem
.
fillBoundaryConditions
();
}
static
void
call
(
BaseProblemType
&
baseProblem
)
{
baseProblem
.
fillBoundaryConditions
();
}
};
};
struct
FindProblem
{
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
ProblemType
&
prob
)
{
if
(
baseProblem
.
getName
()
==
name
)
prob
=
baseProblem
.
getProblem
();
}
};
struct
FindBaseProblem
{
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
ProblemType
*&
prob
)
{
typedef
typename
boost
::
mpl
::
if_
<
typename
boost
::
is_same
<
BaseProblemType
,
ProblemType
>::
type
,
boost
::
mpl
::
bool_
<
true
>
,
boost
::
mpl
::
bool_
<
false
>
>::
type
assign
;
call
(
baseProblem
,
name
,
prob
,
assign
());
}
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
ProblemType
*&
prob
,
boost
::
mpl
::
bool_
<
true
>
)
{
if
(
baseProblem
.
getName
()
==
name
)
prob
=
&
baseProblem
;
}
template
<
typename
BaseProblemType
,
typename
ProblemType
>
static
void
call
(
BaseProblemType
&
baseProblem
,
const
std
::
string
&
name
,
ProblemType
*&
prob
,
boost
::
mpl
::
bool_
<
false
>
)
{}
};
}
// end namespace detail
}
// end namespace detail
/**
/**
...
@@ -151,7 +177,7 @@ public:
...
@@ -151,7 +177,7 @@ public:
template
<
int
i
>
template
<
int
i
>
DOFVector
<
double
>
*
getSolution
(
int
j
)
DOFVector
<
double
>
*
getSolution
(
int
j
)
{
FUNCNAME
(
"CouplingBaseProblem::getSolution<i>(j)"
);
{
FUNCNAME
(
"CouplingBaseProblem::getSolution<i>(j)"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"BaseProblem-index out of range"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"
********** ERROR:
BaseProblem-index out of range
**********
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
return
_GET_
<
i
>
(
baseProblems
).
getSolution
()
->
getDOFVector
(
j
);
return
_GET_
<
i
>
(
baseProblems
).
getSolution
()
->
getDOFVector
(
j
);
...
@@ -162,13 +188,35 @@ public:
...
@@ -162,13 +188,35 @@ public:
template
<
int
i
>
template
<
int
i
>
inline
const
FiniteElemSpace
*
getFeSpace
(
int
j
=
0
)
inline
const
FiniteElemSpace
*
getFeSpace
(
int
j
=
0
)
{
FUNCNAME
(
"CouplingBaseProblem::getFeSpace<i>(j)"
);
{
FUNCNAME
(
"CouplingBaseProblem::getFeSpace<i>(j)"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"BaseProblem index out of range"
);
BOOST_STATIC_ASSERT_MSG
(
0
<=
i
&&
i
<
_LENGTH_
<
BaseProblemsTupleType
>::
value
,
"
********** ERROR:
BaseProblem index out of range
**********
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
TEST_EXIT
(
0
<=
j
&&
j
<=
_GET_
<
i
>
(
baseProblems
).
getNumComponents
())(
"Indices out of range!
\n
"
);
return
_GET_
<
i
>
(
baseProblems
).
getFeSpace
(
j
);
return
_GET_
<
i
>
(
baseProblems
).
getFeSpace
(
j
);
}
}
std
::
string
getName
()
{
return
name
;
}
std
::
string
getName
()
{
return
name
;
}
ProblemType
*
getProblem
(
std
::
string
name_
)
{
ProblemType
*
prob
=
NULL
;
tools
::
FOR_EACH
<
detail
::
FindProblem
>::
loop1
(
baseProblems
,
name_
,
prob
);
if
(
prob
)
return
prob
;
else
throw
(
std
::
runtime_error
(
"problem with given name '"
+
name_
+
"' does not exist"
));
}
template
<
typename
BaseProblemType
>
BaseProblemType
*
getBaseProblem
(
std
::
string
name_
)
{
BaseProblemType
*
prob
=
NULL
;
tools
::
FOR_EACH
<
detail
::
FindBaseProblem
>::
loop1
(
baseProblems
,
name_
,
prob
);
if
(
prob
)
return
prob
;
else
throw
(
std
::
runtime_error
(
"problem with given name '"
+
name_
+
"' does not exist"
));
}
protected:
protected:
BaseProblemsTupleType
baseProblems
;
BaseProblemsTupleType
baseProblems
;
...
...
extensions/base_problems/NavierStokesPhase_TaylorHood.h
View file @
0879bc18
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#define NAVIER_STOKES_PHASE_TAYLOR_HOOD_H
#define NAVIER_STOKES_PHASE_TAYLOR_HOOD_H
#include
"NavierStokes_TaylorHood.h"
#include
"NavierStokes_TaylorHood.h"
#include
"ExtendedProblemStat.h"
using
namespace
AMDiS
;
using
namespace
AMDiS
;
...
@@ -29,11 +30,11 @@ using namespace AMDiS;
...
@@ -29,11 +30,11 @@ using namespace AMDiS;
* dt(phase*u_j) + phase*u*grad(u_j) = phase*d_j(p) - nu*div(phase*grad(u_j)) - beta/eps^alpha (1-phase)*(u_j - g_j); j=1...d
* dt(phase*u_j) + phase*u*grad(u_j) = phase*d_j(p) - nu*div(phase*grad(u_j)) - beta/eps^alpha (1-phase)*(u_j - g_j); j=1...d
* div(phase*u) = grad(phase)*g
* div(phase*u) = grad(phase)*g
*/
*/
class
NavierStokesPhase_TaylorHood
:
public
NavierStokes_TaylorHood
class
NavierStokesPhase_TaylorHood
:
public
::
detail
::
NavierStokes_TaylorHood
<
ExtendedProblemStat
>
{
{
public:
// typedefs
public:
// typedefs
typedef
NavierStokes_TaylorHood
super
;
typedef
::
detail
::
NavierStokes_TaylorHood
<
ExtendedProblemStat
>
super
;
public:
// methods
public:
// methods
...
...
extensions/base_problems/NavierStokes_TH_MultiPhase.h
View file @
0879bc18
...
@@ -19,147 +19,158 @@
...
@@ -19,147 +19,158 @@
#include
"NavierStokes_TaylorHood.h"
#include
"NavierStokes_TaylorHood.h"
namespace
detail
{
using
namespace
AMDiS
;
using
namespace
AMDiS
;
/** \ingroup NavierStokes_TaylorHood
/** \ingroup NavierStokes_TaylorHood
* \brief
* \brief
* Navier-Stokes multi-phase problem, using Taylor Hood elements
* Navier-Stokes multi-phase problem, using Taylor Hood elements
* Standard implementation for two phases, but can be extended to
* Standard implementation for two phases, but can be extended to
* many more, by defining the multiPhase variable and overloading
* many more, by defining the multiPhase variable and overloading
* the initTimestep, where densityPhase and viscosityPhase are defined
* the initTimestep, where densityPhase and viscosityPhase are defined
* depending on the phases
* depending on the phases
*/
*/
class
NavierStokes_TH_MultiPhase
:
public
NavierStokes_TaylorHood
template
<
typename
ProblemType
>
{
class
NavierStokes_TH_MultiPhase
:
public
NavierStokes_TaylorHood
<
ProblemType
>
public:
// typedefs
{
public:
// typedefs
typedef
NavierStokes_TaylorHood
super
;
typedef
NavierStokes_TaylorHood
<
ProblemType
>
super
;
typedef
NavierStokes_TH_MultiPhase
<
ProblemType
>
self
;