• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OPS_ACC2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中OPS_ACC2函数的典型用法代码示例。如果您正苦于以下问题:C++ OPS_ACC2函数的具体用法?C++ OPS_ACC2怎么用?C++ OPS_ACC2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了OPS_ACC2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: drhouupdx_kernel

// user function
inline void drhouupdx_kernel(const double *rhou_new, const double *rho_new,
                             const double *rhoE_new, double *rhou_res) {

  double fni =
      rhou_new[OPS_ACC0(0)] * rhou_new[OPS_ACC0(0)] / rho_new[OPS_ACC1(0)];
  double p = gam1 * (rhoE_new[OPS_ACC2(0)] - 0.5 * fni);
  fni = fni + p;
  double fnim1 =
      rhou_new[OPS_ACC0(-1)] * rhou_new[OPS_ACC0(-1)] / rho_new[OPS_ACC1(-1)];
  p = gam1 * (rhoE_new[OPS_ACC2(-1)] - 0.5 * fnim1);
  fnim1 = fnim1 + p;
  double fnim2 =
      rhou_new[OPS_ACC0(-2)] * rhou_new[OPS_ACC0(-2)] / rho_new[OPS_ACC1(-2)];
  p = gam1 * (rhoE_new[OPS_ACC2(-2)] - 0.5 * fnim2);
  fnim2 = fnim2 + p;
  double fnip1 =
      rhou_new[OPS_ACC0(1)] * rhou_new[OPS_ACC0(1)] / rho_new[OPS_ACC1(1)];
  p = gam1 * (rhoE_new[OPS_ACC2(1)] - 0.5 * fnip1);
  fnip1 = fnip1 + p;
  double fnip2 =
      rhou_new[OPS_ACC0(2)] * rhou_new[OPS_ACC0(2)] / rho_new[OPS_ACC1(2)];
  p = gam1 * (rhoE_new[OPS_ACC2(2)] - 0.5 * fnip2);
  fnip2 = fnip2 + p;

  double deriv = (fnim2 - fnip2 + 8.0 * (fnip1 - fnim1)) / (12.00 * dx);
  rhou_res[OPS_ACC3(0)] = deriv;
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:28,代码来源:drhouupdx_kernel_openacc_kernel_c.c


示例2: advec_cell_kernel2_zdir

inline void advec_cell_kernel2_zdir( double *pre_vol, double *post_vol, const double *volume,
                        const double *vol_flux_z) {

  pre_vol[OPS_ACC0(0,0,0)] = volume[OPS_ACC2(0,0,0)] + vol_flux_z[OPS_ACC3(0,0,1)] - vol_flux_z[OPS_ACC3(0,0,0)];
  post_vol[OPS_ACC1(0,0,0)] = volume[OPS_ACC2(0,0,0)];

}
开发者ID:satyajammy,项目名称:OPS,代码行数:7,代码来源:advec_cell_kernel2_zdir_openacc_kernel_c.c


示例3: flux_calc_kernelx

// user function
inline void flux_calc_kernelx(double *vol_flux_x, const double *xarea,
                              const double *xvel0, const double *xvel1) {

  vol_flux_x[OPS_ACC0(0, 0)] =
      0.25 * dt * (xarea[OPS_ACC1(0, 0)]) *
      ((xvel0[OPS_ACC2(0, 0)]) + (xvel0[OPS_ACC2(0, 1)]) +
       (xvel1[OPS_ACC3(0, 0)]) + (xvel1[OPS_ACC3(0, 1)]));
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:9,代码来源:flux_calc_kernelx_seq_kernel.cpp


示例4: flux_calc_kernelz

//user function
inline 
void flux_calc_kernelz( double *vol_flux_z, const double *zarea,
                        const double *zvel0, const double *zvel1) {

  vol_flux_z[OPS_ACC0(0,0,0)] = 0.125 * dt * (zarea[OPS_ACC1(0,0,0)]) *
  ( zvel0[OPS_ACC2(0,0,0)] + zvel0[OPS_ACC2(1,0,0)] + zvel0[OPS_ACC2(1,0,0)] + zvel0[OPS_ACC2(1,1,0)] +
    zvel1[OPS_ACC3(0,0,0)] + zvel1[OPS_ACC3(1,0,0)] + zvel1[OPS_ACC3(0,1,0)] + zvel1[OPS_ACC3(1,1,0)]);
}
开发者ID:satyajammy,项目名称:OPS,代码行数:9,代码来源:flux_calc_kernelz_openacc_kernel_c.c


示例5: tea_leaf_common_init_diag_init_kernel

// user function
inline void tea_leaf_common_init_diag_init_kernel(double *Mi, const double *Kx,
                                                  const double *Ky,
                                                  const double *rx,
                                                  const double *ry) {
  Mi[OPS_ACC0(0, 0)] =
      1.0 / (1.0 + (*ry) * (Ky[OPS_ACC2(0, 1)] + Ky[OPS_ACC2(0, 0)]) +
             (*rx) * (Kx[OPS_ACC1(1, 0)] + Kx[OPS_ACC1(0, 0)]));
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:9,代码来源:tea_leaf_common_init_diag_init_kernel_openacc_kernel_c.c


示例6: calc_dt_kernel

// user function
inline void calc_dt_kernel(const double *celldx, const double *celldy,
                           const double *soundspeed, const double *viscosity,
                           const double *density0, const double *xvel0,
                           const double *xarea, const double *volume,
                           const double *yvel0, const double *yarea,
                           double *dt_min, const double *celldz,
                           const double *zvel0, const double *zarea) {

  double div, ds, dtut, dtvt, dtct, dtwt, dtdivt, cc, dv1, dv2, du1, du2, dw1,
      dw2;

  ds = MIN(MIN(celldx[OPS_ACC0(0, 0, 0)], celldy[OPS_ACC1(0, 0, 0)]),
           celldz[OPS_ACC11(0, 0, 0)]);
  ds = 1.0 / (ds * ds);

  cc = soundspeed[OPS_ACC2(0, 0, 0)] * soundspeed[OPS_ACC2(0, 0, 0)];
  cc = cc + 2.0 * viscosity[OPS_ACC3(0, 0, 0)] / density0[OPS_ACC4(0, 0, 0)];

  dtct = ds * cc;
  dtct = dtc_safe * 1.0 / MAX(sqrt(dtct), g_small);

  du1 = (xvel0[OPS_ACC5(0, 0, 0)] + xvel0[OPS_ACC5(0, 1, 0)] +
         xvel0[OPS_ACC5(0, 0, 1)] + xvel0[OPS_ACC5(0, 1, 1)]) *
        xarea[OPS_ACC6(0, 0, 0)];
  du2 = (xvel0[OPS_ACC5(1, 0, 0)] + xvel0[OPS_ACC5(1, 1, 0)] +
         xvel0[OPS_ACC5(1, 0, 1)] + xvel0[OPS_ACC5(1, 1, 1)]) *
        xarea[OPS_ACC6(0, 0, 0)];

  dtut = dtu_safe * 4.0 * volume[OPS_ACC7(0, 0, 0)] /
         MAX(MAX(fabs(du1), fabs(du2)), 1.0e-5 * volume[OPS_ACC7(0, 0, 0)]);

  dv1 = (yvel0[OPS_ACC8(0, 0, 0)] + yvel0[OPS_ACC8(1, 0, 0)] +
         yvel0[OPS_ACC8(0, 0, 1)] + yvel0[OPS_ACC8(1, 0, 1)]) *
        yarea[OPS_ACC9(0, 0, 0)];
  dv2 = (yvel0[OPS_ACC8(0, 1, 0)] + yvel0[OPS_ACC8(1, 1, 0)] +
         yvel0[OPS_ACC8(0, 1, 1)] + yvel0[OPS_ACC8(1, 1, 1)]) *
        yarea[OPS_ACC9(0, 0, 0)];

  dtvt = dtv_safe * 4.0 * volume[OPS_ACC7(0, 0, 0)] /
         MAX(MAX(fabs(dv1), fabs(dv2)), 1.0e-5 * volume[OPS_ACC7(0, 0, 0)]);

  dw1 = (zvel0[OPS_ACC12(0, 0, 0)] + zvel0[OPS_ACC12(0, 1, 0)] +
         zvel0[OPS_ACC12(1, 0, 0)] + zvel0[OPS_ACC12(1, 1, 0)]) *
        zarea[OPS_ACC13(0, 0, 0)];
  dw2 = (zvel0[OPS_ACC12(0, 0, 1)] + zvel0[OPS_ACC12(0, 1, 1)] +
         zvel0[OPS_ACC12(1, 0, 1)] + zvel0[OPS_ACC12(1, 1, 1)]) *
        zarea[OPS_ACC13(0, 0, 0)];

  dtwt = dtw_safe * 4.0 * volume[OPS_ACC7(0, 0, 0)] /
         MAX(MAX(fabs(dw1), fabs(dw2)), 1.0e-5 * volume[OPS_ACC7(0, 0, 0)]);

  div = du2 - du1 + dv2 - dv1 + dw2 - dw1;
  dtdivt = dtdiv_safe * 4.0 * (volume[OPS_ACC7(0, 0, 0)]) /
           MAX(volume[OPS_ACC7(0, 0, 0)] * 1.0e-05, fabs(div));

  dt_min[OPS_ACC10(0, 0, 0)] =
      MIN(MIN(MIN(dtct, dtut), MIN(dtvt, dtdivt)), dtwt);
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:59,代码来源:calc_dt_kernel_seq_kernel.cpp


示例7: flux_calc_kernely

// user function
inline void flux_calc_kernely(double *vol_flux_y, const double *yarea,
                              const double *yvel0, const double *yvel1) {

  vol_flux_y[OPS_ACC0(0, 0, 0)] =
      0.125 * dt * (yarea[OPS_ACC1(0, 0, 0)]) *
      (yvel0[OPS_ACC2(0, 0, 0)] + yvel0[OPS_ACC2(1, 0, 0)] +
       yvel0[OPS_ACC2(0, 0, 1)] + yvel0[OPS_ACC2(1, 0, 1)] +
       yvel1[OPS_ACC3(0, 0, 0)] + yvel1[OPS_ACC3(1, 0, 0)] +
       yvel1[OPS_ACC3(0, 0, 1)] + yvel1[OPS_ACC3(1, 0, 1)]);
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:11,代码来源:flux_calc_kernely_omp_kernel.cpp


示例8: calvar_kernel

// user function
inline void calvar_kernel(const double *rho_new, const double *rhou_new,
                          const double *rhoE_new, double *workarray2,
                          double *workarray3) {
  double p, rhoi, u;
  rhoi = 1 / rho_new[OPS_ACC0(0)];
  u = rhou_new[OPS_ACC1(0)] * rhoi;
  p = gam1 * (rhoE_new[OPS_ACC2(0)] - 0.5 * rho_new[OPS_ACC0(0)] * u * u);

  workarray2[OPS_ACC3(0)] = p + rhou_new[OPS_ACC1(0)] * u;
  workarray3[OPS_ACC4(0)] = (p + rhoE_new[OPS_ACC2(0)]) * u;
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:12,代码来源:calvar_kernel_openacc_kernel_c.c


示例9: advec_mom_kernel_post_pre_advec_y

inline void advec_mom_kernel_post_pre_advec_y( double *node_mass_post, const double *post_vol,
                                  const double *density1, double *node_mass_pre, const double *node_flux) {



  node_mass_post[OPS_ACC0(0,0)] = 0.25 * ( density1[OPS_ACC2(0,-1)] * post_vol[OPS_ACC1(0,-1)] +
                              density1[OPS_ACC2(0,0)]   * post_vol[OPS_ACC1(0,0)]   +
                              density1[OPS_ACC2(-1,-1)] * post_vol[OPS_ACC1(-1,-1)] +
                              density1[OPS_ACC2(-1,0)]  * post_vol[OPS_ACC1(-1,0)]  );

  node_mass_pre[OPS_ACC3(0,0)] = node_mass_post[OPS_ACC0(0,0)] - node_flux[OPS_ACC4(0,-1)] + node_flux[OPS_ACC4(0,0)];

}
开发者ID:satyajammy,项目名称:OPS,代码行数:13,代码来源:advec_mom_kernel_post_pre_advec_y_openacc_kernel_c.c


示例10: update_halo_kernel1_fr2

inline void update_halo_kernel1_fr2(double *density0, double *density1,
                          double *energy0, double *energy1,
                          double *pressure, double *viscosity,
                          double *soundspeed , const int* fields) {
  if(fields[FIELD_DENSITY0] == 1) density0[OPS_ACC0(0,0,0)] = density0[OPS_ACC0(0,0,-3)];
  if(fields[FIELD_DENSITY1] == 1) density1[OPS_ACC1(0,0,0)] = density1[OPS_ACC1(0,0,-3)];
  if(fields[FIELD_ENERGY0] == 1) energy0[OPS_ACC2(0,0,0)] = energy0[OPS_ACC2(0,0,-3)];
  if(fields[FIELD_ENERGY1] == 1) energy1[OPS_ACC3(0,0,0)] = energy1[OPS_ACC3(0,0,-3)];
  if(fields[FIELD_PRESSURE] == 1) pressure[OPS_ACC4(0,0,0)] = pressure[OPS_ACC4(0,0,-3)];
  if(fields[FIELD_VISCOSITY] == 1) viscosity[OPS_ACC5(0,0,0)] = viscosity[OPS_ACC5(0,0,-3)];
  if(fields[FIELD_SOUNDSPEED] == 1) soundspeed[OPS_ACC6(0,0,0)] = soundspeed[OPS_ACC6(0,0,-3)];

}
开发者ID:satyajammy,项目名称:OPS,代码行数:13,代码来源:update_halo_kernel1_fr2_omp_kernel.cpp


示例11: tea_leaf_cg_calc_w_reduce_kernel

// user function
inline void tea_leaf_cg_calc_w_reduce_kernel(double *w, const double *Kx,
                                             const double *Ky, const double *p,
                                             const double *rx, const double *ry,
                                             double *pw) {
  w[OPS_ACC0(0, 0)] = (1.0 + (*ry) * (Ky[OPS_ACC2(0, 1)] + Ky[OPS_ACC2(0, 0)]) +
                       (*rx) * (Kx[OPS_ACC1(1, 0)] + Kx[OPS_ACC1(0, 0)])) *
                          p[OPS_ACC3(0, 0)] -
                      (*ry) * (Ky[OPS_ACC2(0, 1)] * p[OPS_ACC3(0, 1)] +
                               Ky[OPS_ACC2(0, 0)] * p[OPS_ACC3(0, -1)]) -
                      (*rx) * (Kx[OPS_ACC1(1, 0)] * p[OPS_ACC3(1, 0)] +
                               Kx[OPS_ACC1(0, 0)] * p[OPS_ACC3(-1, 0)]);
  *pw = *pw + w[OPS_ACC0(0, 0)] * p[OPS_ACC3(0, 0)];
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:14,代码来源:tea_leaf_cg_calc_w_reduce_kernel_seq_kernel.cpp


示例12: tea_leaf_common_init_Kx_Ky_kernel

// user function
inline void tea_leaf_common_init_Kx_Ky_kernel(double *Kx, double *Ky,
                                              const double *w) {
  Kx[OPS_ACC0(0, 0)] = (w[OPS_ACC2(-1, 0)] + w[OPS_ACC2(0, 0)]) /
                       (2.0 * w[OPS_ACC2(-1, 0)] * w[OPS_ACC2(0, 0)]);
  Ky[OPS_ACC1(0, 0)] = (w[OPS_ACC2(0, -1)] + w[OPS_ACC2(0, 0)]) /
                       (2.0 * w[OPS_ACC2(0, -1)] * w[OPS_ACC2(0, 0)]);
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:8,代码来源:tea_leaf_common_init_Kx_Ky_kernel_seq_kernel.cpp


示例13: calc_dt_kernel_print

// user function
inline void calc_dt_kernel_print(const double *xvel0, const double *yvel0,
                                 const double *zvel0, const double *density0,
                                 const double *energy0, const double *pressure,
                                 const double *soundspeed, double *output) {
  output[0] = xvel0[OPS_ACC0(0, 0, 0)];
  output[1] = yvel0[OPS_ACC1(0, 0, 0)];
  output[2] = zvel0[OPS_ACC2(0, 0, 0)];
  output[3] = xvel0[OPS_ACC0(1, 0, 0)];
  output[4] = yvel0[OPS_ACC1(1, 0, 0)];
  output[5] = zvel0[OPS_ACC2(0, 0, 0)];
  output[6] = xvel0[OPS_ACC0(1, 1, 0)];
  output[7] = yvel0[OPS_ACC1(1, 1, 0)];
  output[8] = zvel0[OPS_ACC2(0, 0, 0)];
  output[9] = xvel0[OPS_ACC0(0, 1, 0)];
  output[10] = yvel0[OPS_ACC1(0, 1, 0)];
  output[11] = zvel0[OPS_ACC2(0, 0, 0)];
  output[12] = xvel0[OPS_ACC0(0, 0, 1)];
  output[13] = yvel0[OPS_ACC1(0, 0, 1)];
  output[14] = zvel0[OPS_ACC2(0, 0, 1)];
  output[15] = xvel0[OPS_ACC0(1, 0, 1)];
  output[16] = yvel0[OPS_ACC1(1, 0, 1)];
  output[17] = zvel0[OPS_ACC2(0, 0, 1)];
  output[18] = xvel0[OPS_ACC0(1, 1, 1)];
  output[19] = yvel0[OPS_ACC1(1, 1, 1)];
  output[20] = zvel0[OPS_ACC2(0, 0, 1)];
  output[21] = xvel0[OPS_ACC0(0, 1, 1)];
  output[22] = yvel0[OPS_ACC1(0, 1, 1)];
  output[23] = zvel0[OPS_ACC2(0, 0, 1)];
  output[24] = density0[OPS_ACC3(0, 0, 0)];
  output[25] = energy0[OPS_ACC4(0, 0, 0)];
  output[26] = pressure[OPS_ACC5(0, 0, 0)];
  output[27] = soundspeed[OPS_ACC6(0, 0, 0)];
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:34,代码来源:calc_dt_kernel_print_openacc_kernel_c.c


示例14: update_halo_kernel1_r2

inline void update_halo_kernel1_r2(double *density0, double *energy0,
                                   double *energy1, double *u, double *p,
                                   double *sd, const int *fields) {
  if (fields[FIELD_DENSITY] == 1)
    density0[OPS_ACC0(0, 0)] = density0[OPS_ACC0(-3, 0)];
  if (fields[FIELD_ENERGY0] == 1)
    energy0[OPS_ACC1(0, 0)] = energy0[OPS_ACC1(-3, 0)];
  if (fields[FIELD_ENERGY1] == 1)
    energy1[OPS_ACC2(0, 0)] = energy1[OPS_ACC2(-3, 0)];
  if (fields[FIELD_U] == 1)
    u[OPS_ACC3(0, 0)] = u[OPS_ACC3(-3, 0)];
  if (fields[FIELD_P] == 1)
    p[OPS_ACC4(0, 0)] = p[OPS_ACC4(-3, 0)];
  if (fields[FIELD_SD] == 1)
    sd[OPS_ACC5(0, 0)] = sd[OPS_ACC5(-3, 0)];
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:16,代码来源:update_halo_kernel1_r2_omp_kernel.cpp


示例15: preproc_kernel

//user function
inline void preproc_kernel(const double *u, double *du,
double *ax, double *bx, double *cx, double *ay, double *by, double *cy,
double *az, double *bz, double *cz, int *idx){

  double a, b, c, d;

  if(idx[0]==0 || idx[0]==nx-1 || idx[1]==0 || idx[1]==ny-1 || idx[2]==0 || idx[2]==nz-1) {
    d = 0.0f;
    a = 0.0f;
    b = 1.0f;
    c = 0.0f;
  } else {
    d = lambda*( u[OPS_ACC0(-1,0,0)] + u[OPS_ACC0(1,0,0)]
               + u[OPS_ACC0(0,-1,0)] + u[OPS_ACC0(0,1,0)]
               + u[OPS_ACC0(0,0,-1)] + u[OPS_ACC0(0,0,1)]
               - 6.0f*u[OPS_ACC0(0,0,0)]);
    a = -0.5f * lambda;
    b =  1.0f + lambda;
    c = -0.5f * lambda;

  }

  du[OPS_ACC1(0,0,0)] = d;
  ax[OPS_ACC2(0,0,0)] = a;
  bx[OPS_ACC3(0,0,0)] = b;
  cx[OPS_ACC4(0,0,0)] = c;
  ay[OPS_ACC5(0,0,0)] = a;
  by[OPS_ACC6(0,0,0)] = b;
  cy[OPS_ACC7(0,0,0)] = c;
  az[OPS_ACC8(0,0,0)] = a;
  bz[OPS_ACC9(0,0,0)] = b;
  cz[OPS_ACC10(0,0,0)] = c;
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:34,代码来源:preproc_kernel_seq_kernel.cpp


示例16: save_kernel

// user function
inline void save_kernel(double *rho_old, double *rhou_old, double *rhoE_old,
                        const double *rho_new, const double *rhou_new,
                        const double *rhoE_new) {
  rho_old[OPS_ACC0(0)] = rho_new[OPS_ACC3(0)];
  rhou_old[OPS_ACC1(0)] = rhou_new[OPS_ACC4(0)];
  rhoE_old[OPS_ACC2(0)] = rhoE_new[OPS_ACC5(0)];
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:8,代码来源:save_kernel_seq_kernel.cpp


示例17: field_summary_kernel

// user function
inline void field_summary_kernel(const double *volume, const double *density0,
                                 const double *energy0, const double *pressure,
                                 const double *xvel0, const double *yvel0,
                                 double *vol, double *mass, double *ie,
                                 double *ke, double *press) {

  double vsqrd, cell_vol, cell_mass;

  vsqrd = 0.0;
  vsqrd = vsqrd +
          0.25 * (xvel0[OPS_ACC4(0, 0)] * xvel0[OPS_ACC4(0, 0)] +
                  yvel0[OPS_ACC5(0, 0)] * yvel0[OPS_ACC5(0, 0)]);
  vsqrd = vsqrd +
          0.25 * (xvel0[OPS_ACC4(1, 0)] * xvel0[OPS_ACC4(1, 0)] +
                  yvel0[OPS_ACC5(1, 0)] * yvel0[OPS_ACC5(1, 0)]);
  vsqrd = vsqrd +
          0.25 * (xvel0[OPS_ACC4(0, 1)] * xvel0[OPS_ACC4(0, 1)] +
                  yvel0[OPS_ACC5(0, 1)] * yvel0[OPS_ACC5(0, 1)]);
  vsqrd = vsqrd +
          0.25 * (xvel0[OPS_ACC4(1, 1)] * xvel0[OPS_ACC4(1, 1)] +
                  yvel0[OPS_ACC5(1, 1)] * yvel0[OPS_ACC5(1, 1)]);

  cell_vol = volume[OPS_ACC0(0, 0)];
  cell_mass = cell_vol * density0[OPS_ACC1(0, 0)];
  *vol = *vol + cell_vol;
  *mass = *mass + cell_mass;
  *ie = *ie + cell_mass * energy0[OPS_ACC2(0, 0)];
  *ke = *ke + cell_mass * 0.5 * vsqrd;
  *press = *press + cell_vol * pressure[OPS_ACC3(0, 0)];
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:31,代码来源:field_summary_kernel_omp_kernel.cpp


示例18: ideal_gas_kernel

// user function
inline void ideal_gas_kernel(const double *density, const double *energy,
                             double *pressure, double *soundspeed) {

  double sound_speed_squared, v, pressurebyenergy, pressurebyvolume;

  v = 1.0 / density[OPS_ACC0(0, 0, 0)];
  pressure[OPS_ACC2(0, 0, 0)] =
      (1.4 - 1.0) * density[OPS_ACC0(0, 0, 0)] * energy[OPS_ACC1(0, 0, 0)];

  pressurebyenergy = (1.4 - 1.0) * density[OPS_ACC0(0, 0, 0)];
  pressurebyvolume =
      -1.0 * density[OPS_ACC0(0, 0, 0)] * pressure[OPS_ACC2(0, 0, 0)];
  sound_speed_squared =
      v * v *
      (pressure[OPS_ACC2(0, 0, 0)] * pressurebyenergy - pressurebyvolume);
  soundspeed[OPS_ACC3(0, 0, 0)] = sqrt(sound_speed_squared);
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:18,代码来源:ideal_gas_kernel_omp_kernel.cpp


示例19: calc_dt_kernel

// user function
inline void calc_dt_kernel(const double *celldx, const double *celldy,
                           const double *soundspeed, const double *viscosity,
                           const double *density0, const double *xvel0,
                           const double *xarea, const double *volume,
                           const double *yvel0, const double *yarea,
                           double *dt_min) {

  double div, dsx, dsy, dtut, dtvt, dtct, dtdivt, cc, dv1, dv2;

  dsx = celldx[OPS_ACC0(0, 0)];
  dsy = celldy[OPS_ACC1(0, 0)];

  cc = soundspeed[OPS_ACC2(0, 0)] * soundspeed[OPS_ACC2(0, 0)];
  cc = cc + 2.0 * viscosity[OPS_ACC3(0, 0)] / density0[OPS_ACC4(0, 0)];
  cc = MAX(sqrt(cc), g_small);

  dtct = dtc_safe * MIN(dsx, dsy) / cc;

  div = 0.0;

  dv1 = (xvel0[OPS_ACC5(0, 0)] + xvel0[OPS_ACC5(0, 1)]) * xarea[OPS_ACC6(0, 0)];
  dv2 = (xvel0[OPS_ACC5(1, 0)] + xvel0[OPS_ACC5(1, 1)]) * xarea[OPS_ACC6(1, 0)];

  div = div + dv2 - dv1;

  dtut = dtu_safe * 2.0 * volume[OPS_ACC7(0, 0)] /
         MAX(MAX(fabs(dv1), fabs(dv2)), g_small * volume[OPS_ACC7(0, 0)]);

  dv1 = (yvel0[OPS_ACC8(0, 0)] + yvel0[OPS_ACC8(1, 0)]) * yarea[OPS_ACC9(0, 0)];
  dv2 = (yvel0[OPS_ACC8(0, 1)] + yvel0[OPS_ACC8(1, 1)]) * yarea[OPS_ACC9(0, 1)];

  div = div + dv2 - dv1;

  dtvt = dtv_safe * 2.0 * volume[OPS_ACC7(0, 0)] /
         MAX(MAX(fabs(dv1), fabs(dv2)), g_small * volume[OPS_ACC7(0, 0)]);

  div = div / (2.0 * volume[OPS_ACC7(0, 0)]);

  if (div < -g_small)
    dtdivt = dtdiv_safe * (-1.0 / div);
  else
    dtdivt = g_big;

  dt_min[OPS_ACC10(0, 0)] = MIN(MIN(dtct, dtut), MIN(dtvt, dtdivt));
}
开发者ID:gihanmudalige,项目名称:OPS,代码行数:46,代码来源:calc_dt_kernel_openacc_kernel_c.c


示例20: advec_mom_kernel_x1

inline void advec_mom_kernel_x1( double *pre_vol, double *post_vol,
                          const double *volume,
                          const double *vol_flux_x, const double *vol_flux_y, const double *vol_flux_z) {

  post_vol[OPS_ACC1(0,0,0)] = volume[OPS_ACC2(0,0,0)] + vol_flux_y[OPS_ACC4(0,1,0)] -  vol_flux_y[OPS_ACC4(0,0,0)]
                                                      + vol_flux_z[OPS_ACC5(0,0,1)] -  vol_flux_z[OPS_ACC5(0,0,0)];
  pre_vol[OPS_ACC0(0,0,0)] = post_vol[OPS_ACC1(0,0,0)] + vol_flux_x[OPS_ACC3(1,0,0)] - vol_flux_x[OPS_ACC3(0,0,0)];

}
开发者ID:satyajammy,项目名称:OPS,代码行数:9,代码来源:advec_mom_kernel_x1_openacc_kernel_c.c



注:本文中的OPS_ACC2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OPS_ACC3函数代码示例发布时间:2022-05-30
下一篇:
C++ OPS_ACC0函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap