Skip to content

Commit

Permalink
damping faces/elements consistency (#2758)
Browse files Browse the repository at this point in the history
* damping faces/elements consistency
  • Loading branch information
tbeltzun authored Oct 24, 2023
1 parent abb3b2c commit 2bf2c4a
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct PrecomputeSourceAndReceiverKernel
* @param[in] size the number of cells in the subRegion
* @param[in] numNodesPerElem number of nodes per element
* @param[in] numFacesPerElem number of faces per element
* @param[in] X coordinates of the nodes
* @param[in] nodeCoords coordinates of the nodes
* @param[in] elemGhostRank rank of the ghost element
* @param[in] elemsToNodes map from element to nodes
* @param[in] elemsToFaces map from element to faces
Expand Down Expand Up @@ -70,7 +70,7 @@ struct PrecomputeSourceAndReceiverKernel
localIndex const regionIndex,
localIndex const numNodesPerElem,
localIndex const numFacesPerElem,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const X,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords,
arrayView1d< integer const > const elemGhostRank,
arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes,
arrayView2d< localIndex const > const elemsToFaces,
Expand Down Expand Up @@ -127,7 +127,7 @@ struct PrecomputeSourceAndReceiverKernel

WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords,
elemsToNodes[k],
X,
nodeCoords,
coordsOnRefElem );

sourceIsAccessible[isrc] = 1;
Expand Down Expand Up @@ -175,7 +175,7 @@ struct PrecomputeSourceAndReceiverKernel
{
WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords,
elemsToNodes[k],
X,
nodeCoords,
coordsOnRefElem );
receiverIsLocal[ircv] = 1;
rcvElem[ircv] = k;
Expand Down Expand Up @@ -211,7 +211,7 @@ struct MassMatrixKernel
* @tparam EXEC_POLICY the execution policy
* @tparam ATOMIC_POLICY the atomic policy
* @param[in] size the number of cells in the subRegion
* @param[in] X coordinates of the nodes
* @param[in] nodeCoords coordinates of the nodes
* @param[in] elemsToNodes map from element to nodes
* @param[in] velocity cell-wise velocity
* @param[in] density cell-wise density
Expand All @@ -220,7 +220,7 @@ struct MassMatrixKernel
template< typename EXEC_POLICY, typename ATOMIC_POLICY >
void
launch( localIndex const size,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const X,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords,
arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes,
arrayView1d< real32 const > const velocity,
arrayView1d< real32 const > const density,
Expand All @@ -239,7 +239,7 @@ struct MassMatrixKernel
{
for( localIndex i = 0; i < 3; ++i )
{
xLocal[a][i] = X( elemsToNodes( k, a ), i );
xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i );
}
}

Expand Down Expand Up @@ -337,7 +337,7 @@ struct VelocityComputation
* @tparam EXEC_POLICY the execution policy
* @tparam ATOMIC_POLICY the atomic policy
* @param[in] size the number of cells in the subRegion
* @param[in] X coordinates of the nodes
* @param[in] nodeCoords coordinates of the nodes
* @param[in] elemsToNodes map from element to nodes
* @param[in] p_np1 pressure array (only used here)
* @param[in] dt time-step
Expand All @@ -348,7 +348,7 @@ struct VelocityComputation
template< typename EXEC_POLICY, typename ATOMIC_POLICY >
void
launch( localIndex const size,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const X,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords,
arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes,
arrayView1d< real32 const > const p_np1,
arrayView1d< real32 const > const density,
Expand All @@ -367,7 +367,7 @@ struct VelocityComputation
{
for( localIndex i=0; i<3; ++i )
{
xLocal[a][i] = X( elemsToNodes( k, a ), i );
xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i );
}
}

Expand Down Expand Up @@ -447,7 +447,7 @@ struct PressureComputation
* @param[in] size the number of cells in the subRegion
* @param[in] regionIndex Index of the subregion
* @param[in] size_node the number of nodes in the subRegion
* @param[in] X coordinates of the nodes
* @param[in] nodeCoords coordinates of the nodes
* @param[in] elemsToNodes map from element to nodes
* @param[out] velocity_x velocity array in the x direction (only used here)
* @param[out] velocity_y velocity array in the y direction (only used here)
Expand All @@ -468,7 +468,7 @@ struct PressureComputation
launch( localIndex const size,
localIndex const regionIndex,
localIndex const size_node,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const X,
arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords,
arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes,
arrayView2d< real32 const > const velocity_x,
arrayView2d< real32 const > const velocity_y,
Expand Down Expand Up @@ -502,7 +502,7 @@ struct PressureComputation
{
for( localIndex i=0; i<3; ++i )
{
xLocal[a][i] = X( elemsToNodes( k, a ), i );
xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void AcousticVTIWaveEquationSEM::initializePostInitialConditionsPreSubGroups()

/// get the array of indicators: 1 if the face is on the boundary; 0 otherwise
arrayView1d< integer > const & facesDomainBoundaryIndicator = faceManager.getDomainBoundaryIndicator();
arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const X32 =
arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords =
nodeManager.getField< fields::referencePosition32 >().toViewConst();

/// get face to node map
Expand Down Expand Up @@ -273,7 +273,7 @@ void AcousticVTIWaveEquationSEM::initializePostInitialConditionsPreSubGroups()
{

arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes = elementSubRegion.nodeList();
arrayView2d< localIndex const > const facesToElements = faceManager.elementList();
arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList();
arrayView1d< real32 const > const velocity = elementSubRegion.getField< fields::wavesolverfields::MediumVelocity >();
arrayView1d< real32 const > const epsilon = elementSubRegion.getField< fields::wavesolverfields::Epsilon >();
arrayView1d< real32 const > const delta = elementSubRegion.getField< fields::wavesolverfields::Delta >();
Expand All @@ -288,16 +288,16 @@ void AcousticVTIWaveEquationSEM::initializePostInitialConditionsPreSubGroups()
acousticVTIWaveEquationSEMKernels::MassMatrixKernel< FE_TYPE > kernelM( finiteElement );

kernelM.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(),
X32,
nodeCoords,
elemsToNodes,
velocity,
mass );

acousticVTIWaveEquationSEMKernels::DampingMatrixKernel< FE_TYPE > kernelD( finiteElement );

kernelD.template launch< EXEC_POLICY, ATOMIC_POLICY >( faceManager.size(),
X32,
facesToElements,
kernelD.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(),
nodeCoords,
elemsToFaces,
facesToNodes,
facesDomainBoundaryIndicator,
freeSurfaceFaceIndicator,
Expand Down
Loading

0 comments on commit 2bf2c4a

Please sign in to comment.