HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
LinearADRWriteAdvField.c
Go to the documentation of this file.
1 
5 #include <stdlib.h>
6 #include <string.h>
7 #include <basic.h>
8 #include <common.h>
9 #include <arrayfunctions.h>
10 #include <mathfunctions.h>
11 #include <io.h>
12 #include <plotfuncs.h>
13 #include <mpivars.h>
14 #include <hypar.h>
16 
18 int LinearADRWriteAdvField( void* s,
19  void* m,
20  double a_t )
21 {
22  HyPar *solver = (HyPar*) s;
23  MPIVariables *mpi = (MPIVariables*) m;
24  LinearADR *param = (LinearADR*) solver->physics;
25 
26  if (param->constant_advection == 0) {
27 
28  char fname_root[_MAX_STRING_SIZE_] = "advection_field";
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  }
35 
36  int adv_nvar = solver->ndims * solver->nvars;
37  WriteArray( solver->ndims,
38  adv_nvar,
39  solver->dim_global,
40  solver->dim_local,
41  solver->ghosts,
42  solver->x,
43  param->a,
44  solver,mpi,
45  fname_root );
46 
47  if (!strcmp(solver->plot_solution, "yes")) {
48  PlotArray( solver->ndims,
49  adv_nvar,
50  solver->dim_global,
51  solver->dim_local,
52  solver->ghosts,
53  solver->x,
54  param->a,
55  a_t,
56  solver,mpi,
57  fname_root );
58  }
59 
60  }
61 
62  return(0);
63 }
Some common functions used here and there.
char plot_solution[_MAX_STRING_SIZE_]
Definition: hypar.h:194
int constant_advection
Definition: linearadr.h:40
int nvars
Definition: hypar.h:29
MPI related function definitions.
Contains function definitions for common mathematical functions.
int PlotArray(int, int, int *, int *, int, double *, double *, double, void *, void *, char *)
Definition: PlotArray.c:31
int nsims
Definition: hypar.h:64
Some basic definitions and macros.
double * x
Definition: hypar.h:107
int ndims
Definition: hypar.h:26
Structure containing variables and parameters specific to the linear advection-diffusion-reaction mod...
Definition: linearadr.h:37
double * a
Definition: linearadr.h:50
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Function declarations for plotting functions.
#define _MAX_STRING_SIZE_
Definition: basic.h:14
Contains structure definition for hypar.
int WriteArray(int, int, int *, int *, int, double *, double *, void *, void *, char *)
Definition: WriteArray.c:27
void GetStringFromInteger(int, char *, int)
Linear Advection-Diffusion-Reaction model.
int my_idx
Definition: hypar.h:61
int * dim_local
Definition: hypar.h:37
void * physics
Definition: hypar.h:266
int LinearADRWriteAdvField(void *s, void *m, double a_t)
int ghosts
Definition: hypar.h:52
Structure of MPI-related variables.
Function declarations for file I/O functions.
Contains macros and function definitions for common array operations.
int * dim_global
Definition: hypar.h:33