Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Backofen, Rainer
amdis
Commits
13a42661
Commit
13a42661
authored
Aug 15, 2012
by
Praetorius, Simon
Browse files
extension
parent
f042083c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1091 additions
and
112 deletions
+1091
-112
extensions/demo/src/drivenCavity.cc
extensions/demo/src/drivenCavity.cc
+17
-3
extensions/demo/src/drivenCavity_rb.cc
extensions/demo/src/drivenCavity_rb.cc
+161
-0
extensions/demo/src/drivenCavity_twophase_rb.cc
extensions/demo/src/drivenCavity_twophase_rb.cc
+161
-0
extensions/demo/src/fsi_explicit/ElasticityNavierStokes.h
extensions/demo/src/fsi_explicit/ElasticityNavierStokes.h
+8
-9
extensions/demo/src/fsi_explicit/fluidStructureInteraction.cc
...nsions/demo/src/fsi_explicit/fluidStructureInteraction.cc
+120
-100
extensions/demo/src/movingMesh.cc
extensions/demo/src/movingMesh.cc
+205
-0
extensions/demo/src/movingMesh.h
extensions/demo/src/movingMesh.h
+376
-0
extensions/demo/src/navierStokes.h
extensions/demo/src/navierStokes.h
+43
-0
No files found.
extensions/demo/src/drivenCavity.cc
View file @
13a42661
...
@@ -13,8 +13,16 @@ using namespace boost::posix_time;
...
@@ -13,8 +13,16 @@ using namespace boost::posix_time;
struct
DrivenCavityBC
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
struct
DrivenCavityBC
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
{
{
double
operator
()(
const
WorldVector
<
double
>
&
x
)
const
{
double
operator
()(
const
WorldVector
<
double
>
&
x
)
const
{
return
std
::
max
(
0.0
,
1.0
-
4.0
*
sqr
(
x
[
0
]
-
0.5
));
double
vel
=
std
::
max
(
0.0
,
1.0
-
4.0
*
sqr
(
x
[
0
]
-
0.5
));
return
(
*
time
<
0.1
?
sin
((
*
time
)
*
m_pi
/
0.2
)
*
vel
:
vel
);
}
}
void
setTimePtr
(
double
*
time_
)
{
time
=
time_
;
}
private:
double
*
time
;
};
};
class
CHNS_DrivenCavity
:
public
CahnHilliardNavierStokes
class
CHNS_DrivenCavity
:
public
CahnHilliardNavierStokes
...
@@ -40,6 +48,8 @@ public:
...
@@ -40,6 +48,8 @@ public:
transformDOF
(
prob
->
getSolution
()
->
getDOFVector
(
0
),
transformDOF
(
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
SignedDistToCh
(
initialEps
));
new
SignedDistToCh
(
initialEps
));
}
}
drivenCavityBC
->
setTimePtr
(
adaptInfo
->
getTimePtr
());
}
}
void
fillBoundaryConditions
()
void
fillBoundaryConditions
()
...
@@ -53,10 +63,14 @@ public:
...
@@ -53,10 +63,14 @@ public:
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
getProblem
(
0
)
->
addDirichletBC
(
1
,
2
+
i
,
2
+
i
,
zeroDOF
);
getProblem
(
0
)
->
addDirichletBC
(
1
,
2
+
i
,
2
+
i
,
zeroDOF
);
drivenCavityBC
=
new
DrivenCavityBC
;
/// at upper wall: prescribed velocity
/// at upper wall: prescribed velocity
getProblem
(
0
)
->
addDirichletBC
(
2
,
2
,
2
,
new
D
rivenCavityBC
);
getProblem
(
0
)
->
addDirichletBC
(
2
,
2
,
2
,
d
rivenCavityBC
);
getProblem
(
0
)
->
addDirichletBC
(
2
,
3
,
3
,
zeroDOF
);
getProblem
(
0
)
->
addDirichletBC
(
2
,
3
,
3
,
zeroDOF
);
}
}
private:
DrivenCavityBC
*
drivenCavityBC
;
};
};
...
@@ -96,7 +110,7 @@ public:
...
@@ -96,7 +110,7 @@ public:
/// Set initial condition and perform initial refinement
/// Set initial condition and perform initial refinement
virtual
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
virtual
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
{
refFunction
=
new
PhaseFieldRefinement
(
"mesh->refinement"
,
chnsProb
->
getMesh
());
refFunction
=
new
PhaseFieldRefinement
(
chnsProb
->
getMesh
());
refinement
=
new
RefinementLevelDOF
(
refinement
=
new
RefinementLevelDOF
(
chnsProb
->
getProblem
(
0
)
->
getFeSpace
(
0
),
chnsProb
->
getProblem
(
0
)
->
getFeSpace
(
0
),
refFunction
,
refFunction
,
...
...
extensions/demo/src/drivenCavity_rb.cc
0 → 100644
View file @
13a42661
#include "AMDiS.h"
#include "CahnHilliardNavierStokes_RB.h"
#include "SignedDistFunctors.h"
#include "PhaseFieldConvert.h"
#include "Refinement.h"
#include "MeshFunction_Level.h"
#include "time/ExtendedRosenbrockAdaptInstationary.h"
#include "boost/date_time/posix_time/posix_time.hpp"
using
namespace
AMDiS
;
using
namespace
boost
::
posix_time
;
struct
DrivenCavityBC
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
{
double
operator
()(
const
WorldVector
<
double
>
&
x
)
const
{
double
vel
=
std
::
max
(
0.0
,
1.0
-
4.0
*
sqr
(
x
[
0
]
-
0.5
));
return
vel
;
}
};
class
CHNS_DrivenCavity
:
public
CahnHilliardNavierStokes_RB
{
public:
CHNS_DrivenCavity
(
std
::
string
name_
)
:
CahnHilliardNavierStokes_RB
(
name_
)
{}
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
super
::
solveInitialProblem
(
adaptInfo
);
/// horizontale Linie
double
a
=
0.0
,
dir
=
-
1.0
;
double
initialEps
=
eps
;
Initfile
::
get
(
name
+
"->initial epsilon"
,
initialEps
);
Initfile
::
get
(
name
+
"->line->pos"
,
a
);
Initfile
::
get
(
name
+
"->line->direction"
,
dir
);
/// create phase-field from signed-dist-function
if
(
doubleWell
==
0
)
{
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
SignedDistFctToPhaseField
(
initialEps
,
new
Plane
(
a
,
dir
)));
}
else
{
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Plane
(
a
,
dir
));
transformDOF
(
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
SignedDistToCh
(
initialEps
));
}
}
void
fillBoundaryConditions
()
{
FUNCNAME
(
"NS_DrivenCavity::fillBoundaryConditions()"
);
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
zero
=
new
AMDiS
::
Const
<
double
,
WorldVector
<
double
>
>
(
0.0
);
size_t
dow
=
Global
::
getGeo
(
WORLD
);
/// at rigid wall: no-slip boundary condition
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
getProblem
(
0
)
->
addDirichletBC
(
1
,
2
+
i
,
2
+
i
,
zero
);
drivenCavityBC
=
new
DrivenCavityBC
;
/// at upper wall: prescribed velocity
getProblem
(
0
)
->
addDirichletBC
(
2
,
2
,
2
,
drivenCavityBC
);
getProblem
(
0
)
->
addDirichletBC
(
2
,
3
,
3
,
zero
);
}
private:
DrivenCavityBC
*
drivenCavityBC
;
};
class
RefinementTimeInterface
:
public
CouplingTimeInterface
{
public:
RefinementTimeInterface
(
CHNS_DrivenCavity
*
chnsProb_
)
:
chnsProb
(
chnsProb_
),
refFunction
(
NULL
),
refinement
(
NULL
)
{
addTimeInterface
(
chnsProb
);
}
~
RefinementTimeInterface
()
{
if
(
refFunction
)
delete
refFunction
;
if
(
refinement
)
delete
refinement
;
}
virtual
void
initTimeInterface
()
{
chnsProb
->
initTimeInterface
();
}
/// Called at the end of each timestep.
virtual
void
closeTimestep
(
AdaptInfo
*
adaptInfo
)
{
CouplingTimeInterface
::
closeTimestep
(
adaptInfo
);
refinement
->
refine
(
1
);
}
/// Set initial condition and perform initial refinement
virtual
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
refFunction
=
new
PhaseFieldRefinement
(
chnsProb
->
getMesh
());
refinement
=
new
RefinementLevelDOF
(
chnsProb
->
getProblem
(
0
)
->
getFeSpace
(
0
),
refFunction
,
new
PhaseDOFView
<
double
>
(
chnsProb
->
getProblem
(
0
)
->
getSolution
()
->
getDOFVector
(
0
)));
// initial refinement
refinement
->
refine
(
0
);
bool
initialRefinement
=
true
;
Parameters
::
get
(
chnsProb
->
getName
()
+
"->initial refinement"
,
initialRefinement
);
if
(
initialRefinement
)
{
// refine until interfaces is solved
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
chnsProb
->
solveInitialProblem
(
adaptInfo
);
refinement
->
refine
((
i
<
4
?
4
:
10
));
}
}
CouplingTimeInterface
::
solveInitialProblem
(
adaptInfo
);
}
protected:
CHNS_DrivenCavity
*
chnsProb
;
PhaseFieldRefinement
*
refFunction
;
RefinementLevelDOF
*
refinement
;
};
int
main
(
int
argc
,
char
**
argv
)
{
FUNCNAME
(
"main"
);
AMDiS
::
init
(
argc
,
argv
);
CHNS_DrivenCavity
chnsProb
(
"chns"
);
chnsProb
.
initialize
(
INIT_ALL
);
RefinementTimeInterface
timeInterface
(
&
chnsProb
);
// Adapt-Infos
AdaptInfo
adaptInfo
(
"adapt"
,
chnsProb
.
getNumComponents
());
ExtendedRosenbrockAdaptInstationary
<
CHNS_DrivenCavity
>
adaptInstat
(
"adapt"
,
chnsProb
,
adaptInfo
,
timeInterface
,
adaptInfo
);
ptime
start_time
=
microsec_clock
::
local_time
();
chnsProb
.
initTimeInterface
();
int
error_code
=
adaptInstat
.
adapt
();
time_duration
td
=
microsec_clock
::
local_time
()
-
start_time
;
MSG
(
"elapsed time= %d sec
\n
"
,
td
.
total_seconds
());
AMDiS
::
finalize
();
return
error_code
;
};
extensions/demo/src/drivenCavity_twophase_rb.cc
0 → 100644
View file @
13a42661
#include "AMDiS.h"
#include "CahnHilliardNavierStokes_TwoPhase_RB.h"
#include "SignedDistFunctors.h"
#include "PhaseFieldConvert.h"
#include "Refinement.h"
#include "MeshFunction_Level.h"
#include "time/ExtendedRosenbrockAdaptInstationary.h"
#include "boost/date_time/posix_time/posix_time.hpp"
using
namespace
AMDiS
;
using
namespace
boost
::
posix_time
;
struct
DrivenCavityBC
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
{
double
operator
()(
const
WorldVector
<
double
>
&
x
)
const
{
double
vel
=
std
::
max
(
0.0
,
1.0
-
4.0
*
sqr
(
x
[
0
]
-
0.5
));
return
vel
;
}
};
class
CHNS_DrivenCavity
:
public
CahnHilliardNavierStokes_TwoPhase_RB
{
public:
CHNS_DrivenCavity
(
std
::
string
name_
)
:
CahnHilliardNavierStokes_TwoPhase_RB
(
name_
)
{}
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
super
::
solveInitialProblem
(
adaptInfo
);
/// horizontale Linie
double
a
=
0.0
,
dir
=
-
1.0
;
double
initialEps
=
eps
;
Initfile
::
get
(
name
+
"->initial epsilon"
,
initialEps
);
Initfile
::
get
(
name
+
"->line->pos"
,
a
);
Initfile
::
get
(
name
+
"->line->direction"
,
dir
);
/// create phase-field from signed-dist-function
if
(
doubleWell
==
0
)
{
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
SignedDistFctToPhaseField
(
initialEps
,
new
Plane
(
a
,
dir
)));
}
else
{
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Plane
(
a
,
dir
));
transformDOF
(
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
SignedDistToCh
(
initialEps
));
}
}
void
fillBoundaryConditions
()
{
FUNCNAME
(
"NS_DrivenCavity::fillBoundaryConditions()"
);
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
zero
=
new
AMDiS
::
Const
<
double
,
WorldVector
<
double
>
>
(
0.0
);
size_t
dow
=
Global
::
getGeo
(
WORLD
);
/// at rigid wall: no-slip boundary condition
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
getProblem
(
0
)
->
addDirichletBC
(
1
,
2
+
i
,
2
+
i
,
zero
);
drivenCavityBC
=
new
DrivenCavityBC
;
/// at upper wall: prescribed velocity
getProblem
(
0
)
->
addDirichletBC
(
2
,
2
,
2
,
drivenCavityBC
);
getProblem
(
0
)
->
addDirichletBC
(
2
,
3
,
3
,
zero
);
}
private:
DrivenCavityBC
*
drivenCavityBC
;
};
class
RefinementTimeInterface
:
public
CouplingTimeInterface
{
public:
RefinementTimeInterface
(
CHNS_DrivenCavity
*
chnsProb_
)
:
chnsProb
(
chnsProb_
),
refFunction
(
NULL
),
refinement
(
NULL
)
{
addTimeInterface
(
chnsProb
);
}
~
RefinementTimeInterface
()
{
if
(
refFunction
)
delete
refFunction
;
if
(
refinement
)
delete
refinement
;
}
virtual
void
initTimeInterface
()
{
chnsProb
->
initTimeInterface
();
}
/// Called at the end of each timestep.
virtual
void
closeTimestep
(
AdaptInfo
*
adaptInfo
)
{
CouplingTimeInterface
::
closeTimestep
(
adaptInfo
);
refinement
->
refine
(
1
);
}
/// Set initial condition and perform initial refinement
virtual
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
refFunction
=
new
PhaseFieldRefinement
(
chnsProb
->
getMesh
());
refinement
=
new
RefinementLevelDOF
(
chnsProb
->
getProblem
(
0
)
->
getFeSpace
(
0
),
refFunction
,
new
PhaseDOFView
<
double
>
(
chnsProb
->
getProblem
(
0
)
->
getSolution
()
->
getDOFVector
(
0
)));
// initial refinement
refinement
->
refine
(
0
);
bool
initialRefinement
=
true
;
Parameters
::
get
(
chnsProb
->
getName
()
+
"->initial refinement"
,
initialRefinement
);
if
(
initialRefinement
)
{
// refine until interfaces is solved
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
chnsProb
->
solveInitialProblem
(
adaptInfo
);
refinement
->
refine
((
i
<
4
?
4
:
10
));
}
}
CouplingTimeInterface
::
solveInitialProblem
(
adaptInfo
);
}
protected:
CHNS_DrivenCavity
*
chnsProb
;
PhaseFieldRefinement
*
refFunction
;
RefinementLevelDOF
*
refinement
;
};
int
main
(
int
argc
,
char
**
argv
)
{
FUNCNAME
(
"main"
);
AMDiS
::
init
(
argc
,
argv
);
CHNS_DrivenCavity
chnsProb
(
"chns"
);
chnsProb
.
initialize
(
INIT_ALL
);
RefinementTimeInterface
timeInterface
(
&
chnsProb
);
// Adapt-Infos
AdaptInfo
adaptInfo
(
"adapt"
,
chnsProb
.
getNumComponents
());
ExtendedRosenbrockAdaptInstationary
<
CHNS_DrivenCavity
>
adaptInstat
(
"adapt"
,
chnsProb
,
adaptInfo
,
timeInterface
,
adaptInfo
);
ptime
start_time
=
microsec_clock
::
local_time
();
chnsProb
.
initTimeInterface
();
int
error_code
=
adaptInstat
.
adapt
();
time_duration
td
=
microsec_clock
::
local_time
()
-
start_time
;
MSG
(
"elapsed time= %d sec
\n
"
,
td
.
total_seconds
());
AMDiS
::
finalize
();
return
error_code
;
};
extensions/demo/src/fsi_explicit/ElasticityNavierStokes.h
View file @
13a42661
...
@@ -96,10 +96,10 @@ public:
...
@@ -96,10 +96,10 @@ public:
addTimeInterface
(
elastProb2
);
addTimeInterface
(
elastProb2
);
addTimeInterface
(
nsProb
);
addTimeInterface
(
nsProb
);
//
CouplingProblemStat::initialize(INIT_ALL | INIT_EXACT_SOLUTION);
CouplingProblemStat
::
initialize
(
INIT_ALL
|
INIT_EXACT_SOLUTION
);
ns
Prob
->
initialize
(
INIT_ALL
);
// elast
Prob->initialize(INIT_ALL);
elastProb
->
initialize
(
INIT_ALL
);
//
elastProb
2
->initialize(INIT_ALL);
elast
Prob
2
->
initialize
(
INIT_ALL
);
// ns
Prob->initialize(INIT_ALL
- CREATE_MESH, elastProb2->getProblem(), INIT_MESH
);
dim
=
elastProb
->
getMesh
()
->
getDim
();
dim
=
elastProb
->
getMesh
()
->
getDim
();
initData
();
initData
();
...
@@ -223,18 +223,18 @@ public:
...
@@ -223,18 +223,18 @@ public:
CouplingTimeInterface
::
closeTimestep
(
adaptInfo
);
CouplingTimeInterface
::
closeTimestep
(
adaptInfo
);
flag
->
move
(
elastProb
->
getDeformation
());
//
flag->move(elastProb->getDeformation());
updateMesh
(
elastProb
->
getDeformation
(),
parametricCoords1
,
parametric1
);
updateMesh
(
elastProb
->
getDeformation
(),
parametricCoords1
,
parametric1
);
updateMesh
(
elastProb2
->
getDeformation
(),
parametricCoords2
,
parametric2
);
updateMesh
(
elastProb2
->
getDeformation
(),
parametricCoords2
,
parametric2
);
// refinement1->refine(5);
// refinement1->refine(5);
// refinement2->refine(5);
// refinement2->refine(5);
}
}
void
updateMesh
(
DOF
Vector
<
World
Vector
<
double
>
>
*
vec
,
WorldVector
<
DOFVector
<
double
>*>&
parametricCoords
,
ParametricFirstOrder
*
parametric
)
void
updateMesh
(
World
Vector
<
DOF
Vector
<
double
>*
>
vec
,
WorldVector
<
DOFVector
<
double
>*>&
parametricCoords
,
ParametricFirstOrder
*
parametric
)
{
{
FUNCNAME
(
"ParametricSphere::buildAfterCoarsen()"
);
FUNCNAME
(
"ParametricSphere::buildAfterCoarsen()"
);
MSG
(
"calculation of parametric coordinates
\n
"
);
MSG
(
"calculation of parametric coordinates
\n
"
);
const
FiniteElemSpace
*
feSpace
=
vec
->
getFeSpace
();
const
FiniteElemSpace
*
feSpace
=
vec
[
0
]
->
getFeSpace
();
int
dim
=
feSpace
->
getMesh
()
->
getDim
();
int
dim
=
feSpace
->
getMesh
()
->
getDim
();
int
dow
=
Global
::
getGeo
(
WORLD
);
int
dow
=
Global
::
getGeo
(
WORLD
);
WorldVector
<
double
>
newCoords
;
WorldVector
<
double
>
newCoords
;
...
@@ -259,10 +259,9 @@ public:
...
@@ -259,10 +259,9 @@ public:
basFcts
->
getLocalIndices
(
elInfo
->
getElement
(),
admin
,
localIndices
);
basFcts
->
getLocalIndices
(
elInfo
->
getElement
(),
admin
,
localIndices
);
for
(
int
i
=
0
;
i
<
dim
+
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dim
+
1
;
i
++
)
{
dof
=
localIndices
[
i
];
dof
=
localIndices
[
i
];
newCoords
=
(
*
vec
)[
dof
];
if
(
!
visited
[
dof
])
{
if
(
!
visited
[
dof
])
{
for
(
int
j
=
0
;
j
<
dow
;
j
++
)
for
(
int
j
=
0
;
j
<
dow
;
j
++
)
(
*
(
parametricCoords
[
j
]))[
dof
]
+=
newCoords
[
j
];
(
*
(
parametricCoords
[
j
]))[
dof
]
+=
(
*
vec
[
j
])[
dof
];
visited
[
dof
]
=
true
;
visited
[
dof
]
=
true
;
}
}
...
...
extensions/demo/src/fsi_explicit/fluidStructureInteraction.cc
View file @
13a42661
...
@@ -22,10 +22,7 @@ struct NormalStress : TertiaryAbstractFunction<double, WorldVector<double>, Worl
...
@@ -22,10 +22,7 @@ struct NormalStress : TertiaryAbstractFunction<double, WorldVector<double>, Worl
double
operator
()(
const
WorldVector
<
double
>&
normal
,
const
WorldVector
<
double
>&
grdU0
,
const
WorldVector
<
double
>&
grdU1
)
const
double
operator
()(
const
WorldVector
<
double
>&
normal
,
const
WorldVector
<
double
>&
grdU0
,
const
WorldVector
<
double
>&
grdU1
)
const
{
{
if
(
comp
==
0
)
return
viscosity
*
(
2.0
*
grdU0
[
comp
]
*
normal
[
comp
]
+
(
grdU1
[
0
]
+
grdU0
[
1
])
*
normal
[
1
-
comp
]);
return
viscosity
*
(
2.0
*
grdU0
[
0
]
*
normal
[
0
]
+
(
grdU1
[
0
]
+
grdU0
[
1
])
*
normal
[
1
]);
else
return
viscosity
*
(
2.0
*
grdU1
[
1
]
*
normal
[
1
]
+
(
grdU1
[
0
]
+
grdU0
[
1
])
*
normal
[
0
]);
}
}
private:
private:
int
comp
;
int
comp
;
...
@@ -38,7 +35,7 @@ struct NormalStressP : TertiaryAbstractFunction<double, WorldVector<double>, dou
...
@@ -38,7 +35,7 @@ struct NormalStressP : TertiaryAbstractFunction<double, WorldVector<double>, dou
double
operator
()(
const
WorldVector
<
double
>&
normal
,
const
double
&
stress
,
const
double
&
p
)
const
double
operator
()(
const
WorldVector
<
double
>&
normal
,
const
double
&
stress
,
const
double
&
p
)
const
{
{
return
stress
-
p
*
normal
[
comp
];
return
stress
-
p
*
normal
[
comp
];
}
}
private:
private:
int
comp
;
int
comp
;
...
@@ -73,12 +70,12 @@ public:
...
@@ -73,12 +70,12 @@ public:
typedef
LinearElasticity
super
;
typedef
LinearElasticity
super
;
public:
public:
Elasticity_Obstacle
(
std
::
string
name_
)
:
super
(
name_
)
,
stress
(
NULL
)
{}
Elasticity_Obstacle
(
std
::
string
name_
)
:
super
(
name_
)
{}
~
Elasticity_Obstacle
()
~
Elasticity_Obstacle
()
{
{
delete
deformation
;
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
delete
deformationVelocity
;
delete
stress
[
i
]
;
}
}
void
initData
()
void
initData
()
...
@@ -86,19 +83,37 @@ public:
...
@@ -86,19 +83,37 @@ public:
super
::
initData
();
super
::
initData
();
dim
=
getMesh
()
->
getDim
();
dim
=
getMesh
()
->
getDim
();
stress
=
new
DOFVector
<
WorldVector
<
double
>
>
(
getFeSpace
(
0
),
"stress"
);
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
{
deformation
=
new
DOFVector
<
WorldVector
<
double
>
>
(
getFeSpace
(
0
),
"deformation"
);
stress
[
i
]
=
new
DOFVector
<
double
>
(
getFeSpace
(
0
),
"stress_"
+
Helpers
::
toString
(
i
));
deformationVelocity
=
new
DOFVector
<
WorldVector
<
double
>
>
(
getFeSpace
(
dow
),
"deformation_velocity"
);
stress
[
i
]
->
set
(
0.0
);
}
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
{
deformation
[
i
]
=
prob
->
getSolution
()
->
getDOFVector
(
i
);
deformationVelocity
[
i
]
=
prob
->
getSolution
()
->
getDOFVector
(
dow
+
i
);
}
std
::
vector
<
DOFVector
<
double
>*>
vecs
;
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
vecs
.
push_back
(
stress
[
i
]);
fileWriterStress
=
new
FileWriter
(
name
+
"->stress->output"
,
getFeSpace
()
->
getMesh
(),
vecs
);
}
}
DOFVector
<
WorldVector
<
double
>
>
*
getDeformation
()
DOFVector
<
double
>*
getDeformation
(
int
i
)
{
{
return
deformation
;
return
deformation
[
i
];
}
WorldVector
<
DOFVector
<
double
>*>
getDeformation
()
{
return
deformation
;
}
}
DOFVector
<
WorldVector
<
double
>
>*
getDeformationVelocity
()
DOFVector
<
double
>*
getDeformationVelocity
(
int
i
)
{
return
deformationVelocity
[
i
];
}
WorldVector
<
DOFVector
<
double
>*>
getDeformationVelocity
()
{
{
return
deformationVelocity
;
return
deformationVelocity
;
}
}
void
setNormalStress
(
DOFVector
<
WorldVector
<
double
>
>*
stress_
)
void
setNormalStress
(
DOFVector
<
WorldVector
<
double
>
>*
stress_
)
...
@@ -109,22 +124,20 @@ public:
...
@@ -109,22 +124,20 @@ public:
void
transferInitialSolution
(
AdaptInfo
*
adaptInfo
)
void
transferInitialSolution
(
AdaptInfo
*
adaptInfo
)
{
{
super
::
transferInitialSolution
(
adaptInfo
);
super
::
transferInitialSolution
(
adaptInfo
);
calcDeformation
();
calcDeformationVelocity
();
}
}
void
initTimestep
(
AdaptInfo
*
adaptInfo
)
void
initTimestep
(
AdaptInfo
*
adaptInfo
)
{
{
super
::
initTimestep
(
adaptInfo
);
super
::
initTimestep
(
adaptInfo
);
TEST_EXIT
(
boundaryStress
!=
NULL
)(
"NULL-Pointer problem!
\n
"
);
TEST_EXIT
(
boundaryStress
!=
NULL
)(
"NULL-Pointer problem!
\n
"
);
interpol_coords
(
*
boundaryStress
,
*
stress
);
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
transformDOF_coords
(
*
boundaryStress
,
*
stress
[
i
],
new
Component
(
i
));
fileWriterStress
->
writeFiles
(
adaptInfo
,
false
);
}
}