Skip to content
Snippets Groups Projects
Commit b9a6fc9b authored by Andreas Dedner's avatar Andreas Dedner
Browse files

ms tutorial example was not working and mcfObstacle had too small

epsilon to run efficiently enough
parent 310669ca
Branches feature/pip-install
No related tags found
2 merge requests!31.2.0 version based on dune core 2.8.0,!2Feature/improved api
......@@ -13,7 +13,7 @@ class Mcf:
"""Sharp definition for mean curvature flow"""
omega = [-2, -2], [2, 2], [3, 3]
endTime = 0.125
saveStep = 0.02
saveStep = 0.01
fileBase = "McfObstacle"
mobility = 1
......@@ -29,23 +29,19 @@ class Mcf:
return [[0, 1], [1, 0]]
if __name__== "__main__":
import numpy as np
import matplotlib.pyplot as plt
# run epsilon from 0.02 to 0.03 in 6 increments
maxLevel = 20
maxLevel = 15
dt = 1e-4
epsilon = 0.02
epsilon = 0.04
phaseField = PhaseModel(Mcf, constrained=True, epsilon=epsilon, dt=dt)
fempyBase = PhaseStepper(phaseField)
fempyBase.defaultRefine = [1.4, 0.2, 4, maxLevel]
fempyBase.gridSetup(13, maxLevel)
fempyBase.defaultRefine = [1.4, 1.2, 4, maxLevel]
solution = fempyBase.solution
while fempyBase.time < Mcf.endTime:
print(fempyBase.time)
print(fempyBase.time, flush=True)
fempyBase.nextTime()
fempyBase.adapt()
import math
from dune.fem.plotting import plotComponents
from phasefield import PhaseStepper, PhaseModel, SimpleInterpolation
from phasefield import PhaseStepper, PhaseModel, SimpleInterpolate
from ufl import conditional, grad
class Ms:
omega = [0, 0], [2, 2], [3, 3]
endTime = 0.05
saveStep = 0.005
mobility = 0.
def initial(x):
......@@ -41,7 +42,7 @@ solverParameters = {"fem.solver.newton.tolerance": 1e-9,
phaseField = PhaseModel(Ms, epsilon=0.15*math.sqrt(3/4), dt=1e-4)
phaseField.interpolate = SimpleInterpolate()
phaseField.interpolate = SimpleInterpolate
fempyBase = PhaseStepper(phaseField, solverParameters)
......@@ -50,7 +51,7 @@ fempyBase.gridSetup(12, 12)
solution = fempyBase.solution
while fempyBase.time < Ms.endTime:
print(fempyBase.timte)
print(fempyBase.time)
fempyBase.nextTime()
fempyBase.adapt()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment