# Why cant I get a stable Cranck Nicolson discretization?

조회 수: 1 (최근 30일)
Jort Puiman 2023년 1월 26일
댓글: Jort Puiman 2023년 3월 22일
Hi all,
For a project we try to design a reactor with a diffusion-convection-reaction mechanism before it reaches a steady state. Now, we are using the Cranck Nicoloson discretization for this reaction. However this does not seem to work properly. We get an unstable system, because we have a low diffusion coefficient. We have been playing around, but we cannot find how we can make this system more stable.
Attached is the code we are using right now.
Do you maybe have suggestions on how to make the discretization more stable? Many thanks!
edit: the initial mass balance we are trying to solve is dx/dt = D*d^2x/da^2+v_av*void*dx/da-k*void*x
We use a Dirichet boundary condition so that x=0 for t = 0 and a = 0.
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
Bjorn Gustavsson 2023년 3월 21일
@Jort Puiman: were our suggestions sufficient to solve your issue?
Jort Puiman 2023년 3월 22일
Unfortunately, our model was too sensitive, and our lecturer made us switch to the method of lines discretization.
The timesteps were indeed problematic, but smaller timesteps did not fully fix the problem, and the model remained unstable after a longer time.

댓글을 달려면 로그인하십시오.

### 답변 (2개)

Bjorn Gustavsson 2023년 1월 26일
(caveat: I didn't run your code or analyze it, but speak from my experience with CN) Most likely you take too long steps in time. Even for CN-methods one has to obey the CFL-condition when selecting the time-steps. You might have to read up on the Courant-Friedrichs-Levy condition: wiki-on-CFL-condition.
That was my experience, didn't think I needed to bother because CN is stable, but first solutions were not good, when the CFL-condition on dt was adhered to all was good.
HTH
##### 댓글 수: 0이전 댓글 -2개 표시이전 댓글 -2개 숨기기

댓글을 달려면 로그인하십시오.

Torsten 2023년 1월 26일
이동: Torsten 2023년 1월 26일
We use a Dirichet boundary condition so that x=0 for t = 0 and a = 0.
And which conditions at a = a_end ?
Try "pdepe".
If the convection term v_av*void*dx/da is too strong compared to the diffusion term, discretize dx/da using an upwind method, not central differences.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Electromagnetics에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by