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

Write out the advection field to file. More...

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

Go to the source code of this file.

Functions

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

Detailed Description

Write out the advection field to file.

Author
Debojyoti Ghosh

Definition in file LinearADRWriteAdvField.c.

Function Documentation

◆ LinearADRWriteAdvField()

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

Write out the advection field to file

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

Definition at line 18 of file LinearADRWriteAdvField.c.

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 }
char plot_solution[_MAX_STRING_SIZE_]
Definition: hypar.h:194
int constant_advection
Definition: linearadr.h:40
int nvars
Definition: hypar.h:29
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 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
#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.
int * dim_global
Definition: hypar.h:33