Skip to content

Commit

Permalink
only use the matrix perm for the FaceElementToCellStencil
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfeifan committed Aug 20, 2024
1 parent dd51266 commit 8bb93a1
Showing 1 changed file with 44 additions and 27 deletions.
71 changes: 44 additions & 27 deletions src/coreComponents/finiteVolume/FaceElementToCellStencil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,30 +263,35 @@ inline void FaceElementToCellStencilWrapper::
localIndex const esr0 = m_elementSubRegionIndices[iconn][0];
localIndex const ei0 = m_elementIndices[iconn][0];

localIndex const er1 = m_elementRegionIndices[iconn][1];
localIndex const esr1 = m_elementSubRegionIndices[iconn][1];
localIndex const ei1 = m_elementIndices[iconn][1];
// localIndex const er1 = m_elementRegionIndices[iconn][1];
// localIndex const esr1 = m_elementSubRegionIndices[iconn][1];
// localIndex const ei1 = m_elementIndices[iconn][1];

real64 faceConormal[3];

// Will change when implementing collocation points.
LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, coefficient[er0][esr0][ei0][0], m_faceNormal[iconn] );
real64 const t0 = m_weights[iconn][0] * LvArray::tensorOps::AiBi< 3 >( m_cellToFaceVec[iconn], faceConormal );
// real64 const t0 = m_weights[iconn][0] * coefficient[er1][esr1][ei1][0][2];
// We consider the 3rd component of the permeability which is the normal one.
real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][2];
// real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][2];

real64 const sumOfTrans = t0+t1;
real64 const value = m_transMultiplier[iconn]*t0*t1/sumOfTrans;
// real64 const sumOfTrans = t0+t1;
// real64 const value = m_transMultiplier[iconn]*t0*t1/sumOfTrans;
real64 const value = m_transMultiplier[iconn]*t0;

weight[0][0] = value;
weight[0][1] = -value;

// We consider the 3rd component of the permeability which is the normal one.
real64 const dt0 = m_weights[iconn][0] * dCoeff_dVar[er0][esr0][ei0][0][0];
real64 const dt1 = m_weights[iconn][1] * dCoeff_dVar[er1][esr1][ei1][0][2];
// real64 const dt0 = m_weights[iconn][0] * dCoeff_dVar[er0][esr0][ei0][0][0];
// real64 const dt1 = m_weights[iconn][1] * dCoeff_dVar[er1][esr1][ei1][0][2];

dWeight_dVar[0][0] = ( dt0 * t1 * sumOfTrans - dt0 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
dWeight_dVar[0][1] = ( t0 * dt1 * sumOfTrans - dt1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
// dWeight_dVar[0][0] = ( dt0 * t1 * sumOfTrans - dt0 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
// dWeight_dVar[0][1] = ( t0 * dt1 * sumOfTrans - dt1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
GEOS_UNUSED_VAR( dCoeff_dVar );
dWeight_dVar[0][0] = 0.0;
dWeight_dVar[0][1] = 0.0;
}

GEOS_HOST_DEVICE
Expand All @@ -298,10 +303,12 @@ FaceElementToCellStencilWrapper
{
// Will change when implementing collocation points.
real64 const t0 = m_weights[iconn][0] * LvArray::tensorOps::AiBi< 3 >( m_cellToFaceVec[iconn], m_faceNormal[iconn] );
real64 const t1 = m_weights[iconn][1];
// real64 const t0 = m_weights[iconn][0];
// real64 const t1 = m_weights[iconn][1];

real64 const sumOfTrans = t0+t1;
real64 const value = m_transMultiplier[iconn]*t0*t1/sumOfTrans;
// real64 const sumOfTrans = t0+t1;
// real64 const value = m_transMultiplier[iconn]*t0*t1/sumOfTrans;
real64 const value = m_transMultiplier[iconn]*t0;

weight[0][0] = value;
weight[0][1] = -value;
Expand All @@ -325,35 +332,45 @@ FaceElementToCellStencilWrapper::
localIndex const esr0 = m_elementSubRegionIndices[iconn][0];
localIndex const ei0 = m_elementIndices[iconn][0];

localIndex const er1 = m_elementRegionIndices[iconn][1];
localIndex const esr1 = m_elementSubRegionIndices[iconn][1];
localIndex const ei1 = m_elementIndices[iconn][1];
// localIndex const er1 = m_elementRegionIndices[iconn][1];
// localIndex const esr1 = m_elementSubRegionIndices[iconn][1];
// localIndex const ei1 = m_elementIndices[iconn][1];

real64 faceConormal[3];

// Will change when implementing collocation points.
LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, coefficient[er0][esr0][ei0][0], m_faceNormal[iconn] );
real64 const t0 = m_weights[iconn][0] * LvArray::tensorOps::AiBi< 3 >( m_cellToFaceVec[iconn], faceConormal );
// real64 const t0 = m_weights[iconn][0] * coefficient[er1][esr1][ei1][0][2];
// We consider the 3rd component of the permeability which is the normal one.
real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][2];
// real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][2];

real64 const sumOfTrans = t0+t1;
real64 const value = m_transMultiplier[iconn]*t0*t1/sumOfTrans;
// real64 const sumOfTrans = t0+t1;
// real64 const value = m_transMultiplier[iconn]*t0*t1/sumOfTrans;
real64 const value = m_transMultiplier[iconn]*t0;

weight[0][0] = value;
weight[0][1] = -value;

// We consider the 3rd component of the permeability which is the normal one.
real64 const dt0_dVar1 = m_weights[iconn][0] * dCoeff_dVar1[er0][esr0][ei0][0][0];
real64 const dt1_dVar1 = m_weights[iconn][1] * dCoeff_dVar1[er1][esr1][ei1][0][2];
real64 const dt0_dVar2 = m_weights[iconn][0] * dCoeff_dVar2[er0][esr0][ei0][0][0];
real64 const dt1_dVar2 = m_weights[iconn][1] * dCoeff_dVar2[er1][esr1][ei1][0][2];
// real64 const dt0_dVar1 = m_weights[iconn][0] * dCoeff_dVar1[er0][esr0][ei0][0][0];
// real64 const dt1_dVar1 = m_weights[iconn][1] * dCoeff_dVar1[er1][esr1][ei1][0][2];
// real64 const dt0_dVar2 = m_weights[iconn][0] * dCoeff_dVar2[er0][esr0][ei0][0][0];
// real64 const dt1_dVar2 = m_weights[iconn][1] * dCoeff_dVar2[er1][esr1][ei1][0][2];

// dWeight_dVar1[0][0] = ( dt0_dVar1 * t1 * sumOfTrans - dt0_dVar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
// dWeight_dVar1[0][1] = ( t0 * dt1_dVar1 * sumOfTrans - dt1_dVar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );

// dWeight_dVar2[0][0] = ( dt0_dVar2 * t1 * sumOfTrans - dt0_dVar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
// dWeight_dVar2[0][1] = ( t0 * dt1_dVar2 * sumOfTrans - dt1_dVar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );

GEOS_UNUSED_VAR( dCoeff_dVar1, dCoeff_dVar2 );

dWeight_dVar1[0][0] = ( dt0_dVar1 * t1 * sumOfTrans - dt0_dVar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
dWeight_dVar1[0][1] = ( t0 * dt1_dVar1 * sumOfTrans - dt1_dVar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
dWeight_dVar1[0][0] = 0.0;
dWeight_dVar1[0][1] = 0.0;

dWeight_dVar2[0][0] = ( dt0_dVar2 * t1 * sumOfTrans - dt0_dVar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
dWeight_dVar2[0][1] = ( t0 * dt1_dVar2 * sumOfTrans - dt1_dVar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
dWeight_dVar2[0][0] = 0.0;
dWeight_dVar2[0][1] = 0.0;
}

GEOS_HOST_DEVICE
Expand Down

0 comments on commit 8bb93a1

Please sign in to comment.