HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
hypar.h
Go to the documentation of this file.
1 
6 #ifndef _HYPAR_H_
7 #define _HYPAR_H_
8 
9 #include <basic.h>
10 
23 typedef struct main_parameters {
24 
26  int ndims;
27 
29  int nvars;
30 
33  int *dim_global;
34 
37  int *dim_local;
38 
41 
42  int npoints_local,
46  int ndof_nodes;
48  int size_x;
52  int ghosts;
53 
55  int n_iter;
56 
59 
61  int my_idx;
62 
64  int nsims;
65 
67  double dt;
68 
76 
78  char time_scheme [_MAX_STRING_SIZE_];
79 
81  char time_scheme_type [_MAX_STRING_SIZE_];
82 
84  char spatial_scheme_hyp [_MAX_STRING_SIZE_];
85 
88  char interp_type [_MAX_STRING_SIZE_];
89 
92  char SplitHyperbolicFlux [_MAX_STRING_SIZE_];
93 
96  char spatial_type_par [_MAX_STRING_SIZE_];
97 
99  char spatial_scheme_par [_MAX_STRING_SIZE_];
100 
102  int *index;
103 
107  double *x;
108 
110  double *dxinv;
111 
116  double *u;
117 
119  double *hyp;
120 
122  double *par;
123 
125  double *source;
126 
128  double *fluxC;
129 
131  double *uC;
132 
136  double *fluxI;
137 
138  double *uL,
140  *uR,
142  *fL,
144  *fR;
149  double *Deriv1,
152  *Deriv2;
159  void *boundary;
163 
166 
169 
172 
175 
177  char input_mode [_MAX_STRING_SIZE_];
178 
180  char ip_file_type [_MAX_STRING_SIZE_];
181 
183  char output_mode [_MAX_STRING_SIZE_];
184 
186  char op_file_format[_MAX_STRING_SIZE_];
187 
191  char op_overwrite [_MAX_STRING_SIZE_];
192 
194  char plot_solution[_MAX_STRING_SIZE_];
195 
201  char solnfilename_extn[_MAX_STRING_SIZE_];
203  char plotfilename_extn[_MAX_STRING_SIZE_];
204 
206  char op_fname_root[_MAX_STRING_SIZE_];
208  char aux_op_fname_root[_MAX_STRING_SIZE_];
209 
211  int (*WriteOutput) (int,int,int*,double*,double*,char*,int*);
212 
214  int (*ApplyBoundaryConditions) (void*,void*,double*,double*,double);
215 
217  int (*ApplyIBConditions) (void*,void*,double*,double);
218 
220  int (*TimeIntegrate) (void*);
221 
224  int (*InterpolateInterfacesHyp) (double*,double*,double*,double*,int,int,void*,void*,int);
225 
228  int (*NonlinearInterp) (double*,void*,void*,double,
229  int(*)(double*,double*,int,void*,double));
230 
234  int (*SetInterpLimiterVar) (double*,double*,double*,int,void*,void*);
235 
239  int (*InterpolateInterfacesPar) (double*,double*,int,void*,void*);
240 
243  int (*FirstDerivativePar) (double*,double*,int,int,void*,void*);
244 
247  int (*SecondDerivativePar) (double*,double*,int,void*,void*);
248 
250  int (*HyperbolicFunction) (double*,double*,void*,void*,double,int,
251  int(*)(double*,double*,int,void*,double),
252  int(*)(double*,double*,double*,double*,double*,
253  double*,int,void*,double));
254 
256  int (*ParabolicFunction) (double*,double*,void*,void*,double);
257 
259  int (*SourceFunction) (double*,double*,void*,void*,double);
260 
263  char model[_MAX_STRING_SIZE_];
264 
266  void *physics;
267 
269  double (*ComputeCFL) (void*,void*,double,double);
270 
272  double (*ComputeDiffNumber) (void*,void*,double,double);
273 
276  int (*FFunction) (double*,double*,int,void*,double);
280  int (*dFFunction) (double*,double*,int,void*,double);
286  int (*FdFFunction) (double*,double*,int,void*,double);
291 
295  int (*Upwind) (double*,double*,double*,double*,double*,double*,int,void*,double);
300  int (*UpwinddF) (double*,double*,double*,double*,double*,double*,int,void*,double);
307  int (*UpwindFdF) (double*,double*,double*,double*,double*,double*,int,void*,double);
308 
310  int (*GFunction) (double*,double*,int,void*,double);
311 
313  int (*HFunction) (double*,double*,int,int,void*,double);
314 
317  int (*SFunction) (double*,double*,void*,void*,double);
318 
321  int (*UFunction) (double*,double*,int,void*,void*,double);
322 
326  int (*JFunction) (double*,double*,void*,int,int,int);
327 
331  int (*KFunction) (double*,double*,void*,int,int);
332 
334  int (*PreStage) (int,double**,void*,void*,double);
336  int (*PostStage) (double*,void*,void*,double);
339  int (*PreStep) (double*,void*,void*,double);
341  int (*PostStep) (double*,void*,void*,double,int);
344  int (*PrintStep) (void*,void*,double);
347  int (*PhysicsOutput) (void*,void*,double);
348 
351  int (*PhysicsInput) (void*, void*,int,int,int*);
352 
354  int (*AveragingFunction) (double*,double*,double*,void*);
355 
357  int (*GetLeftEigenvectors) (double*,double*,void*,int);
359  int (*GetRightEigenvectors)(double*,double*,void*,int);
360 
362  void *interp;
364  void *compact;
366  void *msti;
368  void *lusolver;
369 
371  double error[3];
376  char ConservationCheck[_MAX_STRING_SIZE_];
378  double *VolumeIntegral;
388  int (*VolumeIntegralFunction) (double*,double*,void*,void*);
390  int (*BoundaryIntegralFunction) (void*,void*);
392  int (*CalculateConservationError)(void*,void*);
393 
394 #ifdef with_petsc
396  double *u0;
397  double *uref;
398  double *rhsref;
399  double *rhs;
400 #endif
401 
402 #ifdef with_librom
403  double* u_rom_predicted;
405  double rom_diff_norms[3];
407  char op_rom_fname_root[_MAX_STRING_SIZE_];
408 #endif
409 
412 
417 
418  int count_hyp,
419  count_par,
420  count_sou;
421 #ifdef with_petsc
422  int count_RHSFunction,
423  count_IFunction,
424  count_IJacobian,
426  count_IJacFunction,
427  count_RHSJacFunction;
428 #endif
429 
436  double *iblank;
437 
439  char ib_filename[_MAX_STRING_SIZE_];
441  int flag_ib;
443  void *ib;
444 
446  int (*IBFunction) (void*,void*,double*,double);
447 
448 #if defined(HAVE_CUDA)
449  int use_gpu;
452  int gpu_npoints_boundary_offset[3];
453  int gpu_npoints_boundary[3];
456  double *gpu_iblank;
457  double *gpu_x;
458  double *gpu_dxinv;
459  double *gpu_u;
463 #endif
464 
465 #ifdef with_python
466  void* py_plt_func;
468 #endif
469 
470 } HyPar;
471 
472 /* Some definitions - types of discretizations available
473  for the parabolic (2nd derivative) term */
475 #define _NC_1STAGE_ "nonconservative-1stage"
476 
477 #define _NC_2STAGE_ "nonconservative-2stage"
478 
481 #define _NC_1_5STAGE_ "nonconservative-1.5stage"
482 
483 #define _CONS_1STAGE_ "conservative-1stage"
484 
485 #endif
double * StageBoundaryBuffer
Definition: hypar.h:462
int count_RHSJacobian
Definition: hypar.h:422
int nvars
Definition: hypar.h:29
char * filename_index
Definition: hypar.h:197
void * time_integrator
Definition: hypar.h:165
void * boundary
Definition: hypar.h:159
double * par
Definition: hypar.h:122
int * dim_global_ex
Definition: hypar.h:75
int nsims
Definition: hypar.h:64
int SourceFunction(double *source, double *u, void *s, void *m, double t)
int n_iter
Definition: hypar.h:55
double * gpu_iblank
Definition: hypar.h:456
double * gpu_dxinv
Definition: hypar.h:458
double * u
Definition: hypar.h:116
void * ib
Definition: hypar.h:443
Some basic definitions and macros.
int ndof_nodes
Definition: hypar.h:46
int StageBoundaryBuffer_size
Definition: hypar.h:461
double * ConservationError
Definition: hypar.h:374
int flag_ib
Definition: hypar.h:441
double * iblank
Definition: hypar.h:436
double * x
Definition: hypar.h:107
void * py_plt_func
Definition: hypar.h:466
int size_x
Definition: hypar.h:48
int restart_iter
Definition: hypar.h:58
double * gpu_x
Definition: hypar.h:457
int use_petscTS
Definition: hypar.h:395
double * u0
Definition: hypar.h:396
int * stride_with_ghosts
Definition: hypar.h:414
double * fluxI
Definition: hypar.h:136
int HyperbolicFunction(double *hyp, double *u, void *s, void *m, double t, int LimFlag, int(*FluxFunction)(double *, double *, int, void *, double), int(*UpwindFunction)(double *, double *, double *, double *, double *, double *, int, void *, double))
int ndims
Definition: hypar.h:26
double * uC
Definition: hypar.h:131
int ndof_cells_wghosts
Definition: hypar.h:47
double * rhs
Definition: hypar.h:399
int * gpu_dim_local
Definition: hypar.h:455
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
int ApplyIBConditions(void *s, void *m, double *x, double waqt)
#define _MAX_STRING_SIZE_
Definition: basic.h:14
int * stride_without_ghosts
Definition: hypar.h:416
int CalculateConservationError(void *s, void *m)
int ApplyBoundaryConditions(void *s, void *m, double *x, double *xref, double waqt)
Applies the boundary conditions specified for each boundary zone.
int npoints_global
Definition: hypar.h:40
double * gpu_u
Definition: hypar.h:459
int * index
Definition: hypar.h:102
int index_length
Definition: hypar.h:199
void * lusolver
Definition: hypar.h:368
int count_sou
Definition: hypar.h:418
int my_idx
Definition: hypar.h:61
int flag_fdf_specified
Definition: hypar.h:290
int * dim_local
Definition: hypar.h:37
void * interp
Definition: hypar.h:362
double dt
Definition: hypar.h:67
double * rhsref
Definition: hypar.h:398
double * StageBoundaryIntegral
Definition: hypar.h:382
void * physics
Definition: hypar.h:266
double * TotalBoundaryIntegral
Definition: hypar.h:386
int gpu_device_no
Definition: hypar.h:450
int flag_nonlinearinterp
Definition: hypar.h:411
int ghosts
Definition: hypar.h:52
double * StepBoundaryIntegral
Definition: hypar.h:384
int use_gpu
Definition: hypar.h:449
void * msti
Definition: hypar.h:366
int nBoundaryZones
Definition: hypar.h:157
int npoints_local_wghosts
Definition: hypar.h:42
double * u_rom_predicted
Definition: hypar.h:403
double * uref
Definition: hypar.h:397
int * dim_global
Definition: hypar.h:33
int * isPeriodic
Definition: hypar.h:162
double * VolumeIntegral
Definition: hypar.h:378
void * py_plt_func_args
Definition: hypar.h:467
void * compact
Definition: hypar.h:364
int write_residual
Definition: hypar.h:174
double * source
Definition: hypar.h:125
int file_op_iter
Definition: hypar.h:171
double * hyp
Definition: hypar.h:119
int screen_op_iter
Definition: hypar.h:168
double * VolumeIntegralInitial
Definition: hypar.h:380
double * fluxC
Definition: hypar.h:128
double * dxinv
Definition: hypar.h:110