Clarification on opSEM usage #678
-
|
Dear all, I am relatively new to NekRS and have been studying the examples in the Here are my understanding:
But I am still confused about the following code snippets. const auto enstrophy = [&] () {
const dfloat scale = 0.5 / mesh->volume;
auto o_curlU = opSEM::strongCurl(mesh, nrs->fieldOffset, nrs->fluid->o_U);
static poolDeviceMemory<dfloat> o_invJw;
if (!o_invJw.isInitialized()) {
o_invJw.resize(mesh->Nlocal);
platform->linAlg->adyz(mesh->Nlocal, 1.0, mesh->o_Jw, o_invJw);
}
platform->linAlg->axmyMany(mesh->Nlocal, mesh->dim, nrs->fieldOffset, 0, 1.0, o_invJw, o_curlU);
poolDeviceMemory<dfloat> o_magCurlU(nrs->fieldOffset);
platform->linAlg->magSqrVector(mesh->Nlocal, nrs->fieldOffset, o_curlU, o_magCurlU);
return scale * platform->linAlg->innerProd(mesh->Nlocal,
o_magCurlU,
mesh->o_Jw,
platform->comm.mpiComm(),
0);
}();I am confused about the usage of I noticed a somewhat related pattern in the HIT example for dissipation calculation: const auto epsVolAvg = [&]() {
dfloat mue, rho;
platform->options.getArgs("FLUID VISCOSITY", mue);
platform->options.getArgs("FLUID DENSITY", rho);
const auto nu = mue / rho;
auto o_gradU = opSEM::strongGradVec(mesh, nrs->fieldOffset, nrs->fluid->o_U);
static poolDeviceMemory<dfloat> o_invAJwJw;
if (!o_invAJwJw.isInitialized()) {
o_invAJwJw.resize(mesh->Nlocal);
platform->linAlg->axmyz(mesh->Nlocal, 1.0, mesh->o_invAJw, mesh->o_Jw, o_invAJwJw);
}
platform->linAlg->axmyMany(mesh->Nlocal, mesh->dim * mesh->dim, nrs->fieldOffset, 0, 1.0, mesh->o_invAJw, o_gradU);
nrs->qqt->startFinish("+", o_gradU, nrs->fieldOffset);
poolDeviceMemory<dfloat> o_eps(mesh->Nlocal);
platform->linAlg->magSqrTensor(mesh->Nlocal, nrs->fieldOffset, o_gradU, o_eps);
platform->linAlg->scale(mesh->Nlocal, nu, o_eps);
return avg(o_eps);
}();Here, ignoring My questions are:
I really appreciate any clarifications you can provide on these points. Thank you very much! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
opSEM::strongCurl computes the curl using |
Beta Was this translation helpful? Give feedback.
-
|
Please see this documentation for Regarding "Jw" stands for Jacobian times quadrature weight, which is the entries of the diagonal lumped mass matrix |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the explanation, that really helps. But I’m still a bit confused about two specific points:
|
Beta Was this translation helpful? Give feedback.
Please see this documentation for
opSEM. Let me know if you need more clarification.https://nekrs.readthedocs.io/en/latest/other_resources.html#sem-operators-opsem
Regarding
o_Jwando_invAJwundermesh_t. We have a table here:https://nekrs.readthedocs.io/en/latest/other_resources.html#mesh-data
"Jw" stands for Jacobian times quadrature weight, which is the entries of the diagonal lumped mass matrix
"invAJw" is the inverse of the asssembled lumped mass matrix.
They are not the inverse to each other. If you multiple them, it yields the inverse of the multiplicity