HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
WriteInputs.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <basic.h>
#include <timeintegration.h>
#include <mpivars.h>
#include <simulation_object.h>

Go to the source code of this file.

Functions

int WriteInputs (void *s, int nsims, int rank)
 

Function Documentation

◆ WriteInputs()

int WriteInputs ( void *  s,
int  nsims,
int  rank 
)

Write the simulation inputs read from the file solver.inp.

Parameters
sArray of simulation objects of type SimulationObject of size nsims
nsimsNumber of simulation objects
rankMPI rank of this process

Definition at line 15 of file WriteInputs.c.

20 {
22  int n;
23 
24  if (sim == NULL) return 0;
25 
26  if (!rank) {
27 
28  printf(" No. of dimensions : %d\n",sim[0].solver.ndims);
29  printf(" No. of variables : %d\n",sim[0].solver.nvars);
30  if (nsims > 1) {
31  printf(" Domain sizes:\n");
32  for (int n = 0; n < nsims; n++) {
33  printf(" domain %3d - ", n);
34  for (int i=0; i<sim[n].solver.ndims; i++) printf ("%d ",sim[n].solver.dim_global[i]);
35  printf("\n");
36  }
37 #ifndef serial
38  printf(" Processes along each dimension:\n");
39  for (int n = 0; n < nsims; n++) {
40  printf(" domain %3d - ", n);
41  for (int i=0; i<sim[n].solver.ndims; i++) printf ("%d ",sim[n].mpi.iproc[i]);
42  printf("\n");
43  }
44 #endif
45  printf(" Exact solution domain sizes:\n");
46  for (int n = 0; n < nsims; n++) {
47  printf(" domain %3d - ", n);
48  for (int i=0; i<sim[n].solver.ndims; i++) printf ("%d ",sim[n].solver.dim_global_ex[i]);
49  printf("\n");
50  }
51  } else {
52  printf(" Domain size : ");
53  for (int i=0; i<sim[0].solver.ndims; i++) printf ("%d ",sim[0].solver.dim_global[i]);
54  printf("\n");
55 #ifndef serial
56  printf(" Processes along each dimension : ");
57  for (int i=0; i<sim[0].solver.ndims; i++) printf ("%d ",sim[0].mpi.iproc[i]);
58  printf("\n");
59 #endif
60  printf(" Exact solution domain size : ");
61  for (int i=0; i<sim[0].solver.ndims; i++) printf ("%d ",sim[0].solver.dim_global_ex[i]);
62  printf("\n");
63  }
64  printf(" No. of ghosts pts : %d\n" ,sim[0].solver.ghosts );
65  printf(" No. of iter. : %d\n" ,sim[0].solver.n_iter );
66  printf(" Restart iteration : %d\n" ,sim[0].solver.restart_iter );
67 #ifdef with_petsc
68  if (sim[0].solver.use_petscTS)
69  printf(" Time integration scheme : PETSc \n" );
70  else {
71  printf(" Time integration scheme : %s ",sim[0].solver.time_scheme );
72  if (strcmp(sim[0].solver.time_scheme,_FORWARD_EULER_)) {
73  printf("(%s)",sim[0].solver.time_scheme_type );
74  }
75  printf("\n");
76  }
77 #else
78  printf(" Time integration scheme : %s ",sim[0].solver.time_scheme );
79  if (strcmp(sim[0].solver.time_scheme,_FORWARD_EULER_)) {
80  printf("(%s)",sim[0].solver.time_scheme_type );
81  }
82  printf("\n");
83 #endif
84  printf(" Spatial discretization scheme (hyperbolic) : %s\n" ,sim[0].solver.spatial_scheme_hyp );
85  printf(" Split hyperbolic flux term? : %s\n" ,sim[0].solver.SplitHyperbolicFlux );
86  printf(" Interpolation type for hyperbolic term : %s\n" ,sim[0].solver.interp_type );
87  printf(" Spatial discretization type (parabolic ) : %s\n" ,sim[0].solver.spatial_type_par );
88  printf(" Spatial discretization scheme (parabolic ) : %s\n" ,sim[0].solver.spatial_scheme_par );
89  printf(" Time Step : %E\n" ,sim[0].solver.dt );
90  printf(" Check for conservation : %s\n" ,sim[0].solver.ConservationCheck );
91  printf(" Screen output iterations : %d\n" ,sim[0].solver.screen_op_iter );
92  printf(" File output iterations : %d\n" ,sim[0].solver.file_op_iter );
93  printf(" Initial solution file type : %s\n" ,sim[0].solver.ip_file_type );
94  printf(" Initial solution read mode : %s" ,sim[0].solver.input_mode );
95  if (strcmp(sim[0].solver.input_mode,"serial")) printf(" [%d file IO rank(s)]\n",sim[0].mpi.N_IORanks );
96  else printf("\n");
97  printf(" Solution file write mode : %s" ,sim[0].solver.output_mode );
98  if (strcmp(sim[0].solver.output_mode,"serial")) printf(" [%d file IO rank(s)]\n",sim[0].mpi.N_IORanks );
99  else printf("\n");
100  printf(" Solution file format : %s\n" ,sim[0].solver.op_file_format );
101  printf(" Overwrite solution file : %s\n" ,sim[0].solver.op_overwrite );
102 #if defined(HAVE_CUDA)
103  printf(" Use GPU : %s\n" ,(sim[0].solver.use_gpu == 1)? "yes" : "no");
104  printf(" GPU device no : %d\n" ,(sim[0].solver.gpu_device_no));
105 #endif
106  printf(" Physical model : %s\n" ,sim[0].solver.model );
107  if (sim[0].solver.flag_ib) {
108  printf(" Immersed Body : %s\n" ,sim[0].solver.ib_filename );
109  }
110  }
111 
112  return 0;
113 }
Structure defining a simulation.
#define _FORWARD_EULER_
int ndims
Definition: hypar.h:26