From c47aa6e715c003e92ec16d0b1e80697651b80816 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Wed, 27 Jan 2016 13:17:41 +0100 Subject: [PATCH] New parameter and initial-value files for curve shortening flow --- .../gradient-flow-curve-shortening.parset | 55 +++++++++++++++++++ problems/initial-curve.py | 6 ++ src/gradient-flow.cc | 5 +- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 problems/gradient-flow-curve-shortening.parset create mode 100644 problems/initial-curve.py diff --git a/problems/gradient-flow-curve-shortening.parset b/problems/gradient-flow-curve-shortening.parset new file mode 100644 index 00000000..0eccf12e --- /dev/null +++ b/problems/gradient-flow-curve-shortening.parset @@ -0,0 +1,55 @@ +############################################# +# Grid parameters +############################################# + +structuredGrid = true +lower = 0 +upper = 1 +elements = 1 + +# Number of grid levels +numLevels = 1 + +############################################# +# Solver parameters +############################################# + +# Tolerance of the trust region solver +tolerance = 1e-12 + +# Max number of steps of the trust region solver +maxTrustRegionSteps = 0 + +# Initial trust-region radius +initialTrustRegionRadius = 1 + +# Number of multigrid iterations per trust-region step +numIt = 200 + +# Number of presmoothing steps +nu1 = 3 + +# Number of postsmoothing steps +nu2 = 3 + +# Number of coarse grid corrections +mu = 1 + +# Number of base solver iterations +baseIt = 100 + +# Tolerance of the multigrid solver +mgTolerance = 1e-10 + +# Tolerance of the base grid solver +baseTolerance = 1e-8 + +############################ +# Problem specifications +############################ + +# Type of energy we are minimizing +energy = harmonic + +# Inverse stereographic projection +initialIterate = initial-curve diff --git a/problems/initial-curve.py b/problems/initial-curve.py new file mode 100644 index 00000000..538f40c1 --- /dev/null +++ b/problems/initial-curve.py @@ -0,0 +1,6 @@ +import math + +# Wiggly initial curve on the sphere in R^3 for a curve-shortening flow simulation +def f(x): + return [math.sin(0.5*math.pi*x[0]), math.cos(0.5*math.pi*x[0]), 0] + diff --git a/src/gradient-flow.cc b/src/gradient-flow.cc index 5f722f12..58536e58 100644 --- a/src/gradient-flow.cc +++ b/src/gradient-flow.cc @@ -152,10 +152,10 @@ int main (int argc, char *argv[]) try //////////////////////////// // Read initial iterate into a PythonFunction - typedef VirtualDifferentiableFunction<FieldVector<double, dim>, TargetSpace::CoordinateType> FBase; + typedef PythonFunction<FieldVector<double, dim>, TargetSpace::CoordinateType> FBase; Python::Module module = Python::import(parameterSet.get<std::string>("initialIterate")); - auto pythonInitialIterate = module.get("fdf").toC<std::shared_ptr<FBase>>(); + auto pythonInitialIterate = module.get("f").toC<std::shared_ptr<FBase>>(); std::vector<TargetSpace::CoordinateType> v; ::Functions::interpolate(fufemFeBasis, v, *pythonInitialIterate); @@ -219,7 +219,6 @@ int main (int argc, char *argv[]) try TypeTree::hybridTreePath(), xEmbedded); - SubsamplingVTKWriter<GridType::LeafGridView> vtkWriter(grid->leafGridView(),0); vtkWriter.addVertexData(xFunction, VTK::FieldInfo("orientation", VTK::FieldInfo::Type::scalar, xEmbedded[0].size())); vtkWriter.write("gradientflow_result"); -- GitLab