Skip to content

Commit

Permalink
Merge branch 'develop' into pt/remove-setNextDt
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltomin authored Dec 14, 2024
2 parents 7f1fd25 + 5ce6497 commit 03417a1
Show file tree
Hide file tree
Showing 45 changed files with 509 additions and 194 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ jobs:
DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors"
DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust"

- name: Pangea 3 (AlmaLinux 8.8, gcc 9.4.0, open-mpi 4.1.2, cuda 11.5.0, openblas 0.3.10)
- name: Pangea 3 CUDA (AlmaLinux 8.8, gcc 9.4.0, open-mpi 4.1.2, cuda 11.5.0, openblas 0.3.10)
BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema"
CMAKE_BUILD_TYPE: Release
BUILD_GENERATOR: "--makefile"
Expand Down
1 change: 1 addition & 0 deletions src/coreComponents/constitutive/ConstitutiveManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ConstitutiveManager::~ConstitutiveManager()

Group * ConstitutiveManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< ConstitutiveBase > material = ConstitutiveBase::CatalogInterface::factory( childKey, childName, this );
return &registerGroup< ConstitutiveBase >( childName, std::move( material ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/dataRepository/xmlWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void xmlDocument::addIncludedXML( xmlNode & targetNode, int const level )
return isAbsolutePath( fileName ) ? fileName : joinPath( splitPath( currentFilePath ).first, fileName );
}();

GEOS_LOG_RANK_0( "Included additionnal XML file: " << getAbsolutePath( includedFilePath ) );
GEOS_LOG_RANK_0( "Included additional XML file: " << getAbsolutePath( includedFilePath ) );

xmlDocument includedXmlDocument;
xmlResult const result = includedXmlDocument.loadFile( includedFilePath, hasNodeFileInfo() );
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/events/EventBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ EventBase::CatalogInterface::CatalogType & EventBase::getCatalog()

Group * EventBase::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding Event: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< EventBase > event = EventBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< EventBase >( childName, std::move( event ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/events/EventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ EventManager::~EventManager()

Group * EventManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding Event: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< EventBase > event = EventBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< EventBase >( childName, std::move( event ) );
}
Expand Down
1 change: 1 addition & 0 deletions src/coreComponents/events/tasks/TasksManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ TasksManager::~TasksManager()

Group * TasksManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< TaskBase > task = TaskBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< TaskBase >( childName, std::move( task ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ FieldSpecificationManager & FieldSpecificationManager::getInstance()

Group * FieldSpecificationManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< FieldSpecificationBase > bc = FieldSpecificationBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup( childName, std::move( bc ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/fileIO/Outputs/OutputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ OutputManager::~OutputManager()

Group * OutputManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding Output: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< OutputBase > output = OutputBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< OutputBase >( childName, std::move( output ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ FiniteElementDiscretizationManager::~FiniteElementDiscretizationManager()
Group * FiniteElementDiscretizationManager::createChild( string const & childKey, string const & childName )
{
// These objects should probably not be registered on managed group...
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< Group > fem = Group::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup( childName, std::move( fem ) );
}
Expand Down
1 change: 1 addition & 0 deletions src/coreComponents/finiteVolume/FiniteVolumeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ FiniteVolumeManager::~FiniteVolumeManager()

Group * FiniteVolumeManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
if( childKey == HybridMimeticDiscretization::catalogName() )
{
std::unique_ptr< HybridMimeticDiscretization > hm = std::make_unique< HybridMimeticDiscretization >( childName, this );
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/functions/FunctionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ FunctionManager & FunctionManager::getInstance()
Group * FunctionManager::createChild( string const & functionCatalogKey,
string const & functionName )
{
GEOS_LOG_RANK_0( " " << functionCatalogKey << ": " << functionName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), functionCatalogKey, functionName ) );
std::unique_ptr< FunctionBase > function = FunctionBase::CatalogInterface::factory( functionCatalogKey, functionName, this );
return &this->registerGroup< FunctionBase >( functionName, std::move( function ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/mesh/ElementRegionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Group * ElementRegionManager::createChild( string const & childKey, string const
{
GEOS_ERROR_IF( !(CatalogInterface::hasKeyName( childKey )),
"KeyName ("<<childKey<<") not found in ObjectManager::Catalog" );
GEOS_LOG_RANK_0( "Adding Object " << childKey<<" named "<< childName<<" from ObjectManager::Catalog." );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );

Group & elementRegions = this->getGroup( ElementRegionManager::groupKeyStruct::elementRegionsGroup() );
return &elementRegions.registerGroup( childName,
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/mesh/ExternalDataSourceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ExternalDataSourceBase::ExternalDataSourceBase( string const & name, Group * con

Group * ExternalDataSourceBase::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding External Data Source: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< ExternalDataSourceBase > event = ExternalDataSourceBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< ExternalDataSourceBase >( childName, std::move( event ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/mesh/ExternalDataSourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ExternalDataSourceManager::~ExternalDataSourceManager()

Group * ExternalDataSourceManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding External Data Source: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< ExternalDataSourceBase > externalDataSource = ExternalDataSourceBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< ExternalDataSourceBase >( childName, std::move( externalDataSource ) );
}
Expand Down
7 changes: 4 additions & 3 deletions src/coreComponents/mesh/FieldIdentifiers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ class FieldIdentifiers
* @brief Get the Location object
*
* @param key key used to store the list of fields in the map.
* @param location mesh location where fields defined by the key provided were registered.
* @return mesh location where fields defined by the key provided were registered.
*/
void getLocation( string const & key,
FieldLocation & location ) const
FieldLocation getLocation( string const & key ) const
{
FieldLocation location{};
if( key.find( m_locationKeys.nodesKey() ) != string::npos )
{
location = FieldLocation::Node;
Expand All @@ -123,6 +123,7 @@ class FieldIdentifiers
{
GEOS_ERROR( GEOS_FMT( "Invalid key, {}, was provided. Location cannot be retrieved.", key ) );
}
return location;
}

private:
Expand Down
96 changes: 48 additions & 48 deletions src/coreComponents/mesh/MeshManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "mesh/mpiCommunications/SpatialPartition.hpp"
#include "generators/CellBlockManagerABC.hpp"
#include "generators/MeshGeneratorBase.hpp"
#include "mesh/mpiCommunications/CommunicationTools.hpp"
#include "common/TimingMacros.hpp"

Expand All @@ -43,7 +42,7 @@ MeshManager::~MeshManager()

Group * MeshManager::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding Mesh: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< MeshGeneratorBase > mesh = MeshGeneratorBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< MeshGeneratorBase >( childName, std::move( mesh ) );
}
Expand Down Expand Up @@ -81,7 +80,7 @@ void MeshManager::generateMeshes( DomainPartition & domain )

void MeshManager::generateMeshLevels( DomainPartition & domain )
{
this->forSubGroups< MeshGeneratorBase >( [&]( MeshGeneratorBase & meshGen )
forSubGroups< MeshGeneratorBase >( [&]( MeshGeneratorBase & meshGen )
{
string const & meshName = meshGen.getName();
domain.getMeshBodies().registerGroup< MeshBody >( meshName ).createMeshLevel( MeshBody::groupStructKeys::baseDiscretizationString() );
Expand Down Expand Up @@ -126,66 +125,28 @@ void MeshManager::importFields( DomainPartition & domain )
}

GEOS_LOG_RANK_0( GEOS_FMT( "{}: importing field data from mesh dataset", generator.getName() ) );

auto const importFields = [&generator]( ElementRegionBase const & region,
ElementSubRegionBase & subRegion,
MeshGeneratorBase::Block block,
std::map< string, string > const & fieldsMapping,
FieldIdentifiers & fieldsToBeSync )
{
std::unordered_set< string > const materialWrapperNames = getMaterialWrapperNames( subRegion );
// Writing properties
for( auto const & pair : fieldsMapping )
{
string const & meshFieldName = pair.first;
string const & geosFieldName = pair.second;
// Find destination
if( !subRegion.hasWrapper( geosFieldName ) )
{
// Skip - the user may have not enabled a particular physics model/solver on this destination region.
if( generator.getLogLevel() >= 1 )
{
GEOS_LOG_RANK_0( "Skipping import of " << meshFieldName << " -> " << geosFieldName <<
" on " << region.getName() << "/" << subRegion.getName() << " (field not found)" );
}

continue;
}

// Now that we know that the subRegion has this wrapper,
// we can add the geosFieldName to the list of fields to synchronize
fieldsToBeSync.addElementFields( { geosFieldName }, { region.getName() } );
WrapperBase & wrapper = subRegion.getWrapperBase( geosFieldName );
if( generator.getLogLevel() >= 1 )
{
GEOS_LOG_RANK_0( "Importing field " << meshFieldName << " into " << geosFieldName <<
" on " << region.getName() << "/" << subRegion.getName() );
}

bool const isMaterialField = materialWrapperNames.count( geosFieldName ) > 0 && wrapper.numArrayDims() > 1;
generator.importFieldOnArray( block, subRegion.getName(), meshFieldName, isMaterialField, wrapper );
}
};

dataRepository::Group & meshLevels = domain.getMeshBody( generator.getName() ).getMeshLevels();
meshLevels.forSubGroups< MeshLevel >( [&]( MeshLevel & meshLevel )
MeshBody & meshBody = domain.getMeshBody( generator.getName() );
meshBody.forMeshLevels( [&]( MeshLevel & meshLevel )
{
GEOS_LOG_RANK_0( GEOS_FMT( " mesh level = {}", meshLevel.getName() ) );
FieldIdentifiers fieldsToBeSync;
meshLevel.getElemManager().forElementSubRegionsComplete< CellElementSubRegion >(
[&]( localIndex,
localIndex,
ElementRegionBase const & region,
CellElementSubRegion & subRegion )
{
importFields( region, subRegion, MeshGeneratorBase::Block::VOLUMIC, generator.getVolumicFieldsMapping(), fieldsToBeSync );
GEOS_LOG_RANK_0( GEOS_FMT( " volumic fields on {}/{}", region.getName(), subRegion.getName() ) );
importFields( generator, region.getName(), subRegion, MeshGeneratorBase::Block::VOLUMIC, generator.getVolumicFieldsMapping(), fieldsToBeSync );
} );
meshLevel.getElemManager().forElementSubRegionsComplete< FaceElementSubRegion >(
[&]( localIndex,
localIndex,
ElementRegionBase const & region,
FaceElementSubRegion & subRegion )
{
importFields( region, subRegion, MeshGeneratorBase::Block::SURFACIC, generator.getSurfacicFieldsMapping(), fieldsToBeSync );
GEOS_LOG_RANK_0( GEOS_FMT( " surfaic fields on {}/{}", region.getName(), subRegion.getName() ) );
importFields( generator, region.getName(), subRegion, MeshGeneratorBase::Block::SURFACIC, generator.getSurfacicFieldsMapping(), fieldsToBeSync );
} );
CommunicationTools::getInstance().synchronizeFields( fieldsToBeSync, meshLevel, domain.getNeighbors(), false ); // TODO Validate this.
} );
Expand All @@ -197,4 +158,43 @@ void MeshManager::importFields( DomainPartition & domain )
} );
}

void MeshManager::importFields( MeshGeneratorBase const & generator,
string const & regionName,
ElementSubRegionBase & subRegion,
MeshGeneratorBase::Block const block,
std::map< string, string > const & fieldsMapping,
FieldIdentifiers & fieldsToBeSync )
{
std::unordered_set< string > const materialWrapperNames = getMaterialWrapperNames( subRegion );
// Writing properties
for( auto const & pair : fieldsMapping )
{
string const & meshFieldName = pair.first;
string const & geosFieldName = pair.second;
// Find destination
if( !subRegion.hasWrapper( geosFieldName ) )
{
// Skip - the user may have not enabled a particular physics model/solver on this destination region.
if( generator.getLogLevel() >= 1 )
{
GEOS_LOG_RANK_0( GEOS_FMT( " Skipping import of {} -> {} (field not found)", meshFieldName, geosFieldName ) );
}

continue;
}

// Now that we know that the subRegion has this wrapper,
// we can add the geosFieldName to the list of fields to synchronize
fieldsToBeSync.addElementFields( { geosFieldName }, { regionName } );
WrapperBase & wrapper = subRegion.getWrapperBase( geosFieldName );
if( generator.getLogLevel() >= 1 )
{
GEOS_LOG_RANK_0( GEOS_FMT( " {} -> {}", meshFieldName, geosFieldName ) );
}

bool const isMaterialField = materialWrapperNames.count( geosFieldName ) > 0 && wrapper.numArrayDims() > 1;
generator.importFieldOnArray( block, subRegion.getName(), meshFieldName, isMaterialField, wrapper );
}
}

} /* namespace geos */
17 changes: 17 additions & 0 deletions src/coreComponents/mesh/MeshManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "dataRepository/Group.hpp"
#include "mesh/DomainPartition.hpp"
#include "generators/MeshGeneratorBase.hpp"

namespace geos
{
Expand Down Expand Up @@ -74,6 +75,22 @@ class MeshManager : public dataRepository::Group
*/
void importFields( DomainPartition & domain );

/**
* @brief Import fields data
* @param[in] generator reference to mesh generator
* @param[in] regionName name of the region
* @param[in] subRegion reference to the subregion
* @param[in] block block type
* @param[in] fieldsMapping mapping for fields
* @param[out] fieldsToBeSync list of fields to synchronize
*/
static void importFields( MeshGeneratorBase const & generator,
string const & regionName,
ElementSubRegionBase & subRegion,
MeshGeneratorBase::Block block,
std::map< string, string > const & fieldsMapping,
FieldIdentifiers & fieldsToBeSync );

private:

/**
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/mesh/ParticleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Group * ParticleManager::createChild( string const & childKey, string const & ch
{
GEOS_ERROR_IF( !(CatalogInterface::hasKeyName( childKey )),
"KeyName ("<<childKey<<") not found in ObjectManager::Catalog" );
GEOS_LOG_RANK_0( "Adding Object " << childKey << " named " << childName << " from ObjectManager::Catalog." );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );

Group & particleRegions = this->getGroup( ParticleManager::groupKeyStruct::particleRegionsGroup() );
return &particleRegions.registerGroup( childName,
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/mesh/generators/MeshGeneratorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MeshGeneratorBase::MeshGeneratorBase( string const & name, Group * const parent

Group * MeshGeneratorBase::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding Mesh attribute: " << childKey << ", " << childName );
GEOS_LOG_RANK_0( GEOS_FMT( "{}: adding {} {}", getName(), childKey, childName ) );
std::unique_ptr< MeshComponentBase > comp = MeshComponentBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< MeshComponentBase >( childName, std::move( comp ) );
}
Expand Down
Loading

0 comments on commit 03417a1

Please sign in to comment.