HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
burgers.h File Reference

Go to the source code of this file.

Data Structures

struct  Burgers
 

Macros

#define _BURGERS_   "burgers"
 

Functions

int BurgersInitialize (void *, void *)
 
int BurgersCleanup (void *)
 

Data Structure Documentation

◆ Burgers

struct Burgers

Definition at line 16 of file burgers.h.

Macro Definition Documentation

◆ _BURGERS_

#define _BURGERS_   "burgers"

Definition at line 14 of file burgers.h.

Function Documentation

◆ BurgersInitialize()

int BurgersInitialize ( void *  s,
void *  m 
)

Initialize the nonlinear Burgers physics module - allocate and set physics-related parameters, read physics-related inputs from file, and set the physics-related function pointers in HyPar

Parameters
sSolver object of type HyPar
mObject of type MPIVariables containing MPI-related info

Definition at line 25 of file BurgersInitialize.c.

28 {
29  HyPar *solver = (HyPar*) s;
30  MPIVariables *mpi = (MPIVariables*) m;
31  Burgers *physics = (Burgers*) solver->physics;
32  int i, ferr;
33 
34  static int count = 0;
35 
36  /* reading physical model specific inputs - all processes */
37  if (!mpi->rank) {
38  FILE *in;
39  in = fopen("physics.inp","r");
40  if (in) {
41  if (!count) printf("Reading physical model inputs from file \"physics.inp\".\n");
42  char word[_MAX_STRING_SIZE_];
43  ferr = fscanf(in,"%s",word); if (ferr != 1) return(1);
44  if (!strcmp(word, "begin")){
45  while (strcmp(word, "end")){
46  ferr = fscanf(in,"%s",word); if (ferr != 1) return(1);
47  if (strcmp(word,"end")) {
48  char useless[_MAX_STRING_SIZE_];
49  ferr = fscanf(in,"%s",useless); if (ferr != 1) return(ferr);
50  printf("Warning: keyword %s in file \"physics.inp\" with value %s not ",
51  word, useless);
52  printf("recognized or extraneous. Ignoring.\n");
53  }
54  }
55  } else {
56  fprintf(stderr,"Error: Illegal format in file \"physics.inp\".\n");
57  return(1);
58  }
59  }
60  fclose(in);
61  }
62 
63  if (!strcmp(solver->SplitHyperbolicFlux,"yes")) {
64  if (!mpi->rank) {
65  fprintf(stderr,"Error in BurgersInitialize: This physical model does not have a splitting ");
66  fprintf(stderr,"of the hyperbolic term defined.\n");
67  }
68  return(1);
69  }
70 
71 #ifndef serial
72 #endif
73 
74  /* initializing physical model-specific functions */
75  solver->ComputeCFL = BurgersComputeCFL;
76  solver->FFunction = BurgersAdvection;
77  solver->Upwind = BurgersUpwind;
78 
79  count++;
80  return(0);
81 }
int BurgersAdvection(double *, double *, int, void *, double)
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
Definition: hypar.h:92
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
Definition: hypar.h:295
int BurgersUpwind(double *, double *, double *, double *, double *, double *, int, void *, double)
Definition: BurgersUpwind.c:15
int(* FFunction)(double *, double *, int, void *, double)
Definition: hypar.h:276
double(* ComputeCFL)(void *, void *, double, double)
Definition: hypar.h:269
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MAX_STRING_SIZE_
Definition: basic.h:14
double BurgersComputeCFL(void *, void *, double, double)
void * physics
Definition: hypar.h:266
Structure of MPI-related variables.

◆ BurgersCleanup()

int BurgersCleanup ( void *  s)

Function to clean up all physics-related allocations for the Burgers equations

Parameters
sSolver object of type HyPar

Definition at line 10 of file BurgersCleanup.c.

11 {
12  Burgers *physics = (Burgers*) s;
13 
14  return(0);
15 }