Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
help please

Subject: help please

From: Khalid

Date: 1 Sep, 2010 17:05:07

Message: 1 of 2

can you please check this conversion from fortran to matlab if there is better idea (not tried)

!INPUT2
TIMMX=400.0
DTIML=0.5
DTIMG=0.5
DTIMPR=0.5
TDFTOL=2.0
XTOL=1.0E-25
FTOL=1.0E-7
NTOL=20
N=8
VENTOPT='Y'
PVNT=1.4269E5
DPVNT=0.0
IF(VENTOPT .EQ. 'N') GOTO 2
IF(VENTOPT .EQ. 'n') GOTO 2
VOPT='YES'
GOTO 3
2 CONTINUE
PVNT=1.0E25
VOPT='NO'
3 CONTINUE
WRITE(65, 840)'INPUT2'
WRITE(65, *)
WRITE(65, 840)'TIMMX'
WRITE(65, 841) TIMMX
WRITE(65, *)
WRITE(65, 840)'DTIML','DTIMG','DTIMPR'
WRITE(65, 841) DTIML, DTIMG, DTIMPR
WRITE(65, *)
WRITE(65, 840)'TDFTOL','XTOL','FTOL','NTOL'
WRITE(65, 843) TDFTOL, XTOL, FTOL, NTOL
WRITE(65, *)
WRITE(65, 840)'N'
WRITE(65, 842) N
WRITE(65, *)
WRITE(65, 840)'VENTOPT','PVNT','DPVNT'
WRITE(65, 844) VOPT, PVNT, DPVNT
WRITE(65, *)
!INPUT3
PRINT *, "INPUT Imposed heat flux (kW/m**2)."
READ *, QF
QF=QF*1000.0
WRITE(65, 840)'QF'
WRITE(65, 841) QF/1000.0
WRITE(65, *)
PRINT *, 'PRESS RETURN to start program.'
READ '(A1)', AA
!INITVAL
TIML=TIMZ
TWB=TZ
DO 110 K=0,N
TWS(K)=TZ
TC(K)=TZ
110 CONTINUE
TIMG=TIMZ
TWG=TZ
TG=TZ
TCT=TZ
DXM=0.0
QFS=QF
QFT=QF
QFB=QF
TINFS=TINF
TINFT=TINF
TINFB=TINF
!INITM
PV=P1*EXP((XMOLV*XLV/R)*(1.0/T1-1.0/TG))
XMV=(XMOLV*V/R)*PV/TG
XMA=(XMOLA*V/R)*(PATM-PV)/TG
DO 4 K=0,N
Z(K)=K*HL/N
4 CONTINUE
WRITE(65,*)
WRITE(65,840)'COUNT','TIML','TWS(1)','TWS(N)','TC(1)','TC(2)','TC(3)','TC(4)','TC(5)','TC(6)',&
'TC(7)','TC(8)'
!WRITE(65,840)'COUNT','TIML','TWS(1)','TWS(2)','TWS(3)','TWS(4)','TWS(5)','TWS(6)',&
!'TWS(7)','TWS(8)'
WRITE(65,*)
WRITE(66,*)
WRITE(66,840)'COUNT','TIMG','TWG','TG','XMV','XMA','P(PSI)','DXMI','DXMO'
WRITE(66,*)
WRITE(67,*)
WRITE(67,840)'COUNT','PSTTOP','QBNDTOP','TCT','TB','TWB','TIML','TIMG'
WRITE(67,*)
TIMPR=-0.001+TIMZ
COUNT=0
10 CONTINUE
COUNT=COUNT+1
CALL WL(QRROB, EPSI, TWB, TINFB, TC, QCLB, CB, QRROS, TWS, TINFS, QCLS, CS, N, IDM, COUNT)
CALL DVG(DTWG, QFT, QRRO, QRRI, QCG, RCDW, AL, DXM, CVP, TI, CVV, TG,&
DTG, AW, QCL, XMA, CAV, XMV, DXMO, DXMV, DXMI, DXMA, P, P1, PVNT, AVNT, CDVNT,&
PATM, V, DPVNT, EPSI, TWG, TINFT, CG, PA, XMOLA, R,&
PV, XMOLV, QRL, XLEFF, XL, CPL, TCT, TB, T1, XLV, CEV, CPG, TDFTOL,&
XTOL, FTOL, NTOL, COUNT)
WRITE(65,846) COUNT, TIML, TWS(1), TWS(N), TC(1), TC(2), TC(3), TC(4), TC(5), TC(6),&
TC(7), TC(8)
!WRITE(65,846) COUNT, TIML, TWS(1), TWS(2), TWS(3), TWS(4), TWS(5), TWS(6), TWS(7), TWS(8)
WRITE(66,846) COUNT, TIMG, TWG, TG, XMV, XMA, P*PPSI, DXMI, DXMO
WRITE(67,846) COUNT, PSTTOP, QBNDTOP, TCT, TB, TWB, TIML, TIMG
TIMPR=TIMPR+DTIMPR
IF(TIMPR .GE. TIMMX) GOTO 11
20 CONTINUE
CALL GKUTTA(VGY, DTIMG, DGVY,&
DTWG, QFT, QRRO, QRRI, QCG, RCDW, AL, DXM, CVP, TI, CVV, TG,&
DTG, AW, QCL, XMA, CAV, XMV, DXMO, DXMV, DXMI, DXMA, P, P1, PVNT, AVNT, CDVNT,&
PATM, V, DPVNT, EPSI, TWG, TINFT, CG, PA, XMOLA, R,&
PV, XMOLV, QRL, XLEFF, XL, CPL, TCT, TB, T1, XLV, CEV, CPG, TDFTOL,&
XTOL, FTOL, NTOL, COUNT)
TIMG=TIMG+DTIMG
IF(TIMG .LT. (TIML+0.999*DTIML)) GOTO 20
30 CONTINUE
CALL BUOY(PST, G, BETA, TWS, TC, CZ, Z, PSTTOP, QBNDTOP, C2, N, IDM, COUNT)
CALL CORE(DTPC, AB, RHO, CP, VT, QCLB, TCT, TC, DTIML, PSTTOP, QBNDTOP,&
TPC, U, ZP, Z, PST, XLL, RHOZ, AL, TIMPR, N, IDM, COUNT)
CALL LKUTTA(VLY, TWB, TWS, DTIML, DLVY, DTWB, DTWS, QFB, QRRO, QCLB, RCDW, QFS, QRROS, QCLS,&
QRROB, EPSI, TINFB, TC, CB, TINFS, CS, N, IDM, COUNT)
CALL REZCORE(ZP, Z, TC, TPC, N, IDM, COUNT)
TIML=TIML+DTIML
IF(TIML .LT. (TIMG-0.001*DTIMG)) GOTO 30
IF(TIML .LT. TIMPR) GOTO 20
GOTO 10
11 CONTINUE
PRINT *,'OUTPUTFILES CREATED'
END FILE (UNIT = 65)
CLOSE (UNIT = 65)
END FILE (UNIT = 66)
CLOSE (UNIT = 66)
END FILE (UNIT = 67)
CLOSE (UNIT = 67)
END
********************************************************************%*****************************************************************************
%INPUT2
timmx=400.0;
dtiml=0.5;
dtimg=0.5;
dtimpr=0.5;
tdftol=2.0;
xtol=1.0e-25;
ftol=1.0e-7;
ntol=20;
n=8;
ventopt='Y';
pvnt=1.4269e5;
dpvnt=0.0;
% if (ventopt == 'N')
% vopt ='yes'
% pvnt=1.0e25;
% vopt='NO';
qf = input('Input Imposed Heat Flux = ');
qf=qf*1000.0;
timl=timz;
twb=tz;
for k=1:n;
tws(k)=tz;
tc(k)=tz;
end
timg=timz;
twg=tz;
tg=tz;
tct=tz;
%ti=tz;
dxm=0.0;
qfs=qf;
qft=qf;
qfb=qf;
tinfs=tinf;
tinft=tinf;
tinfb=tinf;
%INIT
pv=p1.*exp((xmolv.*xlv./r).*(1.0./t1-1.0./tg));
xmv=(xmolv.*v./r).*pv./tg;
xma=(xmola.*v./r).*(patm-pv)./tg;
for k=1:n;
z(k)=k.*hl./n;
end
timpr=-0.001+timz;
count=0;
 for i=1:100% 10 continue
count=count+1;
[qrrob,tdiff,qclb,qrros,qcls]=wl(twb,tc,tinfb,cb,epsi,tws,tinfs,cs,n);
[dxmtrm,dtwg,dxmo,dxmv,dxma,dtg]=DVG(twg,tinft,tg,cg,xma,...
    xmola,r,v,xmolv,xmv,t1,xlv,p1,epsi,aw,al,xl,cpl,tct,qft,...
    rcdw,dxm,cvp,ti,cvv,cav,pvnt,cevv,cpg,tdftol,xtol,ftol,ntol);
timpr=timpr+dtimpr;
while (timpr <= timmx)
while (timg <(timl+0.999*dtiml))&& (timl < timpr)
[vgy,h,v1,dgvy,s,tg,twg,xmv,xma]=GKUTTA(dtimg,...
    xmola,r,v,xmolv,t1,xlv,p1,epsi,aw,al,xl,cpl,tct,qft,...
    rcdw,dxm,cvp,ti,cvv,cav,pvnt,cevv,twg,tinft,tg,cg,xma...
    ,xmv,cpg,tdftol,xtol,ftol,ntol);
timg=timg+dtimg;
end;
while(timl <(timg-0.001*dtimg))
[pst,dltw,czdz,psttop,qbndtop]=BUOY(g,beta,tws,tc,cz,z,c2,n);
[dtpc,tct,tpc,u,zp]=CORE(ab,rho,cp,vt,qclb,n,tc,dtiml,...
    psttop,qbndtop,z,pst,rhoz,xll,al);
[vly,h,v1,dlvy,s,twb]=LKUTTA(rcdw,qfb,dtiml,twb,n,tc,...
    tinfb,cb,epsi,tws,tinfs,cs,qfs);
[zp, z, tc, tpc, n, idm]=rezcore(zp, z, tc, tpc, n, idm, count);
timl=timl+dtiml;
end
end
end
fprintf(1,'%s \n','OUTPUTFILES CREATED');

Subject: help please

From: Miroslav Balda

Date: 1 Sep, 2010 17:35:05

Message: 2 of 2

"Khalid " <khabuman@hotmail.com> wrote in message <i5m143$1bg$1@fred.mathworks.com>...
> can you please check this conversion from fortran to matlab if there is better idea (not tried)
>
SNIP

Do you really think that the code is a conversion, or are you joking? I am affraid, that you will not get any reasonable reply.

Mira

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us