Skip to content

Commit

Permalink
Bugfix/crook5/mpm restart (#2782)
Browse files Browse the repository at this point in the history
* Merged feature/crook5/restart
* Merged feature/crook5/restart
* Fixed documentation typo in ParticleBlock.hpp
* Ran uncrustify
* Updating schema
* Updating the integratedTests hash

---------

Co-authored-by: Cameron Mikel Crook <[email protected]>
Co-authored-by: Nicola Castelletto <[email protected]>
  • Loading branch information
3 people authored Nov 10, 2023
1 parent 547798f commit c60be25
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 27 deletions.
2 changes: 1 addition & 1 deletion integratedTests
Submodule integratedTests updated 16 files
+ tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000001992.root
+3 −0 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000001992/rank_0000000.hdf5
+3 −0 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000001992/rank_0000001.hdf5
+3 −0 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000001992/rank_0000002.hdf5
+3 −0 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000001992/rank_0000003.hdf5
+0 −3 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000003970/rank_0000000.hdf5
+0 −3 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000003970/rank_0000001.hdf5
+0 −3 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000003970/rank_0000002.hdf5
+0 −3 tests/allTests/solidMechanicsMPM/baselines/dfgMovingGrid_04/0to3970_restart_000003970/rank_0000003.hdf5
+ tests/allTests/solidMechanicsMPM/baselines/particleRepartition_04/0to3882_restart_000003882.root
+2 −2 tests/allTests/solidMechanicsMPM/baselines/particleRepartition_04/0to3882_restart_000003882/rank_0000000.hdf5
+2 −2 tests/allTests/solidMechanicsMPM/baselines/particleRepartition_04/0to3882_restart_000003882/rank_0000001.hdf5
+2 −2 tests/allTests/solidMechanicsMPM/baselines/particleRepartition_04/0to3882_restart_000003882/rank_0000002.hdf5
+2 −2 tests/allTests/solidMechanicsMPM/baselines/particleRepartition_04/0to3882_restart_000003882/rank_0000003.hdf5
+ tests/allTests/solidMechanicsMPM/baselines/singleParticle_01/0to972_restart_000000972.root
+2 −2 tests/allTests/solidMechanicsMPM/baselines/singleParticle_01/0to972_restart_000000972/rank_0000000.hdf5
1 change: 0 additions & 1 deletion src/coreComponents/mainInterface/ProblemManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ void ProblemManager::generateMesh()

if( meshBody.hasParticles() ) // mesh bodies with particles load their data into particle blocks, not cell blocks
{
GEOS_LOG_RANK_0( "Generating particle mesh level" );
ParticleBlockManagerABC & particleBlockManager = meshBody.getGroup< ParticleBlockManagerABC >( keys::particleManager );

this->generateMeshLevel( baseMesh,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "mesh/DomainPartition.hpp"
#include "mesh/mpiCommunications/PartitionBase.hpp"
#include "mesh/mpiCommunications/SpatialPartition.hpp"

#include "ParticleBlockManager.hpp"

#include "common/DataTypes.hpp"
Expand Down Expand Up @@ -66,6 +65,7 @@ Group * ParticleMeshGenerator::createChild( string const & GEOS_UNUSED_PARAM( ch
return nullptr;
}


void ParticleMeshGenerator::fillParticleBlockManager( ParticleBlockManager & particleBlockManager, ParticleManager & particleManager, SpatialPartition const & partition )
{
GEOS_MARK_FUNCTION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ SolidMechanicsMPM::SolidMechanicsMPM( const string & name,
m_frictionCoefficient( 0.0 ),
m_planeStrain( 0 ),
m_numDims( 3 ),
m_hEl{ DBL_MAX, DBL_MAX, DBL_MAX },
m_xLocalMin{ DBL_MAX, DBL_MAX, DBL_MAX },
m_xLocalMax{ -DBL_MAX, -DBL_MAX, -DBL_MAX },
m_xLocalMinNoGhost{ 0.0, 0.0, 0.0 },
m_xLocalMaxNoGhost{ 0.0, 0.0, 0.0 },
m_xGlobalMin{ 0.0, 0.0, 0.0 },
m_xGlobalMax{ 0.0, 0.0, 0.0 },
m_partitionExtent{ 0.0, 0.0, 0.0 },
m_nEl{ 0, 0, 0 },
m_ijkMap()
{
registerWrapper( "solverProfiling", &m_solverProfiling ).
Expand Down Expand Up @@ -235,6 +226,66 @@ SolidMechanicsMPM::SolidMechanicsMPM( const string & name,
registerWrapper( "m_ijkMap", &m_ijkMap ).
setInputFlag( InputFlags::FALSE ).
setDescription( "Map from indices in each spatial dimension to local node ID" );

registerWrapper( "elementSize", &m_hEl ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "Minimum element size in x, y and z" );

registerWrapper( "localMinimum", &m_xLocalMin ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "local minimum" );

registerWrapper( "localMaximum", &m_xLocalMax ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "local maximum" );

registerWrapper( "localMinimumNoGhost", &m_xLocalMinNoGhost ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "local minimum without ghost cells" );

registerWrapper( "localMaximumNoGhost", &m_xLocalMaxNoGhost ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "local maximum without ghost cells" );

registerWrapper( "globalMinimum", &m_xGlobalMin ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "global minimum" );

registerWrapper( "globalMaximum", &m_xGlobalMax ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "global maximum" );

registerWrapper( "partitionExtent", &m_partitionExtent ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "parititon extent" );

registerWrapper( "domainExtent", &m_domainExtent ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "domain extent" );

registerWrapper( "domainF", &m_domainF ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "domain deformation gradient" );

registerWrapper( "domainL", &m_domainL ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "domain L" );

registerWrapper( "numElements", &m_nEl ).
setInputFlag( InputFlags::FALSE ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "number of elements along partition directions" );
}

void SolidMechanicsMPM::postProcessInput()
Expand Down Expand Up @@ -541,12 +592,10 @@ void SolidMechanicsMPM::initialize( NodeManager & nodeManager,

// Initialize domain F and L, then read and distribute F table
m_domainF.resize( 3 );
LvArray::tensorOps::fill< 3 >( m_domainF, 1.0 );
m_domainL.resize( 3 );
for( int i=0; i<3; i++ )
{
m_domainF[i] = 1.0;
m_domainL[i] = 0.0;
}
LvArray::tensorOps::fill< 3 >( m_domainF, 0.0 );

if( m_prescribedBoundaryFTable == 1 )
{
int rank = MpiWrapper::commRank( MPI_COMM_GEOSX );
Expand Down Expand Up @@ -587,6 +636,13 @@ void SolidMechanicsMPM::initialize( NodeManager & nodeManager,
arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const gridPosition = nodeManager.referencePosition();

// Get local domain extent
m_xLocalMin.resize( 3 );
LvArray::tensorOps::fill< 3 >( m_xLocalMin, DBL_MAX );
m_xLocalMax.resize( 3 );
LvArray::tensorOps::fill< 3 >( m_xLocalMax, -DBL_MAX );
m_xLocalMinNoGhost.resize( 3 );
m_xLocalMaxNoGhost.resize( 3 );
m_partitionExtent.resize( 3 );
for( int g=0; g<numNodes; g++ )
{
for( int i=0; i<3; i++ )
Expand All @@ -603,6 +659,8 @@ void SolidMechanicsMPM::initialize( NodeManager & nodeManager,
}

// Get element size
m_hEl.resize( 3 );
LvArray::tensorOps::fill< 3 >( m_hEl, DBL_MAX );
for( int g=0; g<numNodes; g++ )
{
for( int i=0; i<3; i++ )
Expand Down Expand Up @@ -631,6 +689,9 @@ void SolidMechanicsMPM::initialize( NodeManager & nodeManager,
}

// Get global domain extent excluding buffer nodes
m_xGlobalMin.resize( 3 );
m_xGlobalMax.resize( 3 );
m_domainExtent.resize( 3 );
for( int i=0; i<3; i++ )
{
m_xGlobalMin[i] = partition.getGlobalMin()[i] + m_hEl[i];
Expand All @@ -639,6 +700,7 @@ void SolidMechanicsMPM::initialize( NodeManager & nodeManager,
}

// Get number of elements in each direction
m_nEl.resize( 3 );
for( int i=0; i<3; i++ )
{
m_nEl[i] = std::round( m_partitionExtent[i] / m_hEl[i] );
Expand Down Expand Up @@ -936,6 +998,7 @@ real64 SolidMechanicsMPM::explicitStep( real64 const & time_n,
subRegion.setActiveParticleIndices();
} );


//#######################################################################################
solverProfilingIf( "Construct neighbor list", m_needsNeighborList == 1 );
//#######################################################################################
Expand Down Expand Up @@ -1120,21 +1183,25 @@ real64 SolidMechanicsMPM::explicitStep( real64 const & time_n,
computeAndWriteBoxAverage( time_n, dt, particleManager );
}


//#######################################################################################
solverProfiling( "Calculate stable time step" );
//#######################################################################################
real64 dtReturn = getStableTimeStep( particleManager );


//#######################################################################################
solverProfiling( "Flag out-of-range particles" );
//#######################################################################################
flagOutOfRangeParticles( particleManager );


//#######################################################################################
solverProfiling( "Delete bad particles" );
//#######################################################################################
deleteBadParticles( particleManager );


//#######################################################################################
solverProfilingIf( "Particle repartitioning", MpiWrapper::commSize( MPI_COMM_GEOSX ) > 1 );
//#######################################################################################
Expand All @@ -1150,6 +1217,7 @@ real64 SolidMechanicsMPM::explicitStep( real64 const & time_n,
} );
}


//#######################################################################################
solverProfilingIf( "Resize grid based on F-table", m_prescribedBoundaryFTable == 1 );
//#######################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,16 @@ class SolidMechanicsMPM : public SolverBase
int m_planeStrain;
int m_numDims;

real64 m_hEl[3]; // Grid spacing in x-y-z
real64 m_xLocalMin[3]; // Minimum local grid coordinate including ghost nodes
real64 m_xLocalMax[3]; // Maximum local grid coordinate including ghost nodes
real64 m_xLocalMinNoGhost[3]; // Minimum local grid coordinate EXCLUDING ghost nodes
real64 m_xLocalMaxNoGhost[3]; // Maximum local grid coordinate EXCLUDING ghost nodes
real64 m_xGlobalMin[3]; // Minimum global grid coordinate excluding buffer nodes
real64 m_xGlobalMax[3]; // Maximum global grid coordinate excluding buffer nodes
real64 m_partitionExtent[3]; // Length of each edge of partition including buffer and ghost cells
real64 m_domainExtent[3]; // Length of each edge of global domain excluding buffer cells
int m_nEl[3]; // Number of elements in each grid direction including buffer and ghost cells
array1d< real64 > m_hEl; // Grid spacing in x-y-z
array1d< real64 > m_xLocalMin; // Minimum local grid coordinate including ghost nodes
array1d< real64 > m_xLocalMax; // Maximum local grid coordinate including ghost nodes
array1d< real64 > m_xLocalMinNoGhost; // Minimum local grid coordinate EXCLUDING ghost nodes
array1d< real64 > m_xLocalMaxNoGhost; // Maximum local grid coordinate EXCLUDING ghost nodes
array1d< real64 > m_xGlobalMin; // Minimum global grid coordinate excluding buffer nodes
array1d< real64 > m_xGlobalMax; // Maximum global grid coordinate excluding buffer nodes
array1d< real64 > m_partitionExtent; // Length of each edge of partition including buffer and ghost cells
array1d< real64 > m_domainExtent; // Length of each edge of global domain excluding buffer cells
array1d< int > m_nEl; // Number of elements in each grid direction including buffer and ghost cells
array3d< int > m_ijkMap; // Map from indices in each spatial dimension to local node ID

private:
Expand Down
12 changes: 12 additions & 0 deletions src/coreComponents/schema/docs/SolidMechanics_MPM_other.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@ Name Type
========================= ============================================================================================================================================================== ==================================================================================================
bcTable real64_array2d Array that stores time-dependent bc types on x-, x+, y-, y+, z- and z+ faces.
binSizeMultiplier integer Multiplier for setting bin size, used to speed up particle neighbor sorting
domainExtent real64_array domain extent
domainF real64_array domain deformation gradient
domainL real64_array domain L
elementSize real64_array Minimum element size in x, y and z
fTable real64_array2d Array that stores time-dependent grid-aligned stretches interpreted as a global background grid F.
globalMaximum real64_array global maximum
globalMinimum real64_array global minimum
localMaximum real64_array local maximum
localMaximumNoGhost real64_array local maximum without ghost cells
localMinimum real64_array local minimum
localMinimumNoGhost real64_array local minimum without ghost cells
m_ijkMap integer_array3d Map from indices in each spatial dimension to local node ID
maxStableDt real64 Value of the Maximum Stable Timestep for this solver.
meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to.
numContactFlags integer Number of contact flags that can appear due to damage
numContactGroups integer Number of prescribed contact groups
numDims integer The number of active spatial dimensions, 2 for plane strain, 3 otherwise
numElements integer_array number of elements along partition directions
numVelocityFields integer Number of velocity fields
partitionExtent real64_array parititon extent
smallMass real64 The small mass threshold for ignoring extremely low-mass nodes.
LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters`
NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters`
Expand Down
24 changes: 24 additions & 0 deletions src/coreComponents/schema/schema.xsd.other
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,28 @@
<xsd:attribute name="bcTable" type="real64_array2d" />
<!--binSizeMultiplier => Multiplier for setting bin size, used to speed up particle neighbor sorting-->
<xsd:attribute name="binSizeMultiplier" type="integer" />
<!--domainExtent => domain extent-->
<xsd:attribute name="domainExtent" type="real64_array" />
<!--domainF => domain deformation gradient-->
<xsd:attribute name="domainF" type="real64_array" />
<!--domainL => domain L-->
<xsd:attribute name="domainL" type="real64_array" />
<!--elementSize => Minimum element size in x, y and z-->
<xsd:attribute name="elementSize" type="real64_array" />
<!--fTable => Array that stores time-dependent grid-aligned stretches interpreted as a global background grid F.-->
<xsd:attribute name="fTable" type="real64_array2d" />
<!--globalMaximum => global maximum-->
<xsd:attribute name="globalMaximum" type="real64_array" />
<!--globalMinimum => global minimum-->
<xsd:attribute name="globalMinimum" type="real64_array" />
<!--localMaximum => local maximum-->
<xsd:attribute name="localMaximum" type="real64_array" />
<!--localMaximumNoGhost => local maximum without ghost cells-->
<xsd:attribute name="localMaximumNoGhost" type="real64_array" />
<!--localMinimum => local minimum-->
<xsd:attribute name="localMinimum" type="real64_array" />
<!--localMinimumNoGhost => local minimum without ghost cells-->
<xsd:attribute name="localMinimumNoGhost" type="real64_array" />
<!--m_ijkMap => Map from indices in each spatial dimension to local node ID-->
<xsd:attribute name="m_ijkMap" type="integer_array3d" />
<!--maxStableDt => Value of the Maximum Stable Timestep for this solver.-->
Expand All @@ -1112,8 +1132,12 @@
<xsd:attribute name="numContactGroups" type="integer" />
<!--numDims => The number of active spatial dimensions, 2 for plane strain, 3 otherwise-->
<xsd:attribute name="numDims" type="integer" />
<!--numElements => number of elements along partition directions-->
<xsd:attribute name="numElements" type="integer_array" />
<!--numVelocityFields => Number of velocity fields-->
<xsd:attribute name="numVelocityFields" type="integer" />
<!--partitionExtent => parititon extent-->
<xsd:attribute name="partitionExtent" type="real64_array" />
<!--smallMass => The small mass threshold for ignoring extremely low-mass nodes.-->
<xsd:attribute name="smallMass" type="real64" />
</xsd:complexType>
Expand Down

0 comments on commit c60be25

Please sign in to comment.