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

feat: Implement EDFM loading from VTK #3510

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from
Open

Conversation

paveltomin
Copy link
Contributor

copy from #3082

Implement EDFM loading and tested it on a simple 2.5D EDFM case. Below is an input example containing 2 fracture elements:

  • fracture_ids_points: represent all the fracture patch point ids including shared points (no duplicates).
  • fracture_to_paren_matrix_cell_mapping: maps each edfm fracture element to matrix element.
  • permeability : fracture elements permeability (loaded but not used yet, we continue to use constant fracture props provided with CompressibleSolidParallelPlatesPermeability)
  • aperture: is fracture aperture
  • tangential_width_vectors, tangential_length_vectors and normal_vectors are the 3 principal vectors of a fracture patch plan.
  • connectivity: each patch is represented by a 4 points (quad).

image

<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <UnstructuredGrid>
    <Piece NumberOfPoints="6" NumberOfCells="2">
      <PointData>
        <DataArray type="Int32" Name="fracture_ids_points" NumberOfComponents="1" format="ascii">
         0
         1
         2
         3
         4
         5
        </DataArray>
      </PointData>
      <CellData>
        <DataArray type="Int32" Name="fracture_to_parent_matrix_cell_mapping" NumberOfComponents="2" format="ascii">
         0 4
         1 13
        </DataArray>
        <DataArray type="Float32" Name="permeability" NumberOfComponents="1" format="ascii" RangeMin="0.1" RangeMax="0.1">
          0.1
          0.1
        </DataArray>
        <DataArray type="Float32" Name="aperture" NumberOfComponents="1" format="ascii" RangeMin="0.0001" RangeMax="0.0001">
          0.0001
          0.0001
        </DataArray>
        <DataArray type="Float32" Name="tangential_width_vectors" NumberOfComponents="3" format="ascii">
          0 0 1
          0 0 1
        </DataArray>
        <DataArray type="Float32" Name="tangential_length_vectors" NumberOfComponents="3" format="ascii">
          0 1 0
          0 1 0
        </DataArray>
        <DataArray type="Float32" Name="normal_vectors" NumberOfComponents="3" format="ascii">
          1 0 0
          1 0 0
        </DataArray>
      </CellData>
      <Points>
        <DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="0" RangeMax="1">
          0.5 0.3333 0
          0.5 0.6666 0
          0.5 0.3333 0.5
          0.5 0.6666 0.5
          0.5 0.3333 1
          0.5 0.6666 1
          <InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
            <Value index="0">
              0
            </Value>
            <Value index="1">
              1
            </Value>
          </InformationKey>
        </DataArray>
      </Points>
      <Cells>
        <DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="5">
        1 0 2 3
        3 2 4 5
        </DataArray>
        <DataArray type="Int64" Name="offsets" format="ascii" RangeMin="4" RangeMax="8">
          4
          8
        </DataArray>
        <DataArray type="UInt8" Name="types" format="ascii" RangeMin="9" RangeMax="9">
          9
          9
        </DataArray>
      </Cells>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

@@ -75,7 +75,7 @@ EmbeddedSurfaceGenerator::EmbeddedSurfaceGenerator( const string & name,

registerWrapper( viewKeyStruct::targetObjectsNameString(), &m_targetObjectsName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ).
setInputFlag( dataRepository::InputFlags::OPTIONAL ).
setInputFlag( dataRepository::InputFlags::REQUIRED ).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CusiniM why this would be required when vtk input is used?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not need the EmbeddedSurfaceGenerator at all when vtk is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right yes, that makes sense then

Comment on lines +89 to +108
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="47">
0 1 5 4 16 17 21 20
1 2 6 5 17 18 22 21
2 3 7 6 18 19 23 22
4 5 9 8 20 21 25 24
5 6 10 9 21 22 26 25
6 7 11 10 22 23 27 26
8 9 13 12 24 25 29 28
9 10 14 13 25 26 30 29
10 11 15 14 26 27 31 30
16 17 21 20 32 33 37 36
17 18 22 21 33 34 38 37
18 19 23 22 34 35 39 38
20 21 25 24 36 37 41 40
21 22 26 25 37 38 42 41
22 23 27 26 38 39 43 42
24 25 29 28 40 41 45 44
25 26 30 29 41 42 46 45
26 27 31 30 42 43 47 46
</DataArray>
Copy link
Collaborator

@CusiniM CusiniM Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this ever used? I don't think we use this field. Or is it needed by vtk?

Copy link

@ouassimkh ouassimkh Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is used internally by VTK to map fracture patches to their nodes. I use it here VtkEmbeddedSurfaceBlockUtilities.cpp

ArrayOfArrays< localIndex > elem2dToNodes( numEdfmFracs );
  for( vtkIdType i = 0; i < numEdfmFracs; ++i )
  {
    auto const val = grid->GetCell( i )->GetPointIds();
    elem2dToNodes.emplaceBack( i, val->GetId( 0 ));
    elem2dToNodes.emplaceBack( i, val->GetId( 1 ));
    elem2dToNodes.emplaceBack( i, val->GetId( 2 ));
    elem2dToNodes.emplaceBack( i, val->GetId( 3 ));
  }

@CusiniM CusiniM requested a review from ryar9534 as a code owner January 16, 2025 00:49
Comment on lines 616 to 632
void TwoPointFluxApproximation::computeConnectivityIndex( ElementRegionManager & elemManager,
NodeManager & nodeManager,
EmbeddedSurfaceSubRegion & embeddedSurfaceSubRegion ) const
{
// Launch kernel to compute connectivity index of each fractured element.
elemManager.forElementSubRegionsComplete< CellElementSubRegion >(
[&]( localIndex const, localIndex const, ElementRegionBase &, CellElementSubRegion & subRegion )
{
auto kernelVariant = createKernel( subRegion.getElementType(), nodeManager, subRegion, embeddedSurfaceSubRegion );

std::visit( [&] ( auto kernel )
{
using KERNEL_TYPE = decltype( kernel );
KERNEL_TYPE::template launchCIComputationKernel< parallelDevicePolicy< >, KERNEL_TYPE >( kernel );
}, kernelVariant);
} );
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe these changes should be in their own PR. Moving this here should not have any impact on the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants