I would like to solve the equation $$\partial_t u = C(t)\cdot u-u^2$$ using the Crank-Nicolson approach. That resulted in the equations \begin{align} \frac{u_1-u_0}{\Delta t}&=0.5\left((C_1u_1-u_1^2)+(C_0u_0-u_0^2)\right)\\ u_1\left(1-\frac{\Delta t}{2}C_1+\frac{\Delta t}{2}u_1\right)&=u_0\left(1+\frac{\Delta t}{2}C_0-\frac{\Delta t}{2}u_0\right) \end{align} Without the square part the solution would be easy, but I am lost with the $$u_1$$ in the left bracket. How can I fix that? Or is the Crank-Nicolson-Approach not usable for that problem?

• You have a non-linear ODE, using an implicit scheme will result in a set of non-linear algebraic equations. Commented Feb 14, 2017 at 9:37
• Which I then have to solve, but how (especially in my case here)? Commented Feb 14, 2017 at 10:48
• You can either $1.$ solve for the roots of your quadratic in $u_{1}$ and determine which root is the true solution, $2.$ use a Newton iteration at each step to solve for the root, or $3.$ you can scrap the Crank-Nicholson method and use an IMEX approach (discretise the linear terms implicitly, the non-linear terms explicitly) instead. Commented Feb 14, 2017 at 10:56
• This is not CN, as it is not applied to a PDE. This is just the implicit trapezoidal method applied to an ODE. And yes, CN seen as an instance of the method-of-lines uses the impl. trap. method in its time evolution. Commented May 13, 2022 at 7:53

Only one variable $$t$$ appears in the equation : $$\partial_t u = C(t)\cdot u-u^2$$ Thus this is a PDE reduced to an ODE : $$\frac{du}{dt}=C(t)u(t)-\big(u(t)\big)^2$$ To solve this Riccati ODE the change of function is : $$u(t)=\frac{1}{y(t)}\frac{dy}{dt}$$ $$u'=\frac{y''}{y}-\frac{(y')^2}{y^2}=C(t)\frac{y'}{y}-\left(\frac{y'}{y}\right)^2$$ $$y''=C(t)y'\quad\implies\quad \frac{y''}{y'}=C(t)$$ $$y'=c_1e^{\int C(t)dt}$$ $$y=c_1\int\left(e^{\int C(t)dt}\right)dt+c_2$$ $$u(t)=\frac{c_1e^{\int C(t)dt}}{c_1\int\left(e^{\int C(t)dt}\right)dt+c_2}$$ The exact solution is $$\boxed{u(t)=\frac{e^{\int C(t)dt}}{\int\left(e^{\int C(t)dt}\right)dt+c}}$$ $$c=\frac{c_2}{c_1}=$$constant (to be determined according to some initial condition not specified in the wording of the question).
• One could also identify this as Bernoulli DE, $y=1/u$, $y'=1-C(t)y$, ... Commented May 13, 2022 at 8:56