99 REAL,
DIMENSION(:,:,:),
POINTER :: val
103 REAL,
DIMENSION(:,:),
POINTER :: val
105 CHARACTER(LEN=128) :: key
106 INTEGER(KIND=4) :: numbytes
112 CHARACTER(LEN=128) :: key
119 CHARACTER(LEN=512) :: linebuf
120 CHARACTER(LEN=512) :: tslinebuf
121 CHARACTER(LEN=FNAMLEN) :: filename
122 CHARACTER(LEN=FPATLEN) :: path
123 CHARACTER(LEN=FEXTLEN) :: extension
124 LOGICAL :: cartcoords
133 INTEGER :: inum,jnum,& !< mesh extent
136 INTEGER(KIND=8) :: offset
141 REAL,
DIMENSION(:,:,:,:),
POINTER :: &
145 CHARACTER(LEN=32) :: buf
146 CHARACTER(LEN=12) :: realfmt
147 CHARACTER(LEN=14) :: endianness
148 CHARACTER(LEN=14) :: endian
149 REAL,
DIMENSION(:,:,:,:),
POINTER :: &
153 CHARACTER(LEN=512) :: heading
154 CHARACTER(LEN=512) :: tsheading
155 CHARACTER(LEN=64) :: fmtstr
156 CHARACTER(LEN=64) :: linefmt
168 INTEGER(HID_T) :: fid
169 INTEGER(HID_T) :: xferid
175 REAL,
DIMENSION(:,:) ,
POINTER :: &
186 INTEGER,
DIMENSION(MPI_STATUS_SIZE) :: &
188 INTEGER(KIND=MPI_OFFSET_KIND) :: offset
192 INTEGER(KIND=MPI_ADDRESS_KIND) :: &
193 realext, & !< real data type extent
195 CHARACTER,
DIMENSION(:,:),
POINTER :: &
202 CHARACTER(LEN=64),
DIMENSION(:),
POINTER :: &
206 INTEGER,
DIMENSION(:),
POINTER :: &
212 procedure(writeheader),
DEFERRED :: writeheader
213 procedure(writedataset),
DEFERRED:: writedataset
225 SUBROUTINE writedataset(this,Mesh,Physics,Fluxes,Timedisc,Header,IO)
228 CLASS(fileio_base),
INTENT(INOUT) :: this
229 CLASS(mesh_base),
INTENT(IN) :: Mesh
230 CLASS(physics_base),
INTENT(INOUT) :: Physics
231 CLASS(fluxes_base),
INTENT(IN) :: Fluxes
232 CLASS(timedisc_base),
INTENT(IN) :: Timedisc
233 TYPE(Dict_TYP),
POINTER :: Header,IO
235 SUBROUTINE writeheader(this,Mesh,Physics,Header,IO)
238 CLASS(fileio_base),
INTENT(INOUT) :: this
239 CLASS(mesh_base),
INTENT(IN) :: Mesh
240 CLASS(physics_base),
INTENT(IN) :: Physics
241 TYPE(Dict_TYP),
POINTER :: Header,IO
246 CLASS(fileio_base),
INTENT(INOUT) :: this
260 CHARACTER(LEN=9),
PARAMETER ::
ascii =
"formatted" 261 CHARACTER(LEN=11),
PARAMETER ::
bin =
"unformatted" 267 INTEGER,
PARAMETER ::
vtk = 4
293 SUBROUTINE initfileio(this,Mesh,Physics,Timedisc,Sources,config,IO, &
297 CLASS(fileio_base),
INTENT(INOUT) :: this
298 CLASS(mesh_base),
INTENT(IN) :: Mesh
299 CLASS(physics_base),
INTENT(IN) :: Physics
300 CLASS(timedisc_base),
INTENT(IN) :: Timedisc
301 CLASS(sources_base),
INTENT(IN),
POINTER :: Sources
302 TYPE(Dict_TYP),
INTENT(IN),
POINTER :: config
303 TYPE(Dict_TYP),
INTENT(IN),
POINTER :: IO
304 CHARACTER(LEN=*),
INTENT(IN) :: fmtname
305 CHARACTER(LEN=*),
INTENT(IN) :: fext
307 INTEGER :: fileformat
308 CHARACTER(LEN=MAX_CHAR_LEN) :: fname
309 CHARACTER(LEN=MAX_CHAR_LEN) :: fpath
313 CHARACTER(LEN=32) :: timestamp
314 INTEGER :: count_def, fcycles_def, dtwall_def
315 INTEGER :: cartcoords
318 TYPE(Dict_TYP),
POINTER :: oldconfig => null()
322 CALL getattr(config,
"dtwall" , dtwall_def, 3600)
325 CALL getattr(config,
"count" , count_def, 1)
331 CALL getattr(config,
"filecycles", fcycles_def, count_def+1)
334 CALL getattr(config,
"stoptime" , stoptime_def, timedisc%stoptime)
335 CALL getattr(config,
"fileformat", fileformat)
336 CALL getattr(config,
"filename" , fname)
338 CALL getattr(config,
"filepath" , fpath, fpath)
339 CALL getattr(config,
"unit" , unit ,
lastunit+1)
341 CALL getattr(config,
"walltime" , this%walltime, huge(1.0))
345 CALL getattr(config,
"cartcoords", cartcoords, 1)
346 IF (cartcoords.EQ.0)
THEN 347 this%cartcoords = .false.
349 this%cartcoords = .true.
353 CALL this%InitLogging(fileformat,fmtname)
357 CALL this%Error(
"InitFileIO",
"file cycles exceed limits")
359 IF (len_trim(fname).GT.
fnamlen) &
360 CALL this%Error(
"InitFileIO",
"file name too long")
362 IF (len_trim(fpath).GT.
fpatlen) &
363 CALL this%Error(
"InitFileIO",
"file path too long")
365 IF (len_trim(fext).GT.
fextlen-1) &
366 CALL this%Error(
"InitFileIO",
"file name extension too long")
373 IF (this%multfiles)
THEN 376 CALL this%Error(
"InitFileIO",
"number of processes for multiple file output exceeds limits")
381 this%path = trim(fpath)
382 this%filename = trim(fname)
383 this%extension = trim(fext)
384 this%cycles = fcycles_def
386 this%stoptime = stoptime_def
387 this%starttime = timedisc%time
388 this%dtwall = dtwall_def
389 this%count = count_def
393 CALL getattr(config,
"step", this%step, 0)
396 this%time = timedisc%time
399 CALL this%Info(
" FILEIO---> file name: " // trim(this%GetFilename()))
401 WRITE (timestamp,
'(ES10.4)') timedisc%time
402 CALL this%Info(
" time stamp: " // trim(timestamp))
406 IF (timedisc%time.GT.0.0)
CALL this%IncTime()
407 IF (
ASSOCIATED(oldconfig))
CALL deletedict(oldconfig)
433 INTENT(INOUT) :: time,dt,dtcause
435 IF ((time+dt)/
this%time.GT.1.0)
THEN 436 dt =
this%time - time
438 ELSE IF((time+1.5*dt)/
this%time.GT.1.0)
THEN 439 dt = 0.5*(
this%time - time)
452 INTEGER,
OPTIONAL,
INTENT(IN) :: fn
453 CHARACTER(LEN=FMLTLEN) :: multstr
457 CHARACTER(LEN=32) :: mextfmt
461 IF (
PRESENT(fn))
THEN 464 fn_l =
this%GetRank()
467 IF (
this%multfiles .AND. fn_l .GE. 0)
THEN 470 WRITE (multstr, mextfmt)
"-r", fn_l
487 INTEGER,
OPTIONAL,
INTENT(IN) :: fn
488 CHARACTER(LEN=256) :: fname
490 CHARACTER(LEN=FCYCLEN+2) :: cycstr
492 IF (
this%cycles.GT.0)
THEN 494 WRITE (cycstr, fmt=trim(
cycfmt))
"_", modulo(
this%step,
this%cycles),
"." 495 WRITE (fname,
"(A,A,A,A)") trim(
this%filename),&
499 WRITE (fname,
"(A,A,A,A)") trim(
this%filename),&
510 INTEGER,
OPTIONAL,
INTENT(IN) :: fn
511 CHARACTER(LEN=256) :: fname
521 CLASS(fileio_base),
INTENT(INOUT) :: this
523 IF (.NOT.this%Initialized()) &
524 CALL this%Error(
"CloseFileIO",
"not initialized")
subroutine finalize(this)
Destructor of common class.
output-pointer for time step scalar data (gnuplot)
generic source terms module providing functionaly common to all source terms
integer, parameter, public replace
read/write access replacing file
integer, save default_mpi_real
default real type for MPI
subroutine finalize_base(this)
type(logging_base), save this
integer, parameter, public gnuplot
character(len=9), parameter ascii
for ASCII data
integer, parameter fcyclen
length of timestep string
integer, parameter, public binary
integer, parameter, public dtcause_fileio
smallest ts due to fileio
integer, parameter fnamlen
file name length (without any extension)
pure subroutine inctime(this)
Increments the counter for timesteps and sets the time for next output.
character(len=32), save cycfmt
format string for cycles
integer, parameter, public readend
readonly access at end
integer, parameter maxmltfiles
max. number files per time step (parallel mode with one file per node)
output-pointer for array data (binary,gnuplot,vtk)
character(len=11), parameter bin
for BINARY data
named integer constants for flavour of state vectors
recursive subroutine, public deletedict(root)
Delete the dictionary 'root' and all subnodes.
subroutine initfileio(this, Mesh, Physics, Timedisc, Sources, config, IO, fmtname, fext)
Generic constructor for file I/O.
integer, parameter, public xdmf
integer, parameter fpatlen
file path length (without file name)
Dictionary for generic data types.
integer, parameter, public append
read/write access at end
integer, parameter, public vtk
real function adjusttimestep(this, maxerr, dtold)
adjust the time step
integer, parameter fextlen
file name extension length
integer, parameter maxcycles
max. number of data files (not counting multiple files per time step in parallel mode) ...
base module for numerical flux functions
integer, parameter fmltlen
length of multi process string (parallel mode only)
character(len=fmltlen), save fmextstr
multi process string, overwritten below
integer, parameter, public readonly
readonly access
character(len=256) function getbasename(this, fn)
Get the current file name without path e.g. important for vtk (pvts files)
character(len=fmltlen) function makemultstr(this, fn)
Get a file label (multiples files in parallel mode) without filenumber => use GetRank; with filenumbe...
character(len=256) function getfilename(this, fn)
Get the current file name.