<<

Numerical Supersonic Aerodynamics of the /ST Fairing

Javier Urzay

2nd November 2004

Abstract The supersonic blunt-body problem is one of the most classical challenges in CFD of compressible flows. The change of mathematical behavior of the Euler equations across transonic flow zones made impossible its solution until a time-dependent ap- proach was first proposed by Moretti and Abbett [1]. The time-dependent approach is based on integrating the unsteady conservation equations until a steady solution is achieved. In this study, a similar method is employed to compute the solution of the full Navier-Stokes equations around a rocket fairing using a time-dependent approach with an explicit method that is second-order accurate in space and time. The grid reproduces the geometry of the rocket fairing and is generated using an ellip- tic transform, which requires integration of two non-linearly coupled elliptic equations.

1 The Soyuz Payload Fairing

The type-ST fairing of the Soyuz rocket consists of a two-halves shell carbon-fiber rein- forced plastic structure [2]. The fairing hosts payloads such as or other space instrumentation. The fairing structure is a cylindrical body attached to a blunt nose that enables a detached shock and prevents strong aerodynamic heating of the payload. It has a 4.110 m external diameter and provides the largest available volume for accommodation in the Soyuz Launch Vehicles family. The Soyuz rocket is based on the original design of of the R-7A rocket that put the into orbit in 1957. A complete family of followed after that included , , and finally the four-stage Soyuz, which is employed widely in manned and un- manned space missions by the European Space Agency (E.S.A.). The main manufacturers and partner organizations are the Russian Aviation and Space Agency (ROSAVIACOS- MOS), the European Aeronautics, Defense, and Space Company (E.A.D.S), the Samara Space Center (TsSKB-Progress) and ArianeSpace.

1 Figure 1: Schematic Soyuz/ST rocket. The spacecraft consists of four stages: Boosters, Core Stage, 3rd Stage, and Fregat Upper Stage. The payload fairing sits on top of the rocket hosting the upper stage and satellite payload.

2 2 Grid Generation: The Elliptic Transform

The detailed geometry of the fairing is displayed schematically in figure 2.

Figure 2: Dimensions (mm) of the payload fairing.

Because of the relatively complex geometry, the most appropriate method for con- structing the grid is the elliptic transform. This method solves the coordinates {x, y} as a function of transformed coordinates variables {ξ, η}, whose space corresponds to a rectangular domain. To do so, the coupled elliptic and strongly non-linear equations ∂2x ∂2x ∂2x ∂x ∂y ∂x ∂y 2∂x ∂x  α − 2β + γ = − − P + Q ∂ξ2 ∂ξ∂η ∂η2 ∂ξ ∂η ∂η ∂ξ ∂ξ ∂η

∂2y ∂2y ∂2y ∂x ∂y ∂x ∂y 2∂y ∂y  α − 2β + γ = − − P + Q ∂ξ2 ∂ξ∂η ∂η2 ∂ξ ∂η ∂η ∂ξ ∂ξ ∂η need to be integrated, where the coefficients are given by

∂x2 ∂y 2 α = + ∂η ∂η ∂x ∂x ∂y ∂y β = + ∂ξ ∂η ∂ξ ∂η ∂x2 ∂y 2 γ = + . ∂ξ ∂ξ The functions P and Q force the grid points to be clustered around a point or a line, respectively. In the present configuration, the mesh is forced to be squeezed around the internal boundary corresponding to the fairing surface, with Q being given by −d·|η−η | Q(η) = c · sign(η − ηmin)e min . A Gauss-Seidel iteration and a 2nd order accurate discretization in space are employed to solve the set of elliptic differential equations. The resulting grid is shown in figure 3, while figure 4 shows the clustering of points near the neighborhood of the nose to capture the boundary layer.

3 Figure 3: Elliptic grid of the payload fairing (m).

Figure 4: Zoom around the leading nose showing the clustered grid points.

4 3 The Navier-Stokes Equations in Generalized Coordinates

3.1 Formulation Given the coordinate transformation

x = x(ξ, η) y = y(ξ, η) the Jacobian J(ξ, η) is defined as

∂x ∂y

∂(x, y) ∂ξ ∂ξ

J ≡ ≡ ∂(ξ, η) ∂x ∂y . ∂η ∂η An appropriate change of partial differential operators must be made according to the change of variables

∂(ϕ) 1 h∂y ∂(ϕ) ∂y ∂(ϕ)i = − ∂y J ∂η ∂ξ ∂ξ ∂η ∂(ϕ) 1 h∂x∂(ϕ) ∂x∂(ϕ)i = − ∂x J ∂ξ ∂η ∂η ∂ξ for any fluid variable ϕ.

The gas is assumed to be ideal and calorically perfect, with a constant Prandtl number and temperature-dependent viscosity and thermal conductivity. Using the coordinate transformation above, the Navier-Stokes equations can be written as

Continuity: ∂ρ 1 h∂y  ∂ ∂y  ∂ ∂x ∂ ∂x ∂ i + (ρu) − (ρu) + (ρv) − (ρv) = 0 (1) ∂t J ∂η ∂ξ ∂ξ ∂η ∂ξ ∂η ∂η ∂ξ x-Momentum:

∂ 1 h∂y  ∂ ∂y  ∂ (ρu) + (ρu2 + P − τ ) − (ρu2 + P − τ )+ ∂t J ∂η ∂ξ xx ∂ξ ∂η xx ∂x ∂ ∂x ∂ i + (ρuv − τ ) − (ρuv − τ ) = 0 (2) ∂ξ ∂η xy ∂η ∂ξ xy y-Momentum:

∂ 1 h∂y  ∂ ∂y  ∂ (ρv) + (ρuv − τ ) − (ρuv − τ )+ ∂t J ∂η ∂ξ xy ∂ξ ∂η xy ∂x ∂ ∂x ∂ i + (ρv2 + P − τ ) − (ρv2 + P − τ ) = 0 (3) ∂ξ ∂η yy ∂η ∂ξ yy

5 Total Energy:

∂   |v|2  1 n∂y  ∂ h  |v|2 P  i ρ e + + ρ e + + u + q − uτ − vτ ∂t 2 J ∂η ∂ξ 2 ρ x xx xy ∂y  ∂ h  |v|2 P  i − ρ e + + u + q − uτ − vτ + ∂ξ ∂η 2 ρ x xx xy ∂x ∂ h  |v|2 P  i + ρ e + + v + q − uτ − vτ ∂ξ ∂η 2 ρ y xy yy ∂x ∂ h  |v|2 P  io − ρ e + + v + q − uτ − vτ = 0 (4) ∂η ∂ξ 2 ρ y xy yy

Equation of State:

P = ρRgT (5)

Local Thermodynamic Equilibrium:

e = cvT (6)

Fourier’s Law: k(T )h∂y ∂T ∂y ∂T i q = − − (7) x J ∂η ∂ξ ∂ξ ∂η

k(T )h∂x∂T ∂x∂T i q = − − (8) y J ∂ξ ∂η ∂η ∂ξ

Poisson’s Law: 2 µ(T )h ∂y ∂u ∂y ∂u ∂x∂v ∂x∂v i τ = 2 − 2 + − (9) xx 3 J ∂η ∂ξ ∂ξ ∂η ∂η ∂ξ ∂ξ ∂η

2 µ(T )h ∂x∂v ∂x∂v ∂y ∂u ∂y ∂v i τ = 2 − 2 + − (10) yy 3 J ∂ξ ∂η ∂η ∂ξ ∂ξ ∂η ∂η ∂ξ

µ(T )h∂x∂u ∂x∂u ∂y ∂v ∂y ∂v i τ = − + − (11) xy J ∂ξ ∂η ∂η ∂ξ ∂η ∂ξ ∂ξ ∂η where the second coefficient of viscosity is calculated from the Stokes’ approximation 2 λ = − 3 µ. Additionally, the dynamic viscosity and thermal conductivity variations are given by the Sutherland’s Law and the constant Prandtl-number assumption,

 T 3/2 Tref + 110 µ(T ) = µo (12) Tref T + 110

µ(T )c k(T ) = p . (13) P r

6 The system 1-13 represents the full set of conservation equations required to solve the problem. For numerical integration purposes, it is expedient to reformulate these equations in terms of the principal fluxes φ , E and F, namely [4]

 ρ     ρu  φ = ρv (14)   2    v   ρ e + 2 

 ρu   2   ρu + P − τxx  E= (15) ρuv − τxy   2    v P   ρ e + 2 + ρ u + qx − uτxx − vτxy 

 ρv     ρuv − τxy  F = 2 . (16) ρv + P − τyy   2    v P   ρ e + 2 + ρ v + qy − uτxy − vτyy 

In these variables, the Navier-Stokes equations become

∂φ 1 h∂y ∂E ∂y ∂Ei 1 h∂x∂F ∂x∂Fi + − + − = 0. (17) ∂t J ∂η ∂ξ ∂ξ ∂η J ∂ξ ∂η ∂η ∂ξ

Equation 17 represents the system of conservation equations written in strong conser- vative form, which facilitates the numerical treatment of the shock discontinuities. These consist of discontinuities in the primitive variables ρ, v, P and T , whose values are not defined at the shock. Conversely, the flux variables E and F are conserved through the shock as prescribed by the integral form of the conservation equations across. As a re- sult, the strong conservative form 17 enhances numerical stability despite the inherent discontinuities in the primitive variables.

3.2 Boundary Conditions The boundary conditions are shown schematically in figure 5.

3.3 Numerical Formulation A second-order accurate Mac’Cormack’s explicit method is employed to transform (17) into a finite-differences form. The principal flux φ at time t + ∆t is given by

t t+∆t t+∆t t 1h∂φ ∂φc  i φi,j = φi,j + + (18) 2 ∂t i,j ∂t i,j corresponding to a predictor-corrector set. The average derivative in time is composed by two terms, namely

t+∆t ∂φt φb − φt 1 h∂y  Et − Et ∂y  Et − Et i = i,j i,j = i+1,j i,j − i,j+1 i,j + ∂t i,j ∆t Ji,j ∂η i,j ∆ξ ∂ξ i,j ∆η 1 h∂x Ft − Ft ∂x Ft − Ft i + i,j+1 i,j − i+1,j i,j (19) Ji,j ∂ξ i,j ∆η ∂η i,j ∆ξ which represents the linearization of the time derivative at stage t, where both E and F

7 Figure 5: Boundary conditions. The free stream is characterized by the velocity, pressure, temperature and two thermodynamic coefficients. A non-slip condition is used on the fairing surface. The outgoing boundaries employ interpolation from the internal flow field.

t+∆t are known. The symbol φbi,j is the predicted flux at step t + ∆t. The above numerical derivative can be computed from the known step-t conditions. Once the primary variables ρb, ub, vb, Tb and the physical properties are predicted, the predicted fluxes Eb and Fb are used for the corrector derivative,

t+∆t t+∆t t+∆t t+∆t ∂φc t+∆t 1 h∂y  Eb i,j − Eb i−1,j ∂y  Eb i,j − Eb i,j−1 i = − + ∂t i,j Ji,j ∂η i,j ∆ξ ∂ξ i,j ∆η t+∆t t+∆t t+∆t t+∆t 1 h∂x Fb − Fb ∂x Fb − Fb i + i,j i,j−1 − i,j i−1,j . (20) Ji,j ∂ξ i,j ∆η ∂η i,j ∆ξ The combination of (18), (19) and (20) gives

t+∆t t+∆t t+∆t t+∆t t+∆t 1n t t+∆t 1 h∂y  Eb i,j − Eb i−1,j ∂y  Eb i,j − Eb i,j−1 i φi,j = φi,j + φbi,j + − + 2 Ji,j ∂η i,j ∆ξ ∂ξ i,j ∆η t+∆t t+∆t t+∆t t+∆t 1 h∂x Fb − Fb ∂x Fb − Fb io + i,j i,j−1 − i,j i−1,j (21) Ji,j ∂ξ i,j ∆η ∂η i,j ∆ξ which represents the solution of the principal flux φ in space and time. In order to conserve the second-order accuracy of the numerical method, the shear stresses and heat fluxes are computed with second-order central differences.

3.4 CFL Number A CFL condition for numerical stability is required. This is implemented using two types of time integration intervals depending on which velocity component is considered, namely

8 Ji,j ∆t1(i,j) = q 2 2 |u · xξ|i,j + |v · yξ|i,j + ai,j |xξ|i,j + |yξ|i,j and

Ji,j ∆t2(i,j) = q 2 2 |u · xη|i,j + |v · yη|i,j + ai,j |xη|i,j + |yη|i,j where a is the speed of sound. The imposed time step is the minimum of the two,

∆t = K ∗ min(∆t1(i,j), ∆t2(i,j)) where K is the CFL number.

4 Integration Results

4.1 Free-Stream Conditions

In this study, the Mach and Reynolds numbers of the free stream are M∞ = 4.54 and ReL∞ = 1214, respectively, based on the characteristic fairing length L (see figure 5). This surely is an unrealistic value of the Reynolds number that was chosen as a compromise value to reduce computational cost. For simplicity, the wall temperature is assumed to be equal to the free-stream temperature, Tw = T∞.

4.2 Integration Parameters The time step used in the simulations is of order ∆t = 1·10−4s for a scaled-down version of the faring length L = 11.3 cm and with a free stream velocity and temperature U∞ = 1500 −3 m/s and T∞ = 270K. The CFL Number is K = 5 · 10 . Under-relaxation factors for density, Velocity and temperature (ωρ = ωu = ωv = ωT = 0.3) are needed along with a small amount of artificial viscosity (see refs. [4] and [5], Cx = Cy = 0.01) to prevent numerical oscillations.

4.3 Aerothermal Variables The bow shock resulting from the numerical integrations can be observed in figures 6- 7-9. Because of the low Reynolds-numbers employed, the numerical dissipation and the plotter interpolation, the shock thickness is probably unreal. Nevertheless, the static temperature increase downstream from the near-normal portion of the shock front and around the stagnation point is evident. The boundary layer is shown in figures 6 and 8. In subsonic flow, the boundary layer thickness is prone to become thinner as velocity increases, in part because the layer thickness is proportional to the inverse of the root of −1/2 Reynolds Number δ ∼ Rex . On the other hand, at highly supersonic flows (M ∼ 5) the the boundary layer becomes thicker due to the increase in temperature and viscosity caused by friction heat. As a result, the boundary layer increases with the Mach number as δ ∼ M 2Re−1/2.

9 Figure 6: u/U∞ contours for ReL∞ = 1214 and M∞ = Figure 7: T/T∞ (non-dimensional Static Temperature) 4.54. contours for ReL∞ = 1214 and M∞ = 4.54.

Figure 8: Velocity vectors showing the boundary layer.

4.4 The Sonic Line If the stream deflection angle is larger than a maximum value that depends on the incoming Mach number, a detached shock is the only possible solution of the problem [6]. The resulting bow shock has 90o incidence angle near the stagnation point, which results in a strong shock wave with subsonic flow downstream (see figure 10). At larger distances from the blunt nose, the shock degenerates into a Mach wave or weak shock wave. The flow remains supersonic downstream from this weak shock wave, even though the normal local Mach number is always smaller than unity as prescribed by the second principle of thermodynamics. As a result, both subsonic and supersonic conditions occur downstream of the bow shock. A transition line, namely the sonic line, where the Mach number is unity M = 1.0, separates both regions, as shown in figure 10. The sonic line is convected downstream into the boundary layer. The structure of the conservation equations changes downstream of the bow shock, which has an important effect for the numerical algorithms. In the regions where su- personic flow occurs, the steady compressible Navier-Stokes equations are hyperbolic. In subsonic conditions, the equations become elliptic. Because of the coexistence of both flow regions, it was not possible to write any steady code that integrated simultaneously both supersonic and subsonic flow regions. It was in 1966 when Moretti and Abbett devel- oped a time-dependent approach aimed at obtaining a steady solution at long times using a time-marching procedure. The unsteady compressible Navier-Stokes equations have a

10 Figure 9: Pressure gradient |∇(P/P∞)| contours showing the shock front and expansion waves about the round cor- ner. mixed hyperbolic-parabolic behavior, which leads to well-posed integrations even in the presence of both supersonic and subsonic flow regions.

5 Comparisons with the Rankine-Hugoniot Solution Near the Axis.

The Rankine-Hugoniot jump conditions for normal shocks assume inviscid and steady flows. These are given by

P2 2γ 2 = 1 + (M1 − 1) (22) P1 γ + 1

2 2 T2 (2γM1 − (γ − 1))(2 + (γ − 1)M1 ) = 2 2 (23) T1 (γ + 1) M1

2 U2 2 + (γ − 1)M1 = 2 , (24) U1 (γ + 1)M1 where (1) and (2) are respectively the gas conditions upstream and downstream the bow shock. In the neighborhood of the axis, where the shock is nearly planar, only small discrepancies between the Rankine-Hugoniot jump conditions and the numerical results of the previous section are found, which are mainly caused by the numerical viscosity that tends to increase the shock thickness.

11 Figure 10: Local Mach-number contours along with the sonic line (solid black line).

Figure 11: Rankine-Hugoniot values Figure 12: Rankine-Hugoniot values Figure 13: Rankine-Hugoniot values (dotted line) and computational values (dotted line) and computational values (dotted line) and computational values (solid line) for the T /T ratio across (solid line) for the U2/U1 ratio across (solid line) for the P2/P1 ratio across 2 1 the normal shock. the normal shock. the normal shock.

A Code Structure.

12 Figure 14: Code structure.

13 %------NUMERICAL CODES (MAIN INTEGRATOR AND GRID GENERATOR)------%MAIN PROGRAM. clc; clear; clf; format long; fprintf(’Numerical simulation of the Soyuz/ST fairing aerodynamics.\n\n’); fprintf(’Mac‘Cormack Explicit Algorithm.\n\n’); fprintf(’Time-dependent technique for steady flow approximation.\n\n’); fprintf(’Press any key to read and check the grid....\n\n’); pause; fprintf(’Reading grid....\n\n’);

%Reading mesh: %------load x.mat x; load y.mat y; load XIi.mat XIi; load ETAi.mat ETAi; x=x/1e5; y=y/1e5; %escalado a 1/100 de su tama~nooriginal Lefect=11.3 cm; XI=XIi; ETA=ETAi; [nxi,neta]=size(x); hxi=1; heta=1; n=neta*nxi;

[x_xi,x_eta,y_xi,y_eta,J]=Metrics(x,y,nxi,neta); fprintf(’Number of grid points...\n’); disp([n]); fprintf(’Number of iso-eta lines...\n’); disp([neta]); fprintf(’Number of iso-xi lines...\n’); disp([nxi]); figure(1); hold on; title(’Fairing Grid: Elliptic Transform’); xlabel(’x’); ylabel(’y’); plot(x(1,:),y(1,:)); plot(x(nxi,:),y(nxi,:)); plot(x(:,1),y(:,1)); plot(x(:,neta),y(:,neta)); for i=2:nxi-1; plot(x(i,:),y(i,:)); end for j=2:neta-1; plot(x(:,j),y(:,j)); end pause(1); hold off; fprintf(’Done. Grid displayed in figure(1).\n\n’) fprintf(’Press enter key to read initial conditions...\n\n’); pause;

%Initial conditions: %------fprintf(’Reading initial conditions...\n\n’);

[u, v, P, T, rho, Rg, gamma, cp, Pr, M, Re,Uo,To,rhoo,L]=initial_conditions(nxi,neta,y_eta); fprintf(’Done.\n’);

%======%ITERATION: %======residual_Caux=1.0; residual_xMaux=1.0; residual_yMaux=1.0; residual_Eaux=1.0; ITE=0; residual=1.0; tol=1e-3; ITEMAX=1000; residualmax=1e20; %======K=0.005; %Courant Cx=0.01; Cy=0.01; %Artificial Viscosity wC=0.3; wxM=0.3; wyM=0.3; wE=0.3; %Relaxation Parameters %======fprintf(’Integration Parameters...\n\n’); fprintf(’Reynolds#...\n’); disp([Re]); fprintf(’Mach#...\n’); disp([M]); fprintf(’Courant Number...\n’); disp([K]); fprintf(’Tolerance...\n’); disp([tol]); fprintf(’Relaxation factors: Continuity, xMomentum, yMomentum, Energy...’); disp([wC wxM wyM wE]);

if Cx~=0|Cy~=0; fprintf(’Artificial Viscosity Cx and Cy...\n’); disp([Cx Cy]); end fprintf(’Ready. Press enter key to iterate.\n’) pause; time=clock; uaux=u; vaux=v; rhoaux=rho; Taux=T; k=0; while residual>tol ITE=ITE+1; dt=Time_Step(u,v,T,J,x_xi,x_eta,y_xi,y_eta,neta,nxi,... gamma,Rg,K);

[u,v,P,rho,T,Tauxx,Tauxy,Tauyy,qx,qy]=MacCormack(u,v,P,T,rho,cp,... gamma,Pr,Rg,neta,nxi,J,x_xi,x_eta,y_xi,y_eta,dt,Cx,Cy);

[residual_C,residual_xM,residual_yM,residual_E,wC,wxM,wyM,wE,residual_Caux,... residual_xMaux,residual_yMaux,residual_Eaux]=residual(u,v,rho,T,... uaux,vaux,rhoaux,Taux,Uo,rhoo,To,wC,wxM,wyM,wE,residual_Caux,residual_xMaux,... residual_yMaux,residual_Eaux,ITE,Cx,Cy);

residual=residual_C+residual_xM+residual_yM+residual_E;

k=k+1; if k==4; disp(’ iteration dt Continuity xMomentum yMomentum Energy Total Residual’); k=0; end

disp([ITE dt residual_C residual_xM residual_yM... residual_E residual]);

%Relaxation. rho=rhoaux+wC*(rho-rhoaux); u=uaux+wxM*(u-uaux); v=vaux+wyM*(v-vaux); T=Taux+wE*(T-Taux);

uaux=u; vaux=v; rhoaux=rho; Taux=T;

%Checking Symmetry:

14 u(nxi:-1:0.5*nxi,:)=u(1:0.5*nxi+1,:); P(nxi:-1:0.5*nxi,:)=P(1:0.5*nxi+1,:); T(nxi:-1:0.5*nxi,:)=T(1:0.5*nxi+1,:); rho(nxi:-1:0.5*nxi+1,:)=rho(1:0.5*nxi,:);

if residual>residualmax; error(’convergence failed’); end end time=etime(clock,time); disp(’The iteration has converged succesfully.’); disp(’Time employed (s)....’); disp([time]); ------function [u, v, P, T, rho, Rg, gamma, cp, Pr, M, Re,Uo,To,rhoo,L]=initial_conditions(nxi,neta,y_eta);

% Initial conditions.m % Initial conditions reports about the free stream conditions. % The gas model considered is an ideal gas, with constant Prandtl Number % and heat capacities, but variable dynamic viscosity and thermal conductivity. % Also an initial interpolation on u-velocity is made in order to enhance % the non-slip condition at the fairing wall. mo=1.79e-2; Uo=1500; %m/s; %Po=75.6; %Pa; Po=10000; To=270; Ts=300; %K; Rg=288.8; %J/KgK gamma=1.4; cp=1000; %J/KgK rhoo=Po/(Rg*To); %Kg/m3 M=Uo/sqrt(gamma*Rg*To); Pr=0.7; %#Prandtl L=11.3e-2; R=4.11e-2; Re=rhoo*Uo*L/mo;

v(1:nxi,neta)=0; u(1:nxi,1:neta)=Uo; hu=Uo/(neta-1); U=[0:hu:Uo]; ht=(To-Ts)/(neta-1); t=[Ts:ht:To]; for i=1:nxi; u(i,1:neta)=U(1:neta); T(i,1:neta)=t(1:neta); end v(1:nxi,1:neta)=0; P(1:nxi,1:neta)=Po; rho(1:nxi,1:neta)=rhoo; %T(1:nxi,1:neta)=To;

%This initial solution is calculated based on the above boundary %conditions: load u.mat u; load T.mat T; load v.mat v; load P.mat P; load rho.mat rho; ------function dt=Time_Step(u,v,T,J,x_xi,x_eta,y_xi,y_eta,neta,nxi,... gamma,Rg,K); a=sqrt(gamma*Rg*T); for i=1:nxi; for j=1:neta;

Dt1(i,j)=(abs(u(i,j))*abs(x_xi(i,j)/J(i,j))+abs(v(i,j))*abs(y_xi(i,j)/J(i,j))+... a(i,j)*abs(1/J(i,j))*sqrt(x_xi(i,j)^2+y_xi(i,j)^2))^(-1);

Dt2(i,j)=(abs(u(i,j))*abs(x_eta(i,j)/J(i,j))+abs(v(i,j))*abs(y_eta(i,j)/J(i,j))+... a(i,j)*abs(1/J(i,j))*sqrt(x_eta(i,j)^2+y_eta(i,j)^2))^(-1);

end end dt1=min(min(K*Dt1)); dt2=min(min(K*Dt2)); dt=max([dt1 dt2]);

------function [u,v,P,rho,T,Tauxx,Tauxy,Tauyy,qx,qy]=MacCormack(u,v,P,T,rho,cp,... gamma,Pr,Rg,neta,nxi,J,x_xi,x_eta,y_xi,y_eta,dt,Cx,Cy);

%Variables: U1=zeros(nxi,neta); U2=zeros(nxi,neta); U3=zeros(nxi,neta); U4=zeros(nxi,neta); U1p=zeros(nxi,neta); U2p=zeros(nxi,neta); U3p=zeros(nxi,neta); U4p=zeros(nxi,neta); F1=zeros(nxi,neta); F2=zeros(nxi,neta); F3=zeros(nxi,neta); F4=zeros(nxi,neta); E1=zeros(nxi,neta); E2=zeros(nxi,neta); E3=zeros(nxi,neta); E4=zeros(nxi,neta); S1=zeros(nxi,neta); S2=zeros(nxi,neta); S2=zeros(nxi,neta); S4=zeros(nxi,neta); cv=cp/gamma;

%Flux initialization:

15 m=Dynamic_Viscosity(T,nxi,neta); k=Thermal_Conductivity(m,cp,Pr);

Tauxx=Stress_Tauxx(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); Tauxy=Stress_Tauxy(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); Tauyy=Stress_Tauyy(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta);

[qx,qy]=Heat_Flux(T,k,neta,nxi,J,x_xi,x_eta,y_xi,y_eta); for i=1:nxi; for j=1:neta;

et(i,j)=cv*T(i,j)+0.5*(u(i,j)^2+v(i,j)^2); %Total Energy

U1(i,j)=rho(i,j); U2(i,j)=rho(i,j)*u(i,j); U3(i,j)=rho(i,j)*v(i,j); U4(i,j)=rho(i,j)*et(i,j);

E1(i,j)=rho(i,j)*u(i,j); E2(i,j)=rho(i,j)*u(i,j)^2+P(i,j)-Tauxx(i,j); E3(i,j)=rho(i,j)*u(i,j)*v(i,j)-Tauxy(i,j); E4(i,j)=(rho(i,j)*et(i,j)+P(i,j))*u(i,j)-u(i,j)*Tauxx(i,j)-v(i,j)*Tauxy(i,j)+qx(i,j);

F1(i,j)=rho(i,j)*v(i,j); F2(i,j)=rho(i,j)*u(i,j)*v(i,j)-Tauxy(i,j); F3(i,j)=rho(i,j)*v(i,j)^2+P(i,j)-Tauyy(i,j); F4(i,j)=(rho(i,j)*et(i,j)+P(i,j))*v(i,j)-u(i,j)*Tauxy(i,j)-v(i,j)*Tauyy(i,j)+qy(i,j);

end end

%PREDICTOR STEP: z=0; [S1,S2,S3,S4]=Artificial_Viscosity(z,P,U1,U2,U3,U4,U1p,U2p,U3p,U4p,Cx,Cy,nxi,neta); for i=2:nxi-1; for j=2:neta-1;

U1p(i,j)=U1(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E1(i+1,j)-E1(i,j))-y_xi(i,j)*(E1(i,j+1)-E1(i,j))-... x_eta(i,j)*(F1(i+1,j)-F1(i,j))+x_xi(i,j)*(F1(i,j+1)-F1(i,j)))+S1(i,j);

U2p(i,j)=U2(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E2(i+1,j)-E2(i,j))-y_xi(i,j)*(E2(i,j+1)-E2(i,j))-... x_eta(i,j)*(F2(i+1,j)-F2(i,j))+x_xi(i,j)*(F2(i,j+1)-F2(i,j)))+S2(i,j);

U3p(i,j)=U3(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E3(i+1,j)-E3(i,j))-y_xi(i,j)*(E3(i,j+1)-E3(i,j))-... x_eta(i,j)*(F3(i+1,j)-F3(i,j))+x_xi(i,j)*(F3(i,j+1)-F3(i,j)))+S3(i,j);

U4p(i,j)=U4(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E4(i+1,j)-E4(i,j))-y_xi(i,j)*(E4(i,j+1)-E4(i,j))-... x_eta(i,j)*(F4(i+1,j)-F4(i,j))+x_xi(i,j)*(F4(i,j+1)-F4(i,j)))+S4(i,j);

%decoding predicted values:

rho(i,j)=U1p(i,j); u(i,j)=U2p(i,j)/U1p(i,j); v(i,j)=U3p(i,j)/U1p(i,j); T(i,j)=(U4p(i,j)/U1p(i,j)-0.5*(u(i,j)^2+v(i,j)^2))/cv; P(i,j)=rho(i,j)*Rg*T(i,j);

end end

%Boundary correction:

[u,v,P,T,rho]=Boundary_Conditions(u,v,P,T,rho,nxi,neta);

%Predicted Fluxes and Properties:

m=Dynamic_Viscosity(T,nxi,neta); k=Thermal_Conductivity(m,cp,Pr);

Tauxx=Stress_Tauxx(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); Tauxy=Stress_Tauxy(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); Tauyy=Stress_Tauyy(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta);

[qx,qy]=Heat_Flux(T,k,neta,nxi,J,x_xi,x_eta,y_xi,y_eta); for i=1:nxi; for j=1:neta;

et(i,j)=cv*T(i,j)+0.5*(u(i,j)^2+v(i,j)^2); %Total Energy

E1(i,j)=rho(i,j)*u(i,j); E2(i,j)=rho(i,j)*u(i,j)^2+P(i,j)-Tauxx(i,j); E3(i,j)=rho(i,j)*u(i,j)*v(i,j)-Tauxy(i,j); E4(i,j)=(rho(i,j)*et(i,j)+P(i,j))*u(i,j)-u(i,j)*Tauxx(i,j)-v(i,j)*Tauxy(i,j)+qx(i,j);

F1(i,j)=rho(i,j)*v(i,j); F2(i,j)=rho(i,j)*u(i,j)*v(i,j)-Tauxy(i,j); F3(i,j)=rho(i,j)*v(i,j)^2+P(i,j)-Tauyy(i,j); F4(i,j)=(rho(i,j)*et(i,j)+P(i,j))*v(i,j)-u(i,j)*Tauxy(i,j)-v(i,j)*Tauyy(i,j)+qy(i,j);

end end

%CORRECTOR STEP:

16 z=1; [S1,S2,S3,S4]=Artificial_Viscosity(z,P,U1,U2,U3,U4,U1p,U2p,U3p,U4p,Cx,Cy,nxi,neta); for i=2:nxi-1; for j=2:neta-1;

U1(i,j)=0.5*(U1(i,j)+U1p(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E1(i,j)-E1(i-1,j))-y_xi(i,j)*(E1(i,j)-E1(i,j-1))-... x_eta(i,j)*(F1(i,j)-F1(i-1,j))+x_xi(i,j)*(F1(i,j)-F1(i,j-1))))+S1(i,j);

U2(i,j)=0.5*(U2(i,j)+U2p(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E2(i,j)-E2(i-1,j))-y_xi(i,j)*(E2(i,j)-E2(i,j-1))-... x_eta(i,j)*(F2(i,j)-F2(i-1,j))+x_xi(i,j)*(F2(i,j)-F2(i,j-1))))+S2(i,j);

U3(i,j)=0.5*(U3(i,j)+U3p(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E3(i,j)-E3(i-1,j))-y_xi(i,j)*(E3(i,j)-E3(i,j-1))-... x_eta(i,j)*(F3(i,j)-F3(i-1,j))+x_xi(i,j)*(F3(i,j)-F3(i,j-1))))+S3(i,j);

U4(i,j)=0.5*(U4(i,j)+U4p(i,j)-(dt/J(i,j))*(y_eta(i,j)*(E4(i,j)-E4(i-1,j))-y_xi(i,j)*(E4(i,j)-E4(i,j-1))-... x_eta(i,j)*(F4(i,j)-F4(i-1,j))+x_xi(i,j)*(F4(i,j)-F4(i,j-1))))+S4(i,j);

%decoding corrected values:

rho(i,j)=U1(i,j); u(i,j)=U2(i,j)/U1(i,j); v(i,j)=U3(i,j)/U1(i,j); T(i,j)=(U4(i,j)/U1(i,j)-0.5*(u(i,j)^2+v(i,j)^2))/cv; P(i,j)=rho(i,j)*Rg*T(i,j);

end end

%Boundary correction:

[u,v,P,T,rho]=Boundary_Conditions(u,v,P,T,rho,nxi,neta);

%FINAL PROPERTIES AT t=t+dt STAGE: m=Dynamic_Viscosity(T,nxi,neta); k=Thermal_Conductivity(m,cp,Pr); Tauxx=Stress_Tauxx(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); Tauxy=Stress_Tauxy(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); Tauyy=Stress_Tauyy(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta);

[qx,qy]=Heat_Flux(T,k,neta,nxi,J,x_xi,x_eta,y_xi,y_eta);

------function [residual_C,residual_xM,residual_yM,residual_E,wC,wxM,wyM,wE,residual_Caux,... residual_xMaux,residual_yMaux,residual_Eaux,Cx,Cy]=residual(u,v,rho,T,... uaux,vaux,rhoaux,Taux,Uo,rhoo,To,wC,wxM,wyM,wE,residual_Caux,residual_xMaux,... residual_yMaux,residual_Eaux,ITE,Cx,Cy);

% Residual monitorizes instantaneously the residuals of Density, xVelocity, % yVelocity and Temperature. Also enables an active control of the % convergence and stability varying dynamically the relaxation factors. residual_C=(norm(rho-rhoaux,inf)+norm(rho-rhoaux,1))/rhoo; residual_xM=(norm(u-uaux,inf)+norm(u-uaux,1))/Uo; residual_yM=(norm(v-vaux,inf)+norm(v-vaux,1))/Uo; residual_E=(norm(T-Taux,inf)+norm(T-Taux,1))/To; if residual_C>residual_Caux; wC=wC-0.0000001; Cx=Cx+0.000001; Cy=Cy+0.000001; end; if residual_xM>residual_xMaux; wxM=wxM-0.0000001; end if residual_yM>residual_yMaux; wyM=wyM-0.0000001; end if residual_E>residual_Eaux; wE=wE-0.0000001; Cx=Cx+0.000001; Cy=Cy+0.000001; end if residual_C

% if ITE>5; % %Residual Monitoring % figure(2); % subplot(2,2,1), plot(ITE,residual_C); title(’Continuity residual’); hold on % subplot(2,2,2), plot(ITE,residual_xM); title(’xMomentum residual’); hold on % subplot(2,2,3), plot(ITE,residual_yM); title(’yMomentum residual’); hold on % subplot(2,2,4), plot(ITE,residual_E); title(’Energy residual’); hold on % pause(0.01); % end ------

17 function m=Dynamic_Viscosity(T,nxi,neta);

% Dynamic_Viscosity.m computes the viscosity as a % function of the temperature. The model employed is % the Sutherland’s Law. It is convenient to use a % variable model viscosity in supersonic flow. % T_oo and m_o are the values of temperature and viscosity % at sea level.

Too=293; %K %mo=1.79e-5; %Ns/m2 mo=1.79e-2; m=zeros(nxi,neta); m(1:nxi,1:neta)=mo*((T(1:nxi,1:neta)/Too).^(3/2)).*(Too+110)./(T(1:nxi,1:neta)+110);

------function k=Thermal_Conductivity(m,cp,Pr);

% Thermal_Conductivity function calculates % k with constant Prandtl# assumption. k=m*cp/Pr;

------function Tauxx=Stress_Tauxx(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta);

% Tauxx computes shearing stress using central differences % (2nd order) at internal points and one-sided 2nd order % differences at the edges. Tauxx is a (nxi,neta) matrix. % Its slopes change with time and has not got any boundary % constraint. Also, the second coefficient of viscosity is % approximated with the Stokes Law: \=-2m/3.

for i=2:nxi-1; for j=2:neta-1;

Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(u(i+1,j)-u(i-1,j))-... 2*y_xi(i,j)*(u(i,j+1)-u(i,j-1))+x_eta(i,j)*(v(i+1,j)-v(i-1,j))-... x_xi(i,j)*(v(i,j+1)-v(i,j-1)));

end end for j=2:neta-1;

i=1; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))-... 2*y_xi(i,j)*(u(i,j+1)-u(i,j-1))+x_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))-... x_xi(i,j)*(v(i,j+1)-v(i,j-1)));

i=nxi; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))-... 2*y_xi(i,j)*(u(i,j+1)-u(i,j-1))+x_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))-... x_xi(i,j)*(v(i,j+1)-v(i,j-1)));

end

for i=2:nxi-1;

j=1; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(u(i+1,j)-u(i-1,j))-... 2*y_xi(i,j)*(-3*u(i,j)+4*u(i,j+1)-u(i,j+2))+x_eta(i,j)*(v(i+1,j)-v(i-1,j))-... x_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2)));

j=neta; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(u(i+1,j)-u(i-1,j))-... 2*y_xi(i,j)*(3*u(i,j)-4*u(i,j-1)+u(i,j-2))+x_eta(i,j)*(v(i+1,j)-v(i-1,j))-... x_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2)));

end

i=1; j=1; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))-... 2*y_xi(i,j)*(-3*u(i,j)+4*u(i,j+1)-u(i,j+2))+x_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))-... x_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2)));

i=nxi; j=1; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))-... 2*y_xi(i,j)*(-3*u(i,j)+4*u(i,j+1)-u(i,j+2))+x_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))-... x_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2)));

i=1; j=neta; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))-... 2*y_xi(i,j)*(3*u(i,j)-4*u(i,j-1)+u(i,j-2))+x_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))-... x_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2)));

i=nxi; j=neta; Tauxx(i,j)=(1/3)*(m(i,j)/J(i,j))*(2*y_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))-... 2*y_xi(i,j)*(3*u(i,j)-4*u(i,j-1)+u(i,j-2))+x_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))-... x_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2)));

18 ------function Tauxy=Stress_Tauxx(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta);

% Tauxy computes shearing stress using central differences % (2nd order) at internal points and one-sided 2nd order % differences at the edges. Tauxy is a (nxi,neta) matrix. % Its slopes change with time and has not got any boundary % constraint. Also, the second coefficient of viscosity is % approximated with the Stokes Law: \lambda=-2m/3.

for i=2:nxi-1; for j=2:neta-1;

Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(u(i+1,j)-u(i-1,j))+x_xi(i,j)*... (u(i,j+1)-u(i,j-1))+y_eta(i,j)*(v(i+1,j)-v(i-1,j))-... y_xi(i,j)*(v(i,j+1)-v(i,j-1)));

end end for j=2:neta-1;

i=1; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))+x_xi(i,j)*... (u(i,j+1)-u(i,j-1))+y_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))-... y_xi(i,j)*(v(i,j+1)-v(i,j-1)));

i=nxi; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))+x_xi(i,j)*... (u(i,j+1)-u(i,j-1))+y_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))-... y_xi(i,j)*(v(i,j+1)-v(i,j-1))); end for i=2:nxi-1;

j=1; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(u(i+1,j)-u(i-1,j))+x_xi(i,j)*... (-3*u(i,j)+4*u(i,j+1)-u(i,j+2))+y_eta(i,j)*(v(i+1,j)-v(i-1,j))-... y_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2)));

j=neta; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(u(i+1,j)-u(i-1,j))+x_xi(i,j)*... (3*u(i,j)-4*u(i,j-1)+u(i,j-2))+y_eta(i,j)*(v(i+1,j)-v(i-1,j))-... y_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2))); end i=1; j=1; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))+x_xi(i,j)*... (-3*u(i,j)+4*u(i,j+1)-u(i,j+2))+y_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))-... y_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2))); i=nxi; j=1; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))+x_xi(i,j)*... (-3*u(i,j)+4*u(i,j+1)-u(i,j+2))+y_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))-... y_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2))); i=1; j=neta; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))+x_xi(i,j)*... (3*u(i,j)-4*u(i,j-1)+u(i,j-2))+y_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))-... y_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2))); i=nxi; j=neta; Tauxy(i,j)=0.5*(m(i,j)/J(i,j))*(-x_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))+x_xi(i,j)*... (3*u(i,j)-4*u(i,j-1)+u(i,j-2))+y_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))-... y_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2)));

------function Tauyy=Stress_Tauxx(u,v,m,nxi,neta,J,x_xi,x_eta,y_xi,y_eta); % Tauyy computes shearing stress using central differences % (2nd order) at internal points and one-sided 2nd order % differences at the edges. Tauyy is a (nxi,neta) matrix. % Its slopes change with time and has not got any boundary % constraint. Also, the second coefficient of viscosity is % approximated with the Stokes Law: \lambda=-2m/3. for i=2:nxi-1; for j=2:neta-1;

Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(v(i+1,j)-v(i-1,j))+... 2*x_xi(i,j)*(v(i,j+1)-v(i,j-1))-y_eta(i,j)*(u(i+1,j)-u(i-1,j))+... y_xi(i,j)*(u(i,j+1)-u(i,j-1)));

end end for j=2:neta-1;

i=1; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))+... 2*x_xi(i,j)*(v(i,j+1)-v(i,j-1))-y_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))+... y_xi(i,j)*(u(i,j+1)-u(i,j-1)));

i=nxi;

19 Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(3*v(i,j)-4*v(i-1,j)-v(i-2,j))+... 2*x_xi(i,j)*(v(i,j+1)-v(i,j-1))-y_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))+... y_xi(i,j)*(u(i,j+1)-u(i,j-1)));

end

for i=2:nxi-1;

j=1; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(v(i+1,j)-v(i-1,j))+... 2*x_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2))-y_eta(i,j)*(u(i+1,j)-u(i-1,j))+... y_xi(i,j)*(-3*u(i,j)+4*u(i,j+1)-u(i,j+2)));

j=neta; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(v(i+1,j)-v(i-1,j))+... 2*x_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2))-y_eta(i,j)*(u(i+1,j)-u(i-1,j))+... y_xi(i,j)*(3*u(i,j)-4*u(i,j-1)+u(i,j-2))); end

i=1; j=1; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))+... 2*x_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)+v(i,j+2))-y_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))+... y_xi(i,j)*(-3*u(i,j)+4*u(i,j+1)-u(i,j+2)));

i=nxi; j=1; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))+... 2*x_xi(i,j)*(-3*v(i,j)+4*v(i,j+1)-v(i,j+2))-y_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))+... y_xi(i,j)*(-3*u(i,j)+4*u(i,j+1)-u(i,j+2)));

i=1; j=neta; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(-3*v(i,j)+4*v(i+1,j)-v(i+2,j))+... 2*x_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+v(i,j-2))-y_eta(i,j)*(-3*u(i,j)+4*u(i+1,j)-u(i+2,j))+... y_xi(i,j)*(3*u(i,j)-4*u(i,j-1)+u(i,j-2)));

i=nxi; j=neta; Tauyy(i,j)=(1/3)*(m(i,j)/J(i,j))*(-2*x_eta(i,j)*(3*v(i,j)-4*v(i-1,j)+v(i-2,j))+... 2*x_xi(i,j)*(3*v(i,j)-4*v(i,j-1)+3*v(i,j-2))-y_eta(i,j)*(3*u(i,j)-4*u(i-1,j)+u(i-2,j))+... y_xi(i,j)*(3*u(i,j)-4*u(i,j-1)+u(i,j-2))); ------function [qx,qy]=Heat_Flux(T,k,neta,nxi,J,x_xi,x_eta,y_xi,y_eta);

% Heat_Flux computes the heat fluxes across the flow field by % means of 2nd order central differences and one-sided 2nd order % differences at the edges.

for i=2:nxi-1; for j=2:neta-1;

qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(T(i+1,j)-T(i-1,j))-... y_xi(i,j)*(T(i,j+1)-T(i,j-1)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(T(i+1,j)-T(i-1,j))+... x_xi(i,j)*(T(i,j+1)-T(i,j-1)));

end end for j=2:neta-1;

i=1; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(-3*T(i,j)+4*T(i+1,j)-T(i+2,j))-... y_xi(i,j)*(T(i,j+1)-T(i,j-1)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(-3*T(i,j)+4*T(i+1,j)-T(i+2,j))+... x_xi(i,j)*(T(i,j+1)-T(i,j-1)));

i=nxi; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(3*T(i,j)-4*T(i-1,j)+T(i-2,j))-... y_xi(i,j)*(T(i,j+1)-T(i,j-1)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(3*T(i,j)-4*T(i-1,j)+T(i-2,j))+... x_xi(i,j)*(T(i,j+1)-T(i,j-1))); end for i=2:nxi-1;

j=1; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(T(i+1,j)-T(i-1,j))-... y_xi(i,j)*(-3*T(i,j)+4*T(i,j+1)-T(i,j+2)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(T(i+1,j)-T(i-1,j))+... x_xi(i,j)*(-3*T(i,j)+4*T(i,j+1)-T(i,j+2)));

j=neta; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(T(i+1,j)-T(i-1,j))-... y_xi(i,j)*(3*T(i,j)-4*T(i,j-1)+T(i,j-2)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(T(i+1,j)-T(i-1,j))+... x_xi(i,j)*(3*T(i,j)-4*T(i,j-1)+T(i,j-2))); end

i=1; j=1; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(-3*T(i,j)+4*T(i+1,j)-T(i+2,j))-... y_xi(i,j)*(-3*T(i,j)+4*T(i,j+1)-T(i,j+2)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(-3*T(i,j)+4*T(i+1,j)-T(i+2,j))+...

20 x_xi(i,j)*(-3*T(i,j)+4*T(i,j+1)-T(i,j+2)));

i=nxi; j=1; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(3*T(i,j)-4*T(i-1,j)+T(i-2,j))-... y_xi(i,j)*(-3*T(i,j)+4*T(i,j+1)-T(i,j+2)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(3*T(i,j)-4*T(i-1,j)+T(i-2,j))+... x_xi(i,j)*(-3*T(i,j)+4*T(i,j+1)-T(i,j+2)));

i=1; j=neta; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(-3*T(i,j)+4*T(i+1,j)-T(i+2,j))-... y_xi(i,j)*(3*T(i,j)-4*T(i,j-1)+T(i,j-2)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(-3*T(i,j)+4*T(i+1,j)-T(i+2,j))+... x_xi(i,j)*(3*T(i,j)-4*T(i,j-1)+T(i,j-2)));

i=nxi; j=neta; qx(i,j)=-0.5*(k(i,j)/J(i,j))*(y_eta(i,j)*(3*T(i,j)-4*T(i-1,j)+T(i-2,j))-... y_xi(i,j)*(3*T(i,j)-4*T(i,j-1)+T(i,j-2)));

qy(i,j)=-0.5*(k(i,j)/J(i,j))*(-x_eta(i,j)*(3*T(i,j)-4*T(i-1,j)+T(i-2,j))+... x_xi(i,j)*(3*T(i,j)-4*T(i,j-1)+T(i,j-2)));

------function [S1,S2,S3,S4]=Artificial_Viscosity(z,P,U1,U2,U3,U4,U1p,U2p,U3p,... U4p,Cx,Cy,nxi,neta);

S1=zeros(nxi,neta); S2=zeros(nxi,neta); S3=zeros(nxi,neta); S4=zeros(nxi,neta); if z==0;

for i=2:nxi-1; for j=2:neta-1;

S1(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U1(i+1,j)-2*U1(i,j)+U1(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U1(i,j+1)-2*U1(i,j)+U1(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

S2(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U2(i+1,j)-2*U2(i,j)+U2(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U2(i,j+1)-2*U2(i,j)+U2(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

S3(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U3(i+1,j)-2*U3(i,j)+U3(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U3(i,j+1)-2*U3(i,j)+U3(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

S4(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U4(i+1,j)-2*U4(i,j)+U4(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U4(i,j+1)-2*U4(i,j)+U4(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

end end end if z==1;

for i=2:nxi-1; for j=2:neta-1;

S1(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U1p(i+1,j)-2*U1p(i,j)+U1p(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U1p(i,j+1)-2*U1p(i,j)+U1p(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

S2(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U2p(i+1,j)-2*U2p(i,j)+U2p(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U2p(i,j+1)-2*U2p(i,j)+U2p(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

S3(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U3p(i+1,j)-2*U3p(i,j)+U3p(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U3p(i,j+1)-2*U3p(i,j)+U3p(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

S4(i,j)=Cx*abs(P(i+1,j)-2*P(i,j)+P(i-1,j))*(U4p(i+1,j)-2*U4p(i,j)+U4p(i-1,j))/... (P(i+1,j)+2*P(i,j)+P(i-1,j))+... Cy*abs(P(i,j+1)-2*P(i,j)+P(i,j-1))*(U4p(i,j+1)-2*U4p(i,j)+U4p(i,j-1))/... (P(i,j+1)+2*P(i,j)+P(i,j-1));

end end end ------function [u,v,P,T,rho]=Boundary_Conditions(u,v,P,T,rho,nxi,neta);

% Boundary_Conditions computes the boundary values behind the shock % interpolating with values of internal points.

21 for j=2:neta-1;

i=1;

u(i,j)=2*u(i+1,j)-u(i+2,j); v(i,j)=2*v(i+1,j)-v(i+2,j); P(i,j)=2*P(i+1,j)-P(i+2,j); T(i,j)=2*T(i+1,j)-T(i+2,j); rho(i,j)=2*rho(i+1,j)-rho(i+2,j);

i=nxi;

u(i,j)=u(i-(nxi-1),j); v(i,j)=-v(i-(nxi-1),j); P(i,j)=P(i-(nxi-1),j); T(i,j)=T(i-(nxi-1),j); rho(i,j)=rho(i-(nxi-1),j); end for i=1:nxi;

j=1; P(i,j)=2*P(i,j+1)-P(i,j+2); rho(i,j)=2*rho(i,j+1)-rho(i,j+2); end ------

%ELLIPTIC GRID GENERATOR %INTERNAL BOUNDARY: SOYUZ/ST FAIRING ROCKET %TYPE-C. %TEST #2. %Dimensions in mm. clc; clear; clf; format long;

%1. COMPUTATIONAL PLANE: %------etamax=100; etamin=1; heta=99; neta=(etamax-etamin)/heta+1; eta=linspace(etamin,etamax,neta); ximax=100; ximin=1; hxi=1.0; nxi=(ximax-ximin)/hxi+1; xi=linspace(ximin,ximax,nxi);

[ETA,XI]=meshgrid(eta,xi); fprintf(’ELLIPTICAL GRID GENERATOR\n’); fprintf(’Internal boundary: Soyuz/ST Rocket Fairing\n’) fprintf(’Plotting successively each boundary...\n\n’)

%2.VARIABLES: %------x=zeros(nxi,neta); y=zeros(nxi,neta); xhat=zeros(nxi,neta); yhat=zeros(nxi,neta); alfahat=zeros(nxi,neta); betahat=zeros(nxi,neta); gammahat=zeros(nxi,neta);

%3.BOUNDARIES: %------

R=15000; %Surroundings extension.

%1--->2 (Solid surface; eta=etamin); =1; xi1=(n1-1)*hxi; n2=0.25*nxi; xi2=(n2-1)*hxi; x1=6748; y1=2055; x2=0; y2=2055; x(1:n2,1)=linspace(x1,x2,n2)’; y(1:n2,1)=2055; plot(x(1:n2,1),y(1:n2,1),’r’); axis([-35000 20000 -20000 20000]); title(’Boundary conditions and Interpolated Initial Solution’); hold on; pause(1);

%2--->3 (Solid surface; eta=etamin); n3=0.40*nxi; xi3=(n3-1)*hxi; x3=-3776.85; y3=1148.22; x(n2:n3,1)=linspace(x2,x3,n3-n2+1)’; y(n2:n3,1)=tan(13.5*pi/180)*x(n2:n3,1)+2055; plot(x(n2:n3,1),y(n2:n3,1),’r’); pause(1);

%3--->4 (Solid surface; eta=etamin); n4=0.60*nxi; xi4=(n4-1)*hxi; x4=x3; y4=-y3; alfa3=103.32; alfa4=256.68; halfa=(alfa4-alfa3)*hxi/(xi4-xi3); alfa=[alfa3:halfa:alfa4]’; x(n3:n4,1)=1180*cos(alfa(:)*pi/180)-3505; y(n3:n4,1)=1180*sin(alfa(:)*pi/180);

22 plot(x(n3:n4,1),y(n3:n4,1),’r’); pause(1);

%4--->5 (Solid surface; eta=etamin); n5=0.75*nxi; xi5=(n5-1)*hxi; x5=x2; y5=-y2; x(n4:n5,1)=linspace(x4,x5,n5-n4+1)’; y(n4:n5,1)=-tan(13.5*pi/180)*x(n4:n5,1)-2055; plot(x(n4:n5,1),y(n4:n5,1),’r’); pause(1);

%5--->6 (Solid surface; eta=etamin); n6=nxi; xi6=(n6-1)*hxi; x6=x1; y6=-y1; x(n5:n6,1)=linspace(x5,x6,n6-n5+1)’; y(n5:n6,1)=-y1; plot(x(n5:n6,1),y(n5:n6,1),’r’); pause(1);

%6--->7 (Surroundings; xi=ximax); n7=n6; xi7=xi6; x7=x6; y7=-R; x(nxi,1:neta)=x6; y(nxi,1:neta)=linspace(y6,y7,neta); plot(x(nxi,:),y(nxi,:)); pause(1);

%7--->8 (Surroundings, eta=etamax);

R1=20000; n8=1; xi8=(n8-1)*hxi; theta=linspace(90,270,nxi)’; x(n8:nxi,neta)=R1*cos(pi/180*theta)+x1; y(n8:nxi,neta)=R*sin(pi/180*theta); plot(x(n8:nxi,neta),y(n8:nxi,neta)); pause(1);

%8--->9 (Surroundings, xi=ximin) x(1,1:neta)=x1; y(1,1:neta)=linspace(y1,R,neta); plot(x(1,1:neta),y(1,1:neta)); pause(1);

%4. INTEGRATION %------%------tol=1e-1; ite=0; maxite=50000; error=1.0; errormax=1e20; w=0.08;

%Initial solution: etamax=100; etamin=1; heta=1; neta=(etamax-etamin)/heta+1; eta=linspace(etamin,etamax,neta); [ETAi,XIi]=meshgrid(eta,xi); n=nxi*neta;

x=interp2(ETA,XI,x,ETAi,XIi); y=interp2(ETA,XI,y,ETAi,XIi); for i=2:nxi-1, plot(x(i,:),y(i,:)); end for j=2:neta-1, plot(x(:,j),y(:,j)); end hold off;

%Clustering Parameters: a=0; b=0; %P Forcing Function; c=-0.13; d=0.0001; %Q Forcing Function; if a~=0|c~=0 ; fprintf(’Clustering ON\n\n’) end fprintf(’Number of mesh points...\n’); disp([n]); fprintf(’Press enter key to iterate...\n\n’); pause; r=0; time=clock; while error>tol ite=ite+1; xhat=x; yhat=y;

for j=2:neta-1; for i=1:nxi-1; k=0; if i==1; k=1; end

alfahat(i,j)=0.25*((xhat(i,j+1)-xhat(i,j-1))^2+... (yhat(i,j+1)-yhat(i,j-1))^2); betahat(i,j)=0.25*((xhat(i+1,j)-xhat(i-1+k,j))*... (xhat(i,j+1)-xhat(i,j-1))+... (yhat(i+1,j)-((-1)^k)*yhat(i-1+k*(nxi-1),j))*... (yhat(i,j+1)-yhat(i,j-1))); gammahat(i,j)=0.25*((xhat(i+1,j)-xhat(i-1+k,j))^2+... (yhat(i+1,j)-((-1)^k)*yhat(i-1+k*(nxi-1),j))^2);

Q(j)=c*sign(eta(j)-etamax)*exp(-d*abs(eta(j)-etamax)); %Forcing Function.

23 J(i,j)=0.25*((xhat(i+1,j)-xhat(i-1+k,j))*... (yhat(i,j+1)-yhat(i,j-1))-... (xhat(i,j+1)-xhat(i,j-1))*... (yhat(i+1,j)-((-1)^k)*yhat(i-1+k*(nxi-1),j)));

A=-0.5*betahat(i,j); B=alfahat(i,j); C=0.5*betahat(i,j); D=gammahat(i,j)+0.5*J(i,j)*Q(j); E=2*alfahat(i,j)+2*gammahat(i,j); F=gammahat(i,j)-0.5*J(i,j)*Q(j); G=0.5*betahat(i,j); H=alfahat(i,j); L=-0.5*betahat(i,j);

x(i,j)=(1-k)*(x(i+1,j+1)*A... +x(i+1,j)*B+... x(i+1,j-1)*C+... x(i,j+1)*D+... x(i,j-1)*F+... x(i-1+k,j+1)*G+... x(i-1+k,j)*H+... x(i-1+k,j-1)*L)/E+k*x1; y(i,j)=(y(i+1,j+1)*A... +y(i+1,j)*B... +y(i+1,j-1)*C... +y(i,j+1)*D... +y(i,j-1)*F... +((-1)^k)*y(i-1+k*(nxi-1),j+1)*G... +((-1)^k)*y(i-1+k*(nxi-1),j)*H... +((-1)^k)*y(i-1+k*(nxi-1),j-1)*L)/E;

x(i,j)=xhat(i,j)+w*(x(i,j)-xhat(i,j)); %Successive Overrelaxation; y(i,j)=yhat(i,j)+w*(y(i,j)-yhat(i,j));

end x(nxi,j)=x(1,j); y(nxi,j)=-y(1,j); end error=norm((xhat-x),inf)+norm((yhat-y),inf)+norm((xhat-x),1)+norm((yhat-y),1); % r=r+1; % if r==4; % disp(’ Iteration Error ’); % r=0; % end disp([ite error]);

if ite>maxite|error>errormax error(’the iteration does not converge’);

end

% plot(x(1,:),y(1,:)); hold on % plot(x(nxi,:),y(nxi,:)); % plot(x(:,1),y(:,1)); % plot(x(:,neta),y(:,neta)); % for i=2:nxi-1, plot(x(i,:),y(i,:)); end % for j=2:neta-1, plot(x(:,j),y(:,j)); end % pause(1); % hold off; %

end time=etime(clock,time); disp(’The iteration has converged succesfully.’); disp(’Time employed (s)....’); disp([time]); figure(2); plot(x(1,:),y(1,:)); hold on plot(x(nxi,:),y(nxi,:)); plot(x(:,1),y(:,1)); plot(x(:,neta),y(:,neta)); for i=2:nxi-1, plot(x(i,:),y(i,:)); end for j=2:neta-1, plot(x(:,j),y(:,j)); end pause(1); hold off; ------function [x_xi,x_eta,y_xi,y_eta,J]=Metrics(x,y,nxi,neta); x_xi=zeros(nxi,neta); x_eta=zeros(nxi,neta); y_xi=zeros(nxi,neta); y_eta=zeros(nxi,neta); J=zeros(nxi,neta); for i=2:nxi-1; for j=2:neta-1;

x_xi(i,j)=0.5*(x(i+1,j)-x(i-1,j));

x_eta(i,j)=0.5*(x(i,j+1)-x(i,j-1));

y_xi(i,j)=0.5*(y(i+1,j)-y(i-1,j));

y_eta(i,j)=0.5*(y(i,j+1)-y(i,j-1));

J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j);

end end for j=2:neta-1;

i=1; x_xi(i,j)=0.5*(-3*x(i,j)+4*x(i+1,j)-x(i+2,j)); x_eta(i,j)=0.5*(x(i,j+1)-x(i,j-1)); y_xi(i,j)=0.5*(-3*y(i,j)+4*y(i+1,j)-y(i+2,j));

24 y_eta(i,j)=0.5*(y(i,j+1)-y(i,j-1)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j);

i=nxi; x_xi(i,j)=0.5*(3*x(i,j)-4*x(i-1,j)+x(i-2,j)); x_eta(i,j)=0.5*(x(i,j+1)-x(i,j-1)); y_xi(i,j)=0.5*(3*y(i,j)-4*y(i-1,j)+y(i-2,j)); y_eta(i,j)=0.5*(y(i,j+1)-y(i,j-1)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j); end for i=2:nxi-1;

j=1; x_xi(i,j)=0.5*(x(i+1,j)-x(i-1,j)); x_eta(i,j)=0.5*(-3*x(i,j)+4*x(i,j+1)-x(i,j+2)); y_xi(i,j)=0.5*(y(i+1,j)-y(i-1,j)); y_eta(i,j)=0.5*(-3*y(i,j)+4*y(i,j+1)-y(i,j+2)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j);

j=neta; x_xi(i,j)=0.5*(x(i+1,j)-x(i-1,j)); x_eta(i,j)=0.5*(3*x(i,j)-4*x(i,j-1)+x(i,j-2)); y_xi(i,j)=0.5*(y(i+1,j)-y(i-1,j)); y_eta(i,j)=0.5*(3*y(i,j)-4*y(i,j-1)+y(i,j-2)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j); end i=1; j=1; x_xi(i,j)=0.5*(-3*x(i,j)+4*x(i+1,j)-x(i+2,j)); x_eta(i,j)=0.5*(-3*x(i,j)+4*x(i,j+1)-x(i,j+2)); y_xi(i,j)=0.5*(-3*y(i,j)+4*y(i+1,j)-y(i+2,j)); y_eta(i,j)=0.5*(-3*y(i,j)+4*y(i,j+1)-y(i,j+2)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j); i=1; j=neta; x_xi(i,j)=0.5*(-3*x(i,j)+4*x(i+1,j)-x(i+2,j)); x_eta(i,j)=0.5*(3*x(i,j)-4*x(i,j-1)+x(i,j-2)); y_xi(i,j)=0.5*(-3*y(i,j)+4*y(i+1,j)-y(i+2,j)); y_eta(i,j)=0.5*(3*y(i,j)-4*y(i,j-1)+y(i,j-2)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j); i=nxi; j=1; x_xi(i,j)=0.5*(3*x(i,j)-4*x(i-1,j)+x(i-2,j)); x_eta(i,j)=0.5*(-3*x(i,j)+4*x(i,j+1)-x(i,j+2)); y_xi(i,j)=0.5*(3*y(i,j)-4*y(i-1,j)+y(i-2,j)); y_eta(i,j)=0.5*(-3*y(i,j)+4*y(i,j+1)-y(i,j+2)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j); i=nxi; j=neta; x_xi(i,j)=0.5*(3*x(i,j)-4*x(i-1,j)+x(i-2,j)); x_eta(i,j)=0.5*(3*x(i,j)-4*x(i,j-1)+x(i,j-2)); y_xi(i,j)=0.5*(3*y(i,j)-4*y(i-1,j)+y(i-2,j)); y_eta(i,j)=0.5*(3*y(i,j)-4*y(i,j-1)+y(i,j-2)); J(i,j)=x_xi(i,j)*y_eta(i,j)-y_xi(i,j)*x_eta(i,j);

25 References

[1] Moretti G., and M. Abbett: A Time-Dependent Computational Method for Blunt Body Flows,” American Instutute of Aeronautics and Astronautics (AIAA) Journal, vol. 4, no. 12, pp. 2136-2141, December 1966.

[2] Starsem, The Soyuz Company: ”Soyuz User’s Manual,” Issue 3, Revision no. 0; April 2001.

[3] Thompson J.F., Warsi Z.V.A., and Wayne Mastin C.: ”Numerical Grid Generation: Foundations and Applications,” North-Holland, New York, 1985.

[4] Anderson J.D., Jr.: ”Computational Fluid Dynamics,” McGraw-Hill.

[5] Anderson D.A, Tanhenhill J.C., and Pletcher R.H.: ”Computational Fluid Dynamics and Heat Transfer,” McGraw-Hill, 1986.

[6] Spurk J.H.: ”Fluid Mechanics,” Springer Verlag, 1997.

[7] Vincenti W., Kruger C.H.,: ”Introduction to Physical Gas Dynamics,” John Wiley & Sons, 1965.

26