19 const int*
const,
int,
void*,
void*);
23 #if defined(HAVE_CUDA)
47 int nvars = solver->
nvars;
48 int ndims = solver->
ndims;
65 in = fopen(
"weno.inp",
"r");
66 if (!in) printf(
"Warning: File weno.inp not found. Using default parameters for WENO5/CRWENO5/HCWENO5 scheme.\n");
68 if (!count) printf(
"Reading WENO parameters from weno.inp.\n");
70 ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
71 if (!strcmp(word,
"begin")){
72 while (strcmp(word,
"end")){
73 ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
74 if (!strcmp(word,
"mapped" )) { ferr = fscanf(in,
"%d" ,&weno->
mapped );
if (ferr != 1)
return(1); }
75 else if (!strcmp(word,
"borges" )) { ferr = fscanf(in,
"%d" ,&weno->
borges );
if (ferr != 1)
return(1); }
76 else if (!strcmp(word,
"yc" )) { ferr = fscanf(in,
"%d" ,&weno->
yc );
if (ferr != 1)
return(1); }
77 else if (!strcmp(word,
"no_limiting")) { ferr = fscanf(in,
"%d" ,&weno->
no_limiting);
if (ferr != 1)
return(1); }
78 else if (!strcmp(word,
"epsilon" )) { ferr = fscanf(in,
"%lf",&weno->
eps );
if (ferr != 1)
return(1); }
79 else if (!strcmp(word,
"p" )) { ferr = fscanf(in,
"%lf",&weno->
p );
if (ferr != 1)
return(1); }
80 else if (!strcmp(word,
"rc" )) { ferr = fscanf(in,
"%lf",&weno->
rc );
if (ferr != 1)
return(1); }
81 else if (!strcmp(word,
"xi" )) { ferr = fscanf(in,
"%lf",&weno->
xi );
if (ferr != 1)
return(1); }
82 else if (!strcmp(word,
"tol" )) { ferr = fscanf(in,
"%lf",&weno->
tol );
if (ferr != 1)
return(1); }
83 else if (strcmp(word,
"end")) {
85 ferr = fscanf(in,
"%s",useless);
if (ferr != 1)
return(ferr);
86 printf(
"Warning: keyword %s in file \"weno.inp\" with value %s not ",word,useless);
87 printf(
"recognized or extraneous. Ignoring.\n");
91 fprintf(stderr,
"Error: Illegal format in file \"weno.inp\".\n");
101 integer_data[0] = weno->
mapped;
102 integer_data[1] = weno->
borges;
103 integer_data[2] = weno->
yc;
105 real_data[0] = weno->
eps;
106 real_data[1] = weno->
p;
107 real_data[2] = weno->
rc;
108 real_data[3] = weno->
xi;
109 real_data[4] = weno->
tol;
114 weno->
mapped = integer_data[0];
115 weno->
borges = integer_data[1];
116 weno->
yc = integer_data[2];
118 weno->
eps = real_data [0];
119 weno->
p = real_data [1];
120 weno->
rc = real_data [2];
121 weno->
xi = real_data [3];
122 weno->
tol = real_data [4];
126 if (weno->
p != 2.0) {
127 if (!mpi->
rank && !count) printf(
"Warning from WENOInitialize(): \"p\" parameter is 2.0. Any other value will be ignored!\n");
135 weno->
offset = (
int*) calloc (ndims,
sizeof(
int));
137 for (dir=0; dir<ndims; dir++) {
139 for (d=0; d<dir; d++) {
141 for (i=0; i<ndims; i++)
143 weno->
offset[dir] += size;
148 for (d=0; d<ndims; d++) {
150 for (i=0; i<ndims; i++)
154 weno->
size = total_size;
159 #if defined(HAVE_CUDA)
165 #if defined(HAVE_CUDA)
171 double* tmp_w1 = (
double*) calloc (4*total_size,
sizeof(
double));
172 double* tmp_w2 = (
double*) calloc (4*total_size,
sizeof(
double));
173 double* tmp_w3 = (
double*) calloc (4*total_size,
sizeof(
double));
183 #if defined(HAVE_CUDA)
186 gpuMalloc((
void**)&weno->
w1, 4*total_size*
sizeof(
double));
187 gpuMalloc((
void**)&weno->
w2, 4*total_size*
sizeof(
double));
188 gpuMalloc((
void**)&weno->
w3, 4*total_size*
sizeof(
double));
196 weno->
w1 = (
double*) calloc (4*total_size,
sizeof(
double));
197 weno->
w2 = (
double*) calloc (4*total_size,
sizeof(
double));
198 weno->
w3 = (
double*) calloc (4*total_size,
sizeof(
double));
203 #if defined(HAVE_CUDA)
int gpuWENOFifthOrderCalculateWeights(double *fC, double *uC, double *x, int dir, void *s, void *m)
int WENOFifthOrderCalculateWeightsChar(double *fC, double *uC, double *x, int dir, void *s, void *m)
Definitions for the functions computing the interpolated value of the primitive at the cell interface...
int MPIBroadcast_double(double *, int, int, void *)
int WENOFifthOrderCalculateWeights(double *fC, double *uC, double *x, int dir, void *s, void *m)
void gpuMemcpy(void *, const void *, size_t, enum gpuMemcpyKind)
MPI related function definitions.
int WENOFifthOrderInitializeWeights(double *const a_w1, double *const a_w2, double *const a_w3, const int *const a_offset, int dir, void *s, void *m)
Structure of variables/parameters needed by the WENO-type scheme.
int(* SetInterpLimiterVar)(double *, double *, double *, int, void *, void *)
#define _MAX_STRING_SIZE_
int WENOInitialize(void *, void *, char *, char *)
Contains function definitions for common array operations on GPU.
#define _ArrayCopy1D_(x, y, size)
void gpuMalloc(void **, size_t)
Contains structure definition for hypar.
Contains macros and function definitions for common array operations.
Structure of MPI-related variables.
Structure containing all solver-specific variables and functions.
int MPIBroadcast_integer(int *, int, int, void *)