46 for (idx=0; idx<neles; idx++) {
48 for (row=0; row<NFVARS; row++) {
49 for (col=0; col<NFVARS; col++)
54 for (jdx=0; jdx<nface; jdx++) {
55 fv = fnorm_vol[neles*jdx + idx];
56 for (row=0; row<NFVARS; row++) {
57 for (col=0; col<NFVARS; col++) {
59 += fjmat[idx+neles*jdx+nface*neles*col+NFVARS*nface*neles*row]*fv;
65 dti = 1.0/(dt[idx]*factor);
66 for (kdx=0; kdx<NFVARS; kdx++) {
67 dmat[kdx][kdx] += dti;
74 for (row=0; row<NFVARS; row++) {
75 for (col=0; col<NFVARS; col++) {
76 diag[idx+neles*col+neles*NFVARS*row] = dmat[row][col];
99 for (idx=0; idx<neles; idx++) {
101 for (row=0; row<NTURBVARS; row++) {
102 for (col=0; col<NTURBVARS; col++)
103 tmat[row][col] = 0.0;
106 for (kdx=0; kdx<NVARS; kdx++) {
107 uf[kdx] = uptsb[idx+neles*kdx];
108 dsrcf[kdx] = dsrc[idx+neles*kdx];
112 for (jdx=0; jdx<nface; jdx++) {
113 fv = fnorm_vol[neles*jdx + idx];
114 for (row=0; row<NTURBVARS; row++) {
115 for (col=0; col<NTURBVARS; col++) {
117 += tjmat[idx+neles*jdx+nface*neles*col+NTURBVARS*nface*neles*row]*fv;
124 printf(
"Error::Invalid `NTURBVARS` value\n");
127 for (kdx=0; kdx<NTURBVARS; kdx++) {
128 tmat[kdx][kdx] += 1.0/(dt[idx]*factor);
135 for (row=0; row<NTURBVARS; row++) {
136 for (col=0; col<NTURBVARS; col++) {
137 tdiag[idx+neles*col+neles*NTURBVARS*row] = tmat[row][col];
163 for (idx=0; idx<neles; idx++) {
165 for (kdx=0; kdx<NFVARS; kdx++) {
166 rhs[kdx] = rhsb[idx+kdx*neles];
169 for (row=0; row<NFVARS; row++) {
170 for (col=0; col<NFVARS; col++) {
171 dmat[row][col] = diag[idx+neles*col+neles*NFVARS*row];
176 for (jdx=0; jdx<nface; jdx++) {
177 neib = nei_ele[idx+neles*jdx];
180 fv = fnorm_vol[neles*jdx + idx];
182 for (row=0; row<NFVARS; row++) {
184 for (col=0; col<NFVARS; col++) {
185 val += fjmat[idx+neles*jdx+nface*neles*col+NFVARS*nface*neles*row] \
186 * dub[neib+neles*col];
194 lusub(NFVARS, dmat, rhs);
197 for (kdx=0; kdx<NFVARS; kdx++) {
198 dub[idx+neles*kdx] = rhs[kdx];
219 UCFD_FLOAT rhs[NTURBVARS], tmat[NTURBVARS][NTURBVARS];
222 for (idx=0; idx<neles; idx++) {
224 for (kdx=0; kdx<NTURBVARS; kdx++) {
225 rhs[kdx] = rhsb[idx+(kdx+NFVARS)*neles];
228 for (row=0; row<NTURBVARS; row++) {
229 for (col=0; col<NTURBVARS; col++) {
230 tmat[row][col] = tdiag[idx+neles*col+neles*NTURBVARS*row];
235 for (jdx=0; jdx<nface; jdx++) {
236 neib = nei_ele[idx+neles*jdx];
239 fv = fnorm_vol[idx+neles*jdx];
241 for (row=0; row<NTURBVARS; row++) {
243 for (col=0; col<NTURBVARS; col++) {
244 val += tjmat[idx+neles*jdx+nface*neles*col+NTURBVARS*nface*neles*row] \
245 * dub[neib+neles*(col+NFVARS)];
253 lusub(NTURBVARS, tmat, rhs);
256 for (kdx=0; kdx<NTURBVARS; kdx++) {
257 dub[idx+neles*(kdx+NFVARS)] = rhs[kdx];
282 for (idx=neles-1; idx>-1; idx--) {
284 for (kdx=0; kdx<NFVARS; kdx++) {
285 rhs[kdx] = rhsb[idx+kdx*neles];
288 for (row=0; row<NFVARS; row++) {
289 for (col=0; col<NFVARS; col++) {
290 dmat[row][col] = diag[idx+neles*col+neles*NFVARS*row];
295 for (jdx=0; jdx<nface; jdx++) {
296 neib = nei_ele[idx+neles*jdx];
299 fv = fnorm_vol[neles*jdx + idx];
301 for (row=0; row<NFVARS; row++) {
303 for (col=0; col<NFVARS; col++) {
304 val += fjmat[idx+neles*jdx+nface*neles*col+NFVARS*nface*neles*row] \
305 * dub[neib+neles*col];
313 lusub(NFVARS, dmat, rhs);
316 for (kdx=0; kdx<NFVARS; kdx++) {
317 dub[idx+neles*kdx] = rhs[kdx];
338 UCFD_FLOAT rhs[NTURBVARS], tmat[NTURBVARS][NTURBVARS];
341 for (idx=neles-1; idx>-1; idx--) {
344 for (kdx=0; kdx<NTURBVARS; kdx++) {
345 rhs[kdx] = rhsb[idx+(kdx+NFVARS)*neles];
348 for (row=0; row<NTURBVARS; row++) {
349 for (col=0; col<NTURBVARS; col++) {
350 tmat[row][col] = tdiag[idx+neles*col+neles*NTURBVARS*row];
355 for (jdx=0; jdx<nface; jdx++) {
356 neib = nei_ele[idx+neles*jdx];
359 fv = fnorm_vol[neles*jdx + idx];
361 for (row=0; row<NTURBVARS; row++) {
363 for (col=0; col<NTURBVARS; col++) {
364 val += tjmat[idx+neles*jdx+nface*neles*col+NTURBVARS*nface*neles*row] \
365 * dub[neib+neles*(col+NFVARS)];
373 lusub(NTURBVARS, tmat, rhs);
376 for (kdx=0; kdx<NTURBVARS; kdx++) {
377 dub[idx+neles*(kdx+NFVARS)] = rhs[kdx];
390 for (idx=0; idx<neles; idx++) {
391 for (kdx=0; kdx<NFVARS; kdx++) {
392 uptsb[idx+neles*kdx] += dub[idx+neles*kdx];
395 dub[idx+neles*kdx] = 0.0;
410 for (idx=0; idx<neles; idx++) {
411 for (kdx=0; kdx<NVARS; kdx++) {
412 uptsb[idx+neles*kdx] += dub[idx+neles*kdx];
415 dub[idx+neles*kdx] = 0.0;
void blusgs_serial_update(UCFD_INT neles, UCFD_FLOAT *uptsb, UCFD_FLOAT *dub, UCFD_FLOAT *subres)
Updates solution array.
void ns_serial_pre_blusgs(UCFD_INT neles, UCFD_INT nface, UCFD_FLOAT factor, UCFD_FLOAT *fnorm_vol, UCFD_FLOAT *dt, UCFD_FLOAT *diag, UCFD_FLOAT *fjmat)
Computes Diagonal matrix for LU-SGS method.
void ns_serial_block_lower_sweep(UCFD_INT neles, UCFD_INT nface, UCFD_INT *nei_ele, UCFD_FLOAT *fnorm_vol, UCFD_FLOAT *rhsb, UCFD_FLOAT *dub, UCFD_FLOAT *diag, UCFD_FLOAT *fjmat)
Lower sweep of Block LU-SGS method for Navier-Stokes equations.
void rans_serial_block_upper_sweep(UCFD_INT neles, UCFD_INT nface, UCFD_INT *nei_ele, UCFD_FLOAT *fnorm_vol, UCFD_FLOAT *rhsb, UCFD_FLOAT *dub, UCFD_FLOAT *tdiag, UCFD_FLOAT *tjmat)
Upper sweep of Block LU-SGS method for RANS equations.
void ns_serial_block_upper_sweep(UCFD_INT neles, UCFD_INT nface, UCFD_INT *nei_ele, UCFD_FLOAT *fnorm_vol, UCFD_FLOAT *rhsb, UCFD_FLOAT *dub, UCFD_FLOAT *diag, UCFD_FLOAT *fjmat)
Upper sweep of Block LU-SGS method for Navier-Stokes equations.
void blusgs_serial_ns_update(UCFD_INT neles, UCFD_FLOAT *uptsb, UCFD_FLOAT *dub, UCFD_FLOAT *subres)
Updates solution array.
void rans_serial_pre_blusgs(UCFD_INT neles, UCFD_INT nface, UCFD_FLOAT factor, UCFD_FLOAT *fnorm_vol, UCFD_FLOAT *uptsb, UCFD_FLOAT *dt, UCFD_FLOAT *tdiag, UCFD_FLOAT *tjmat, UCFD_FLOAT *dsrc)
Computes Diagonal matrix for Block LU-SGS method for RANS equations.
void rans_serial_block_lower_sweep(UCFD_INT neles, UCFD_INT nface, UCFD_INT *nei_ele, UCFD_FLOAT *fnorm_vol, UCFD_FLOAT *rhsb, UCFD_FLOAT *dub, UCFD_FLOAT *tdiag, UCFD_FLOAT *tjmat)
Lower sweep of Block LU-SGS method for RANS equations.
Header file for serial LU-SGS method.
ucfd_status_t rans_source_jacobian(UCFD_FLOAT *uf, UCFD_FLOAT tmat[NTURBVARS][NTURBVARS], UCFD_FLOAT *dsrc)
Computes source term Jacobian matrix for RANS equations.
Header file for numerical flux funtions.
void lusub(UCFD_FLOAT *LU, UCFD_FLOAT *b)
Forward/Backward substitution function.
void ludcmp(UCFD_FLOAT *A)
LU Decomposition function.
@ UCFD_STATUS_NOT_SUPPORTED