fosite.f90
Go to the documentation of this file.
1 !#############################################################################
2 !# #
3 !# fosite - 3D hydrodynamical simulation program #
4 !# program file: fosite.f90 #
5 !# #
6 !# Copyright (C) 2006-2018 #
7 !# Tobias Illenseer <tillense@astrophysik.uni-kiel.de> #
8 !# Manuel Jung <mjung@astrophysik.uni-kiel.de> #
9 !# Björn Sperling <sperling@astrophysik.uni-kiel.de> #
10 !# Jannes Klee <jklee@astrophysik.uni-kiel.de> #
11 !# #
12 !# This program is free software; you can redistribute it and/or modify #
13 !# it under the terms of the GNU General Public License as published by #
14 !# the Free Software Foundation; either version 2 of the License, or (at #
15 !# your option) any later version. #
16 !# #
17 !# This program is distributed in the hope that it will be useful, but #
18 !# WITHOUT ANY WARRANTY; without even the implied warranty of #
19 !# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or #
20 !# NON INFRINGEMENT. See the GNU General Public License for more #
21 !# details. #
22 !# #
23 !# You should have received a copy of the GNU General Public License #
24 !# along with this program; if not, write to the Free Software #
25 !# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
26 !# #
27 !#############################################################################
28 
29 !----------------------------------------------------------------------------!
40 !----------------------------------------------------------------------------!
41 MODULE fosite_mod
52  USE integration
53  USE common_dict
54 #ifdef PARALLEL
55 #ifdef HAVE_MPI_MOD
56  USE mpi
57 #endif
58 #endif
59  IMPLICIT NONE
60 #ifdef PARALLEL
61 #ifdef HAVE_MPIF_H
62  include 'mpif.h'
63 #endif
64 #endif
65  !--------------------------------------------------------------------------!
66  INTEGER, PRIVATE, PARAMETER :: maxlen = 500
67  INTEGER, PRIVATE, PARAMETER :: simtype = 1
68  CHARACTER(LEN=32), PRIVATE, PARAMETER :: simname = "fosite"
69 
71  TYPE, EXTENDS(logging_base) :: fosite
74  TYPE(dict_typ),POINTER :: config => null()
75  TYPE(dict_typ),POINTER :: io => null()
76  CLASS(mesh_base),ALLOCATABLE :: mesh
77  CLASS(fluxes_base),ALLOCATABLE :: fluxes
78  CLASS(physics_base),ALLOCATABLE :: physics
79  CLASS(fileio_base),ALLOCATABLE :: datafile
80  CLASS(timedisc_base),ALLOCATABLE :: timedisc
81  CLASS(fileio_base),ALLOCATABLE :: logfile
82  CLASS(sources_base), POINTER :: sources & !< list of source terms
83  => null()
86  INTEGER :: iter
87  LOGICAL :: aborted = .true.
88  DOUBLE PRECISION :: wall_time
89  DOUBLE PRECISION :: log_time
90  DOUBLE PRECISION :: start_time
91  DOUBLE PRECISION :: end_time
92  DOUBLE PRECISION :: run_time
93  INTEGER :: start_count
94  CHARACTER(MAXLEN) :: buffer
97 #ifdef PARALLEL
98  INTEGER :: ierror
99  REAL :: dt_all
101 #endif
102 
103  CONTAINS
106  PROCEDURE :: initfosite
107  PROCEDURE :: setup
108  PROCEDURE :: firststep
109  PROCEDURE :: step
110  PROCEDURE :: run
111  PROCEDURE :: printinfo
112  PROCEDURE :: printboundaryfluxes
113  PROCEDURE :: printsummary
114  PROCEDURE :: computeruntime
115  PROCEDURE :: finalize
116  END TYPE fosite
117  !--------------------------------------------------------------------------!
118  PUBLIC :: fosite
121  !--------------------------------------------------------------------------!
122 
123 
124 CONTAINS
125 
126  SUBROUTINE initfosite(this)
127  IMPLICIT NONE
128  !--------------------------------------------------------------------------!
129  CLASS(fosite), INTENT(INOUT) :: this
130  !--------------------------------------------------------------------------!
131 #ifdef PARALLEL
132  LOGICAL :: already_initialized = .false.
133 #endif
134  !--------------------------------------------------------------------------!
135 #ifdef PARALLEL
136  ! initialize MPI library for parallel execution, if Fosite is not initialized
137  IF(.NOT.this%Initialized()) &
138  CALL mpi_initialized(already_initialized,this%ierror)
139  IF (.NOT.already_initialized) &
140  CALL mpi_init(this%ierror)
141 #endif
142 
143  IF(this%Initialized()) &
144  CALL this%Finalize(.false.)
145 
146  CALL this%InitLogging(simtype,simname)
147 
148  CALL initdict()
149  this%iter = 0
150  END SUBROUTINE initfosite
151 
152  SUBROUTINE setup(this)
153  IMPLICIT NONE
154  !--------------------------------------------------------------------------!
155  CLASS(fosite), INTENT(INOUT) :: this
156  TYPE(dict_typ), POINTER :: dir, iodir, config_copy
157  TYPE(dict_typ), POINTER :: boundary
158  !--------------------------------------------------------------------------!
159  IF (.NOT.this%Initialized()) &
160  CALL this%Error("Setup","Sim is uninitialized")
161 
162  CALL deletedict(this%IO)
163 
164  IF (this%GetRank().EQ.0) THEN
165  ! print some information
166  WRITE(this%buffer, "(A)")&
167  "+---------------------------------------------------------+"
168  CALL this%Info(this%buffer)
169  WRITE(this%buffer, "(A1,A29,A28,A1)")&
170  "|",trim(simname),"","|"
171  CALL this%Info(this%buffer)
172  WRITE(this%buffer, "(A1,A35,A22,A1)")&
173  "|",trim(version),"","|"
174  CALL this%Info(this%buffer)
175  WRITE(this%buffer, "(A)")&
176  "| Solution of 3D advection problems |"
177  CALL this%Info(this%buffer)
178  WRITE(this%buffer, "(A)")&
179  "+---------------------------------------------------------+"
180  CALL this%Info(this%buffer)
181  CALL this%Info("Initializing simulation:")
182  END IF
183 
184  CALL getattr(this%config, "mesh", dir)
185  IF(ASSOCIATED(dir)) THEN
186  NULLIFY(iodir)
187  CALL new_mesh(this%Mesh, dir, iodir)
188  IF(ASSOCIATED(iodir)) CALL setattr(this%IO, "mesh", iodir)
189  END IF
190 
191  CALL getattr(this%config, "physics", dir)
192  IF(ASSOCIATED(dir)) THEN
193  NULLIFY(iodir)
194  CALL new_physics(this%Physics, this%Mesh, dir, iodir)
195  IF(ASSOCIATED(iodir)) CALL setattr(this%IO, "physics", iodir)
196  END IF
197 
198  CALL getattr(this%config, "fluxes", dir)
199  IF(ASSOCIATED(dir)) THEN
200  NULLIFY(iodir)
201  CALL new_fluxes(this%Fluxes, this%Mesh, this%Physics, dir, iodir)
202  IF(ASSOCIATED(iodir)) CALL setattr(this%IO, "fluxes", iodir)
203  END IF
204 
205  CALL getattr(this%config, "timedisc", dir)
206  IF(ASSOCIATED(dir)) THEN
207  NULLIFY(iodir)
208  CALL new_timedisc(this%Timedisc, this%Mesh,this%Physics,dir,iodir)
209  IF(ASSOCIATED(iodir)) CALL setattr(this%IO, "timedisc", iodir)
210  END IF
211 
212  CALL getattr(this%config, "boundary", dir)
213  IF(.NOT.ASSOCIATED(dir)) THEN
214  boundary => dict("empty"/ 0)
215  CALL setattr(this%config, "boundary", boundary)
216  CALL getattr(this%config, "boundary", dir)
217  END IF
218  IF(ASSOCIATED(dir)) THEN
219  NULLIFY(iodir)
220  CALL new_boundary(this%Timedisc%Boundary, this%Mesh, this%Physics, dir,iodir)
221  IF(ASSOCIATED(iodir)) CALL setattr(this%IO, "boundary", iodir)
222  END IF
223 
224  CALL getattr(this%config, "sources", dir)
225  IF(ASSOCIATED(dir)) THEN
226  IF(haschild(dir)) THEN
227  NULLIFY(iodir)
228  CALL new_sources(this%Sources, &
229  this%Mesh,this%Fluxes,this%Physics,dir,iodir)
230  IF(ASSOCIATED(iodir)) CALL setattr(this%IO, "sources", iodir)
231  END IF
232  END IF
233 
234  CALL getattr(this%config, "datafile", dir)
235  IF(ASSOCIATED(dir)) THEN
236  CALL new_fileio(this%Datafile, this%Mesh, this%Physics, this%Timedisc,&
237  this%Sources, dir,this%IO)!,this%config)
238  END IF
239 
240  CALL getattr(this%config, "logfile", dir)
241  IF(ASSOCIATED(dir)) THEN
242  CALL new_fileio(this%Logfile, this%Mesh, this%Physics, this%Timedisc,&
243  this%Sources,dir,this%IO)
244  END IF
245 
246  CALL setattr(this%config, "version", trim(version))
247  CALL copydict(this%config, config_copy)
248 
249  CALL setattr(this%IO, "config", config_copy)
250 
251  END SUBROUTINE setup
252 
253 
254  SUBROUTINE firststep(this)
255  IMPLICIT NONE
256  !--------------------------------------------------------------------------!
257  CLASS(fosite), INTENT(INOUT) :: this
258  INTEGER :: datetime(8)
259  !--------------------------------------------------------------------------!
260 
261 #ifdef PARALLEL
262  this%start_time = mpi_wtime()
263 #else
264  CALL cpu_time(this%start_time)
265 #endif
266 
267  CALL system_clock(this%start_count)
268 
269  ! make sure that the initial data is written to the log file
270  this%wall_time = this%start_time
271  this%log_time = this%wall_time
272 
273  IF (this%GetRank().EQ.0) THEN
274  CALL this%Info( &
275  "===================================================================")
276  CALL this%Info("Starting calculation...")
277  CALL date_and_time(values = datetime)
278  WRITE(this%buffer,"(A,I2.2,A,I2.2,A,I4.4,A,I2.2,A,I2.2,A,I2.2)")&
279  "Time: ", &
280  datetime(3), ".", datetime(2), ".", datetime(1), " ",&
281  datetime(5), ":", datetime(6), ":", datetime(7)
282  CALL this%Info(this%buffer)
283  CALL this%Info( &
284  "step time n t min(dt) due to adj.")
285  CALL this%Info( &
286  "-------------------------------------------------------------------")
287  END IF
288 
289  ! determine the background velocity if fargo advection type 1 is enabled
290  IF (this%Mesh%FARGO.EQ.1) THEN
291  ! make sure there is valid data at least in the i-ghost cells
292  CALL this%Timedisc%Boundary%CenterBoundary(this%Mesh,this%Physics,&
293  0.0,this%Timedisc%pvar,this%Timedisc%cvar)
294  CALL this%Timedisc%CalcBackgroundVelocity(this%Mesh,this%Physics, &
295  this%Timedisc%pvar,this%Timedisc%cvar,this%Timedisc%w)
296  END IF
297 
298  ! do a complete update of all data
299  CALL this%Timedisc%ComputeRHS(this%Mesh,this%Physics,this%Sources,this%Fluxes, &
300  this%Timedisc%time,0.0,this%Timedisc%pvar,this%Timedisc%cvar, &
301  check_all,this%Timedisc%rhs)
302 
303  ! calculate timestep
304  this%Timedisc%dt = this%Timedisc%CalcTimestep(this%Mesh,this%Physics,this%Sources,&
305  this%Fluxes,this%Timedisc%time,this%Timedisc%dtcause)
306 
307  SELECT TYPE(phys => this%Physics)
308  CLASS IS(physics_eulerisotherm)
309  IF(phys%csiso.GT.0.) THEN
310  IF(any(phys%bccsound%data1d(:).NE.phys%csiso)) THEN
311  CALL this%Error("FirstStep","isothermal sound speed set, but "&
312  // "arrays bccsound and/or fcsound have been overwritten.")
313  END IF
314  END IF
315  CLASS DEFAULT
316  ! do nothing
317  END SELECT
318 
319 
320  ! store old values
321  this%Timedisc%cold = this%Timedisc%cvar
322 
323  ! store initial data
324  IF (this%Timedisc%time.EQ.0.0) THEN
325  CALL this%Datafile%WriteDataset(this%Mesh,this%Physics,this%Fluxes,&
326  this%Timedisc,this%config,this%IO)
327  IF (this%GetRank().EQ.0) CALL this%PrintInfo(0,0,0.0,0.0,0,this%Timedisc%n_adj)
328  END IF
329 
330  IF(this%Timedisc%break) &
331  CALL this%Error("FirstStep","Initial data invalid!")
332  END SUBROUTINE firststep
333 
334 
335  SUBROUTINE run(this)
336  IMPLICIT NONE
337  !--------------------------------------------------------------------------!
338  CLASS(fosite), INTENT(INOUT) :: this
339  !--------------------------------------------------------------------------!
340  ! main loop
341  DO WHILE((this%Timedisc%maxiter.LE.0).OR.(this%iter.LE.this%Timedisc%maxiter))
342  IF(this%Step()) EXIT
343  END DO
344  END SUBROUTINE run
345 
346 
347  FUNCTION step(this) RESULT(break)
348  IMPLICIT NONE
349  !--------------------------------------------------------------------------!
350  CLASS(fosite), INTENT(INOUT) :: this
351  LOGICAL :: break
352 #ifdef PARALLEL
353  REAL,DIMENSION(2) :: dt_buf
354 #endif
355 ! TYPE(Gravity_TYP), POINTER :: pmass
356  !--------------------------------------------------------------------------!
357  break = .false.
358 
359  IF (this%iter.EQ.0) &
360  CALL this%FirstStep()
361 
362  ! finish simulation if stop time is reached
363  IF (abs(this%Timedisc%stoptime-this%Timedisc%time)&
364  .LE.1.0e-05*this%Timedisc%stoptime) THEN
365  break = .true.
366  this%aborted = .false.
367  RETURN
368  END IF
369 
370 #ifdef PARALLEL
371  ! In Fortran MPI_MINLOC is only able to have two values of the same kind!
372  dt_buf(1) = this%Timedisc%dt
373  dt_buf(2) = this%Timedisc%dtcause
374  CALL mpi_allreduce(mpi_in_place,dt_buf,1,default_mpi_2real,mpi_minloc,&
375  this%Mesh%comm_cart,this%ierror)
376  this%Timedisc%dt = dt_buf(1)
377  this%Timedisc%dtcause = dt_buf(2)
378 
379  this%run_time = mpi_wtime() - this%log_time
380  CALL mpi_allreduce(this%run_time,this%wall_time,1,mpi_double_precision,&
381  mpi_min,this%Mesh%comm_cart,this%ierror)
382 #else
383  CALL cpu_time(this%wall_time)
384  this%wall_time = this%wall_time - this%log_time
385 #endif
386 
387  ! adjust timestep for output and calculate the wall clock time
388  CALL this%Datafile%AdjustTimestep(this%Timedisc%time,&
389  this%Timedisc%dt,this%Timedisc%dtcause)
390 
391 #ifdef PARALLEL
392  ! In Fortran MPI_MINLOC is only able to have two values of the same kind!
393  dt_buf(1) = this%Timedisc%dt
394  dt_buf(2) = this%Timedisc%dtcause
395  CALL mpi_allreduce(mpi_in_place,dt_buf,1,default_mpi_2real,mpi_minloc,&
396  this%Mesh%comm_cart,this%ierror)
397  this%Timedisc%dt = dt_buf(1)
398  this%Timedisc%dtcause = dt_buf(2)
399 #endif
400 
401  ! advance the solution in time
402  CALL this%Timedisc%IntegrationStep(this%Mesh,this%Physics,this%Sources, &
403  this%Fluxes,this%iter,this%config,this%IO)
404 
405  ! write output to data file
406  IF ((abs(this%Datafile%time-this%Timedisc%time)&
407  .LE.1.0e-5*this%Datafile%time).OR.&
408  this%Timedisc%break.OR.(this%Datafile%walltime.LE.this%wall_time)) THEN
409  CALL this%Datafile%WriteDataset(this%Mesh,this%Physics,this%Fluxes,&
410  this%Timedisc,this%config,this%IO)
411  CALL this%PrintInfo(this%Datafile%step-1, this%iter,this%Timedisc%time,&
412  this%Timedisc%dtmin,this%Timedisc%dtmincause,this%Timedisc%n_adj)
413 
414  ! Stop program if a break is requested from SolveODE
415  IF(this%Timedisc%break.AND.this%GetRank().EQ.0) THEN
416  CALL this%Warning("SolveODE", "Time step too small, aborting.",0)
417  break = .true.
418  RETURN
419  END IF
420 
421  ! only give one additional output at before walltime
422  IF (this%Datafile%walltime.LE.this%wall_time) THEN
423  this%Datafile%walltime = huge(1.0)
424  END IF
425 
426  ! reset dt_min,dtmincause and n_adj
427  this%Timedisc%dtmin = this%Timedisc%stoptime
428  this%Timedisc%dtmincause = -99
429  this%Timedisc%n_adj = 0
430  !IF(GetRank(this).EQ.0) &
431  ! WRITE(*,"(A,ES10.4,A,ES10.4)") "dtmean: ", this%Timedisc%dtmean, " +- ",&
432  ! SQRT(this%Timedisc%dtstddev/(this%Timedisc%dtaccept-1))/this%Timedisc%dtmean
433  this%Timedisc%dtmean = 0.
434  this%Timedisc%dtstddev = 0.
435  this%Timedisc%dtaccept = 0
436  ! reset max error of cvar
437  IF(this%Timedisc%write_error) &
438  this%Timedisc%cerr_max%data1d(:) = 0.
439  END IF
440 
441  ! calculate next timestep
442  this%Timedisc%dt = this%Timedisc%CalcTimestep(this%Mesh,this%Physics,this%Sources, &
443  this%Fluxes,this%Timedisc%time,this%Timedisc%dtcause)
444  END FUNCTION step
445 
446  SUBROUTINE finalize(this,mpifinalize_)
447  IMPLICIT NONE
448  !--------------------------------------------------------------------------!
449  CLASS(fosite), INTENT(INOUT) :: this
450  LOGICAL,OPTIONAL, INTENT(IN) :: mpifinalize_
451  !--------------------------------------------------------------------------!
452  LOGICAL :: mpifinalize = .true.
453  !--------------------------------------------------------------------------!
454  mpifinalize = .true.
455  CALL this%ComputeRunTime()
456  CALL this%PrintBoundaryFluxes()
457  CALL this%PrintSummary()
458 
459  CALL this%Datafile%Finalize()
460  DEALLOCATE(this%Datafile)
461  IF (ALLOCATED(this%Logfile)) THEN
462  CALL this%Logfile%Finalize()
463  DEALLOCATE(this%Logfile)
464  END IF
465  CALL this%Timedisc%Finalize()
466  DEALLOCATE(this%Timedisc)
467 
468  CALL destroy_sources(this%Sources)
469 
470  CALL this%Physics%Finalize()
471  DEALLOCATE(this%Physics)
472  CALL this%Fluxes%Finalize()
473  DEALLOCATE(this%Fluxes)
474  CALL this%Mesh%Finalize()
475  DEALLOCATE(this%Mesh)
476 
477  CALL deletedict(this%IO)
478  CALL deletedict(this%config)
479  CALL closedict()
480 
481 #ifdef PARALLEL
482  IF(PRESENT(mpifinalize_)) THEN
483  mpifinalize = mpifinalize_
484  END IF
485  IF(mpifinalize) THEN
486  CALL mpi_finalize(this%ierror)
487  END IF
488 #endif
489  END SUBROUTINE finalize
490 
491  SUBROUTINE computeruntime(this)
492  IMPLICIT NONE
493  !--------------------------------------------------------------------------!
494  CLASS(fosite), INTENT(INOUT) :: this
495  !--------------------------------------------------------------------------!
496 
497 #ifdef PARALLEL
498  this%end_time = mpi_wtime() - this%start_time
499  CALL mpi_allreduce(this%end_time,this%run_time,1,mpi_double_precision,mpi_min,&
500  this%Mesh%comm_cart,this%ierror)
501 #else
502  CALL cpu_time(this%end_time)
503  this%run_time = this%end_time - this%start_time
504 #endif
505 
506  END SUBROUTINE computeruntime
507 
508 
509  SUBROUTINE printinfo(this,step,i,t,d,dc,na)
510  IMPLICIT NONE
511  !------------------------------------------------------------------------!
512  CLASS(fosite), INTENT(INOUT) :: this
513  INTEGER :: step, i, dc, na
514  CHARACTER(LEN=9) :: dtcause
515  REAL :: t, d
516  !------------------------------------------------------------------------!
517  INTEGER :: drt, c, c_rate, c_max
518  !------------------------------------------------------------------------!
519  INTENT(IN) :: i,t,d
520  !--------------------------------------------------------------------------!
521  IF (this%GetRank().EQ.0) THEN
522 
523  SELECT CASE (dc)
524  ! positive values represent source terms
525  CASE(1:)
526  WRITE(dtcause, "(A,I2.2,A)") " S",dc," "
527  CASE(dtcause_cfl)
528  WRITE(dtcause, "(A)") " cfl "
529  CASE(dtcause_erradj)
530  WRITE(dtcause, "(A)") " err_adj "
531  CASE(dtcause_smallerr)
532  WRITE(dtcause, "(A)") " err "
533  CASE(dtcause_fileio)
534  ! output by this reason is suppressed by default
535  WRITE(dtcause, "(A)") " fileio "
536  CASE DEFAULT
537  WRITE(dtcause, "(A,I3.2,A)") " ?", dc, "? "
538  END SELECT
539 
540  CALL system_clock(c,c_rate, c_max)
541  ! overflow every 24days => assumption: max one per simulation
542  drt = (c - this%start_count)/c_rate
543  IF (drt .LT. 0) THEN
544  drt = c_max/c_rate + drt
545  END IF
546  WRITE(this%buffer,"(I4.4,A,I2.2,A,I2.2,A,I2.2,A,I8,A,ES11.3,A,ES11.3,A,I5)")&
547  step, " ", drt/3600, ":", mod(drt,3600)/60, ":", mod(drt,60),&
548  " ", i, " ", t, " ", d, dtcause, na
549  CALL this%Info(this%buffer)
550  END IF
551  END SUBROUTINE printinfo
552 
553  SUBROUTINE printboundaryfluxes(this)
554  IMPLICIT NONE
555  !------------------------------------------------------------------------!
556  CLASS(fosite), INTENT(INOUT) :: this
557  INTEGER :: k
558  REAL, DIMENSION(this%Physics%VNUM,6) :: bflux
559  !--------------------------------------------------------------------------!
560  DO k=1,6
561  bflux(:,k) = this%Fluxes%GetBoundaryFlux(this%Mesh,this%Physics,k)
562  END DO
563  IF (this%GetRank().EQ.0) THEN
564  CALL this%Info("-------------------------------------------------------------------")
565  CALL this%Info("total boundary fluxes:")
566  SELECT CASE(this%Physics%VDIM)
567  CASE(1)
568  IF(this%Mesh%INUM.GT.1) THEN
569  CALL this%Info(" west east")
570  DO k=1,this%Physics%VNUM
571  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
572  bflux(k,west), bflux(k,east)
573  CALL this%Info(this%buffer)
574  END DO
575  ELSEIF(this%Mesh%JNUM.GT.1) THEN
576  CALL this%Info(" south north")
577  DO k=1,this%Physics%VNUM
578  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
579  bflux(k,south), bflux(k,north)
580  CALL this%Info(this%buffer)
581  END DO
582  ELSEIF(this%Mesh%KNUM.GT.1) THEN
583  CALL this%Info(" bottom top")
584  DO k=1,this%Physics%VNUM
585  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
586  bflux(k,bottom), bflux(k,top)
587  CALL this%Info(this%buffer)
588  END DO
589  END IF
590  CASE(2)
591  IF(this%Mesh%INUM.EQ.1) THEN
592  CALL this%Info(" south north")
593  DO k=1,this%Physics%VNUM
594  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
595  bflux(k,south), bflux(k,north)
596  CALL this%Info(this%buffer)
597  END DO
598  CALL this%Info(" bottom top")
599  DO k=1,this%Physics%VNUM
600  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
601  bflux(k,bottom), bflux(k,top)
602  CALL this%Info(this%buffer)
603  END DO
604  ELSEIF(this%Mesh%JNUM.EQ.1) THEN
605  CALL this%Info(" west east")
606  DO k=1,this%Physics%VNUM
607  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
608  bflux(k,west), bflux(k,east)
609  CALL this%Info(this%buffer)
610  END DO
611  CALL this%Info(" bottom top")
612  DO k=1,this%Physics%VNUM
613  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
614  bflux(k,bottom), bflux(k,top)
615  CALL this%Info(this%buffer)
616  END DO
617  ELSEIF(this%Mesh%KNUM.EQ.1) THEN
618  CALL this%Info(" west east")
619  DO k=1,this%Physics%VNUM
620  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
621  bflux(k,west), bflux(k,east)
622  CALL this%Info(this%buffer)
623  END DO
624  CALL this%Info(" south north")
625  DO k=1,this%Physics%VNUM
626  WRITE(this%buffer,"(T2,A,T21,2(ES12.3))")trim(this%Physics%cvarname(k)), &
627  bflux(k,south), bflux(k,north)
628  CALL this%Info(this%buffer)
629  END DO
630  END IF
631  CASE(3)
632  CALL this%Info(" west east south")
633  DO k=1,this%Physics%VNUM
634  WRITE(this%buffer,"(T2,A,T21,3(ES12.3))")trim(this%Physics%cvarname(k)), &
635  bflux(k,west), bflux(k,east), bflux(k,south)
636  CALL this%Info(this%buffer)
637  END DO
638  CALL this%Info(" north bottom top")
639  DO k=1,this%Physics%VNUM
640  WRITE(this%buffer,"(T2,A,T21,3(ES12.3))")trim(this%Physics%cvarname(k)), &
641  bflux(k,north), bflux(k,bottom), bflux(k,top)
642  CALL this%Info(this%buffer)
643  END DO
644  END SELECT
645  END IF
646  END SUBROUTINE printboundaryfluxes
647 
648  SUBROUTINE printsummary(this)
649  IMPLICIT NONE
650  !------------------------------------------------------------------------!
651  CLASS(fosite), INTENT(INOUT) :: this
652  !--------------------------------------------------------------------------!
653  IF (this%GetRank().EQ.0) THEN
654  CALL this%Info("===================================================================")
655  IF ((this%Timedisc%maxiter.LE.0).OR.(this%iter.LT.this%Timedisc%maxiter)) THEN
656  CALL this%Info("calculation finished correctly.")
657  ELSE
658  CALL this%Info("too many iterations, aborting!")
659  END IF
660  WRITE(this%buffer,"(A,F10.2,A)")" main loop runtime: ", this%run_time, " sec."
661  CALL this%Info(this%buffer)
662  END IF
663  END SUBROUTINE printsummary
664 
665 END MODULE fosite_mod
constructor for mesh class
type(dict_typ) function, pointer, public dict(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20)
Construct a new dictionary from several key/value pairs. Together with the Assign subroutine and over...
recursive subroutine, public copydict(root, outdir)
Copy complete Dictionary.
constructor for fileio class
integer, parameter, private maxlen
Definition: fosite.f90:66
subroutine new_fileio(Fileio, Mesh, Physics, Timedisc, Sources, config, IO)
integer, save default_mpi_2real
default 2real type for MPI
type(logging_base), save this
Generic boundary module.
subroutine, private printinfo(this, step, i, t, d, dc, na)
Definition: fosite.f90:510
subroutine new_sources(this, Mesh, Fluxes, Physics, config, IO)
subroutine, private initfosite(this)
Definition: fosite.f90:127
integer, parameter, private simtype
Definition: fosite.f90:67
main fosite class
Definition: fosite.f90:71
Basic fosite module.
common data structure
Numerical integration.
Definition: integration.f90:33
logical function, public haschild(root)
Check if the node &#39;root&#39; has one or more children.
subroutine, private printboundaryfluxes(this)
Definition: fosite.f90:554
subroutine, private printsummary(this)
Definition: fosite.f90:649
subroutine, public new_boundary(Boundary, Mesh, Physics, config, IO)
constructor for sources class
subroutine new_mesh(Mesh, config, IO)
logical function, private step(this)
Definition: fosite.f90:348
subroutine, private run(this)
Definition: fosite.f90:336
constructor for physics class
subroutine, public new_fluxes(Fluxes, Mesh, Physics, config, IO)
subroutine, public closedict()
subroutine, private computeruntime(this)
Definition: fosite.f90:492
recursive subroutine, public deletedict(root)
Delete the dictionary &#39;root&#39; and all subnodes.
constructor for timedisc class
subroutine, private finalize(this, mpifinalize_)
Definition: fosite.f90:447
subroutine destroy_sources(this)
Dictionary for generic data types.
Definition: common_dict.f90:61
subroutine new_physics(Physics, Mesh, config, IO)
allocate and initialize new physics class
subroutine, public initdict()
subroutine, private firststep(this)
Definition: fosite.f90:255
subroutine new_timedisc(Timedisc, Mesh, Physics, config, IO)
subroutine, private setup(this)
Definition: fosite.f90:153
constructor for reconstruction class
constructor for fluxes class
character(len=32), parameter, private simname
Definition: fosite.f90:68