Skip to content

Commit

Permalink
Merge pull request CEED#1338 from CEED/jrwrigh/sycl_sgs_dd
Browse files Browse the repository at this point in the history
fluids: Use explicit array size for `new_bounds`
  • Loading branch information
jrwrigh authored Sep 19, 2023
2 parents 0dab8ee + 0382e78 commit d23a61d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions examples/fluids/qfunctions/sgs_dd_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ CEED_QFUNCTION_HELPER void DataDrivenInference(const CeedScalar *inputs, CeedSca

CEED_QFUNCTION_HELPER void ComputeSgsDDAnisotropic(const CeedScalar grad_velo_aniso[3][3], const CeedScalar km_A_ij[6], const CeedScalar delta,
const CeedScalar viscosity, CeedScalar kmsgs_stress[6], SgsDDModelContext sgsdd_ctx) {
CeedScalar inputs[6], grad_velo_magnitude, eigenvectors[3][3], sgs_sframe_sym[6] = {0.};
const CeedScalar(*new_bounds)[2] = (const CeedScalar(*)[2]) & sgsdd_ctx->data[sgsdd_ctx->offsets.out_scaling];
CeedScalar inputs[6], grad_velo_magnitude, eigenvectors[3][3], sgs_sframe_sym[6] = {0.}, new_bounds[6][2];
// Copying new_bounds because Sycl online compiler doesn't like direct casting the pointer
CopyN(&sgsdd_ctx->data[sgsdd_ctx->offsets.out_scaling], (CeedScalar *)new_bounds, 12);

ComputeSGS_DDAnisotropicInputs(grad_velo_aniso, km_A_ij, delta, viscosity, eigenvectors, inputs, &grad_velo_magnitude);
DataDrivenInference(inputs, sgs_sframe_sym, sgsdd_ctx);
Expand Down
4 changes: 2 additions & 2 deletions examples/fluids/qfunctions/sgs_dd_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CEED_QFUNCTION_HELPER void OrientBasisWithVector(CeedScalar basis[3][3], const C
}

// @brief Denormalize outputs using min-max (de-)normalization
CEED_QFUNCTION_HELPER void DenormalizeDDOutputs(CeedScalar output[6], const CeedScalar (*new_bounds)[2], const CeedScalar old_bounds[6][2]) {
CEED_QFUNCTION_HELPER void DenormalizeDDOutputs(CeedScalar output[6], const CeedScalar new_bounds[6][2], const CeedScalar old_bounds[6][2]) {
CeedScalar bounds_ratio;
for (int i = 0; i < 6; i++) {
bounds_ratio = (new_bounds[i][1] - new_bounds[i][0]) / (old_bounds[i][1] - old_bounds[i][0]);
Expand Down Expand Up @@ -118,7 +118,7 @@ CEED_QFUNCTION_HELPER void ComputeSGS_DDAnisotropicInputs(const CeedScalar grad_
* @param[out] kmsgs_stress Physical SGS stresses in Kelvin-Mandel notation
*/
CEED_QFUNCTION_HELPER void ComputeSGS_DDAnisotropicOutputs(CeedScalar outputs[6], const CeedScalar delta, const CeedScalar eigenvectors[3][3],
const CeedScalar (*new_bounds)[2], const CeedScalar grad_velo_magnitude,
const CeedScalar new_bounds[6][2], const CeedScalar grad_velo_magnitude,
CeedScalar kmsgs_stress[6]) {
CeedScalar old_bounds[6][2] = {{0}};
for (int j = 0; j < 6; j++) old_bounds[j][1] = 1;
Expand Down

0 comments on commit d23a61d

Please sign in to comment.