How to add tolerance in code for unsteady 2D problem?

Hello, I am working on unsteady 2D coupled PDE. I have four equations need to solve simultaneously. I generate a code even working well. But for accuracy purpose, I need to add tolerance. I did it for 2D (steady case) but couldn't success for this problem. My problem have four unknowns C,T,U and V. 'i' for x-index, 'j' for y-index and 'k' for time level. I am calculating each unknown, say C, at a particular 'i' for all 'j' at '(k+1)th' time level.
I attached my code here. Can someone help me?
Thank you in advance.
Kind regards,
BibiGul

Respuestas (2)

KSSV
KSSV el 11 de Oct. de 2018
Editada: KSSV el 11 de Oct. de 2018
Take the required errors out from the function...run the function for different values of (nx,ny,nt) when you get satisfactory error, break the loop.
nx = 10:10:100 ; % take your desired values
ny = nx ;
nt = nx ;
for i = 1:length(nx)
err = thesisp3atitol2(nx(i),ny(i),nt(i)) ;
if err<=tol
[nx(i) ny(i) nt(i)] % pick these values for less error
break
end
end

2 comentarios

Bibigul
Bibigul el 11 de Oct. de 2018
@KSSV nx, ny and nt are the no of points in x,y direction and for time respectively. Unknown vector , say C, is a vector of size(ny-1,1) for each i. I am calculating C at (k+1)th time level. I am trying to insert while loop.
KSSV
KSSV el 11 de Oct. de 2018
Yes I know that (nx,ny,nt) are number of points..okay you can replace the for loop with while loop very much.

Iniciar sesión para comentar.

Bibigul
Bibigul el 14 de Oct. de 2018
@KSSV I already run the function for different values of (nx, ny, nt). Now I want to check the error for fixed domain.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Oct. de 2018

Respondida:

el 14 de Oct. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by