Overview |
PVD (ParaView Data format) is a project which goals is to define Fortran modules to produce ParaView data files from 2D or 3D scalar and vector fields. These routines can be called from a single-threaded or a multi-processes (MPI) applications. It has been developed by Jalel Chergui, LIMSI-CNRS.
a) create a set of ".vtr" files, b) write a 3D rectilinear mesh defined here by x, y and z components, c) write a 3D vector field defined here by u, v, and w components, d) write a 3D scalar field denoted here by p, e) close ".vtr" files, f) Collect the set of ".vtr" files in a unique ".pvd" file.
program calcul USE PVD type(VTR_file_handle) :: fd ... real(kind=8), dimension(15) :: x, y, z ! mesh real(kind=8), dimension(15,15,15) :: u, v, w, p ! fields integer :: t, max_time_iter ... do t = 1, max_time_iter ... (a) call VTR_open_file(PREFIX="project", FD=fd) (b) call VTR_write_mesh(FD=fd, X=x, Y=y, Z=z) (c) call VTR_write_var(FD=fd, NAME="Velocity", VX=u, VY=v, VZ=w) (d) call VTR_write_var(FD=fd, NAME="Pressure", FIELD=p) (e) call VTR_close_file(FD=fd) ... end do (f) call VTR_collect_file(fd) ! Produces "project.pvd" file ... end program calcul |
program calcul USE PVD type(VTR_file_handle) :: fd include "mpif.h" ... real(kind=8), dimension(11) :: x, y, z ! mesh real(kind=8), dimension(11,11,11) :: u, v, w, p ! fields integer :: t, max_time_iter, code, rank, nb_procs ... call MPI_Init(code) call MPI_Comm_size(MPI_COMM_WORLD, nb_procs, code) call MPI_Comm_rank(MPI_COMM_WORLD, rank, code) do t = 1, max_time_iter ... (a) call VTR_open_file(PREFIX="project", PROC_RANK=rank, NUM_PROCS=nb_procs, FD=fd) (b) call VTR_write_mesh(FD=fd, X=x, Y=y, Z=z) (c) call VTR_write_var(FD=fd, NAME="Velocity", VX=u, VY=v, VZ=w) (d) call VTR_write_var(FD=fd, NAME="Pressure", FIELD=p) (e) call VTR_close_file(FD=fd) ... end do (f) call VTR_collect_file(fd) ! Produces "project.pvd" file ... call MPI_Finalize(code) end program calcul |
Compilation geared towards single-threaded execution : gfortran -c VTR_mod.f90 VTK_mod.f90 gfortran -O3 -c monprog.f90 gfortran -o prog.x monprog.o VTR_mod.o VTK_mod.o ./prog.x
Compilation geared towards multi-processes execution : mpif90 -c VTR_mod.f90 VTK_mod.f90 mpif90 -O3 -c monprog.f90 mpif90 -o prog.x monprog.o VTR_mod.o VTK_mod.o mpirun -np 32 ./prog.x