|
[Sponsors] |
Steady Lid-driven cavity flowstream function vorticity form |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 3, 2018, 12:12 |
Steady Lid-driven cavity flowstream function vorticity form
|
#1 |
New Member
thecampusgirl
Join Date: Jan 2018
Posts: 11
Rep Power: 8 |
Im master student and as a final project my teacher give a steady flow in a lid-driven cavity by using Naiver-Stokes equations in stream function vorticity form with deltax=deltay=0.1 Re=50,100 stopping criteria for both streamfunctions and vorticity is 0.0001.
initial vorticity is 0 everywhere , stream function zero at boundaries and partial derivative of streamfunction with respect to y is 1. So the only top lid is moving. We use finite difference for the scheme. I have to drive streamlines and vorticity equations. I try to write matlab code myself program runs but I think I missing some point and I am not sure how to put stopping criteria in loop. Matlab code that I write clear all close all n=11; x=linspace(0,1,n); y=linspace(0,1,n); h=x(2)-x(1); criteria=0.0001; Re=50; [xx,yy]=meshgrid(x,y); vortnew=zeros(n,n); psi=zeros(n,n); U=1; run=1; iter=0; for i=1:n for j=1:n psi(i,j,1)=0; vortnew(i,j,1)=0; if j==n psi(i,j,1)=0; vortnew(i,j,1)=-2/h; end end end % vorticity equation if run==1; while ( 1>criteria ) vortold=vortnew; psinew=psi; iter=iter+1; for i=1:n for j=1:n if j~=1 && j~=n && i~=1 && i~=n % Eger boundaryde degilse f(i,j)=-((psi(i,j+1)-psi(i,j-1))*(vortnew(i+1,j)-vortnew(i-1,j)))/4*(h^2) +((psi(i+1,j)-psi(i-1,j))*(vortnew(i,j+1)-vortnew(i,j-1)))/4*(h^2) +(vortnew(i+1,j)-4*vortnew(i,j)+vortnew(i-1,j)+vortnew(i,j+1))/Re*(h^2); elseif j==1 && i~=1 && i~=n vortnew(i,j)=2*(psi(i,j)-psi(i,j+1))/h^2; %Bottom elseif j==n && i~=1 && i~=n vortnew(i,j)=2*(psi(i,j)-psi(i,j-1))/h^2-2*U/h; % Top elseif i==1 && j~=1 && j~=n vortnew(i,j)=2*(psi(i,j)-psi(i+1,j))/h^2; % Left elseif i==n && j~=1 && j~=n vortnew(i,j)=2*(psi(i,j)-psi(i-1,j))/h^2; % Right elseif (i==1 && j==1) %corners equal to neighbors or zero vortnew(i,j)=0; elseif (i==n && j==1) vortnew(i,j)=0; elseif (i==1 && j==n) vortnew(i,j)=(vortnew(i+1,j)); elseif (i==n && j==n) vortnew(i,j)=(vortnew(i-1,j)); end end end end for i=1:n for j=1:m vortold(i,j)=vortnew(i,j)+(1-0.05)*f(i,j); % To guarantee convergence she give above statement end end %streamfunction equation non-boundary points for i=1:n for j=1:n if j~=1 && j~=n && i~=1 && i~=n psi(i,j)=0.25*(h^2*vortnew(i,j)+psi(i+1,j)+psi(i-1,j)+psi(i,j+1)+psi(i,j-1)); else psi(i,j)=0; end end end end |
|
January 4, 2018, 06:06 |
|
#2 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71 |
Stopping criteria are based on the evaluation of some norm of the (normalized) residuals. You have two equations so you need to apply the norm on two vectors of the residuals.
See https://www.sciencedirect.com/scienc...21999117306939 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Lid Driven Cavity velocity profiles | new_at_this | Main CFD Forum | 0 | December 22, 2011 16:04 |
Lid Driven Cavity using Ghost Cell Method and in C++ | illuminati5288 | Main CFD Forum | 0 | August 12, 2011 22:05 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 20:50 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 06:27 |
Two sided Lid Driven Cavity Flow | Perumal | Main CFD Forum | 1 | January 22, 2007 13:27 |