-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfert_parm_read.f90
60 lines (49 loc) · 1.77 KB
/
fert_parm_read.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
subroutine fert_parm_read
use input_file_module
use maximum_data_module
use fertilizer_data_module
implicit none
integer :: it !none |counter
character (len=13) :: fertdbase ! |counter
character (len=80) :: titldum ! |title of file
character (len=80) :: header ! |header of file
integer :: eof ! |end of file
integer :: i ! |
integer :: imax !none |determine max number for array (imax) and total number in file
integer :: mfrt ! |
logical :: i_exist !none |check to determine if file exists
eof = 0
imax = 0
mfrt = 0
inquire (file=in_parmdb%fert_frt, exist=i_exist)
if (.not. i_exist .or. in_parmdb%fert_frt == "null") then
allocate (fertdb(0:0))
else
do
open (107,file=in_parmdb%fert_frt)
read (107,*,iostat=eof) titldum
if (eof < 0) exit
read (107,*,iostat=eof) header
if (eof < 0) exit
do while (eof == 0)
read (107,*,iostat=eof) titldum
if (eof < 0) exit
imax = imax + 1
end do
allocate (fertdb(0:imax))
rewind (107)
read (107,*,iostat=eof) titldum
if (eof < 0) exit
read (107,*,iostat=eof) header
if (eof < 0) exit
do it = 1, imax
read (107,*,iostat=eof) fertdb(it)
if (eof < 0) exit
end do
exit
enddo
endif
db_mx%fertparm = imax
close (107)
return
end subroutine fert_parm_read