Read in initial solution from file, and compute grid spacing and volume integral of the initial solution
30 int n, flag, d, i, offset, ierr;
32 for (n = 0; n < nsims; n++) {
40 strcat(fname_root,
"_");
41 strcat(fname_root, index);
45 simobj[n].solver.nvars,
46 simobj[n].solver.dim_global,
47 simobj[n].solver.dim_local,
48 simobj[n].solver.ghosts,
56 fprintf(stderr,
"Error in InitialSolution() on rank %d.\n",
61 fprintf(stderr,
"Error: initial solution file not found.\n");
68 simobj[n].solver.nvars,
69 simobj[n].solver.dim_local,
70 simobj[n].solver.ghosts,
79 = 2.0 / (simobj[n].
solver.
x[i+1+offset+ghosts]-simobj[n].
solver.
x[i-1+offset+ghosts]);
88 &(simobj[n].solver.dxinv[offset]),
89 simobj[n].solver.dim_local[d],
92 simobj[n].solver.ndims );
CHECKERR(ierr);
94 fprintf(stderr,
"Error in InitialSolution() on rank %d.\n",
106 if (simobj[n].mpi.ip[d] == 0) {
108 for (i = 0; i < ghosts; i++) dxinv[i] = dxinv[ghosts];
110 if (simobj[n].mpi.ip[d] == simobj[n].mpi.iproc[d]-1) {
112 for (i = dim[d]+ghosts; i < dim[d]+2*ghosts; i++) dxinv[i] = dxinv[dim[d]+ghosts-1];
114 offset += (dim[d] + 2*ghosts);
123 fprintf(stderr,
"Error in InitialSolution() on rank %d.\n",
127 if (!simobj[n].mpi.rank) {
128 if (nsims > 1) printf(
"Volume integral of the initial solution on domain %d:\n", n);
129 else printf(
"Volume integral of the initial solution:\n");
131 printf(
"%2d: %1.16E\n",d,simobj[n].solver.VolumeIntegralInitial[d]);
135 _ArraySetValue_(simobj[n].solver.TotalBoundaryIntegral,simobj[n].solver.nvars,0);
139 #if defined(HAVE_CUDA) 140 if (simobj[0].solver.use_gpu) {
141 for (
int n = 0; n < nsims; n++) {
147 simobj[n].solver.x, simobj[n].solver.size_x*
sizeof(
double),
149 gpuMemcpy(simobj[n].solver.gpu_dxinv, simobj[n].solver.dxinv,
150 simobj[n].solver.size_x*
sizeof(
double),
153 #ifdef CUDA_VAR_ORDERDING_AOS 156 simobj[n].solver.ndof_cells_wghosts*
sizeof(
double),
159 double *h_u = (
double *) malloc(simobj[n].solver.ndof_cells_wghosts*
sizeof(
double));
160 for (
int i=0; i<npoints_local_wghosts; i++) {
161 for (
int v=0; v<nvars; v++) {
162 h_u[i+v*npoints_local_wghosts] = simobj[n].
solver.
u[i*nvars+v];
167 simobj[n].solver.ndof_cells_wghosts*
sizeof(
double),
Structure defining a simulation.
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
int MPIExchangeBoundaries1D(void *, double *, int, int, int, int)
#define _MAX_STRING_SIZE_
void GetStringFromInteger(int, char *, int)
#define _ArraySetValue_(x, size, value)
void gpuMemcpy(void *, const void *, size_t, enum gpuMemcpyKind)
int VolumeIntegral(double *, double *, void *, void *)
int ReadArray(int, int, int *, int *, int, void *, void *, double *, double *, char *, int *)
int npoints_local_wghosts