how to set the ifil for the 2uvobc?
Posted: Tue Mar 01, 2016 11:15 pm
HI,
I applied a daily river discharge file to my model. my time step is 1min. I asked the program to read the file daily.
I have applied this code but it seems the problem is in "ifil" and/or "iunit. here is the what the computer complains about:
Fortran runtime error: Cannot read from file opened for WRITE
here are my settings:
This is my setting:
!6. Model I/O file properties
!----------------------------
!
!6.1 Input
!---------
!---model grid
modfiles(io_modgrd,1,1)%status = 'N'
modfiles(io_modgrd,1,1)%form = 'A'
modfiles(io_modgrd,1,1)%filename = 'DATA/bathyERIEgrid.dat'
!---open boundary conditions (2-D)
modfiles(io_2uvobc,1:2,1)%status = 'N'
modfiles(io_2uvobc,1:2,1)%form = 'A'
modfiles(io_2uvobc,2,1)%filename = 'DATA/discharge.csv'
modfiles(io_2uvobc,2,1)%tlims = (/0,int_undef,1440/)
!---open boundary conditions (3-D)
modfiles(io_3uvobc,2,1)%status = 'N'
!
!6.2 Output
!----------
!
IF (ciffiles(icif_model)%status.EQ.'W') THEN
! ---model grid
modfiles(io_modgrd,1,2)%status = 'W'
modfiles(io_modgrd,1,2)%form = 'U'
! ---open boundary conditions (2-D)
modfiles(io_2uvobc,1:2,2)%status = 'W'
modfiles(io_2uvobc,1:2,2)%form = 'U'
! ---open boundary conditions (3-D)
modfiles(io_3uvobc,1:2,2)%status = 'W'
modfiles(io_3uvobc,1:2,2)%form = 'A'
ENDIF
.
.
.
.
!
!4. Open boundary locations
!--------------------------
!
!---river mouth
!DETROIT:(6km)
iobv(1)=15
jobv(1)=44
iobv(2)=16
jobv(2)=45
iobv(3)=17
jobv(3)=45
!NIAGARA:(600m)
iobv(4) = 192
jobv(4) = 86
.
.
.
IF (modfiles(io_2uvobc,2,1)%iostat.EQ.0) THEN
CALL open_filepars(modfiles(io_2uvobc,2,1))
iunit = modfiles(io_2uvobc,2,1)%iunit
modfiles(io_2uvobc,2,1)%iostat = 1
READ (iunit,*)
GOTO 1000
ENDIF
ciodatetime = CStartDateTime
!2. Read data
!------------
!
READ(iunit,*) iodatetime(1),iodatetime(2),iodatetime(3),qdis1,dettemp,qdis2,niagtemp
width = 2000.0
data2d(1,3) = qdis1/width
data2d(2,3) = qdis1/width
data2d(3,3) = qdis1/width
data2d(1,4) = qdis2/width
!write(*,*) qdis1,qdis2,data2d(1,3),data2d(2,3),data2d(3,3),data2d(1,4)
!---close file
CALL close_filepars(modfiles(io_2uvobc,2,1))
!.
here are the rest of 2uvobc settings:
.
.
.
SELECT CASE (iddesc)
CASE (io_3uvobc,io_salobc)
noprofsd = 2
iprofobv(1:nobv,1) = (/1,1,1,2/)
indexprof(1:2,2) = (/1,2/)
END SELECT
.
.
.
!---type of conditions at U-open boundaries
!ityp2dobu = 6; iloczobu = 1
!---type of conditions at V-open boundaries
ityp2dobv(1:nobv) = 4; iloczobv = 1
!---type and form of output data
no2dobc(2) = 4
index2dobc(1:4,2) = (/1,2,3,4/)
iobc2dtype(2)= 3
I need to know which part causes the problem
Thanks
Sue
I applied a daily river discharge file to my model. my time step is 1min. I asked the program to read the file daily.
I have applied this code but it seems the problem is in "ifil" and/or "iunit. here is the what the computer complains about:
Fortran runtime error: Cannot read from file opened for WRITE
here are my settings:
This is my setting:
!6. Model I/O file properties
!----------------------------
!
!6.1 Input
!---------
!---model grid
modfiles(io_modgrd,1,1)%status = 'N'
modfiles(io_modgrd,1,1)%form = 'A'
modfiles(io_modgrd,1,1)%filename = 'DATA/bathyERIEgrid.dat'
!---open boundary conditions (2-D)
modfiles(io_2uvobc,1:2,1)%status = 'N'
modfiles(io_2uvobc,1:2,1)%form = 'A'
modfiles(io_2uvobc,2,1)%filename = 'DATA/discharge.csv'
modfiles(io_2uvobc,2,1)%tlims = (/0,int_undef,1440/)
!---open boundary conditions (3-D)
modfiles(io_3uvobc,2,1)%status = 'N'
!
!6.2 Output
!----------
!
IF (ciffiles(icif_model)%status.EQ.'W') THEN
! ---model grid
modfiles(io_modgrd,1,2)%status = 'W'
modfiles(io_modgrd,1,2)%form = 'U'
! ---open boundary conditions (2-D)
modfiles(io_2uvobc,1:2,2)%status = 'W'
modfiles(io_2uvobc,1:2,2)%form = 'U'
! ---open boundary conditions (3-D)
modfiles(io_3uvobc,1:2,2)%status = 'W'
modfiles(io_3uvobc,1:2,2)%form = 'A'
ENDIF
.
.
.
.
!
!4. Open boundary locations
!--------------------------
!
!---river mouth
!DETROIT:(6km)
iobv(1)=15
jobv(1)=44
iobv(2)=16
jobv(2)=45
iobv(3)=17
jobv(3)=45
!NIAGARA:(600m)
iobv(4) = 192
jobv(4) = 86
.
.
.
IF (modfiles(io_2uvobc,2,1)%iostat.EQ.0) THEN
CALL open_filepars(modfiles(io_2uvobc,2,1))
iunit = modfiles(io_2uvobc,2,1)%iunit
modfiles(io_2uvobc,2,1)%iostat = 1
READ (iunit,*)
GOTO 1000
ENDIF
ciodatetime = CStartDateTime
!2. Read data
!------------
!
READ(iunit,*) iodatetime(1),iodatetime(2),iodatetime(3),qdis1,dettemp,qdis2,niagtemp
width = 2000.0
data2d(1,3) = qdis1/width
data2d(2,3) = qdis1/width
data2d(3,3) = qdis1/width
data2d(1,4) = qdis2/width
!write(*,*) qdis1,qdis2,data2d(1,3),data2d(2,3),data2d(3,3),data2d(1,4)
!---close file
CALL close_filepars(modfiles(io_2uvobc,2,1))
!.
here are the rest of 2uvobc settings:
.
.
.
SELECT CASE (iddesc)
CASE (io_3uvobc,io_salobc)
noprofsd = 2
iprofobv(1:nobv,1) = (/1,1,1,2/)
indexprof(1:2,2) = (/1,2/)
END SELECT
.
.
.
!---type of conditions at U-open boundaries
!ityp2dobu = 6; iloczobu = 1
!---type of conditions at V-open boundaries
ityp2dobv(1:nobv) = 4; iloczobv = 1
!---type and form of output data
no2dobc(2) = 4
index2dobc(1:4,2) = (/1,2,3,4/)
iobc2dtype(2)= 3
I need to know which part causes the problem
Thanks
Sue