Skip to content

Commit

Permalink
Fix GCL on GPU (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Sep 24, 2024
1 parent 30cc003 commit e3751ee
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/ngp_algorithms/GeometryAlgDriver.C
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ GeometryAlgDriver::pre_work()
void
GeometryAlgDriver::mesh_motion_prework()
{
using MeshIndex = nalu_ngp::NGPMeshTraits<stk::mesh::NgpMesh>::MeshIndex;

const auto& meta = realm_.meta_data();
const auto& meshInfo = realm_.mesh_info();
const auto ngpMesh = meshInfo.ngp_mesh();
Expand Down Expand Up @@ -176,9 +178,15 @@ GeometryAlgDriver::mesh_motion_prework()
stk::topology::EDGE_RANK, "edge_swept_face_volume");
const stk::mesh::Selector sel =
stk::mesh::selectField(*sweptVolEdge) & meta.locally_owned_part();
nalu_ngp::field_axpby(
ngpMesh, sel, (gamma1 + gamma2) / dt, ngpSweptVolEdgeN, 0.0,
ngpFaceVelMag, 1, stk::topology::EDGE_RANK);

const auto alpha = (gamma1 + gamma2) / dt;
ngpFaceVelMag.sync_to_device();
nalu_ngp::run_entity_algorithm(
"ngp_field_axpby", ngpMesh, stk::topology::EDGE_RANK, sel,
KOKKOS_LAMBDA(const MeshIndex& mi) {
ngpFaceVelMag.get(mi, 0) = alpha * ngpSweptVolEdgeN.get(mi, 0);
});
ngpFaceVelMag.modify_on_device();
}
}

Expand Down

0 comments on commit e3751ee

Please sign in to comment.