- #1
shipman
- 3
- 0
Hi to everyone,
I am quite new to forum and fortran. Basically, i am trying to calculate the bubble radius using RP model and this is my code:
could someone tell me that why i get NaN error when i run the program?
Best Regards
I am quite new to forum and fortran. Basically, i am trying to calculate the bubble radius using RP model and this is my code:
Code:
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
IMPLICIT INTEGER (I-N)
C ! Declare local constant Pi
REAL, PARAMETER :: Pi = 3.1415927D0
C *************************************************************
C * OUTPUT VARIABLES *
C *************************************************************
OPEN (10,FILE='DT12.csv',STATUS='UNKNOWN')
C ************INPUT VARIABLES**************
DT=1.0D-12 !time step
TEND=8.0D-4 ! ENDTIME
DIN= 8.0D-4 !Initial BUBle Dia ometer
C ******** SOME VARIABLE DATA*****************
ROL =1.0D3 ! DENSITY [LIQUID] kg/m-3
DMYUL=1.002D-3 ! VISCOSITY [LIQUID]
PV=2.3D3 ! SATURATION PRESSURE
SIGMA=7.277D-2 ! SURFACE TENSION
BETA=1.4D0 ! pressure parameter
VO=4.78D-9 !constant bubble volume
PO=1.00072D5 !used in pres. calculation
RO=0.5D0*DIN ! BUBBLE RADIUS AT OLD TIME STEP
R =0.5D0*DIN !0.5D0*1.07D-3 ! CURRENT BUBBLE RADIUS
! Initial bubble volume
VB= 4.0D0*Pi*(RO**3.0D0)/3.0D0
PG = PO*(VB/VO)**BETA ! PRESSURE OF NON-CONDENSING GAS
PBUB =PG +PV !bubble pressure
PSUR=1.01325D5 !enviroment pressure=constant
TP =0.0D0
N =0
C ************OUT PUT INFOMATION*******************************
NDATA=INT(TEND/DT)
WRITE(*,100) DIN*1.0D3
WRITE(*,300) NDATA
C **************************************************************
C ***************LOOP 1 START*********************************
C **************************************************************
10 TP=TP+DT
N=N+1
! Solving RP equation
RR=(PBUB-PSUR
& -4.0D0*DMYUL/DT*(R-RO)/R
& -2.0D0*SIGMA/R)/ROL
RNE=2.0D0*R-RO-1.5D0*(R-RO)**2.0D0/R+DT*DT*RR/R
! BUBBLE RADIUS AT NEW TIME STEP
IF(RNE*2.0D0.LE.0) RNE= 0.5d0*DIN
IF(RNE*2.0D0.GE.2.0d-3) RNE= 2.0d-3
VB= 4.0D0*Pi*(RNE**3.0D0)/3.0D0
PG = PO*(VB/VO)**BETA ! PRESSURE OF NON-CONDENSING GAS
PBUB =PG+PV !bubble pressure
DRDT=(RNE-R)/DT
RO =R
R =RNE
RNE=0.0D0
C *************************************************************
C * OUTPUT *
C *********************WRITE( *,400)*****************************************
IF (MOD(N,NDATA/10000).EQ.1) THEN !screen display data
WRITE( *,400) N,TP,((3.0D0*VB)/(4.0d0*Pi))**(1.0d0/3.0D0)*1.0D3,
& PG/1.0d6,DRDT
end if
if (MOD(N,NDATA/10000).EQ.1) THEN !csv.data
WRITE( *,400) N,TP,((3.0D0*VB)/(4.0d0*Pi))**(1.0d0/3.0D0)*1.0D3,
& PG/1.0d6,DRDT
END IF
IF (TP.LT.TEND) GOTO 10 !time iteration
goto 101
C *************************************************************
C * LOOP END *
C *************************************************************
C
101 write(*,*)RNE
100 FORMAT('INITIAL DIAMETER(um)='F6.2)
200 FORMAT('LIQUID PRESSURE(kPa)='F6.2)
300 FORMAT('CYCLE NUMBER='8X,I16)
400 FORMAT(I13,4(1X,1H,E13.6))
CLOSE(10)
STOP
END
could someone tell me that why i get NaN error when i run the program?
Best Regards