# I would like to transform matlab program in FORTRAN someone to help me me this program that calculates drag and lift forces

% *************************************** %
% ********** Cd/Cl Computation ********** %
% *************************************** %
% Determination of the drag and lift on the profil

function [Fx, Fy, Cd, Cl] = CdCl(f,ftemp,Nxlimg,Nylims,Nxlimd,Nylimn,Num,R,uref,rhoref,C)

global bin binC

% Computation of the forces applied to the profil
k = 1;
Fx=0;
Fy=0;
FX=zeros(Nxlimd+2,Nylimn+2);
FY=zeros(Nxlimd+2,Nylimn+2);
Balayage=0;
for i = Nxlimg:Nxlimd
for j = Nylims:Nylimn
if bin(i,j,Num)==1
if bin(i+1,j,Num)==0
FX(i,j)=FX(i,j)+(f(i+1,j,1)+ftemp(i+1,j,3));
Balayage=Balayage+1;
end
if bin(i+1,j+1,Num)==0
FX(i,j)=FX(i,j)+(f(i+1,j+1,5)+ftemp(i+1,j+1,7));
FY(i,j)=FY(i,j)+(f(i+1,j+1,5)+ftemp(i+1,j+1,7));
Balayage=Balayage+1;
end
if bin(i,j+1,Num)==0
FY(i,j)=FY(i,j)+(f(i,j+1,2)+ftemp(i,j+1,4));
Balayage=Balayage+1;
end
if bin(i-1,j+1,Num)==0
FX(i,j)=FX(i,j)-(f(i-1,j+1,6)+ftemp(i-1,j+1,8));
FY(i,j)=FY(i,j)+(f(i-1,j+1,6)+ftemp(i-1,j+1,8));
Balayage=Balayage+1;
end
if bin(i-1,j,Num)==0
FX(i,j)=FX(i,j)-(f(i-1,j,3)+ftemp(i-1,j,1));
Balayage=Balayage+1;
end
if bin(i-1,j-1,Num)==0
FX(i,j)=FX(i,j)-(f(i-1,j-1,7)+ftemp(i-1,j-1,5));
FY(i,j)=FY(i,j)-(f(i-1,j-1,7)+ftemp(i-1,j-1,5));
Balayage=Balayage+1;
end
if bin(i,j-1,Num)==0
FY(i,j)=FY(i,j)-(f(i,j-1,4)+ftemp(i,j-1,2));
Balayage=Balayage+1;
end
if bin(i+1,j-1,Num)==0
FX(i,j)=FX(i,j)+(f(i+1,j-1,8)+ftemp(i+1,j-1,6));
FY(i,j)=FY(i,j)-(f(i+1,j-1,8)+ftemp(i+1,j-1,6));
Balayage=Balayage+1;
end
end
end
end

``````      alpha=0;
``````

Fx=sum(sum(FX));
Fy=sum(sum(FY));
Fx=-Fx;
Fy=-Fy;

% Rotation of the referential
F=sqrt(FxFx+FyFy);
Ang1=acosd(Fx/F);
Ang2=asind(Fy/F);
Fx=Fcosd(Ang1+alpha);
Fy=F
sind(Ang2+alpha);

% --------- %
% - Cd/Cl - %
% --------- %

## Cd=2abs(Fx)/uref/uref/R/rhoref; Cl=2Fy/uref/uref/R/rhoref;

cd= drag coefficient
cl = lift coefficient