0% found this document useful (0 votes)
39 views7 pages

Taller #4

The document discusses generating a Laplacian matrix for modeling pressure problems using computational fluid dynamics (CFD). It involves: 1. Generating a Laplacian matrix for a given number of points in each direction of a square grid. 2. Calculating and graphing the eigenvalues and singular values of the matrix to analyze it. 3. Generating the right hand side vector based on an expression in the referenced article to model pressure variation across the grid points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views7 pages

Taller #4

The document discusses generating a Laplacian matrix for modeling pressure problems using computational fluid dynamics (CFD). It involves: 1. Generating a Laplacian matrix for a given number of points in each direction of a square grid. 2. Calculating and graphing the eigenvalues and singular values of the matrix to analyze it. 3. Generating the right hand side vector based on an expression in the referenced article to model pressure variation across the grid points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Taller N 4

ENTENDIENDO EL PROBLEMA DE LA PRESIN


CFD
Maestra en Hidrosistemas
Presentado por:
Vctor Alfonso Garca Eraso

1. Generar la matriz Laplaciana para un determinado nmero de puntos en cada direccin, definidos por ustedes.
1

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

1 -4

1 -4

1 -4

10

0 -1

11

-1

12

-4

13

-4

14

-4

15

-1

16

-1

17

-4

18

-4

19

-4

20

-1

21

-1

22

-1

23

-1

24

-1

25

1 2 3 4 5
1 -2 0 0 0 0
2 0 -1 0 0 0
3 0 0 -1 0 0
4 0 0 0 -1 0
5 0 0 0 0 -1

6
1
0
0
0
0

7
0
1
0
0
0

8
0
0
1
0
0

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0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
0
0
0
0
0
0
0
1
0
0
0
0
1
0

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2

% _______________________________(Datos de Entrada)_______________________
%--------------------------------(genEracn de la superfcie)------------% Dimensin de la malla (cuadrada)
nx=16;
%Numero de pasos en el espcaio(x)
ny=nx;
%Numero de pasos en el espcaio(y)
niter=1000;
%Numero de iteraciones
n=nx;
nn = (n+1)-n
xmin = 1;
%Malla de refinamiento en x;
xmax = nx;
%Malla de refinamiento en x
ymin = 1;
%Malla de refinamiento en y
ymax = ny;
%Malla de refinamiento en y
%---(Generando vector con puntos de la discretizacin (equiespaciados)----x1 = linspace(xmin,xmax,n);
%Vector en x
y1 = linspace(ymin,ymax,n);
%Vector en y

dx = x1(2) - x1(1)
dy = y1(2) - y1(1)
x=0:dx:(nx*ny);
grid points
y=0:dy:(nx*ny);

G=zeros(nx,ny);
% pn=zeros(nx,ny);

%generacin de espacimaiento en x
%generacin de espacimaiento en y
%Rango of x(1,n) y espesifica los pntos en la malla the
%Range of y(1,n) y espesifica los pntos en la malla
%en esta etpa tenemos las posiciones
%posbles para los puntos en x y y
%desarrollando un arreglo que contiene la
%secuencia de valores uno en uno, cabe
%mecnionar que es una malla estructurada
%los valores en x y x son iguales y de
%igual magnitud y longitud x[1,n]
%vector de mano derecha g=b
%PPresin

% Generar vector parte derecha CC Neumman


delta = 1
a = delta;
b = a
xxmin = 0;
%Malla de refinamiento en x;
xxmax = a;
%Malla de refinamiento en x
yymin = 0;
%Malla de refinamiento en y
yymax = b;
%Malla de refinamiento en y
%---(Generando vector con puntos de la discretizacin (equiespaciados)----xx1 = linspace(xxmin,xxmax,nx);
%Vector en x
yy1 = linspace(yymin,yymax,ny);
%Vector en y
dxx = xx1(2) - xx1(1)
%generacin de espacimaiento en x
dyy = yy1(2) - yy1(1)

% ____________________(Generar la matriz Laplaciana)_______________________


%-------------------------------------------------------------------------A=zeros(nx*ny,nx*ny);
%Para los contornos de la matriz la aproximacin
%de diferencias finitas, as que se llenar la
%los puntos de ls contornos e interiores acorde
%con la discretiacin.
%
21 22 23 24 25
%
16 17 18 19 20
%
11 12 13 14 15
%
6
7 8 9 10
%
1
2 3 4 5
%---------------------------(Generacin de contornos - Anexo)-----------Ader=nx:nx:nx*ny;
Aizq=(nx+1):nx:((nx*ny)-(nx-1));
Aaba=1:1:nx;
Aarri=((nx*ny)-(nx+1)):1:(nx*ny);
Acent = x
Acent([Aaba Aizq Aarri Ader])=[];

2. Calcular y graficar los autovalores y valores singulares de la matriz y comentar sobre esto.

3. Generar el vector de mano derecha a partir de la expresin presentada en el artculo (Ec. 7).

[X,Y]=meshgrid(x1,y1);
xr = reshape(X,1,nx*ny)
yr = reshape(Y,1,nx*ny)
AA = -1/a^2*exp((xr+yr)/delta)+delta^2/(a^3*b)%-((1/(a*a))*exp(-(xr+yr)/delta))
BB = ((delta*delta)/(((a*a*a)*b)))
CC = delta^2/(a^3*b)% (1-exp(a/delta))*(1-exp(b/delta))%((1-exp(-a/delta)))*(1-exp(a/delta))
g = AA+(BB*CC)
G = -1/a^2*exp((xr+yr)/delta)+delta^2/(a^3*b)*(1-exp(a/delta))*(1-exp(b/delta));
g = G
g([Aaba Aizq Aarri Ader])=0;

4. Imponer condiciones de contorno =0 - Para la solucin del sistema de ecuaciones usar todos los mtodos
que puedan o encuentren (directos o iterativos).
f = A\g'
fnor = A\ggorro

[U, S, V]=svd(A);
mm = diag (S)
mmm = diag (U)
mmmm = diag (V)
U0=U(:,nx*ny);
s = svd(A)
figure

plot(s,'--rs','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',5)
figure
plot(mmm,'--ro','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',5)
figure
plot(mmmm,'--rd','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',5)

%Calcular b normalizado
ggorro=g'-U0*(U0'*g');
f = A\g'
fnor = A\ggorro

Amodificada=A
Amodificada(n-1,:)=0
Amodificada(n-1,n-1)=-1
[U, S, V]=svd(Amodificada);
ss = svd(Amodificada)

fnorAmodi = Amodificada\g'
fnorAmodiggorro = Amodificada\ggorro
fv1 = reshape(f,nx,ny);
fnorv1 = reshape(fnor,nx,ny);
fnorAmodiv1 = reshape(fnorAmodi,nx,ny);
fnorAmodiggorrov1 = reshape(fnorAmodiggorro,nx,ny);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy