PB3D
[2.45]
Ideal linear high-n MHD stability in 3-D
|
Go to the documentation of this file.
5 #include <PB3D_macros.h>
28 integer,
intent(out),
optional :: unit
31 integer,
parameter :: lun_min=70, lun_max=1000
37 do lun=lun_min,lun_max
38 inquire(unit=lun,opened=file_open)
39 if (.not.file_open)
then
54 integer function skip_comment(file_i,file_name)
result(ierr)
55 character(*),
parameter :: rout_name =
'skip_comment'
58 integer,
intent(in) :: file_i
59 character(len=*),
intent(in),
optional :: file_name
62 character(len=1) :: loc_data_char
63 character(len=max_str_ln) :: err_msg
69 do while (loc_data_char.eq.
'#')
70 read(file_i,*,iostat=ierr) loc_data_char
71 if (
present(file_name))
then
72 err_msg =
'failed to read "'//trim(file_name)//
'"'
74 err_msg =
'failed to read file'
85 subroutine get_file_info(file_name,file_size,acc_time,mod_time)
87 character(len=*),
intent(in) :: file_name
88 integer,
intent(inout),
optional :: file_size
89 integer,
intent(inout),
optional :: acc_time
90 integer,
intent(inout),
optional :: mod_time
97 call stat(trim(file_name),vals,istat)
101 call writo(
'call to stat failed',warning=.true.)
102 if (
present(file_size)) file_size = 0
103 if (
present(acc_time)) acc_time = 0
104 if (
present(mod_time)) mod_time = 0
106 if (
present(file_size)) file_size = vals(8)
107 if (
present(acc_time)) acc_time = vals(9)
108 if (
present(mod_time)) mod_time = vals(10)
118 &result(full_pb3d_name)
122 integer,
intent(in),
optional :: rich_lvl
125 integer :: rich_lvl_loc
129 if (
present(rich_lvl)) rich_lvl_loc = rich_lvl
132 if (rich_lvl_loc.gt.0)
then
133 full_pb3d_name = trim(
pb3d_name)//
'_R_'//&
134 &trim(
i2str(rich_lvl_loc))//
'.h5'
143 integer function delete_file(file_name)
result(istat)
145 character(len=*),
intent(inout) :: file_name
155 inquire(file=trim(file_name),opened=file_open,number=file_i,&
158 if (.not.file_open)
then
159 open(unit=
nextunit(file_i),file=trim(file_name),iostat=istat)
164 close(unit=file_i,status=
'delete',iostat=istat)
169 integer function count_lines(file_i)
result(nr_lines)
171 integer,
intent(in) :: file_i
175 character(len=1) :: loc_data_char
182 do while (istat.eq.0)
184 read(file_i,*,iostat=istat) loc_data_char
185 if (istat.eq.0 .and. loc_data_char.ne.
'#')
then
186 nr_lines = nr_lines + 1
integer function, public delete_file(file_name)
Removes a file.
integer, parameter, public dp
double precision
Numerical variables used by most other modules.
integer function, public skip_comment(file_i, file_name)
Skips comment when reading a file.
subroutine, public get_file_info(file_name, file_size, acc_time, mod_time)
Gets file information.
integer, parameter, public max_str_ln
maximum length of strings
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
integer function, public nextunit(unit)
Search for available new unit.
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Numerical utilities related to giving output.
integer function, public count_lines(file_i)
Count non-comment lines in a file.
character(len=max_str_ln), public pb3d_name
name of PB3D output file
character(len=max_str_ln) function, public get_full_pb3d_name(rich_lvl)
Returns the name of the PB3D output file.
Numerical utilities related to files.