Commit 8c0fc620 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Several small features added.

parent fd5a901e
...@@ -44,7 +44,7 @@ available_tags=" CXX F77" ...@@ -44,7 +44,7 @@ available_tags=" CXX F77"
# ### BEGIN LIBTOOL CONFIG # ### BEGIN LIBTOOL CONFIG
# Libtool was configured on host deimos101: # Libtool was configured on host p2d108:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -82,13 +82,13 @@ AR="ar" ...@@ -82,13 +82,13 @@ AR="ar"
AR_FLAGS="cru" AR_FLAGS="cru"
# A C compiler. # A C compiler.
LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" LTCC="gcc"
# LTCC compiler flags. # LTCC compiler flags.
LTCFLAGS="-g -O2" LTCFLAGS="-g -O2"
# A language-specific compiler. # A language-specific compiler.
CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" CC="gcc"
# Is the compiler the GNU C compiler? # Is the compiler the GNU C compiler?
with_gcc=yes with_gcc=yes
...@@ -174,7 +174,7 @@ dlopen_self=unknown ...@@ -174,7 +174,7 @@ dlopen_self=unknown
dlopen_self_static=unknown dlopen_self_static=unknown
# Compiler flag to prevent dynamic linking. # Compiler flag to prevent dynamic linking.
link_static_flag="" link_static_flag="-static"
# Compiler flag to turn off builtin functions. # Compiler flag to turn off builtin functions.
no_builtin_flag=" -fno-builtin" no_builtin_flag=" -fno-builtin"
...@@ -6763,7 +6763,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` ...@@ -6763,7 +6763,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
# End: # End:
# ### BEGIN LIBTOOL TAG CONFIG: CXX # ### BEGIN LIBTOOL TAG CONFIG: CXX
# Libtool was configured on host deimos101: # Libtool was configured on host p2d108:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -6801,13 +6801,13 @@ AR="ar" ...@@ -6801,13 +6801,13 @@ AR="ar"
AR_FLAGS="cru" AR_FLAGS="cru"
# A C compiler. # A C compiler.
LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" LTCC="gcc"
# LTCC compiler flags. # LTCC compiler flags.
LTCFLAGS="-g -O2" LTCFLAGS="-g -O2"
# A language-specific compiler. # A language-specific compiler.
CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpiCC" CC="g++"
# Is the compiler the GNU C compiler? # Is the compiler the GNU C compiler?
with_gcc=yes with_gcc=yes
...@@ -6893,7 +6893,7 @@ dlopen_self=unknown ...@@ -6893,7 +6893,7 @@ dlopen_self=unknown
dlopen_self_static=unknown dlopen_self_static=unknown
# Compiler flag to prevent dynamic linking. # Compiler flag to prevent dynamic linking.
link_static_flag="" link_static_flag="-static"
# Compiler flag to turn off builtin functions. # Compiler flag to turn off builtin functions.
no_builtin_flag=" -fno-builtin" no_builtin_flag=" -fno-builtin"
...@@ -6960,11 +6960,11 @@ predeps="" ...@@ -6960,11 +6960,11 @@ predeps=""
# Dependencies to place after the objects being linked to create a # Dependencies to place after the objects being linked to create a
# shared library. # shared library.
postdeps="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -libverbs -lrt -lnuma -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s" postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
# The library search path used internally by the compiler when linking # The library search path used internally by the compiler when linking
# a shared library. # a shared library.
compiler_lib_search_path=`echo "-L/usr/lib64 -L/licsoft/libraries/openmpi/1.2.6/64bit/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/fastfs/wir/local/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.." | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` compiler_lib_search_path=`echo "-L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/fastfs/wir/local/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.." | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"`
# Method to check whether dependent libraries are shared objects. # Method to check whether dependent libraries are shared objects.
deplibs_check_method="pass_all" deplibs_check_method="pass_all"
...@@ -7071,7 +7071,7 @@ include_expsyms="" ...@@ -7071,7 +7071,7 @@ include_expsyms=""
# ### BEGIN LIBTOOL TAG CONFIG: F77 # ### BEGIN LIBTOOL TAG CONFIG: F77
# Libtool was configured on host deimos101: # Libtool was configured on host p2d108:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -7109,7 +7109,7 @@ AR="ar" ...@@ -7109,7 +7109,7 @@ AR="ar"
AR_FLAGS="cru" AR_FLAGS="cru"
# A C compiler. # A C compiler.
LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" LTCC="gcc"
# LTCC compiler flags. # LTCC compiler flags.
LTCFLAGS="-g -O2" LTCFLAGS="-g -O2"
......
...@@ -47,19 +47,18 @@ namespace AMDiS { ...@@ -47,19 +47,18 @@ namespace AMDiS {
/// Constructor. /// Constructor.
ScalContent(std::string prefix) ScalContent(std::string prefix)
: est_sum(0.0), : est_sum(0.0),
est_t_sum(0.0), est_t_sum(0.0),
est_max(0.0), est_max(0.0),
est_t_max(0.0), est_t_max(0.0),
fac_max(0.0), fac_max(0.0),
fac_sum(1.0), fac_sum(1.0),
spaceTolerance(0.0), spaceTolerance(0.0),
timeTolerance(0.0), timeTolerance(0.0),
timeErrLow(0.0), timeErrLow(0.0),
coarsenAllowed(0), coarsenAllowed(0),
refinementAllowed(1), refinementAllowed(1),
refineBisections(1), refineBisections(1),
coarseBisections(1) coarseBisections(1)
{ {
double timeTheta2 = 0.3; double timeTheta2 = 0.3;
...@@ -147,7 +146,8 @@ namespace AMDiS { ...@@ -147,7 +146,8 @@ namespace AMDiS {
solverTolerance(1e-8), solverTolerance(1e-8),
solverResidual(0.0), solverResidual(0.0),
scalContents(size), scalContents(size),
isDeserialized_(false) deserialized(false),
rosenbrockMode(false)
{ {
GET_PARAMETER(0, name_ + "->start time", "%f", &startTime); GET_PARAMETER(0, name_ + "->start time", "%f", &startTime);
time = startTime; time = startTime;
...@@ -615,13 +615,18 @@ namespace AMDiS { ...@@ -615,13 +615,18 @@ namespace AMDiS {
inline const int getCoarseBisections(int index) const inline const int getCoarseBisections(int index) const
{ {
return scalContents[index]->coarseBisections; return scalContents[index]->coarseBisections;
} }
inline int getSize() inline int getSize()
{ {
return scalContents.size(); return scalContents.size();
} }
inline bool getRosenbrockMode()
{
return rosenbrockMode;
}
inline void setSolverIterations(int it) inline void setSolverIterations(int it)
{ {
solverIterations = it; solverIterations = it;
...@@ -665,12 +670,17 @@ namespace AMDiS { ...@@ -665,12 +670,17 @@ namespace AMDiS {
/// Returns true, if the adaptive procedure was deserialized from a file. /// Returns true, if the adaptive procedure was deserialized from a file.
const bool isDeserialized() const const bool isDeserialized() const
{ {
return isDeserialized_; return deserialized;
} }
inline void setIsDeserialized(bool b) inline void setIsDeserialized(bool b)
{ {
isDeserialized_ = b; deserialized = b;
}
inline void setRosenbrockMode(bool b)
{
rosenbrockMode = b;
} }
/// Creates new scalContents with the given size. /// Creates new scalContents with the given size.
...@@ -767,7 +777,10 @@ namespace AMDiS { ...@@ -767,7 +777,10 @@ namespace AMDiS {
std::vector<ScalContent*> scalContents; std::vector<ScalContent*> scalContents;
/// Is true, if the adaptive procedure was deserialized from a file. /// Is true, if the adaptive procedure was deserialized from a file.
bool isDeserialized_; bool deserialized;
/// Is true, if the time adaption is controlled by a Rosenbrock Method.
bool rosenbrockMode;
}; };
} }
......
...@@ -523,19 +523,22 @@ namespace AMDiS { ...@@ -523,19 +523,22 @@ namespace AMDiS {
/// vec[i] = v.vec[i] /// vec[i] = v.vec[i]
void copy(const DOFVector<T>& v); void copy(const DOFVector<T>& v);
/// Returns minimum of DOFVector /// Returns minimum of DOFVector.
T min() const; T min() const;
/// Returns maximum of DOFVector /// Returns maximum of DOFVector.
T max() const; T max() const;
/// Returns absolute maximum of DOFVector /// Returns absolute maximum of DOFVector.
T absMax() const; T absMax() const;
/// Used by interpol while mesh traversal /// Returns the average value of the DOFVector.
T average() const;
/// Used by interpol while mesh traversal.
void interpolFct(ElInfo* elinfo); void interpolFct(ElInfo* elinfo);
/// Prints \ref vec to stdout /// Prints \ref vec to stdout.
void print() const; void print() const;
/// ///
......
...@@ -289,6 +289,7 @@ namespace AMDiS { ...@@ -289,6 +289,7 @@ namespace AMDiS {
return m; return m;
} }
template<typename T> template<typename T>
T DOFVector<T>::max() const T DOFVector<T>::max() const
{ {
...@@ -302,6 +303,7 @@ namespace AMDiS { ...@@ -302,6 +303,7 @@ namespace AMDiS {
m = std::max(m, *vecIterator); m = std::max(m, *vecIterator);
return m; return m;
} }
template<typename T> template<typename T>
...@@ -310,6 +312,26 @@ namespace AMDiS { ...@@ -310,6 +312,26 @@ namespace AMDiS {
return std::max(abs(max()), abs(min())); return std::max(abs(max()), abs(min()));
} }
template<typename T>
T DOFVector<T>::average() const
{
FUNCNAME("DOFVector<T>::average()");
checkFeSpace(this->feSpace, vec);
int count = 0;
T m = 0;
Iterator vecIterator(const_cast<DOFIndexed<T>*>(dynamic_cast<const DOFIndexed<T>*>(this)), USED_DOFS);
for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) {
m += *vecIterator;
count++;
}
return m / count;
}
template<typename T> template<typename T>
void DOFVector<T>::print() const void DOFVector<T>::print() const
{ {
......
...@@ -538,10 +538,11 @@ namespace AMDiS { ...@@ -538,10 +538,11 @@ namespace AMDiS {
adaptInfo->setEstSum(scalEstimator->getErrorSum(), i); adaptInfo->setEstSum(scalEstimator->getErrorSum(), i);
adaptInfo->setEstMax(scalEstimator->getErrorMax(), i); adaptInfo->setEstMax(scalEstimator->getErrorMax(), i);
adaptInfo->setTimeEstSum(scalEstimator->getTimeEst(), i);
adaptInfo->setTimeEstMax(scalEstimator->getTimeEstMax(), i); if (adaptInfo->getRosenbrockMode() == false) {
} else { adaptInfo->setTimeEstSum(scalEstimator->getTimeEst(), i);
WARNING("No estimator for component %d\n" , i); adaptInfo->setTimeEstMax(scalEstimator->getTimeEstMax(), i);
}
} }
} }
} }
...@@ -623,7 +624,7 @@ namespace AMDiS { ...@@ -623,7 +624,7 @@ namespace AMDiS {
FUNCNAME("ProblemVec::buildAfterCoarsen()"); FUNCNAME("ProblemVec::buildAfterCoarsen()");
if (dualMeshTraverseRequired()) { if (dualMeshTraverseRequired()) {
dualAssemble(adaptInfo, flag); dualAssemble(adaptInfo, flag, asmMatrix, asmVector);
return; return;
} }
...@@ -779,10 +780,13 @@ namespace AMDiS { ...@@ -779,10 +780,13 @@ namespace AMDiS {
} }
void ProblemVec::dualAssemble(AdaptInfo *adaptInfo, Flag flag) void ProblemVec::dualAssemble(AdaptInfo *adaptInfo, Flag flag,
bool asmMatrix, bool asmVector)
{ {
FUNCNAME("ProblemVec::dualAssemble()"); FUNCNAME("ProblemVec::dualAssemble()");
TEST_EXIT(asmVector)("Not yet implemented!\n");
for (unsigned int i = 0; i < meshes.size(); i++) for (unsigned int i = 0; i < meshes.size(); i++)
meshes[i]->dofCompress(); meshes[i]->dofCompress();
...@@ -828,7 +832,7 @@ namespace AMDiS { ...@@ -828,7 +832,7 @@ namespace AMDiS {
bool assembleMatrix = true; bool assembleMatrix = true;
// The DOFMatrix which should be assembled (or not, if assembleMatrix // The DOFMatrix which should be assembled (or not, if assembleMatrix
// will be set to false). // will be set to false).
DOFMatrix *matrix = (*systemMatrix)[i][j]; DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL);
if (writeAsmInfo && matrix) { if (writeAsmInfo && matrix) {
for (std::vector<Operator*>::iterator it = matrix->getOperatorsBegin(); for (std::vector<Operator*>::iterator it = matrix->getOperatorsBegin();
...@@ -874,6 +878,10 @@ namespace AMDiS { ...@@ -874,6 +878,10 @@ namespace AMDiS {
if (!assembleMatrix && i != j) if (!assembleMatrix && i != j)
if (matrix) if (matrix)
nnz += matrix->getBaseMatrix().nnz(); nnz += matrix->getBaseMatrix().nnz();
if (matrix && !assembleMatrix) {
ERROR_EXIT("Not yet implemented!\n");
}
} }
} }
...@@ -899,7 +907,7 @@ namespace AMDiS { ...@@ -899,7 +907,7 @@ namespace AMDiS {
for (int i = 0; i < nComponents; i++) { for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++) { for (int j = 0; j < nComponents; j++) {
DOFMatrix *matrix = (*systemMatrix)[i][j]; DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL);
if (!matrix) if (!matrix)
continue; continue;
...@@ -983,19 +991,18 @@ namespace AMDiS { ...@@ -983,19 +991,18 @@ namespace AMDiS {
for (int i = 0; i < nComponents; i++) { for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++) { for (int j = 0; j < nComponents; j++) {
DOFMatrix *matrix = (*systemMatrix)[i][j]; DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL);
if (matrix) if (!matrix)
matrix->removeRowsWithDBC(matrix->getApplyDBCs()); continue;
if (matrix) matrix->removeRowsWithDBC(matrix->getApplyDBCs());
matrix->finishInsertion(); matrix->finishInsertion();
if (matrix && matrix->getBoundaryManager()) if (matrix->getBoundaryManager())
matrix->getBoundaryManager()->exitMatrix(matrix); matrix->getBoundaryManager()->exitMatrix(matrix);
if (matrix) nnz += matrix->getBaseMatrix().nnz();
nnz += matrix->getBaseMatrix().nnz();
} }
// And now assemble boundary conditions on the vectors // And now assemble boundary conditions on the vectors
......
...@@ -182,7 +182,8 @@ namespace AMDiS { ...@@ -182,7 +182,8 @@ namespace AMDiS {
bool dualMeshTraverseRequired(); bool dualMeshTraverseRequired();
void dualAssemble(AdaptInfo *adaptInfo, Flag flag); void dualAssemble(AdaptInfo *adaptInfo, Flag flag,
bool asmMatrix = true, bool asmVector = true);
void createPrecon(); void createPrecon();
......
...@@ -179,9 +179,9 @@ namespace AMDiS { ...@@ -179,9 +179,9 @@ namespace AMDiS {
} }
if (output) { if (output) {
MSG("estimate = %.8e\n", est_sum); MSG("estimate for component %d = %.8e\n", row, est_sum);
if (C3) if (C3)
MSG("time estimate = %.8e\n", est_t_sum); MSG("time estimate for component %d = %.8e\n", row, est_t_sum);
} }
delete [] riq; delete [] riq;
......
...@@ -126,7 +126,8 @@ namespace AMDiS { ...@@ -126,7 +126,8 @@ namespace AMDiS {
DOFVector<double>::Iterator valueIt(values, USED_DOFS); DOFVector<double>::Iterator valueIt(values, USED_DOFS);
DOFVector< std::list<WorldVector<double> > >::Iterator coordIt(dofCoords, USED_DOFS); DOFVector< std::list<WorldVector<double> > >::Iterator coordIt(dofCoords, USED_DOFS);
file << std::fixed; file << std::scientific;
file.precision(15);
// Write the values for all vertex DOFs. // Write the values for all vertex DOFs.
for (intPointIt.reset(), valueIt.reset(), coordIt.reset(); for (intPointIt.reset(), valueIt.reset(), coordIt.reset();
......
...@@ -15,15 +15,23 @@ namespace AMDiS { ...@@ -15,15 +15,23 @@ namespace AMDiS {
firstTimestep(true), firstTimestep(true),
lastTimestepRejected(false), lastTimestepRejected(false),
succRejection(false), succRejection(false),
fixFirstTimesteps(0),
tauGamma(1.0) tauGamma(1.0)
{ {
FUNCNAME("RosenbrockAdaptInstationary::RosenbrockAdaptInstationary()");
std::string str; std::string str;
GET_PARAMETER(0, name + "->rosenbrock method", &str); GET_PARAMETER(0, name + "->rosenbrock method", &str);
RosenbrockMethodCreator *creator = RosenbrockMethodCreator *creator =
dynamic_cast<RosenbrockMethodCreator*>(CreatorMap<RosenbrockMethod>::getCreator(str)); dynamic_cast<RosenbrockMethodCreator*>(CreatorMap<RosenbrockMethod>::getCreator(str));
rosenbrockMethod = creator->create(); rosenbrockMethod = creator->create();
TEST_EXIT_DBG(rosenbrockMethod)("This should not happen!\n");
GET_PARAMETER(0, name + "->fix first timesteps", "%d", &fixFirstTimesteps);
problemStat->setRosenbrockMethod(rosenbrockMethod); problemStat->setRosenbrockMethod(rosenbrockMethod);
adaptInfo->setRosenbrockMode(true);
} }
...@@ -58,61 +66,63 @@ namespace AMDiS { ...@@ -58,61 +66,63 @@ namespace AMDiS {
double newTimestep = 0.0; double newTimestep = 0.0;
double order = rosenbrockMethod->getOrder(); double order = rosenbrockMethod->getOrder();
if (errorEst < timeTol) { if (errorEst < timeTol || fixFirstTimesteps > 0 || firstTimestep) {
double fac = 1.0; double fac = 1.0;
if (firstTimestep || succRejection) { if (fixFirstTimesteps > 0) {
fac = pow((timeTol / errorEst), 1.0 / order); newTimestep = adaptInfo->getTimestep();
} else { } else {
fac = adaptInfo->getTimestep() / tauAcc * if (firstTimestep || succRejection) {
pow((timeTol * estAcc / (errorEst * errorEst)), 1.0 / order); fac = pow((timeTol / errorEst), 1.0 / order);
} else {
fac = adaptInfo->getTimestep() / tauAcc *
pow((timeTol * estAcc / (errorEst * errorEst)), 1.0 / order);
}
fac = std::min(fac, 3.0);
newTimestep = fac * adaptInfo->getTimestep();
newTimestep *= 0.95;
} }
fac = std::min(fac, 3.0);
newTimestep = fac * adaptInfo->getTimestep();
tauAcc = adaptInfo->getTimestep(); tauAcc = adaptInfo->getTimestep();
estAcc = errorEst; estAcc = errorEst;