My boundary value problem has a parameter that renders the problem easy or hard.
Is there a way to restart the solve function for the hard problem by specifying the solution of the easy problem as initial guess?
Below a MWE (solves Burgers equation by harmonic balancing. If nonlinscaling=0 (see below), problem reduces to linear Helmholtz equation)
# set source function
src(x) = 1.
# set right-hand side
function rhs!(du, u, p, x)
c, omd = p
C = u[1]; A = u[2]; B = u[3]
dC = du[1]; dA = du[2]; dB = du[3]
nonlinscaling = 0.2
du[1] = nonlinscaling*(A*dA+B*dB+C*dC)
du[2] = omd/c*B + nonlinscaling*(A*dC+C*dA)
du[3] = -omd/c*A - src(x)/c + nonlinscaling*(B*dC+C*dB)
end
# set boundary conditions
function bc(residual, u, p, x)
Cleft = 0; Aleft = 0; Bleft=0;
residual[1] = u[1][1] - Cleft
residual[2] = u[1][2] - Aleft
residual[3] = u[1][3] - Bleft
end
# set constants
c = 0.2
omd = 2*pi
p = [c, omd]
# set domain size
xspan = (0.,1.)
# set initial guess
start = [0., 1., 1.]
# define and solve the problem
bvp = BVProblem(rhs!, bc, start, xspan,p)
sol = solve(bvp, MIRK4(), dt = 0.005)