Post on 13-Apr-2018
7/23/2019 mecc.com6
http://slidepdf.com/reader/full/mecccom6 1/6
Svuotamento a potenziale di un serbatoio
◼ Risoluzione del problema col metodo variazionale
(*Svuotamento 2D di un serbatoio parallelepipedo in
termini di funzione di corrente ψ e di funzione potenziale φ,
col metodo di minimizzazione del funzionale*)
Off[General::"spell"]
Off[General::"spell1"]
(* Numero modi *)
Nmod = 40;
(*intensità della vorticità*)ω0 = 0.;
(*Portata*)
q = 1;
(*Dimensioni serbatoio*)
L = 1;
h = 1;
(*Posizione sbocco*)
a = .4;
b = .6;
(* Velocità inbocco e sbocco*)
v1 = q / L;
v3 = q / ( b - a);
(* Valori al contorno della ψ *)
gb[x_] =0 0 ≤ x ≤ a
v3 (x - a) a < x ≤ b
v1 L True
;
ga[x_] := v1 x;
ϵ = 10-20;
(*Funzione prolungata in tutto il dominio*)
Ψ0[x_, y_] :=
(h - y)
h gb[x] +
y
h ga[x];
(*Campo di vorticità qualitativo*)
ωx[x_] = -ⅇ-(x/Θ) + ⅇ-((L-x)/Θ);
ωy[y_] = ⅇ-6 y/h;
ω[x_, y_] = ωx[x] ωy[y];
vort[r_, s_] = 0
Lωx[x] Sin r π xL
ⅆx 0
hωy[y] Sin s π yh
ⅆy ;
Θ = .1;
(*Coefficienti per lo sviluppo di ψ *)
c[r_, s_] = vort[r, s] ω0 -h v3
π s Sin r π bL
- Sin r π aL
π 24
h r2
L+
L s2
h;
Printed by Wolfram Mathematica Student Edition
7/23/2019 mecc.com6
http://slidepdf.com/reader/full/mecccom6 2/6
(* Approssimante per ψ *)
ψ [x_, y_] = Ψ0[x, y] + i=1
Nmod j=1
Nmod
c[i, j] Sin i π xL
Sin j π yh
;
bco3[r_] := Ifr ⩵ 0, b - a,L
r
π Sin r π b
L - Sin r π a
L ;
bco1[r_, s_] := If[r ⩵ 0, L Cos[s π ], 0];
zer[r_, s_] := If[r ⩵ 0 s ⩵ 0, 0, 1]
var[s_] := If[s ⩵ 0, 1, 2];
(*Coefficienti per lo sviluppo di φ*)
d [r_, s_] = zer[r, s]v3 bco3[r] - v1 bco1[r, s]
π 2 h r2
2 var[s] L+
L s2
2 var[r] h + ϵ
;
φ[x_, y_] = i=0
Nmod j=0
Nmod
d [i, j] Cos i π xL
Cos j π yh
;
◼ Grafici output
◻ Grafico della ψ sulla superficie libera e sullo sbocco
(*Grafico della ψ sulla superficie libera e sullo sbocco*)
Plot[{ga[xx], gb[xx]}, {xx, 0, 1}]
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
◻ ContourPlot di ψ , φ :rete del moto
nct = 50;
ContourPlot[Ψ0[x, y], {x, 0, L},
{y, 0, h}, Contours → nct, ContourShading → False]
grψ = ContourPlot[ψ [x, y], {x, 0, L}, {y, 0, h},
Contours → nct, ContourShading → False];
grφ = ContourPlot[φ[x, y], {x, 0, L}, {y, 0, h},
Contours → nct, ContourShading → False];
{grψ , grφ, Show[grψ , grφ]}
2 mecc.com6.nb
Printed by Wolfram Mathematica Student Edition
7/23/2019 mecc.com6
http://slidepdf.com/reader/full/mecccom6 3/6
0.0 0.2 0.4 0.6 0.8 1.0
0.0
0.2
0.4
0.6
0.8
1.0
0.0 0.2 0.4 0.6 0.8 1.0
0.0
0.2
0.4
0.6
0.8
1.0
,
1.0
mecc.com6.nb 3
Printed by Wolfram Mathematica Student Edition
7/23/2019 mecc.com6
http://slidepdf.com/reader/full/mecccom6 4/6
0.0 0.2 0.4 0.6 0.8 1.0
0.0
0.2
0.4
0.6
0.8
,
0.0 0.2 0.4 0.6 0.8 1.0
0.0
0.2
0.4
0.6
0.8
1.0
4 mecc.com6.nb
Printed by Wolfram Mathematica Student Edition
7/23/2019 mecc.com6
http://slidepdf.com/reader/full/mecccom6 5/6
◻ Plot3D dell'approssimazione zero e della funzione di corrente
Plot3D[Ψ0[x, y], {x, 0, L}, {y, 0, h}]
Plot3D[ψ [x, y], {x, 0, L}, {y, 0, h}]
mecc.com6.nb 5
Printed by Wolfram Mathematica Student Edition
7/23/2019 mecc.com6
http://slidepdf.com/reader/full/mecccom6 6/6
◻ Andamento dell’approssimazione zero e della funzione di corrente a metà serbatoio
PlotΨ0xx, h 2, {xx, 0, L}Plotψxx, h 2, {xx, 0, L}, Exclusions → None
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
◻ Campo di vorticità (se assegnato)
6 mecc.com6.nb
Printed by Wolfram Mathematica Student Edition