20 #undef _MINIMUM_GHOSTS_
25 #define _MINIMUM_GHOSTS_ 3
113 int ghosts = solver->
ghosts;
114 int ndims = solver->
ndims;
115 int nvars = solver->
nvars;
119 static const double one_third = 1.0/3.0;
120 static const double one_sixth = 1.0/6.0;
122 double *ww1, *ww2, *ww3;
123 ww1 = weno->w1 + (upw < 0 ? 2*weno->size : 0) + (uflag ? weno->size : 0) + weno->offset[dir];
124 ww2 = weno->w2 + (upw < 0 ? 2*weno->size : 0) + (uflag ? weno->size : 0) + weno->offset[dir];
125 ww3 = weno->w3 + (upw < 0 ? 2*weno->size : 0) + (uflag ? weno->size : 0) + weno->offset[dir];
129 int indexC[ndims], indexI[ndims], index_outer[ndims], bounds_outer[ndims], bounds_inter[ndims];
130 _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
131 _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
137 double R[nvars*nvars], L[nvars*nvars], uavg[nvars];
140 double *A = compact->
A;
141 double *B = compact->
B;
142 double *C = compact->
C;
143 double *F = compact->
R;
145 #pragma omp parallel for schedule(auto) default(shared) private(sys,d,v,k,R,L,uavg,index_outer,indexC,indexI)
146 for (sys=0; sys<Nsys; sys++) {
150 for (indexI[dir] = 0; indexI[dir] < dim[dir]+1; indexI[dir]++) {
151 int qm1,qm2,qm3,qp1,qp2;
153 indexC[dir] = indexI[dir]-3;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qm3);
154 indexC[dir] = indexI[dir]-2;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qm2);
155 indexC[dir] = indexI[dir]-1;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qm1);
156 indexC[dir] = indexI[dir] ;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qp1);
157 indexC[dir] = indexI[dir]+1;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qp2);
159 indexC[dir] = indexI[dir]+2;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qm3);
160 indexC[dir] = indexI[dir]+1;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qm2);
161 indexC[dir] = indexI[dir] ;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qm1);
162 indexC[dir] = indexI[dir]-1;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qp1);
163 indexC[dir] = indexI[dir]-2;
_ArrayIndex1D_(ndims,dim,indexC,ghosts,qp2);
176 for (v=0; v<nvars; v++) {
179 double fm3, fm2, fm1, fp1, fp2;
180 fm3 = fm2 = fm1 = fp1 = fp2 = 0;
181 for (k = 0; k < nvars; k++) {
182 fm3 += L[v*nvars+k] * fC[qm3*nvars+k];
183 fm2 += L[v*nvars+k] * fC[qm2*nvars+k];
184 fm1 += L[v*nvars+k] * fC[qm1*nvars+k];
185 fp1 += L[v*nvars+k] * fC[qp1*nvars+k];
186 fp2 += L[v*nvars+k] * fC[qp2*nvars+k];
191 if ( ((mpi->
ip[dir] == 0 ) && (indexI[dir] == 0 ))
192 || ((mpi->
ip[dir] == mpi->
iproc[dir]-1) && (indexI[dir] == dim[dir])) ) {
194 f1 = (2*one_sixth)*fm3 - (7.0*one_sixth)*fm2 + (11.0*one_sixth)*fm1;
195 f2 = (-one_sixth)*fm2 + (5.0*one_sixth)*fm1 + (2*one_sixth)*fp1;
196 f3 = (2*one_sixth)*fm1 + (5*one_sixth)*fp1 - (one_sixth)*fp2;
199 f1 = (one_sixth) * (fm2 + 5*fm1);
200 f2 = (one_sixth) * (5*fm1 + fp1);
201 f3 = (one_sixth) * (fm1 + 5*fp1);
206 w1 = *(ww1+p*nvars+v);
207 w2 = *(ww2+p*nvars+v);
208 w3 = *(ww3+p*nvars+v);
210 if ( ((mpi->
ip[dir] == 0 ) && (indexI[dir] == 0 ))
211 || ((mpi->
ip[dir] == mpi->
iproc[dir]-1) && (indexI[dir] == dim[dir])) ) {
212 for (k=0; k<nvars; k++) {
213 A[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = 0.0;
214 C[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = 0.0;
215 B[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = L[v*nvars+k];
219 for (k=0; k<nvars; k++) {
220 A[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = ((2*one_third)*w1 + (one_third)*w2) * L[v*nvars+k];
221 B[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = ((one_third)*w1 + (2*one_third)*(w2+w3)) * L[v*nvars+k];
222 C[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = ((one_third)*w3) * L[v*nvars+k];
225 for (k=0; k<nvars; k++) {
226 C[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = ((2*one_third)*w1 + (one_third)*w2) * L[v*nvars+k];
227 B[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = ((one_third)*w1 + (2*one_third)*(w2+w3)) * L[v*nvars+k];
228 A[(Nsys*indexI[dir]+sys)*nvars*nvars+v*nvars+k] = ((one_third)*w3) * L[v*nvars+k];
232 F[(Nsys*indexI[dir]+sys)*nvars+v] = w1*f1 + w2*f2 + w3*f3;
246 if (mpi->
ip[dir] != mpi->
iproc[dir]-1) {
253 double *sendbuf = compact->
sendbuf;
254 double *recvbuf = compact->
recvbuf;
255 MPI_Request req[2] = {MPI_REQUEST_NULL,MPI_REQUEST_NULL};
256 if (mpi->
ip[dir])
for (d=0; d<Nsys*nvars; d++) sendbuf[d] = F[d];
257 if (mpi->
ip[dir] != mpi->
iproc[dir]-1) MPI_Irecv(recvbuf,Nsys*nvars,MPI_DOUBLE,mpi->
ip[dir]+1,214,mpi->
comm[dir],&req[0]);
258 if (mpi->
ip[dir]) MPI_Isend(sendbuf,Nsys*nvars,MPI_DOUBLE,mpi->
ip[dir]-1,214,mpi->
comm[dir],&req[1]);
259 MPI_Status status_arr[2];
260 MPI_Waitall(2,&req[0],status_arr);
261 if (mpi->
ip[dir] != mpi->
iproc[dir]-1)
for (d=0; d<Nsys*nvars; d++) F[d+Nsys*nvars*dim[dir]] = recvbuf[d];
266 #pragma omp parallel for schedule(auto) default(shared) private(sys,d,v,k,R,L,uavg,index_outer,indexC,indexI)
267 for (sys=0; sys<Nsys; sys++) {
270 for (indexI[dir] = 0; indexI[dir] < dim[dir]+1; indexI[dir]++) {
272 _ArrayCopy1D_((F+sys*nvars+Nsys*nvars*indexI[dir]),(fI+nvars*p),nvars);
Header file for TridiagLU.
Definitions for the functions computing the interpolated value of the primitive at the cell interface...
#define _ArrayIndexnD_(N, index, imax, i, ghost)
int(* GetRightEigenvectors)(double *, double *, void *, int)
MPI related function definitions.
int blocktridiagLU(double *, double *, double *, double *, int, int, int, void *, void *)
Structure of variables/parameters needed by the WENO-type scheme.
Structure of variables/parameters needed by the compact schemes.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int(* AveragingFunction)(double *, double *, double *, void *)
Contains function definitions for common mathematical functions.
int(* GetLeftEigenvectors)(double *, double *, void *, int)
#define _ArrayCopy1D_(x, y, size)
Contains structure definition for hypar.
int Interp1PrimFifthOrderCRWENOChar(double *, double *, double *, double *, int, int, void *, void *, int)
5th order CRWENO reconstruction (characteristic-based) on a uniform grid
Some basic definitions and macros.
Contains macros and function definitions for common array operations.
#define _ArrayProduct1D_(x, size, p)
Structure of MPI-related variables.
Structure containing all solver-specific variables and functions.
Contains macros and function definitions for common matrix multiplication.