コード例 #1
0
// Source function.
void source_fn(int n, Hermes::Tuple<scalar*> values, scalar* out)
{
  for (int i = 0; i < n; i++)
  {
    out[i] = (nu[1][0] * Sf[1][0] * values.at(0)[i] +
    nu[1][1] * Sf[1][1] * values.at(1)[i] +
    nu[1][2] * Sf[1][2] * values.at(2)[i] +
    nu[1][3] * Sf[1][3] * values.at(3)[i]);
  }
}
コード例 #2
0
ファイル: forms.cpp プロジェクト: michalkuraz/hermes
void omega_dt_fn(int n, Hermes::Tuple<scalar*> values, Hermes::Tuple<scalar*> dx, Hermes::Tuple<scalar*> dy,
                        scalar* out, scalar* outdx, scalar* outdy)
{
  for (int i = 0; i < n; i++)
  {
    scalar t1 = std::max(values.at(0)[i],0.0) - 1.0;
    scalar t2 = t1 * beta;
    scalar t3 = 1.0 + t1 * alpha;
    scalar t4 = sqr(beta) / (2.0*Le) * exp(t2 / t3);
    scalar t5 = (beta / (t3 * t3));
    out[i] = t4 * t5 * values.at(1)[i];
    outdx[i] = 0.0;
    outdy[i] = 0.0; // not important
  }
}
コード例 #3
0
ファイル: main.cpp プロジェクト: sriharifez/hermes
// Filter for entropy which uses the constants defined above.
static void calc_entropy_estimate_func(int n, Hermes::Tuple<scalar*> scalars, scalar* result)
{
  for (int i = 0; i < n; i++)
    result[i] = std::log((calc_pressure(scalars.at(0)[i], scalars.at(1)[i], scalars.at(2)[i], scalars.at(3)[i]) / P_EXT)
    / pow((scalars.at(0)[i] / RHO_EXT), KAPPA));
};