diff --git a/problems/gradient-flow-curve-shortening.parset b/problems/gradient-flow-curve-shortening.parset new file mode 100644 index 0000000000000000000000000000000000000000..0eccf12e79723a6e58897744c7916294ecd1b9ed --- /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 0000000000000000000000000000000000000000..538f40c14de17b1a3e272f13b114e28f44f36b4d --- /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 5f722f12a3d27905e0f6b4e8ff924b86019fead0..58536e58fd7ae6af7d53730163f562f641ae4565 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");