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

Function to write out the topography. More...

#include <stdlib.h>
#include <string.h>
#include <basic.h>
#include <common.h>
#include <arrayfunctions.h>
#include <io.h>
#include <plotfuncs.h>
#include <mpivars.h>
#include <hypar.h>
#include <physicalmodels/shallowwater1d.h>

Go to the source code of this file.

Functions

int ShallowWater1DWriteTopography (void *s, void *m, double a_t)
 

Detailed Description

Function to write out the topography.

Author
Debojyoti Ghosh

Definition in file ShallowWater1DWriteTopography.c.

Function Documentation

◆ ShallowWater1DWriteTopography()

int ShallowWater1DWriteTopography ( void *  s,
void *  m,
double  a_t 
)

Write out the topography data to file

Parameters
sSolver object of type HyPar
mMPI object of type MPIVariables
a_tCurrent simulation time

Definition at line 17 of file ShallowWater1DWriteTopography.c.

20 {
21  HyPar *solver = (HyPar*) s;
22  MPIVariables *mpi = (MPIVariables*) m;
23  ShallowWater1D *params = (ShallowWater1D*) solver->physics;
25 
26  if (params->topo_flag) {
27 
28  char fname_root[_MAX_STRING_SIZE_] = "topography";
29  if (solver->nsims > 1) {
30  char index[_MAX_STRING_SIZE_];
31  GetStringFromInteger(solver->my_idx, index, (int)log10(solver->nsims)+1);
32  strcat(fname_root, "_");
33  strcat(fname_root, index);
34  strcat(fname_root, "_");
35  }
36 
37  WriteArray( solver->ndims,
38  1,
39  solver->dim_global,
40  solver->dim_local,
41  solver->ghosts,
42  solver->x,
43  params->b,
44  solver,
45  mpi,
46  fname_root );
47 
48  if (!strcmp(solver->plot_solution, "yes")) {
49  PlotArray( solver->ndims,
50  1,
51  solver->dim_global,
52  solver->dim_local,
53  solver->ghosts,
54  solver->x,
55  params->b,
56  a_t,
57  solver,mpi,
58  fname_root );
59  }
60 
61 
62  }
63 
64  return(0);
65 }
char plot_solution[_MAX_STRING_SIZE_]
Definition: hypar.h:194
Structure containing variables and parameters specific to the 1D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 1D ShallowWater equations.
int PlotArray(int, int, int *, int *, int, double *, double *, double, void *, void *, char *)
Definition: PlotArray.c:31
int nsims
Definition: hypar.h:64
double * x
Definition: hypar.h:107
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MAX_STRING_SIZE_
Definition: basic.h:14
int WriteArray(int, int, int *, int *, int, double *, double *, void *, void *, char *)
Definition: WriteArray.c:27
void GetStringFromInteger(int, char *, int)
int my_idx
Definition: hypar.h:61
int * dim_local
Definition: hypar.h:37
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
Structure of MPI-related variables.
#define _DECLARE_IERR_
Definition: basic.h:17
int * dim_global
Definition: hypar.h:33