HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
TimePrintStep.c File Reference

Print to screen. More...

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <simulation_object.h>
#include <timeintegration.h>

Go to the source code of this file.

Functions

int TimePrintStep (void *ts)
 

Detailed Description

Print to screen.

Author
Debojyoti Ghosh

Definition in file TimePrintStep.c.

Function Documentation

◆ TimePrintStep()

int TimePrintStep ( void *  ts)

Print information to screen (also calls any physics-specific printing function, if defined).

Parameters
tsObject of type TimeIntegration

Definition at line 16 of file TimePrintStep.c.

17 {
18  TimeIntegration* TS = (TimeIntegration*) ts;
20  int ns, nsims = TS->nsims;
21 
22  if ((!TS->rank) && ((TS->iter+1)%sim[0].solver.screen_op_iter == 0)) {
23  if (nsims > 1) {
24  printf("--\n");
25  printf("iter=%7d, t=%1.3e\n", TS->iter+1, TS->waqt);
26  if (TS->max_cfl >= 0) printf(" CFL=%1.3E\n", TS->max_cfl);
27  if (TS->norm >= 0) printf(" norm=%1.4E\n", TS->norm);
28  printf(" wctime=%1.1E (s)\n",TS->iter_wctime);
29  } else {
30  printf("iter=%7d ",TS->iter+1 );
31  printf("t=%1.3E ",TS->waqt );
32  if (TS->max_cfl >= 0) printf("CFL=%1.3E ",TS->max_cfl );
33  if (TS->norm >= 0) printf("norm=%1.4E ",TS->norm );
34  printf("wctime: %1.1E (s) ",TS->iter_wctime);
35  }
36 
37  /* calculate and print conservation error */
38  if (!strcmp(sim[0].solver.ConservationCheck,"yes")) {
39 
40  double error = 0;
41  for (ns = 0; ns < nsims; ns++) {
42  int v;
43  for (v=0; v<sim[ns].solver.nvars; v++) {
44  error += (sim[ns].solver.ConservationError[v] * sim[ns].solver.ConservationError[v]);
45  }
46  }
47  error = sqrt(error);
48  printf(" cons_err=%1.4E\n", error);
49 
50  } else {
51 
52  if (nsims == 1) printf("\n");
53 
54  }
55 
56  /* print physics-specific info, if available */
57  for (ns = 0; ns < nsims; ns++) {
58  if (sim[ns].solver.PrintStep) {
59  if (nsims > 1) printf("Physics-specific output for domain %d:\n", ns);
60  sim[ns].solver.PrintStep( &(sim[ns].solver),
61  &(sim[ns].mpi),
62  TS->waqt );
63  }
64  }
65  if (nsims > 1) {
66  printf("--\n");
67  printf("\n");
68  }
69  }
70 
71  return(0);
72 }
int(* PrintStep)(void *, void *, double)
Definition: hypar.h:344
Structure of variables/parameters and function pointers for time integration.
int nvars
Definition: hypar.h:29
Structure defining a simulation.
double * ConservationError
Definition: hypar.h:374