Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: robust point location for degenerate configurations #3202

Merged
merged 42 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
73f8348
work in progress
sframba Jun 12, 2024
637cf71
Merge branch 'develop' of https://github.com/GEOS-DEV/GEOS into develop
sframba Jun 12, 2024
24b87bc
implemented method based on winding number
sframba Jul 2, 2024
ded94c2
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 2, 2024
a0aea88
using element global index for element choice in degenerate cases
sframba Jul 3, 2024
897217f
added global id criterion for points coincident with vertices, as well
sframba Jul 3, 2024
be87fa1
wrong condition for vertices
sframba Jul 3, 2024
1f6d82e
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 3, 2024
0421543
uncrustify
sframba Jul 3, 2024
4589bdc
Merge branch 'feature/robustInsideOutside' of https://github.com/GEOS…
sframba Jul 3, 2024
de21789
doxygen
sframba Jul 3, 2024
4075951
typo
sframba Jul 3, 2024
c617d2f
removed unused variable
sframba Jul 3, 2024
de5c110
another unused variable
sframba Jul 4, 2024
4f25702
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 10, 2024
023811b
Fix some typos in comments
acitrain Jul 10, 2024
e2fd255
Merge branch 'feature/robustInsideOutside' of https://github.com/GEOS…
acitrain Jul 10, 2024
ba49f23
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 12, 2024
89af49e
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 17, 2024
c845d9b
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 22, 2024
3a613b9
Merge branch 'develop' into feature/robustInsideOutside
acitrain Jul 24, 2024
4915455
Merge branch 'develop' into feature/robustInsideOutside
acitrain Jul 25, 2024
bca995d
review comments + high-order case
sframba Jul 29, 2024
4dffd52
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 29, 2024
c0375b6
restored omega initial value (changed by mistake)
sframba Jul 29, 2024
8dccedb
Changed order of methods
sframba Jul 29, 2024
51787c8
using base discretization for precomputing src/rcv
sframba Jul 30, 2024
eb2011e
Revert "using base discretization for precomputing src/rcv"
sframba Jul 31, 2024
6a97776
fixed issue for higher orders
sframba Jul 31, 2024
2252f8d
Merge branch 'develop' into feature/robustInsideOutside
sframba Jul 31, 2024
aa82ad3
Revert "fixed issue for higher orders"
sframba Jul 31, 2024
8a2187a
Merge branch 'feature/robustInsideOutside' of https://github.com/GEOS…
sframba Jul 31, 2024
4648f8f
enabled for high orders. Also removed extra high-order nodes where no…
sframba Aug 1, 2024
f473ff6
restored default node coordinate behaviour outside of precompute src …
sframba Aug 3, 2024
c1b553b
uncrustify + spurious changes
sframba Aug 3, 2024
a5a7b46
leftover spurious change
sframba Aug 3, 2024
00cf346
Merge branch 'develop' into feature/robustInsideOutside
sframba Aug 3, 2024
e51b95e
unused vars
sframba Aug 3, 2024
baa23ce
Merge branch 'feature/robustInsideOutside' of https://github.com/GEOS…
sframba Aug 3, 2024
2821c93
unused vars
sframba Aug 3, 2024
a458470
rebaseline
sframba Aug 3, 2024
71f5930
Merge branch 'develop' into feature/robustInsideOutside
rrsettgast Aug 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .integrated_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
baselines:
bucket: geosx
baseline: integratedTests/baseline_integratedTests-pr3215-6396-9b43cc8
baseline: integratedTests/baseline_integratedTests-pr3202-6636-2821c93

allow_fail:
all: ''
Expand Down
4 changes: 4 additions & 0 deletions BASELINE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This file is designed to track changes to the integrated test baselines.
Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining.
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).

PR #3202 (2024-08-03)
======================
Acoustic VTI tests needed rebaselining after update in source and receiver location algorithm.

PR #3215 (2024-07-23)
======================
Changed the default value for massCreation and name of the wrapper.
Expand Down
397 changes: 396 additions & 1 deletion src/coreComponents/mesh/utilities/ComputationalGeometry.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ void AcousticFirstOrderWaveEquationSEM::postInputInitialization()
m_receiverRegion.resize( numReceiversGlobal );
}

void AcousticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & mesh, arrayView1d< string const > const & regionNames )
void AcousticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & baseMesh, MeshLevel & mesh, arrayView1d< string const > const & regionNames )
{
NodeManager const & nodeManager = mesh.getNodeManager();
FaceManager const & faceManager = mesh.getFaceManager();
GEOS_MARK_FUNCTION;

arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const
X = nodeManager.getField< fields::referencePosition32 >().toViewConst();
arrayView2d< real64 const > const faceNormal = faceManager.faceNormal();
arrayView2d< real64 const > const faceCenter = faceManager.faceCenter();
arrayView1d< globalIndex const > const nodeLocalToGlobal = baseMesh.getNodeManager().localToGlobalMap().toViewConst();
ArrayOfArraysView< localIndex const > const nodesToElements = baseMesh.getNodeManager().elementList().toViewConst();
ArrayOfArraysView< localIndex const > const facesToNodes = baseMesh.getFaceManager().nodeList().toViewConst();
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const nodeCoords = baseMesh.getNodeManager().referencePosition();

arrayView2d< real64 const > const sourceCoordinates = m_sourceCoordinates.toViewConst();
arrayView2d< localIndex > const sourceNodeIds = m_sourceNodeIds.toView();
Expand Down Expand Up @@ -195,39 +194,44 @@ void AcousticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLev
}
}

mesh.getElemManager().forElementSubRegions< CellElementSubRegion >( regionNames, [&]( localIndex const regionIndex,
CellElementSubRegion & elementSubRegion )
mesh.getElemManager().forElementSubRegionsComplete< CellElementSubRegion >( regionNames, [&]( localIndex const,
localIndex const regionIndex,
localIndex const esr,
ElementRegionBase &,
CellElementSubRegion & elementSubRegion )
{
GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Hexahedron,
getDataContext() << ": Invalid type of element, the acoustic solver is designed for hexahedral meshes only (C3D8) ",
InputError );

arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList();
arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes = elementSubRegion.nodeList();
arrayView2d< localIndex const, cells::NODE_MAP_USD > const & baseElemsToNodes = baseMesh.getElemManager().getRegion( regionIndex ).getSubRegion< CellElementSubRegion >( esr ).nodeList();
arrayView2d< real64 const > const elemCenter = elementSubRegion.getElementCenter();
arrayView1d< integer const > const elemGhostRank = elementSubRegion.ghostRank();
arrayView1d< globalIndex const > const elemLocalToGlobal = elementSubRegion.localToGlobalMap().toViewConst();

finiteElement::FiniteElementBase const &
fe = elementSubRegion.getReference< finiteElement::FiniteElementBase >( getDiscretizationName() );
finiteElement::FiniteElementDispatchHandler< SEM_FE_TYPES >::dispatch3D( fe, [&] ( auto const finiteElement )
{
using FE_TYPE = TYPEOFREF( finiteElement );

localIndex const numFacesPerElem = elementSubRegion.numFacesPerElement();

PreComputeSourcesAndReceivers::
Compute1DSourceAndReceiverConstantsWithElementsAndRegionStorage
< EXEC_POLICY, FE_TYPE >
( elementSubRegion.size(),
regionIndex,
numFacesPerElem,
X,
facesToNodes,
nodeCoords,
nodeLocalToGlobal,
elemLocalToGlobal,
nodesToElements,
baseElemsToNodes,
elemGhostRank,
elemsToNodes,
elemsToFaces,
elemCenter,
faceNormal,
faceCenter,
sourceCoordinates,
sourceIsAccessible,
sourceElem,
Expand Down Expand Up @@ -258,11 +262,12 @@ void AcousticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGro

applyFreeSurfaceBC( 0.0, domain );

forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &,
forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const & meshBodyName,
MeshLevel & mesh,
arrayView1d< string const > const & regionNames )
{
precomputeSourceAndReceiverTerm( mesh, regionNames );
MeshLevel & baseMesh = domain.getMeshBodies().getGroup< MeshBody >( meshBodyName ).getBaseDiscretization();
precomputeSourceAndReceiverTerm( baseMesh, mesh, regionNames );

NodeManager & nodeManager = mesh.getNodeManager();
FaceManager & faceManager = mesh.getFaceManager();
Expand Down Expand Up @@ -435,7 +440,7 @@ real64 AcousticFirstOrderWaveEquationSEM::explicitStepInternal( real64 const & t
{
NodeManager & nodeManager = mesh.getNodeManager();

arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const X = nodeManager.getField< fields::referencePosition32 >().toViewConst();
arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords = nodeManager.getField< fields::referencePosition32 >().toViewConst();

arrayView1d< real32 const > const mass = nodeManager.getField< acousticfields::AcousticMassVector >();
arrayView1d< real32 const > const damping = nodeManager.getField< acousticfields::DampingVector >();
Expand Down Expand Up @@ -468,7 +473,7 @@ real64 AcousticFirstOrderWaveEquationSEM::explicitStepInternal( real64 const & t
VelocityComputation< FE_TYPE > kernel( finiteElement );
kernel.template launch< EXEC_POLICY, ATOMIC_POLICY >
( elementSubRegion.size(),
X,
nodeCoords,
elemsToNodes,
p_np1,
density,
Expand All @@ -482,7 +487,7 @@ real64 AcousticFirstOrderWaveEquationSEM::explicitStepInternal( real64 const & t
( elementSubRegion.size(),
regionIndex,
nodeManager.size(),
X,
nodeCoords,
elemsToNodes,
velocity_x,
velocity_y,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ class AcousticFirstOrderWaveEquationSEM : public WaveSolverBase
/**
* @brief Locate sources and receivers position in the mesh elements, evaluate the basis functions at each point and save them to the
* corresponding elements nodes.
* @param baseMesh the level-0 mesh
* @param mesh mesh of the computational domain
*/
virtual void precomputeSourceAndReceiverTerm( MeshLevel & mesh, arrayView1d< string const > const & regionNames ) override;
virtual void precomputeSourceAndReceiverTerm( MeshLevel & baseMesh, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) override;

/**
* @brief Apply free surface condition to the face define in the geometry box from the xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,15 @@
m_pressureNp1AtReceivers.resize( m_nsamplesSeismoTrace, numReceiversGlobal + 1 );
}

void AcousticVTIWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & mesh,
void AcousticVTIWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & baseMesh, MeshLevel & mesh,

Check warning on line 115 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L115

Added line #L115 was not covered by tests
arrayView1d< string const > const & regionNames )
{
NodeManager const & nodeManager = mesh.getNodeManager();
FaceManager const & faceManager = mesh.getFaceManager();

arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords32 =
nodeManager.getField< fields::referencePosition32 >().toViewConst();

arrayView2d< real64 const > const faceNormal = faceManager.faceNormal();
arrayView2d< real64 const > const faceCenter = faceManager.faceCenter();
GEOS_MARK_FUNCTION;

Check warning on line 118 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L118

Added line #L118 was not covered by tests

arrayView1d< globalIndex const > const nodeLocalToGlobal = baseMesh.getNodeManager().localToGlobalMap().toViewConst();
ArrayOfArraysView< localIndex const > const nodesToElements = baseMesh.getNodeManager().elementList().toViewConst();
ArrayOfArraysView< localIndex const > const facesToNodes = baseMesh.getFaceManager().nodeList().toViewConst();
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const nodeCoords = baseMesh.getNodeManager().referencePosition().toViewConst();

Check warning on line 123 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L120-L123

Added lines #L120 - L123 were not covered by tests

arrayView2d< real64 const > const sourceCoordinates = m_sourceCoordinates.toViewConst();
arrayView2d< localIndex > const sourceNodeIds = m_sourceNodeIds.toView();
Expand Down Expand Up @@ -153,38 +150,43 @@
}
}

mesh.getElemManager().forElementSubRegions< CellElementSubRegion >( regionNames, [&]( localIndex const,
CellElementSubRegion & elementSubRegion )
mesh.getElemManager().forElementSubRegionsComplete< CellElementSubRegion >( regionNames, [&]( localIndex const,

Check warning on line 153 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L153

Added line #L153 was not covered by tests
localIndex const er,
localIndex const esr,
ElementRegionBase &,
CellElementSubRegion & elementSubRegion )
{
GEOS_THROW_IF( elementSubRegion.getElementType() != ElementType::Hexahedron,
"Invalid type of element, the acoustic solver is designed for hexahedral meshes only (C3D8), using the SEM formulation",
InputError );

arrayView2d< localIndex const > const elemsToFaces = elementSubRegion.faceList();
arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes = elementSubRegion.nodeList();
arrayView2d< localIndex const, cells::NODE_MAP_USD > const & baseElemsToNodes = baseMesh.getElemManager().getRegion( er ).getSubRegion< CellElementSubRegion >( esr ).nodeList();

Check warning on line 165 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L165

Added line #L165 was not covered by tests
arrayView2d< real64 const > const elemCenter = elementSubRegion.getElementCenter();
arrayView1d< integer const > const elemGhostRank = elementSubRegion.ghostRank();
arrayView1d< globalIndex const > const elemLocalToGlobal = elementSubRegion.localToGlobalMap().toViewConst();

Check warning on line 168 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L168

Added line #L168 was not covered by tests

finiteElement::FiniteElementBase const &
fe = elementSubRegion.getReference< finiteElement::FiniteElementBase >( getDiscretizationName() );
finiteElement::FiniteElementDispatchHandler< SEM_FE_TYPES >::dispatch3D( fe, [&] ( auto const finiteElement )
{
using FE_TYPE = TYPEOFREF( finiteElement );

localIndex const numFacesPerElem = elementSubRegion.numFacesPerElement();

acousticVTIWaveEquationSEMKernels::
PrecomputeSourceAndReceiverKernel::
launch< EXEC_POLICY, FE_TYPE >
( elementSubRegion.size(),
numFacesPerElem,
nodeCoords32,
facesToNodes,
nodeCoords,
nodeLocalToGlobal,
elemLocalToGlobal,
nodesToElements,
baseElemsToNodes,

Check warning on line 185 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L180-L185

Added lines #L180 - L185 were not covered by tests
elemGhostRank,
elemsToNodes,
elemsToFaces,
elemCenter,
faceNormal,
faceCenter,
sourceCoordinates,
sourceIsAccessible,
sourceNodeIds,
Expand Down Expand Up @@ -233,19 +235,19 @@
applyFreeSurfaceBC( 0.0, domain );
precomputeSurfaceFieldIndicator( domain );

forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &,
forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const & meshBodyName,

Check warning on line 238 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L238

Added line #L238 was not covered by tests
MeshLevel & mesh,
arrayView1d< string const > const & regionNames )
{
precomputeSourceAndReceiverTerm( mesh, regionNames );
MeshLevel & baseMesh = domain.getMeshBodies().getGroup< MeshBody >( meshBodyName ).getBaseDiscretization();
precomputeSourceAndReceiverTerm( baseMesh, mesh, regionNames );

Check warning on line 243 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L242-L243

Added lines #L242 - L243 were not covered by tests

NodeManager & nodeManager = mesh.getNodeManager();
FaceManager & faceManager = mesh.getFaceManager();

/// 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 nodeCoords =
nodeManager.getField< fields::referencePosition32 >().toViewConst();
arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords = nodeManager.getField< fields::referencePosition32 >().toViewConst();

Check warning on line 250 in src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp#L250

Added line #L250 was not covered by tests

/// get face to node map
ArrayOfArraysView< localIndex const > const facesToNodes = faceManager.nodeList().toViewConst();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ class AcousticVTIWaveEquationSEM : public WaveSolverBase
/**
* @brief Locate sources and receivers position in the mesh elements, evaluate the basis functions at each point and save them to the
* corresponding elements nodes.
* @param baseMesh the level-0 mesh
* @param mesh mesh of the computational domain
*/
virtual void precomputeSourceAndReceiverTerm( MeshLevel & mesh, arrayView1d< string const > const & regionNames ) override;
virtual void precomputeSourceAndReceiverTerm( MeshLevel & baseMesh, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) override;

/**
* @brief Compute the lateral and bottom surface Field indicators of the boxed domain
Expand Down
Loading