Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
iwr
amdis
Commits
88e2a179
Commit
88e2a179
authored
Oct 29, 2013
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
singular dbc corrected
parent
f4aa2f3e
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
367 additions
and
234 deletions
+367
-234
AMDiS/CMakeLists.txt
AMDiS/CMakeLists.txt
+64
-1
demo/CMakeLists.txt
demo/CMakeLists.txt
+6
-0
demo/init/ellipt.dat.3d
demo/init/ellipt.dat.3d
+3
-3
demo/src/ellipt.cc
demo/src/ellipt.cc
+5
-5
extensions/ExtendedProblemStat.h
extensions/ExtendedProblemStat.h
+11
-5
extensions/ProblemStatMassConserve.h
extensions/ProblemStatMassConserve.h
+3
-5
extensions/SingularDirichletBC2.cc
extensions/SingularDirichletBC2.cc
+11
-8
extensions/SingularDirichletBC2.h
extensions/SingularDirichletBC2.h
+36
-5
extensions/base_problems/CahnHilliard.cc
extensions/base_problems/CahnHilliard.cc
+63
-59
extensions/base_problems/CahnHilliard.h
extensions/base_problems/CahnHilliard.h
+37
-30
extensions/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc
...ons/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc
+0
-1
extensions/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.h
...ions/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.h
+6
-6
extensions/base_problems/NavierStokes_TaylorHood.h
extensions/base_problems/NavierStokes_TaylorHood.h
+94
-83
extensions/demo/other/CMakeLists.txt
extensions/demo/other/CMakeLists.txt
+7
-6
extensions/demo/other/src/cahnHilliard_navierStokes.cc
extensions/demo/other/src/cahnHilliard_navierStokes.cc
+12
-8
extensions/demo/other/src/fsi_explicit/ElasticityNavierStokes.h
...ions/demo/other/src/fsi_explicit/ElasticityNavierStokes.h
+4
-4
extensions/demo/other/src/fsi_explicit/fluidStructureInteraction.cc
.../demo/other/src/fsi_explicit/fluidStructureInteraction.cc
+1
-1
extensions/demo/other/src/movingMesh.h
extensions/demo/other/src/movingMesh.h
+4
-4
No files found.
AMDiS/CMakeLists.txt
View file @
88e2a179
...
@@ -497,7 +497,7 @@ if(ENABLE_EXTENSIONS)
...
@@ -497,7 +497,7 @@ if(ENABLE_EXTENSIONS)
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokesCahnHilliard.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokesCahnHilliard.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokesPhase_TaylorHood.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokesPhase_TaylorHood.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TaylorHood.cc
#
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TaylorHood_RB.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TaylorHood_RB.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TH_MultiPhase.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TH_MultiPhase.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${
EXTENSIONS_DIR
}
/base_problems/NavierStokes_TH_MultiPhase_RB.cc
...
@@ -708,6 +708,69 @@ list(APPEND deb_add_dirs "share/amdis/doc")
...
@@ -708,6 +708,69 @@ list(APPEND deb_add_dirs "share/amdis/doc")
list
(
REMOVE_DUPLICATES deb_add_dirs
)
list
(
REMOVE_DUPLICATES deb_add_dirs
)
# TESTING
ENABLE_TESTING
()
INCLUDE
(
CTest
)
set
(
TEST_FILE amdis_test.cc
)
file
(
WRITE
${
TEST_FILE
}
"#include <AMDiS.h>
int main (int argc, char* argv[]) {
AMDiS::init(argc, argv);
AMDiS::finalize();
return 0 ;
}"
)
if
(
WIN32
)
set
(
Boost_USE_STATIC_LIBS ON
)
find_package
(
Boost 1.42 REQUIRED system iostreams filesystem program_options date_time zlib bzip2
)
else
()
set
(
Boost_USE_STATIC_LIBS OFF
)
find_package
(
Boost 1.42 REQUIRED system iostreams filesystem program_options date_time
)
endif
()
if
(
Boost_FOUND
)
list
(
APPEND AMDIS_LIBRARIES
${
Boost_LIBRARIES
}
)
list
(
APPEND AMDIS_LIBRARY_DIRS
${
Boost_LIBRARY_DIRS
}
)
list
(
APPEND AMDIS_INCLUDE_DIRS
${
Boost_INCLUDE_DIR
}
)
else
()
message
(
ERROR
"Boost libraries not found"
)
endif
(
Boost_FOUND
)
find_library
(
UMFPACK_LIB umfpack
HINTS ENV LIBRARY_PATH
DOC
"The UMFPACK library"
)
if
(
UMFPACK_LIB
)
list
(
APPEND AMDIS_LIBRARIES
${
UMFPACK_LIB
}
)
else
()
message
(
FATAL_ERROR
"Could not find the UMFPACK library"
)
endif
()
add_executable
(
"amdis_test"
${
TEST_FILE
}
)
target_link_libraries
(
"amdis_test"
amdis reinit compositeFEM muparser
${
AMDIS_LIBRARIES
}
)
add_test
(
NAME test.amdis
WORKING_DIRECTORY
${
CMAKE_BINARY_DIRECTORY
}
COMMAND
${
CMAKE_COMMAND
}
--build . --target amdis_test --config $<CONFIGURATION>
)
# add_test(NAME test.build.amdis
# WORKING_DIRECTORY ${CMAKE_BINARY_DIRECTORY}
# COMMAND ${CMAKE_COMMAND} --build . --target amdis --config $<CONFIGURATION>
# )
# add_test(NAME test.build.reinit
# WORKING_DIRECTORY ${CMAKE_BINARY_DIRECTORY}
# COMMAND ${CMAKE_COMMAND} --build . --target reinit --config $<CONFIGURATION>
# )
# add_test(NAME test.build.compositeFEM
# WORKING_DIRECTORY ${CMAKE_BINARY_DIRECTORY}
# COMMAND ${CMAKE_COMMAND} --build . --target compositeFEM --config $<CONFIGURATION>
# )
# add_test(NAME test.build.muparser
# WORKING_DIRECTORY ${CMAKE_BINARY_DIRECTORY}
# COMMAND ${CMAKE_COMMAND} --build . --target muparser --config $<CONFIGURATION>
# )
# PACKAGES
# PACKAGES
# ========================================================
# ========================================================
set
(
CPACK_PACKAGE_NAME
"AMDIS"
)
set
(
CPACK_PACKAGE_NAME
"AMDIS"
)
...
...
demo/CMakeLists.txt
View file @
88e2a179
...
@@ -71,6 +71,12 @@ add_executable("vecheat" ${vecheat})
...
@@ -71,6 +71,12 @@ add_executable("vecheat" ${vecheat})
target_link_libraries
(
"vecheat"
${
BASIS_LIBS
}
)
target_link_libraries
(
"vecheat"
${
BASIS_LIBS
}
)
install
(
TARGETS vecheat RUNTIME DESTINATION bin
)
install
(
TARGETS vecheat RUNTIME DESTINATION bin
)
set
(
test src/test.cc
)
add_executable
(
"test"
${
test
}
)
target_link_libraries
(
"test"
${
BASIS_LIBS
}
)
install
(
TARGETS test RUNTIME DESTINATION bin
)
# add_executable("matrix_test" src/matrix_test.cc)
# add_executable("matrix_test" src/matrix_test.cc)
# target_link_libraries("matrix_test" ${BASIS_LIBS})
# target_link_libraries("matrix_test" ${BASIS_LIBS})
# install(TARGETS vecheat RUNTIME DESTINATION bin)
# install(TARGETS vecheat RUNTIME DESTINATION bin)
...
...
demo/init/ellipt.dat.3d
View file @
88e2a179
...
@@ -15,17 +15,17 @@ ellipt->solver->info: 2
...
@@ -15,17 +15,17 @@ ellipt->solver->info: 2
ellipt->solver->left precon: diag
ellipt->solver->left precon: diag
ellipt->solver->right precon: no
ellipt->solver->right precon: no
ellipt->estimator[0]: residual
%
ellipt->estimator[0]: residual
ellipt->estimator[0]->error norm: H1_NORM % 1: H1_NORM, 2: L2_NORM
ellipt->estimator[0]->error norm: H1_NORM % 1: H1_NORM, 2: L2_NORM
ellipt->estimator[0]->C1: 0.01 % constant of jump residual
ellipt->estimator[0]->C1: 0.01 % constant of jump residual
ellipt->marker[0]->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS
ellipt->marker[0]->strategy:
0 %
2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS
ellipt->marker[0]->MSGamma: 0.5
ellipt->marker[0]->MSGamma: 0.5
ellipt->adapt[0]->tolerance: 1e-4
ellipt->adapt[0]->tolerance: 1e-4
ellipt->adapt[0]->refine bisections: 2
ellipt->adapt[0]->refine bisections: 2
ellipt->adapt->max iteration: 10
ellipt->adapt->max iteration:
0 %
10
ellipt->output->filename: output/ellipt.3d
ellipt->output->filename: output/ellipt.3d
ellipt->output->ParaView format: 1
ellipt->output->ParaView format: 1
...
...
demo/src/ellipt.cc
View file @
88e2a179
...
@@ -62,17 +62,17 @@ int main(int argc, char* argv[])
...
@@ -62,17 +62,17 @@ int main(int argc, char* argv[])
// ===== create matrix operator =====
// ===== create matrix operator =====
Operator
matrixOperator
(
ellipt
.
getFeSpace
());
Operator
matrixOperator
(
ellipt
.
getFeSpace
());
matrixOperator
.
addTerm
(
new
Simple_
S
OT
);
matrixOperator
.
addTerm
(
new
Simple_
Z
OT
);
ellipt
.
addMatrixOperator
(
matrixOperator
,
0
,
0
);
ellipt
.
addMatrixOperator
(
matrixOperator
,
0
,
0
);
// ===== create rhs operator =====
// ===== create rhs operator =====
Operator
rhsOperator
(
ellipt
.
getFeSpace
());
//
Operator rhsOperator(ellipt.getFeSpace());
rhsOperator
.
addTerm
(
new
CoordsAtQP_ZOT
(
new
F
));
//
rhsOperator.addTerm(new CoordsAtQP_ZOT(new F));
ellipt
.
addVectorOperator
(
rhsOperator
,
0
);
//
ellipt.addVectorOperator(rhsOperator, 0);
// ===== add boundary conditions =====
// ===== add boundary conditions =====
ellipt
.
addDirichletBC
(
1
,
0
,
0
,
new
G
);
ellipt
.
addDirichletBC
(
1
,
0
,
0
,
new
AMDiS
::
Const
<
double
,
WorldVector
<
double
>
>
(
1.0
)
);
// ===== start adaption loop =====
// ===== start adaption loop =====
...
...
extensions/ExtendedProblemStat.h
View file @
88e2a179
...
@@ -68,11 +68,15 @@ public:
...
@@ -68,11 +68,15 @@ public:
~
ExtendedProblemStat
()
~
ExtendedProblemStat
()
{
{
for
(
int
i
=
0
;
i
<
nComponents
;
++
i
)
for
(
int
i
=
0
;
i
<
nComponents
;
++
i
)
{
if
(
exactSolutions
[
i
])
{
if
(
exactSolutions
[
i
])
{
delete
exactSolutions
[
i
];
delete
exactSolutions
[
i
];
exactSolutions
[
i
]
=
NULL
;
exactSolutions
[
i
]
=
NULL
;
}
}
}
for
(
size_t
i
=
0
;
i
<
DirichletBcDataList
.
size
();
i
++
)
delete
DirichletBcDataList
[
i
];
}
}
...
@@ -80,7 +84,7 @@ public:
...
@@ -80,7 +84,7 @@ public:
void
initialize
(
Flag
initFlag
,
void
initialize
(
Flag
initFlag
,
ProblemStatSeq
*
adoptProblem
=
NULL
,
ProblemStatSeq
*
adoptProblem
=
NULL
,
Flag
adoptFlag
=
INIT_NOTHING
)
Flag
adoptFlag
=
INIT_NOTHING
)
{
{
ProblemStat_
::
initialize
(
initFlag
,
adoptProblem
,
adoptFlag
);
ProblemStat_
::
initialize
(
initFlag
,
adoptProblem
,
adoptFlag
);
for
(
int
i
=
0
;
i
<
nComponents
;
++
i
)
for
(
int
i
=
0
;
i
<
nComponents
;
++
i
)
exactSolutions
[
i
]
=
new
DOFVector
<
double
>
(
getFeSpace
(
i
),
"exact_solution"
);
exactSolutions
[
i
]
=
new
DOFVector
<
double
>
(
getFeSpace
(
i
),
"exact_solution"
);
...
@@ -144,7 +148,7 @@ public:
...
@@ -144,7 +148,7 @@ public:
// apply dirichlet boundary conditions
// apply dirichlet boundary conditions
for
(
size_t
k
=
0
;
k
<
singularDirichletBC
.
size
();
k
++
)
for
(
size_t
k
=
0
;
k
<
singularDirichletBC
.
size
();
k
++
)
applyDirichletBC
(
singularDirichletBC
[
k
],
asmMatrix
,
asmVector
);
applyDirichletBC
(
singularDirichletBC
[
k
],
asmMatrix
,
asmVector
);
// update solverMatrix
// update solverMatrix
if
(
asmMatrix
&&
(
singularDirichletBC
.
size
()
>
0
||
manualPeriodicBC
.
size
()
>
0
))
{
if
(
asmMatrix
&&
(
singularDirichletBC
.
size
()
>
0
||
manualPeriodicBC
.
size
()
>
0
))
{
solverMatrix
.
setMatrix
(
*
getSystemMatrix
());
solverMatrix
.
setMatrix
(
*
getSystemMatrix
());
...
@@ -230,7 +234,7 @@ public:
...
@@ -230,7 +234,7 @@ public:
{
{
WARNING
(
"Depreciated! Use addDirichletBC instead!!!
\n
"
);
WARNING
(
"Depreciated! Use addDirichletBC instead!!!
\n
"
);
DofIndex
*
dofIndex
=
new
DofIndex
(
idx
);
DofIndex
*
dofIndex
=
new
DofIndex
(
idx
);
addDirichletBC
(
*
dofIndex
,
row
,
col
,
values
);
addDirichletBC
(
dofIndex
,
row
,
col
,
&
values
);
}
}
...
@@ -333,7 +337,9 @@ public:
...
@@ -333,7 +337,9 @@ public:
protected:
protected:
// traverse matrix rows and set unity row where dirichlet condition shall be applied.
// traverse matrix rows and set unity row where dirichlet condition shall be applied.
void
applyDirichletBC
(
size_t
row_
,
size_t
col_
,
DegreeOfFreedom
idx
,
double
value
,
bool
asmMatrix
=
true
,
bool
asmVector
=
true
)
void
applyDirichletBC
(
size_t
row_
,
size_t
col_
,
DegreeOfFreedom
idx
,
double
value
,
bool
asmMatrix
=
true
,
bool
asmVector
=
true
)
{
{
using
namespace
mtl
;
using
namespace
mtl
;
typedef
DOFMatrix
::
base_matrix_type
Matrix
;
typedef
DOFMatrix
::
base_matrix_type
Matrix
;
...
...
extensions/ProblemStatMassConserve.h
View file @
88e2a179
...
@@ -125,7 +125,7 @@ struct ProblemStatMassConserve : public ExtendedProblemStat
...
@@ -125,7 +125,7 @@ struct ProblemStatMassConserve : public ExtendedProblemStat
prob2
->
setMeshes
(
meshes2
);
prob2
->
setMeshes
(
meshes2
);
prob2
->
initialize
(
INIT_ALL
-
INIT_MESH
);
prob2
->
initialize
(
INIT_ALL
-
INIT_MESH
);
for
(
size_t
i
=
1
;
i
<
meshes2
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
meshes2
.
size
();
i
++
)
{
int
globalRefinements
=
0
;
int
globalRefinements
=
0
;
// If AMDiS is compiled for parallel computations, the global refinements are
// If AMDiS is compiled for parallel computations, the global refinements are
...
@@ -139,12 +139,10 @@ struct ProblemStatMassConserve : public ExtendedProblemStat
...
@@ -139,12 +139,10 @@ struct ProblemStatMassConserve : public ExtendedProblemStat
bool
initMesh
=
true
;
bool
initMesh
=
true
;
// Initialize the meshes if there is no serialization file.
// Initialize the meshes if there is no serialization file.
if
(
initMesh
&&
meshes2
[
i
]
&&
!
(
meshes2
[
i
]
->
isInitialized
()))
if
(
initMesh
&&
meshes2
[
i
]
&&
!
(
meshes2
[
i
]
->
isInitialized
()))
{
meshes2
[
i
]
->
initialize
();
meshes2
[
i
]
->
initialize
();
// do global refinements
if
(
initMesh
&&
meshes2
[
i
])
prob2
->
getRefinementManager
()
->
globalRefine
(
meshes2
[
i
],
globalRefinements
);
prob2
->
getRefinementManager
()
->
globalRefine
(
meshes2
[
i
],
globalRefinements
);
}
}
}
...
...
extensions/SingularDirichletBC2.cc
View file @
88e2a179
...
@@ -43,7 +43,7 @@ void getIndicesAux<WorldVector<double> >(
...
@@ -43,7 +43,7 @@ void getIndicesAux<WorldVector<double> >(
// AbstractFunction (signedDistFct)
// AbstractFunction (signedDistFct)
template
<
>
template
<
>
void
getIndicesAux
(
void
getIndicesAux
<
AbstractFunction
<
double
,
WorldVector
<
double
>
>
>
(
AbstractFunction
<
double
,
WorldVector
<
double
>
>&
pos
,
AbstractFunction
<
double
,
WorldVector
<
double
>
>&
pos
,
BoundaryType
boundary_nr
,
BoundaryType
boundary_nr
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
...
@@ -67,7 +67,7 @@ void getIndicesAux<DOFVector<double> >(
...
@@ -67,7 +67,7 @@ void getIndicesAux<DOFVector<double> >(
// Meshindicator
// Meshindicator
template
<
>
template
<
>
void
getIndicesAux
(
void
getIndicesAux
<
AbstractFunction
<
bool
,
WorldVector
<
double
>
>
>
(
AbstractFunction
<
bool
,
WorldVector
<
double
>
>&
pos
,
AbstractFunction
<
bool
,
WorldVector
<
double
>
>&
pos
,
BoundaryType
boundary_nr
,
BoundaryType
boundary_nr
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
...
@@ -85,7 +85,8 @@ void getValuesAux<double>(
...
@@ -85,7 +85,8 @@ void getValuesAux<double>(
const
double
&
val
,
const
double
&
val
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
boost
::
false_type
is_not_abstract_fct
)
boost
::
false_type
is_not_abstract_fct
,
int
depth
)
{
{
std
::
map
<
DegreeOfFreedom
,
double
>::
iterator
it
;
std
::
map
<
DegreeOfFreedom
,
double
>::
iterator
it
;
for
(
it
=
indicesValues
.
begin
();
it
!=
indicesValues
.
end
();
it
++
)
for
(
it
=
indicesValues
.
begin
();
it
!=
indicesValues
.
end
();
it
++
)
...
@@ -97,13 +98,14 @@ void getValuesAux<AbstractFunction<double, WorldVector<double> > >(
...
@@ -97,13 +98,14 @@ void getValuesAux<AbstractFunction<double, WorldVector<double> > >(
const
AbstractFunction
<
double
,
WorldVector
<
double
>
>&
val
,
const
AbstractFunction
<
double
,
WorldVector
<
double
>
>&
val
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
boost
::
true_type
is_abstract_fct
)
boost
::
true_type
is_abstract_fct
,
int
depth
)
{
{
WorldVector
<
double
>
x
;
DOFVector
<
WorldVector
<
double
>
>
x
(
feSpace
,
"coords"
);
feSpace
->
getMesh
()
->
getDofIndexCoords
(
x
);
std
::
map
<
DegreeOfFreedom
,
double
>::
iterator
it
;
std
::
map
<
DegreeOfFreedom
,
double
>::
iterator
it
;
for
(
it
=
indicesValues
.
begin
();
it
!=
indicesValues
.
end
();
it
++
)
for
(
it
=
indicesValues
.
begin
();
it
!=
indicesValues
.
end
();
it
++
)
if
(
feSpace
->
getMesh
()
->
getDofIndexCoords
(
it
->
first
,
feSpace
,
x
))
it
->
second
=
val
(
x
[
it
->
first
]);
it
->
second
=
val
(
x
);
}
}
// DOFVector<double>
// DOFVector<double>
...
@@ -112,7 +114,8 @@ void getValuesAux<DOFVector<double> >(
...
@@ -112,7 +114,8 @@ void getValuesAux<DOFVector<double> >(
const
DOFVector
<
double
>&
val
,
const
DOFVector
<
double
>&
val
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
boost
::
false_type
is_not_abstract_fct
)
boost
::
false_type
is_not_abstract_fct
,
int
depth
)
{
{
std
::
map
<
DegreeOfFreedom
,
double
>::
iterator
it
;
std
::
map
<
DegreeOfFreedom
,
double
>::
iterator
it
;
for
(
it
=
indicesValues
.
begin
();
it
!=
indicesValues
.
end
();
it
++
)
for
(
it
=
indicesValues
.
begin
();
it
!=
indicesValues
.
end
();
it
++
)
...
...
extensions/SingularDirichletBC2.h
View file @
88e2a179
...
@@ -86,6 +86,23 @@ namespace details {
...
@@ -86,6 +86,23 @@ namespace details {
const
FiniteElemSpace
*
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
boost
::
true_type
is_abstract_fct
);
boost
::
true_type
is_abstract_fct
);
// template specialization for AbstractFunctions
template
<
>
void
getIndicesAux
<
AbstractFunction
<
double
,
WorldVector
<
double
>
>
>
(
AbstractFunction
<
double
,
WorldVector
<
double
>
>
&
pos
,
BoundaryType
b
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
boost
::
true_type
is_abstract_fct
);
template
<
>
void
getIndicesAux
<
AbstractFunction
<
bool
,
WorldVector
<
double
>
>
>
(
AbstractFunction
<
bool
,
WorldVector
<
double
>
>
&
pos
,
BoundaryType
b
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
boost
::
true_type
is_abstract_fct
);
template
<
typename
PosType
>
template
<
typename
PosType
>
void
getIndicesAux
(
PosType
&
pos
,
void
getIndicesAux
(
PosType
&
pos
,
BoundaryType
b
,
BoundaryType
b
,
...
@@ -114,20 +131,34 @@ namespace details {
...
@@ -114,20 +131,34 @@ namespace details {
void
getValuesAux
(
const
ValueType
&
val
,
void
getValuesAux
(
const
ValueType
&
val
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
boost
::
true_type
is_abstract_fct
);
boost
::
true_type
is_abstract_fct
,
int
depth
=
0
)
{
TEST_EXIT
(
depth
==
0
)(
"Recursion bricht nicht ab!
\n
"
);
details
::
getValuesAux
(
dynamic_cast
<
const
AbstractFunction
<
double
,
WorldVector
<
double
>
>&>
(
val
),
feSpace
,
indices
,
is_abstract_fct
,
depth
+
1
);
}
// template specialization for AbstractFunctions
template
<
>
void
getValuesAux
<
AbstractFunction
<
double
,
WorldVector
<
double
>
>
>
(
const
AbstractFunction
<
double
,
WorldVector
<
double
>
>&
val
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indicesValues
,
boost
::
true_type
is_abstract_fct
,
int
depth
);
template
<
typename
ValueType
>
template
<
typename
ValueType
>
void
getValuesAux
(
const
ValueType
&
val
,
void
getValuesAux
(
const
ValueType
&
val
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
,
boost
::
false_type
is_not_abstract_fct
);
boost
::
false_type
is_not_abstract_fct
,
int
depth
=
0
);
template
<
typename
ValueType
>
template
<
typename
ValueType
>
void
getValues
(
const
ValueType
&
val
,
void
getValues
(
const
ValueType
&
val
,
const
FiniteElemSpace
*
feSpace
,
const
FiniteElemSpace
*
feSpace
,
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
)
std
::
map
<
DegreeOfFreedom
,
double
>
&
indices
)
{
{
details
::
getValuesAux
(
val
,
feSpace
,
indices
,
details
::
getValuesAux
(
val
,
feSpace
,
indices
,
typename
boost
::
is_base_of
<
AbstractFunction
<
double
,
WorldVector
<
double
>
>
,
ValueType
>::
type
());
typename
boost
::
is_base_of
<
AbstractFunction
<
double
,
WorldVector
<
double
>
>
,
ValueType
>::
type
());
}
}
/**
/**
...
@@ -300,7 +331,7 @@ struct DirichletBcData : DirichletBcDataBase {
...
@@ -300,7 +331,7 @@ struct DirichletBcData : DirichletBcDataBase {
DirichletBcData
(
int
i_
,
int
j_
,
BoundaryType
nr_
,
PosType
&
meshIndicator_
,
const
ValueType
&
val_
)
DirichletBcData
(
int
i_
,
int
j_
,
BoundaryType
nr_
,
PosType
&
meshIndicator_
,
const
ValueType
&
val_
)
:
DirichletBcDataBase
(
i_
,
j_
),
boundary_nr
(
nr_
),
pos
(
meshIndicator_
),
val
(
val_
)
{}
:
DirichletBcDataBase
(
i_
,
j_
),
boundary_nr
(
nr_
),
pos
(
meshIndicator_
),
val
(
val_
)
{}
virtual
void
addToList
(
const
FiniteElemSpace
*
feSpace
,
std
::
vector
<
SingularDirichletBC
>
&
list
)
void
addToList
(
const
FiniteElemSpace
*
feSpace
,
std
::
vector
<
SingularDirichletBC
>
&
list
)
override
{
{
std
::
map
<
DegreeOfFreedom
,
double
>
indicesValues
;
std
::
map
<
DegreeOfFreedom
,
double
>
indicesValues
;
...
...
extensions/base_problems/CahnHilliard.cc
View file @
88e2a179
...
@@ -24,7 +24,10 @@
...
@@ -24,7 +24,10 @@
using
namespace
AMDiS
;
using
namespace
AMDiS
;
CahnHilliard
::
CahnHilliard
(
const
std
::
string
&
name_
)
:
namespace
details
{
template
<
typename
P
>
CahnHilliard
<
P
>::
CahnHilliard
(
const
std
::
string
&
name_
)
:
super
(
name_
),
super
(
name_
),
useMobility
(
false
),
useMobility
(
false
),
useReinit
(
false
),
useReinit
(
false
),
...
@@ -45,7 +48,7 @@ CahnHilliard::CahnHilliard(const std::string &name_) :
...
@@ -45,7 +48,7 @@ CahnHilliard::CahnHilliard(const std::string &name_) :
// type of double well: 0= [0,1], 1= [-1,1]
// type of double well: 0= [0,1], 1= [-1,1]
Parameters
::
get
(
name_
+
"->double-well type"
,
doubleWell
);
Parameters
::
get
(
name_
+
"->double-well type"
,
doubleWell
);
Parameters
::
get
(
name
+
"->use reinit"
,
useReinit
);
Parameters
::
get
(
name
_
+
"->use reinit"
,
useReinit
);
// transformation of the parameters
// transformation of the parameters
minusEps
=
-
eps
;
minusEps
=
-
eps
;
...
@@ -56,106 +59,106 @@ CahnHilliard::CahnHilliard(const std::string &name_) :
...
@@ -56,106 +59,106 @@ CahnHilliard::CahnHilliard(const std::string &name_) :
}
}
void
CahnHilliard
::
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
template
<
typename
P
>
{
FUNCNAME
(
"
CahnHilliard::solveInitialProblem(
)"
);
void
CahnHilliard
<
P
>
::
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
Flag
initFlag
=
initDataFromFile
(
adaptInfo
);
Flag
initFlag
=
self
::
initDataFromFile
(
adaptInfo
);
if
(
!
initFlag
.
isSet
(
DATA_ADOPTED
))
{
if
(
!
initFlag
.
isSet
(
DATA_ADOPTED
))
{
int
initialInterface
=
0
;
int
initialInterface
=
0
;
Initfile
::
get
(
name
+
"->initial interface"
,
initialInterface
);
Initfile
::
get
(
self
::
name
+
"->initial interface"
,
initialInterface
);
double
initialEps
=
eps
;
double
initialEps
=
eps
;
Initfile
::
get
(
name
+
"->initial epsilon"
,
initialEps
);
Initfile
::
get
(
self
::
name
+
"->initial epsilon"
,
initialEps
);
if
(
initialInterface
==
0
)
{
if
(
initialInterface
==
0
)
{
/// horizontale Linie
/// horizontale Linie
double
a
=
0.0
,
dir
=
-
1.0
;
double
a
=
0.0
,
dir
=
-
1.0
;
Initfile
::
get
(
name
+
"->line->pos"
,
a
);
Initfile
::
get
(
self
::
name
+
"->line->pos"
,
a
);
Initfile
::
get
(
name
+
"->line->direction"
,
dir
);
Initfile
::
get
(
self
::
name
+
"->line->direction"
,
dir
);
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Plane
(
a
,
dir
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Plane
(
a
,
dir
));
}
}
else
if
(
initialInterface
==
1
)
{
else
if
(
initialInterface
==
1
)
{
/// schraege Linie
/// schraege Linie
double
theta
=
m_pi
/
4.0
;
double
theta
=
m_pi
/
4.0
;
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
PlaneRotation
(
0.0
,
theta
,
1.0
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
PlaneRotation
(
0.0
,
theta
,
1.0
));
transformDOFInterpolation
(
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
PlaneRotation
(
0.0
,
-
theta
,
-
1.0
),
new
AMDiS
::
Min
<
double
>
);
transformDOFInterpolation
(
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
PlaneRotation
(
0.0
,
-
theta
,
-
1.0
),
new
AMDiS
::
Min
<
double
>
);
}
}
else
if
(
initialInterface
==
2
)
{
else
if
(
initialInterface
==
2
)
{
/// Ellipse
/// Ellipse
double
a
=
1.0
,
b
=
1.0
;
double
a
=
1.0
,
b
=
1.0
;
Initfile
::
get
(
name
+
"->ellipse->a"
,
a
);
Initfile
::
get
(
self
::
name
+
"->ellipse->a"
,
a
);
Initfile
::
get
(
name
+
"->ellipse->b"
,
b
);
Initfile
::
get
(
self
::
name
+
"->ellipse->b"
,
b
);
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Ellipse
(
a
,
b
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Ellipse
(
a
,
b
));
}
}
else
if
(
initialInterface
==
3
)
{
else
if
(
initialInterface
==
3
)
{
/// zwei horizontale Linien
/// zwei horizontale Linien
double
a
=
0.75
,
b
=
0.375
;
double
a
=
0.75
,
b
=
0.375
;
Initfile
::
get
(
name
+
"->lines->pos1"
,
a
);
Initfile
::
get
(
self
::
name
+
"->lines->pos1"
,
a
);
Initfile
::
get
(
name
+
"->lines->pos2"
,
b
);
Initfile
::
get
(
self
::
name
+
"->lines->pos2"
,
b
);
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Plane
(
a
,
-
1.0
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Plane
(
a
,
-
1.0
));
transformDOFInterpolation
(
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
Plane
(
b
,
1.0
),
new
AMDiS
::
Max
<
double
>
);
transformDOFInterpolation
(
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
),
new
Plane
(
b
,
1.0
),
new
AMDiS
::
Max
<
double
>
);
}
}
else
if
(
initialInterface
==
4
)
{
else
if
(
initialInterface
==
4
)
{
/// Kreis
/// Kreis
double
radius
=
1.0
;
double
radius
=
1.0
;
Initfile
::
get
(
name
+
"->kreis->radius"
,
radius
);
Initfile
::
get
(
self
::
name
+
"->kreis->radius"
,
radius
);
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Circle
(
radius
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Circle
(
radius
));
}
else
if
(
initialInterface
==
5
)
{
}
else
if
(
initialInterface
==
5
)
{
/// Rechteck
/// Rechteck
double
width
=
0.5
;
double
width
=
0.5
;
double
height
=
0.3
;
double
height
=
0.3
;
WorldVector
<
double
>
center
;
center
.
set
(
0.5
);
WorldVector
<
double
>
center
;
center
.
set
(
0.5
);
Initfile
::
get
(
name
+
"->rectangle->width"
,
width
);
Initfile
::
get
(
self
::
name
+
"->rectangle->width"
,
width
);
Initfile
::
get
(
name
+
"->rectangle->height"
,
height
);
Initfile
::
get
(
self
::
name
+
"->rectangle->height"
,
height
);
Initfile
::
get
(
name
+
"->rectangle->center"
,
center
);
Initfile
::
get
(
self
::
name
+
"->rectangle->center"
,
center
);
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
interpol
(
new
Rectangle
(
width
,
height
,
center
));
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
)
->
inte