diff --git a/AMDiS/src/AdaptInfo.h b/AMDiS/src/AdaptInfo.h index ea83c53170e7385c9368c373902dd502257a44d1..e505f9b77dc47b8800cb3f99b9661f5d48d730e9 100644 --- a/AMDiS/src/AdaptInfo.h +++ b/AMDiS/src/AdaptInfo.h @@ -70,7 +70,7 @@ namespace AMDiS { GET_PARAMETER(0, prefix + "->sum factor", "%f", &fac_sum); GET_PARAMETER(0, prefix + "->max factor", "%f", &fac_max); - timeErrLow = timeTolerance; + timeErrLow = timeTolerance * 0.3; } /// Sum of all error estimates diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc index 107db52ad38d723fbefa41ff2c77efeabfa7c361..8f20a949325e567a35583320c62e634c68351817 100644 --- a/AMDiS/src/AdaptInstationary.cc +++ b/AMDiS/src/AdaptInstationary.cc @@ -169,11 +169,11 @@ namespace AMDiS { adaptInfo->setSpaceIteration(0); - /* === Do only space iterations only if the maximum is higher than 0. === */ + // === Do only space iterations only if the maximum is higher than 0. === if (adaptInfo->getMaxSpaceIteration() > 0) { - /* === Space iterations === */ + // === Space iterations. === do { problemIteration->beginIteration(adaptInfo); diff --git a/demo/init/ellipt.dat.1d b/demo/init/ellipt.dat.1d index 04812387b032ac72ccf71b60b8763f973e4b464c..95d3d893c83519911722cf7583d470b7706cb5e1 100644 --- a/demo/init/ellipt.dat.1d +++ b/demo/init/ellipt.dat.1d @@ -19,30 +19,12 @@ ellipt->estimator->error norm: 1 % 1: H1_NORM, 2: L2_NORM ellipt->estimator->C0: 0.1 % constant of element residual ellipt->estimator->C1: 0.1 % constant of jump residual -ellipt->adapt->tolerance: 1e-4 -ellipt->adapt->max iteration: 10 -ellipt->adapt->info: 8 - -ellipt->adapt->refine bisections: 1 - ellipt->marker->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS ellipt->marker->MSGamma: 0.5 -ellipt->marker->info: 8 -ellipt->output->filename: ellipt +ellipt->adapt->tolerance: 1e-4 +ellipt->adapt->max iteration: 10 +ellipt->adapt->refine bisections: 2 +ellipt->output->filename: output/ellipt ellipt->output->ParaView format: 1 - -ellipt->output->TecPlot format: 0 -ellipt->output->TecPlot ext: .tec - -ellipt->output->AMDiS format: 0 -ellipt->output->AMDiS mesh ext: .mesh -ellipt->output->AMDiS data ext: .dat - -ellipt->output->append index: 0 -ellipt->output->index length: 6 -ellipt->output->index decimals: 3 - -WAIT: 0 - diff --git a/demo/init/ellipt.dat.2d b/demo/init/ellipt.dat.2d index 11b7aba4e8f061bd9128fda5f661c49415714306..2cce76214818ac5317f11e8d718da0c14763fe8d 100644 --- a/demo/init/ellipt.dat.2d +++ b/demo/init/ellipt.dat.2d @@ -22,23 +22,9 @@ ellipt->estimator->C1: 0.1 % constant of jump residual ellipt->marker->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS ellipt->marker->MSGamma: 0.5 -ellipt->adapt->tolerance: 1e-4 -ellipt->adapt->max iteration: 10 +ellipt->adapt->tolerance: 1e-4 +ellipt->adapt->max iteration: 10 ellipt->adapt->refine bisections: 2 -ellipt->output->filename: ellipt - +ellipt->output->filename: output/ellipt ellipt->output->ParaView format: 1 - -ellipt->output->TecPlot format: 0 -ellipt->output->TecPlot ext: .tec - -ellipt->output->AMDiS format: 0 -ellipt->output->AMDiS mesh ext: .mesh -ellipt->output->AMDiS data ext: .dat - -ellipt->output->append index: 0 -ellipt->output->index length: 6 -ellipt->output->index decimals: 3 - -WAIT: 1 diff --git a/demo/init/ellipt.dat.3d b/demo/init/ellipt.dat.3d index 396d400ad228d46e4fee6d71ef961576423e3e64..93be86c4a27722b0e0ce976739a4269830c3672d 100644 --- a/demo/init/ellipt.dat.3d +++ b/demo/init/ellipt.dat.3d @@ -5,42 +5,25 @@ elliptMesh->global refinements: 0 ellipt->mesh: elliptMesh ellipt->dim: 3 -ellipt->polynomial degree: 2 +ellipt->polynomial degree: 1 -ellipt->solver: bicgstab +ellipt->solver: cg ellipt->solver->max iteration: 1000 ellipt->solver->tolerance: 1.e-8 ellipt->solver->info: 2 -ellipt->solver->left precon: ilu +ellipt->solver->left precon: diag ellipt->solver->right precon: no ellipt->estimator: residual ellipt->estimator->error norm: 1 % 1: H1_NORM, 2: L2_NORM ellipt->estimator->C1: 0.01 % constant of jump residual -ellipt->marker->strategy: 3 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS +ellipt->marker->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS ellipt->marker->MSGamma: 0.5 -ellipt->adapt->tolerance: 1e-8 -ellipt->adapt->max iteration: 5 -ellipt->adapt->info: 8 - -ellipt->adapt->refine bisections: 3 - -ellipt->output->filename: ellipt +ellipt->adapt->tolerance: 1e-4 +ellipt->adapt->max iteration: 10 +ellipt->adapt->refine bisections: 2 +ellipt->output->filename: output/ellipt ellipt->output->ParaView format: 1 - -ellipt->output->TecPlot format: 0 -ellipt->output->TecPlot ext: .tec - -ellipt->output->AMDiS format: 0 -ellipt->output->AMDiS mesh ext: .mesh -ellipt->output->AMDiS data ext: .dat - -ellipt->output->append index: 0 -ellipt->output->index length: 6 -ellipt->output->index decimals: 3 - -WAIT: 0 - diff --git a/demo/init/heat.dat.1d b/demo/init/heat.dat.1d index db1621c5daf13bce7bba9b2de9cca873f6a9d571..f82aa315b51ab9229eed65ee5250f10752ccc72b 100644 --- a/demo/init/heat.dat.1d +++ b/demo/init/heat.dat.1d @@ -4,7 +4,7 @@ heatMesh->macro file name: ./macro/macro.stand.1d heatMesh->global refinements: 0 heat->space->polynomial degree: 1 - +heat->space->dim: 1 heat->space->mesh: heatMesh heat->space->solver: cg @@ -21,51 +21,31 @@ heat->space->estimator->C3: 1.0 heat->theta: 1.0 -heat->adapt->tolerance: 0.01 - heat->adapt->timestep: 0.01 +heat->adapt->start time: 0.0 +heat->adapt->end time: 1.0 -heat->adapt->rel space error: 0.5 -heat->adapt->rel time error: 0.5 -heat->adapt->max iteration: 2 -heat->adapt->info: 8 -heat->adapt->coarsen allowed: 1 % 0|1 -heat->adapt->refine bisections: 1 -heat->adapt->coarsen bisections: 1 - - -heat->adapt->strategy: 1 % 0=explicit, 1=implicit -heat->adapt->max iteration: 1 - -heat->initial->marker->strategy: 2 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS +heat->adapt->tolerance: 0.01 +heat->adapt->time tolerance: 0.01 -heat->initial->adapt->max iteration: 10 -heat->initial->adapt->info: 8 +heat->adapt->strategy: 1 % 0=explicit, 1=implicit +heat->adapt->max iteration: 2 -heat->space->dim: 1 +heat->adapt->coarsen allowed: 1 +heat->adapt->refine bisections: 1 +heat->adapt->coarsen bisections: 1 -heat->space->marker->strategy: 3 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS +heat->space->marker->strategy: 3 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS heat->space->marker->ESTheta: 0.9 -heat->space->marker->ESThetaC: 0.05 - -heat->space->marker->info: 8 - -heat->space->output->filename: heat - -heat->space->output->ParaView format: 1 - -heat->space->output->TecPlot format: 0 -heat->space->output->TecPlot ext: .tec - -heat->space->output->AMDiS format: 0 -heat->space->output->AMDiS mesh ext: .mesh -heat->space->output->AMDiS data ext: .dat - -heat->space->output->write every i-th timestep: 1 - -heat->space->output->append index: 1 -heat->space->output->index length: 6 -heat->space->output->index decimals: 3 +heat->space->marker->ESThetaC: 0.05 + +heat->space->output->filename: output/heat +heat->space->output->ParaView format: 1 +heat->space->output->ParaView animation: 1 +heat->space->output->write every i-th timestep: 1 +heat->space->output->append index: 1 +heat->space->output->index length: 6 +heat->space->output->index decimals: 3 WAIT: 0 diff --git a/demo/init/heat.dat.2d b/demo/init/heat.dat.2d index 6cd362ed0fc394a2521ff7e6cf09390af6789bfa..f49b16a9a98cd86c60c2d5be838aacb5e7ac1fe7 100644 --- a/demo/init/heat.dat.2d +++ b/demo/init/heat.dat.2d @@ -7,49 +7,44 @@ heat->space->polynomial degree: 1 heat->space->dim: 2 heat->space->mesh: heatMesh -heat->space->solver: umfpack +heat->space->solver: cg heat->space->solver->max iteration: 1000 heat->space->solver->tolerance: 1.e-8 heat->space->solver->info: 2 -heat->space->solver->left precon: no +heat->space->solver->left precon: diag heat->space->solver->right precon: no heat->space->estimator: residual -heat->space->estimator->C0: 0.1 -heat->space->estimator->C1: 0.1 +heat->space->estimator->C0: 1.0 +heat->space->estimator->C1: 1.0 +heat->space->estimator->C3: 1.0 heat->theta: 1.0 -heat->adapt->timestep: 0.01 -heat->adapt->min timestep: 0.01 +heat->adapt->timestep: 0.1 heat->adapt->start time: 0.0 -heat->adapt->end time: 10.0 +heat->adapt->end time: 1.0 -heat->adapt->tolerance: 0.0001 -heat->adapt->rel space error: 0.5 -heat->adapt->rel time error: 0.5 -heat->adapt->time theta 1: 1.0 -heat->adapt->time theta 2: 0.3 +heat->adapt->tolerance: 0.05 +heat->adapt->time tolerance: 0.05 heat->adapt->strategy: 1 % 0=explicit, 1=implicit -heat->adapt->time delta 1: 0.7071 -heat->adapt->time delta 2: 1.4142 heat->adapt->max iteration: 100 -heat->adapt->coarsen allowed: 1 % 0|1 -heat->adapt->refine bisections: 1 -heat->adapt->coarsen bisections: 1 +heat->adapt->coarsen allowed: 1 +heat->adapt->refine bisections: 2 +heat->adapt->coarsen bisections: 2 -heat->space->marker->strategy: 4 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS +heat->space->marker->strategy: 2 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS heat->space->marker->MSGamma: 0.5 heat->space->marker->MSGammaC: 0.1 -heat->space->output->ParaView animation: 1 -heat->space->output->filename: output/heat -heat->space->output->ParaView format: 1 -heat->space->output->write every i-th timestep: 1 -heat->space->output->append index: 1 -heat->space->output->index length: 6 -heat->space->output->index decimals: 3 +heat->space->output->filename: output/heat +heat->space->output->ParaView format: 1 +heat->space->output->ParaView animation: 1 +heat->space->output->write every i-th timestep: 1 +heat->space->output->append index: 1 +heat->space->output->index length: 6 +heat->space->output->index decimals: 3 WAIT: 0 diff --git a/demo/init/heat.dat.3d b/demo/init/heat.dat.3d index 8b39a666010d55beb5689c4e3e0028492fd9c131..77dbfc0f9b0be2e8adbed80f16ed69d7d4dfe415 100644 --- a/demo/init/heat.dat.3d +++ b/demo/init/heat.dat.3d @@ -3,7 +3,7 @@ dimension of world: 3 heatMesh->macro file name: ./macro/macro.stand.3d heatMesh->global refinements: 3 -heat->space->polynomial degree: 2 +heat->space->polynomial degree: 1 heat->space->dim: 3 heat->space->mesh: heatMesh @@ -21,45 +21,32 @@ heat->space->estimator->C3: 1.0 heat->theta: 1.0 -heat->adapt->tolerance: 0.01 - heat->adapt->timestep: 0.01 -heat->adapt->rel space error: 0.5 -heat->adapt->rel time error: 0.5 -heat->adapt->strategy: 1 % 0=explicit, 1=implicit -heat->adapt->max iteration: 1 -heat->adapt->info: 2 - -heat->initial->adapt->strategy: 2 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS -heat->initial->adapt->max iteration: 10 -heat->initial->adapt->info: 2 +heat->adapt->start time: 0.0 +heat->adapt->end time: 1.0 -heat->adapt->strategy: 3 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS -heat->adapt->ESTheta: 0.9 -heat->adapt->ESThetaC: 0.05 -heat->adapt->max iteration: 2 -heat->adapt->coarsen allowed: 1 % 0|1 -heat->adapt->info: 2 -heat->adapt->refine bisections: 3 -heat->adapt->coarsen bisections: 3 - - -heat->space->output->filename: heat +heat->adapt->tolerance: 0.01 +heat->adapt->time tolerance: 0.01 -heat->space->output->ParaView format: 1 +heat->adapt->strategy: 1 % 0=explicit, 1=implicit +heat->adapt->max iteration: 2 -heat->space->output->TecPlot format: 0 -heat->space->output->TecPlot ext: .tec +heat->adapt->strategy: 3 % 0=none, 1=GR, 2=MS, 3=ES, 4=GERS +heat->adapt->ESTheta: 0.9 +heat->adapt->ESThetaC: 0.05 -heat->space->output->AMDiS format: 0 -heat->space->output->AMDiS mesh ext: .mesh -heat->space->output->AMDiS data ext: .dat -heat->space->output->write every i-th timestep: 100 +heat->adapt->coarsen allowed: 1 +heat->adapt->refine bisections: 3 +heat->adapt->coarsen bisections: 3 -heat->space->output->append index: 1 -heat->space->output->index length: 6 -heat->space->output->index decimals: 3 +heat->space->output->filename: output/heat +heat->space->output->ParaView format: 1 +heat->space->output->ParaView animation: 1 +heat->space->output->write every i-th timestep: 1 +heat->space->output->append index: 1 +heat->space->output->index length: 6 +heat->space->output->index decimals: 3 WAIT: 0 diff --git a/demo/init/vecellipt.dat.1d b/demo/init/vecellipt.dat.1d index 1dade792ae2966c70908d56bf7bd4d96c8d146af..5b68c9f1f475f1648ff5abf1e46930e5d8a4de7c 100644 --- a/demo/init/vecellipt.dat.1d +++ b/demo/init/vecellipt.dat.1d @@ -5,16 +5,15 @@ vecelliptMesh->global refinements: 0 vecellipt->mesh: vecelliptMesh vecellipt->dim: 1 -vecellipt->polynomial degree[0]: 2 -vecellipt->polynomial degree[1]: 2 - vecellipt->components: 2 +vecellipt->polynomial degree[0]: 1 +vecellipt->polynomial degree[1]: 1 -vecellipt->solver: bicgstab +vecellipt->solver: ufmpack vecellipt->solver->max iteration: 1000 vecellipt->solver->tolerance: 1.e-8 vecellipt->solver->info: 2 -vecellipt->solver->left precon: diag +vecellipt->solver->left precon: no vecellipt->solver->right precon: no vecellipt->estimator[0]: residual @@ -33,18 +32,11 @@ vecellipt->estimator[1]->C1: 0.1 % constant of jump residual vecellipt->marker[0]->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS vecellipt->marker[1]->MSGamma: 0.5 -vecellipt->adapt->max iteration: 8 -vecellipt->adapt->info: 8 - -vecellipt->adapt->refine bisections: 1 - vecellipt->adapt[0]->tolerance: 1e-4 vecellipt->adapt[1]->tolerance: 1e-4 -vecellipt->output->filename: vecellipt -vecellipt->output->ParaView format: 1 - -vecellipt->info: 8 - -WAIT: 0 +vecellipt->adapt->max iteration: 10 +vecellipt->adapt->refine bisections: 2 +vecellipt->output->filename: output/vecellipt +vecellipt->output->ParaView format: 1 diff --git a/demo/init/vecellipt.dat.2d b/demo/init/vecellipt.dat.2d index 8ea2462bb3db0f8ef19f9ed74b0b8ceea3df868a..8d04dd3f092e3d6bc2b3ca040ad595baccbee282 100644 --- a/demo/init/vecellipt.dat.2d +++ b/demo/init/vecellipt.dat.2d @@ -5,9 +5,7 @@ vecelliptMesh->global refinements: 0 vecellipt->mesh: vecelliptMesh vecellipt->dim: 2 - -vecellipt->components: 2 - +vecellipt->components: 2 vecellipt->polynomial degree[0]: 1 vecellipt->polynomial degree[1]: 1 @@ -29,15 +27,12 @@ vecellipt->marker[0]->MSGamma: 0.5 vecellipt->estimator[1]: 0 vecellipt->marker[1]->strategy: 0 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS - vecellipt->adapt[0]->tolerance: 1e-2 vecellipt->adapt[1]->tolerance: 1e-3 -vecellipt->adapt->max iteration: 100 +vecellipt->adapt->max iteration: 10 vecellipt->adapt->refine bisections: 2 -vecellipt->output->filename: vecellipt +vecellipt->output->filename: output/vecellipt vecellipt->output->ParaView format: 1 -WAIT: 0 - diff --git a/demo/init/vecellipt.dat.3d b/demo/init/vecellipt.dat.3d index e7efeb64aa544d3c7cd55cdee90e278b8bd9c31e..22a693176468f49e86790f78f60d9c28fd4f3e11 100644 --- a/demo/init/vecellipt.dat.3d +++ b/demo/init/vecellipt.dat.3d @@ -5,16 +5,15 @@ vecelliptMesh->global refinements: 0 vecellipt->mesh: vecelliptMesh vecellipt->dim: 3 -vecellipt->polynomial degree[0]: 1 -vecellipt->polynomial degree[1]: 1 - vecellipt->components: 2 +vecellipt->polynomial degree[0]: 1 +vecellipt->polynomial degree[1]: 1 -vecellipt->solver: bicgstab +vecellipt->solver: umfpack vecellipt->solver->max iteration: 1000 vecellipt->solver->tolerance: 1.e-8 vecellipt->solver->info: 2 -vecellipt->solver->left precon: diag +vecellipt->solver->left precon: no vecellipt->solver->right precon: no vecellipt->estimator[0]: residual @@ -33,21 +32,11 @@ vecellipt->estimator[1]->C1: 0.1 % constant of jump residual vecellipt->marker[1]->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS vecellipt->marker[1]->MSGamma: 0.5 -vecellipt->adapt->max iteration: 5 -vecellipt->adapt->info: 8 - -vecellipt->adapt->refine bisections[0]: 3 -vecellipt->adapt->refine bisections[1]: 3 - - vecellipt->adapt[0]->tolerance: 1e-4 vecellipt->adapt[1]->tolerance: 1e-4 +vecellipt->adapt->max iteration: 10 +vecellipt->adapt->refine bisections: 2 -vecellipt->output->filename: vecellipt -vecellipt->output->ParaView format: 1 - -vecellipt->info: 8 - -WAIT: 0 - +vecellipt->output->filename: output/vecellipt +vecellipt->output->ParaView format: 1 diff --git a/demo/src/ellipt.cc b/demo/src/ellipt.cc index 7ac58241ad8414f55773326473d2ffc47670e0c6..906968953a43b25a347304887079cac819e22bec 100644 --- a/demo/src/ellipt.cc +++ b/demo/src/ellipt.cc @@ -29,7 +29,7 @@ public: /// Implementation of AbstractFunction::operator(). double operator()(const WorldVector<double>& x) const { - int dow = x.getSize(); + int dow = Global::getGeo(WORLD); double r2 = (x * x); double ux = exp(-10.0 * r2); return -(400.0 * r2 - 20.0 * dow) * ux; diff --git a/demo/src/heat.cc b/demo/src/heat.cc index 80a60ecb7283c3694dad15551a2efe039f2c1842..04829495670ef480e0dc18c6fd815967bb8efc55 100644 --- a/demo/src/heat.cc +++ b/demo/src/heat.cc @@ -30,7 +30,7 @@ public: /// Implementation of AbstractFunction::operator(). double operator()(const WorldVector<double>& x) const { - int dim = x.getSize(); + int dim = Global::getGeo(WORLD); double r2 = x * x; double ux = sin(M_PI * (*timePtr)) * exp(-10.0 * r2); double ut = M_PI * cos(M_PI * (*timePtr)) * exp(-10.0 * r2); @@ -58,7 +58,7 @@ public: WARNING("Use a sufficiently small time step size!!!\n"); } MSG("theta = %f\n", theta); - theta1 = theta - 1; + theta1 = theta - 1.0; } // ===== ProblemInstatBase methods =================================== @@ -66,9 +66,10 @@ public: /// set the time in all needed functions! void setTime(AdaptInfo *adaptInfo) { + ProblemInstat::setTime(adaptInfo); + rhsTime = adaptInfo->getTime() - (1 - theta) * adaptInfo->getTimestep(); boundaryTime = adaptInfo->getTime(); - tau1 = 1.0 / adaptInfo->getTimestep(); } void closeTimestep(AdaptInfo *adaptInfo) @@ -118,12 +119,6 @@ public: return &theta1; } - /// Returns pointer to \ref tau1 - double *getTau1Ptr() - { - return &tau1; - } - /// Returns pointer to \ref rhsTime. double *getRHSTimePtr() { @@ -143,9 +138,6 @@ private: /// theta - 1 double theta1; - /// 1.0 / timestep - double tau1; - /// time for right hand side functions. double rhsTime; @@ -193,6 +185,13 @@ int main(int argc, char** argv) adaptInfoInitial); + // ===== create boundary functions ===== + G *boundaryFct = new G; + boundaryFct->setTimePtr(heat.getBoundaryTimePtr()); + heat.setExactSolution(boundaryFct); + heatSpace.addDirichletBC(1, boundaryFct); + + // ===== create rhs functions ===== int degree = heatSpace.getFeSpace()->getBasisFcts()->getDegree(); F *rhsFct = new F(degree); @@ -216,8 +215,8 @@ int main(int argc, char** argv) Operator C(heatSpace.getFeSpace()); C.addZeroOrderTerm(new Simple_ZOT); C.setUhOld(heat.getOldSolution()); - heatSpace.addMatrixOperator(C, heat.getTau1Ptr(), heat.getTau1Ptr()); - heatSpace.addVectorOperator(C, heat.getTau1Ptr(), heat.getTau1Ptr()); + heatSpace.addMatrixOperator(C, heat.getInvTau(), heat.getInvTau()); + heatSpace.addVectorOperator(C, heat.getInvTau(), heat.getInvTau()); // create RHS operator Operator F(heatSpace.getFeSpace()); @@ -225,14 +224,6 @@ int main(int argc, char** argv) heatSpace.addVectorOperator(F); - // ===== create boundary functions ===== - G *boundaryFct = new G; - boundaryFct->setTimePtr(heat.getBoundaryTimePtr()); - heat.setExactSolution(boundaryFct); - - // heatSpace.addDirichletBC(DIRICHLET, boundaryFct); - - // ===== start adaption loop ===== int errorCode = adaptInstat.adapt(); diff --git a/demo/src/vecellipt.cc b/demo/src/vecellipt.cc index 8283d78dfaaa02ccd5120bbefe106bac99161cf2..dedf5311cc2f89d6b8dad89742d6b4a158115516 100644 --- a/demo/src/vecellipt.cc +++ b/demo/src/vecellipt.cc @@ -27,7 +27,7 @@ public: /// Implementation of AbstractFunction::operator(). double operator()(const WorldVector<double>& x) const { - int dim = x.getSize(); + int dim = Global::getGeo(WORLD); double r2 = (x * x); double ux = exp(-10.0 * r2); return -(400.0 * r2 - 20.0 * dim) * ux; diff --git a/doc/tutorial/ellipt.tex b/doc/tutorial/ellipt.tex index d471e3496a7acd527245f001c7b153d8b75ea4c5..8993682a7182aeb17137a771a5013734ac4df62d 100644 --- a/doc/tutorial/ellipt.tex +++ b/doc/tutorial/ellipt.tex @@ -268,28 +268,29 @@ a finer mesh. \begin{lstlisting}{} ellipt->mesh: elliptMesh ellipt->dim: 2 -ellipt->polynomial degree: 3 +ellipt->polynomial degree: 1 \end{lstlisting} Now, we construct the finite element space for the problem \verb+ellipt+ (see Section \ref{s:ellipt code}). We use the mesh \verb+elliptMesh+, set the problem dimension to 2, and choose Lagrange -basis functions of degree 3. +basis functions of degree 1. \begin{lstlisting}{} -ellipt->solver: cg % no bicgstab cg gmres odir ores +ellipt->solver: cg ellipt->solver->max iteration: 1000 ellipt->solver->tolerance: 1.e-8 -ellipt->solver->left precon: diag % no, diag +ellipt->solver->left precon: diag +ellipt->solver->right precon: no \end{lstlisting} We use the {\it conjugate gradient method} as iterative solver. The solving process stops after maximal $1000$ iterations or when a -tolerance of $10^{-8}$ is reached. Furthermore, we apply diagonal -pre-conditioning. +tolerance of $10^{-8}$ is reached. Furthermore, we apply diagonal left +preconditioning, and no right preconditioning. \begin{lstlisting}{} -ellipt->estimator: residual % residual, recovery +ellipt->estimator: residual ellipt->estimator->error norm: 1 ellipt->estimator->C0: 0.1 ellipt->estimator->C1: 0.1 @@ -309,27 +310,23 @@ coarsening. Here, we use the maximum strategy with $\gamma = 0.5$. \begin{lstlisting}{} ellipt->adapt->tolerance: 1e-4 -ellipt->adapt->max iteration: 100 +ellipt->adapt->max iteration: 10 ellipt->adapt->refine bisections: 2 \end{lstlisting} The adaptation loop stops, when an error tolerance of $10^{-4}$ is -reached, or after maximal $100$ iterations. An element that is marked +reached, or after maximal $10$ iterations. An element that is marked for refinement, is bisected twice within one iteration. Analog elements that are marked for coarsening are coarsened twice per iteration. \begin{lstlisting}{} ellipt->output->filename: output/ellipt -ellipt->output->AMDiS format: 1 -ellipt->output->AMDiS mesh ext: .mesh -ellipt->output->AMDiS data ext: .dat +ellipt->output->ParaView format: 1 \end{lstlisting} -The result is written in AMDiS-format to the files -\verb+output/ellipt.mesh+ and \verb+output/ellipt.dat+. The first -contains the final mesh, the second contains the corresponding -solution values. +The result is written in ParaView-format to the file +\verb+output/ellipt.vtu+. \subsection{Macro file} \label{s:ellipt macro} diff --git a/doc/tutorial/heat.tex b/doc/tutorial/heat.tex index d811b894d9255741f3215e37217f58c7052a18e9..0728c13787b363470173d4caca299198450d830a 100644 --- a/doc/tutorial/heat.tex +++ b/doc/tutorial/heat.tex @@ -104,7 +104,7 @@ public: theta = -1.0; GET_PARAMETER(0, name + "->theta", "%f", &theta); TEST_EXIT(theta >= 0)("theta not set!\n"); - theta1 = theta - 1; + theta1 = theta - 1.0; } \end{lstlisting} @@ -117,7 +117,6 @@ The next lines show the implementation of the time interface. { rhsTime = adaptInfo->getTime() - (1 - theta) * adaptInfo->getTimestep(); boundaryTime = adaptInfo->getTime(); - tau1 = 1.0 / adaptInfo->getTimestep(); } void closeTimestep(AdaptInfo *adaptInfo) @@ -130,11 +129,8 @@ The next lines show the implementation of the time interface. The method \verb+setTime+ is called by the adaptation loop to inform the problem about the current time. The right hand side function $f$ will be evaluated at $t^{old}+\theta\tau = t^{new} - (1-\theta)\tau$, -the Dirichlet boundary function $g$ at $t^{new}$. $t^{new}$ is the -current time, $\tau$ is the current timestep, both set by the -adaptation loop and stored in \verb+adaptInfo+. \verb+tau1+ stores the -value of $\frac{1}{\tau}$, which is used later as factor for the zero -order time discretization terms. +the Dirichlet boundary function $g$ at $t^{new}$, which is the +current time. The method \verb+closeTimestep+ is called at the end of each timestep by the adaptation loop. In the default implementation of @@ -193,14 +189,12 @@ Now, we define some getting functions and the private member variables: \begin{lstlisting}{} double *getThetaPtr() { return θ }; double *getTheta1Ptr() { return &theta1; }; - double *getTau1Ptr() { return &tau1; }; double *getRHSTimePtr() { return &rhsTime; }; double *getBoundaryTimePtr() { return &boundaryTime; }; private: double theta; double theta1; - double tau1; double rhsTime; double boundaryTime; AbstractFunction<double, WorldVector<double> > *exactSolution; @@ -259,14 +253,12 @@ The object \verb+heatSpace+ is handed as as \verb+ProblemTimeInterface+ (implemented by class \verb+ProblemInstatScal+). -The definitions of functions $f$ and $g$ are: - +The functions $f$ and $g$ are declared in the following way: \begin{lstlisting}{} // ===== create boundary functions ===== G *boundaryFct = new G; boundaryFct->setTimePtr(heat.getBoundaryTimePtr()); heat.setExactSolution(boundaryFct); - heatSpace.addDirichletBC(1, boundaryFct); // ===== create rhs functions ===== @@ -274,7 +266,6 @@ The definitions of functions $f$ and $g$ are: F *rhsFct = new F(degree); rhsFct->setTimePtr(heat.getRHSTimePtr()); \end{lstlisting} - The functions interpreted as \verb+TimedObject+s are linked with the corresponding time pointers by \verb+setTimePtr+. The boundary function is handed to \verb+heat+ as exact solution and as Dirichlet @@ -313,14 +304,16 @@ operator by \verb+setUhOld+. Operator C(heatSpace.getFESpace()); C.addZeroOrderTerm(new Simple_ZOT); C.setUhOld(heat.getOldSolution()); - heatSpace.addMatrixOperator(C, heat.getTau1Ptr(), heat.getTau1Ptr()); - heatSpace.addVectorOperator(C, heat.getTau1Ptr(), heat.getTau1Ptr()); + heatSpace.addMatrixOperator(C, heat.getInvTau(), heat.getInvTau()); + heatSpace.addVectorOperator(C, heat.getInvTau(), heat.getInvTau()); \end{lstlisting} The \verb+Simple_ZOT+ of operator \verb+C+ represents the zero order terms for the time discretization. On both sides of the equation $u$ -is added with $\frac{1}{\tau}$ as assemble factor and as estimate -factor. +are added with the factor $\frac{1}{\tau}$ for both, assembling and +error estimation. The inverse of the current timestep is returned by +the function \verb+getInvTau()+, which is a member of the class +\verb+ProblemInstat+. Finally, the operator for the right hand side function $f$ is added and the adaptation loop is started: diff --git a/doc/tutorial/tutorial.pdf b/doc/tutorial/tutorial.pdf index 43b038d6b8462af34d0e7cc7945219d2d0e0dc44..613e311c722c4b1827ba5aec7526e580f80c33d1 100644 Binary files a/doc/tutorial/tutorial.pdf and b/doc/tutorial/tutorial.pdf differ diff --git a/doc/tutorial/vecellipt.tex b/doc/tutorial/vecellipt.tex index caf5972ef576f1665243358f29226d8fbd96db5f..a03045a2a1e73dffc590003863a76a024e60826e 100644 --- a/doc/tutorial/vecellipt.tex +++ b/doc/tutorial/vecellipt.tex @@ -121,26 +121,25 @@ a fixed factor of $1$ and once with a factor of $-1$. \subsection{Parameter file} First, the number of components and the basis function degrees are -given. We use Lagrange polynomials of degree 1 for the first component -and of degree 2 for the second component. +given. We use Lagrange polynomials of degree 1 for both components. \begin{lstlisting}{} vecellipt->components: 2 vecellipt->polynomial degree[0]: 1 -vecellipt->polynomial degree[1]: 2 +vecellipt->polynomial degree[1]: 1 \end{lstlisting} -In general, the linear system of equations for systems of PDEs is not -symmetric. So with the GMRes solver, we use a solver that doesn't -assume symmetric matrices. +For most small and mid-size linear systems, direct solver perform much +better than iterative ones. Therefore, we make use of the direct +solver UMFPACK in this example. \begin{lstlisting}{} -vecellipt->solver: gmres +vecellipt->solver: umfpack \end{lstlisting} -Note that we have only one solver, because the equations of our system -are assembled in one linear system of equations. +All other solver parameters are than ommited because they need to be +defined only for iterative solvers. Each equation can have its own estimator. In this case, adaptivity should be managed only by the first component. So the second equation @@ -148,7 +147,7 @@ has no estimator. \begin{lstlisting}{} vecellipt->estimator[0]: residual -vecellipt->estimator[1]: no +vecellipt->estimator[1]: 0 \end{lstlisting} Also the marking strategy can differ between the @@ -162,33 +161,26 @@ vecellipt->marker[0]->strategy: 2 vecellipt->marker[1]->strategy: 0 \end{lstlisting} -We have only one adaptation loop, which does maximal $6$ +We have only one adaptation loop, which does maximal $10$ iterations. The tolerance can be determined for each component. The total tolerance criterion is fulfilled, if all criteria of all components are fulfilled. \begin{lstlisting}{} -vecellipt->adapt->max iteration: 6 +vecellipt->adapt->max iteration: 10 -vecellipt->adapt[0]->tolerance: 1e-4 -vecellipt->adapt[1]->tolerance: 1e-4 +vecellipt->adapt[0]->tolerance: 1e-2 +vecellipt->adapt[1]->tolerance: 1e-3 \end{lstlisting} -Also the output can be controlled for each component individually: - +All components can be written into one file: \begin{lstlisting}{} -vecellipt->output[0]->filename: output/vecellipt_comp0 - -vecellipt->output[0]->AMDiS format: 1 -vecellipt->output[0]->AMDiS mesh ext: .mesh -vecellipt->output[0]->AMDiS data ext: .dat - -vecellipt->output[1]->filename: output/vecellipt_comp1 - -vecellipt->output[1]->AMDiS format: 1 -vecellipt->output[1]->AMDiS mesh ext: .mesh -vecellipt->output[1]->AMDiS data ext: .dat +vecellipt->output->filename: output/vecellipt +vecellipt->output->ParaView format: 1 \end{lstlisting} +As long as all FE spaces are equal, i.e., all components are +discretized on the same mesh with the same basis functions, all +components can and should be written to one file. \subsection{Macro file} We again use the macro file \verb+macro/macro.stand.2d+, which was