Hello,
I want to solve a nonlinear PDE in fenics. After a few iterations I want to change the size of the time step: Is that possible?
Here is what I tried, but unfortunately, it doesn't work.
# Time Step
dt = 2.5e-06
dT = Constant(dt)
# Function F for Newton Method
F = F_1 + dT*F_2
# Derivative of F for Newton Method
J = derivative(F, u, du)
# Create Nonlinear Problem and Newton Solver
Problem = NonlinearVariationalProblem(F, u, bcs, J)
Solver = NonlinearVariationalSolver(Problem)
t = 0.0
u.interpolate(InitialConditions())
i = 0
# Loop
while (i < 500):
if i == 10:
dT = 10**4*dT
# Iterate
i += 1
t += dT
# Store old Solution
u0.vector()[:] = u.vector()
# Solve Nonlinear Problem
Solver.solve()
Can anyone help me?
Thanks a lot!