NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble::DataManager Class Reference

#include <nimble_data_manager.h>

Public Member Functions

 DataManager (const nimble::Parser &parser, const nimble::GenesisMesh &mesh)
 Constructor.
 
 ~DataManager ()=default
 Destructor.
 
void InitializeOutput (const std::string &filename)
 Initialize the data for Exodus output.
 
const nimble::ParserGetParser () const
 Return constant reference to parser information.
 
const nimble::GenesisMeshGetMesh () const
 Return constant reference to mesh.
 
std::shared_ptr< nimble::ModelDataBaseGetModelData ()
 Return shared pointer to ModelData objet.
 
const nimble::FieldIdsGetFieldIDs () const
 Return a const reference to the field IDs.
 
nimble::FieldIdsGetFieldIDs ()
 Return reference to the field IDs.
 
std::shared_ptr< nimble::VectorCommunicatorGetVectorCommunicator ()
 Return shared pointer to VectorCommunicator objet.
 
void WriteOutput (double time_current)
 Write output of simulations.
 
std::shared_ptr< nimble::ExodusOutputGetExodusOutput ()
 
void SetBlockMaterialInterfaceFactory (const std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > &block_material_factory)
 Set BlockMaterialInterfaceFactoryBase object and initialize block data information.
 
const std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > & GetBlockMaterialInterfaceFactory () const
 Return shared pointer to BlockMaterialInterfaceFactoryBase object.
 
std::shared_ptr< nimble::BoundaryConditionManagerGetBoundaryConditionManager ()
 Return shared pointer to BoundaryConditionManager object.
 

Protected Member Functions

void Initialize ()
 Initialize data for simulation.
 

Protected Attributes

const nimble::Parserparser_
 
const nimble::GenesisMeshmesh_
 
std::shared_ptr< nimble::ModelDataBasemodel_data_ = nullptr
 
nimble::FieldIds field_ids_
 
std::shared_ptr< nimble::VectorCommunicatorvector_communicator_ = nullptr
 
std::shared_ptr< nimble::ExodusOutputexodus_output_ = nullptr
 
std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBaseblock_material_factory_ = nullptr
 
std::shared_ptr< nimble::BoundaryConditionManagerboundary_condition_ = nullptr
 

Constructor & Destructor Documentation

◆ DataManager()

nimble::DataManager::DataManager ( const nimble::Parser & parser,
const nimble::GenesisMesh & mesh )

Constructor.

Parameters
parserReference to parser information
meshReference to mesh
70 : parser_(parser),
71 mesh_(mesh),
73 field_ids_(),
74 vector_communicator_(nullptr),
75 boundary_condition_(new nimble::BoundaryConditionManager())
76{
77 Initialize();
78}
const nimble::Parser & parser_
Definition nimble_data_manager.h:191
std::shared_ptr< nimble::ModelDataBase > model_data_
Definition nimble_data_manager.h:193
void Initialize()
Initialize data for simulation.
Definition nimble_data_manager.cc:81
const nimble::GenesisMesh & mesh_
Definition nimble_data_manager.h:192
nimble::FieldIds field_ids_
Definition nimble_data_manager.h:195
std::shared_ptr< nimble::VectorCommunicator > vector_communicator_
Definition nimble_data_manager.h:197
std::shared_ptr< nimble::BoundaryConditionManager > boundary_condition_
Definition nimble_data_manager.h:202

◆ ~DataManager()

nimble::DataManager::~DataManager ( )
default

Destructor.

Member Function Documentation

◆ GetBlockMaterialInterfaceFactory()

const std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > & nimble::DataManager::GetBlockMaterialInterfaceFactory ( ) const

Return shared pointer to BlockMaterialInterfaceFactoryBase object.

Returns
Shared pointer
194{
196}
std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > block_material_factory_
Definition nimble_data_manager.h:200

◆ GetBoundaryConditionManager()

std::shared_ptr< nimble::BoundaryConditionManager > nimble::DataManager::GetBoundaryConditionManager ( )
inline

Return shared pointer to BoundaryConditionManager object.

Returns
Shared pointer
181 {
182 return boundary_condition_;
183 }

◆ GetExodusOutput()

std::shared_ptr< nimble::ExodusOutput > nimble::DataManager::GetExodusOutput ( )
inline
159 {
160 return exodus_output_;
161 }
std::shared_ptr< nimble::ExodusOutput > exodus_output_
Definition nimble_data_manager.h:198

◆ GetFieldIDs() [1/2]

nimble::FieldIds & nimble::DataManager::GetFieldIDs ( )
inline

Return reference to the field IDs.

Returns
Field IDs
138 {
139 return field_ids_;
140 }

◆ GetFieldIDs() [2/2]

const nimble::FieldIds & nimble::DataManager::GetFieldIDs ( ) const
inline

Return a const reference to the field IDs.

Returns
Field IDs
129 {
130 return field_ids_;
131 }

◆ GetMesh()

const nimble::GenesisMesh & nimble::DataManager::GetMesh ( ) const
inline

Return constant reference to mesh.

Returns
Reference to mesh
111 {
112 return mesh_;
113 }

◆ GetModelData()

std::shared_ptr< nimble::ModelDataBase > nimble::DataManager::GetModelData ( )
inline

Return shared pointer to ModelData objet.

Returns
Shared pointer
120 {
121 return model_data_;
122 }

◆ GetParser()

const nimble::Parser & nimble::DataManager::GetParser ( ) const
inline

Return constant reference to parser information.

Returns
Reference to parser information
102 {
103 return parser_;
104 }

◆ GetVectorCommunicator()

std::shared_ptr< nimble::VectorCommunicator > nimble::DataManager::GetVectorCommunicator ( )
inline

Return shared pointer to VectorCommunicator objet.

Returns
Shared pointer
147 {
149 }

◆ Initialize()

void nimble::DataManager::Initialize ( )
protected

Initialize data for simulation.

82{
83 const auto dim = static_cast<int>(mesh_.GetDim());
84 const auto num_nodes = static_cast<int>(mesh_.GetNumNodes());
85
86 //--- Create VectorCommunicator
87#ifdef NIMBLE_HAVE_TRILINOS
88 auto comm = (parser_.UseTpetra()) ? Tpetra::getDefaultComm() : Teuchos::RCP<const Teuchos::Comm<int>>();
89#else
90 int comm = 0;
91#endif
92 vector_communicator_ = std::make_shared<nimble::VectorCommunicator>(dim, num_nodes, comm);
93
94 std::vector<int> global_node_ids(num_nodes);
95 int const* const global_node_ids_ptr = mesh_.GetNodeGlobalIds();
96 for (int n = 0; n < num_nodes; ++n) { global_node_ids[n] = global_node_ids_ptr[n]; }
97
98 // DJL
99 // Here is where the initialization occurs for MPI operations
100 // In this call, each rank determines which nodes are shared with which other
101 // ranks This information is stored so that the vector reductions will work
102 // later
103 vector_communicator_->Initialize(global_node_ids);
104
105 //--- Create ModelData
106 if (parser_.UseUQ()) {
107#ifdef NIMBLE_HAVE_UQ
108 model_data_ = std::make_shared<nimble_uq::ModelData>();
109#else
110 NIMBLE_ABORT(" Wrong environment !\n");
111#endif
112 } else {
113 model_data_ = std::make_shared<nimble_kokkos::ModelData>();
114 }
115
116 model_data_->SetDimension(dim);
117
118 //
119 // Initialize the boundary condition manager
120 //
121
122 std::map<int, std::string> const& node_set_names = mesh_.GetNodeSetNames();
123 std::map<int, std::vector<int>> const& node_sets = mesh_.GetNodeSets();
124 std::map<int, std::string> const& side_set_names = mesh_.GetSideSetNames();
125 std::map<int, std::vector<int>> const& side_sets = mesh_.GetSideSets();
126 std::vector<std::string> const& bc_strings = parser_.GetBoundaryConditionStrings();
127 std::string time_integration_scheme = parser_.TimeIntegrationScheme();
128 boundary_condition_->Initialize(
129 node_set_names, node_sets, side_set_names, side_sets, bc_strings, dim, time_integration_scheme);
130
131 //
132 // Initialize vectors for storing fields
133 //
134
135 if (time_integration_scheme == "explicit")
136 field_ids_.lumped_mass = model_data_->AllocateNodeData(nimble::SCALAR, "lumped_mass", num_nodes);
137
138 field_ids_.reference_coordinates = model_data_->AllocateNodeData(nimble::VECTOR, "reference_coordinate", num_nodes);
139 field_ids_.displacement = model_data_->AllocateNodeData(nimble::VECTOR, "displacement", num_nodes);
140 field_ids_.velocity = model_data_->AllocateNodeData(nimble::VECTOR, "velocity", num_nodes);
141 field_ids_.acceleration = model_data_->AllocateNodeData(nimble::VECTOR, "acceleration", num_nodes);
142
143 field_ids_.internal_force = model_data_->AllocateNodeData(nimble::VECTOR, "internal_force", num_nodes);
144 field_ids_.external_force = model_data_->AllocateNodeData(nimble::VECTOR, "external_force", num_nodes);
145
146 field_ids_.contact_force = model_data_->AllocateNodeData(nimble::VECTOR, "contact_force", num_nodes);
147
148 if (time_integration_scheme == "quasistatic") {
149 //
150 // These variables are used in the "quasi-static" simulations
151 //
152 model_data_->AllocateNodeData(nimble::VECTOR, "trial_displacement", num_nodes);
153 model_data_->AllocateNodeData(nimble::VECTOR, "displacement_fluctuation", num_nodes);
154 model_data_->AllocateNodeData(nimble::VECTOR, "trial_internal_force", num_nodes);
155 model_data_->AllocateNodeData(nimble::SCALAR, "skin_node", num_nodes);
156 }
157
158 model_data_->SetReferenceCoordinates(mesh_);
159}
@ SCALAR
Definition nimble_data_utils.h:88
@ VECTOR
Definition nimble_data_utils.h:89
#define NIMBLE_ABORT(...)
Definition nimble_macros.h:87

◆ InitializeOutput()

void nimble::DataManager::InitializeOutput ( const std::string & filename)

Initialize the data for Exodus output.

Parameters
filenameFile name for the output files
163{
164 std::vector<std::string> global_data_labels;
165
166 exodus_output_ = std::shared_ptr<nimble::ExodusOutput>(new nimble::ExodusOutput);
167 exodus_output_->Initialize(filename, mesh_);
168
169 auto& node_data_labels_for_output = model_data_->GetNodeDataLabelsForOutput();
170 auto& elem_data_labels_for_output = model_data_->GetElementDataLabelsForOutput();
171 auto& derived_elem_data_labels = model_data_->GetDerivedElementDataLabelsForOutput();
172
173 model_data_->InitializeExodusOutput(*this);
174
175 exodus_output_->InitializeDatabase(
176 mesh_, global_data_labels, node_data_labels_for_output, elem_data_labels_for_output, derived_elem_data_labels);
177}

◆ SetBlockMaterialInterfaceFactory()

void nimble::DataManager::SetBlockMaterialInterfaceFactory ( const std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > & block_material_factory)

Set BlockMaterialInterfaceFactoryBase object and initialize block data information.

188{
189 block_material_factory_ = block_material_factory;
190}

◆ WriteOutput()

void nimble::DataManager::WriteOutput ( double time_current)

Write output of simulations.

Parameters
[in]time_currentTime value
181{
182 model_data_->WriteExodusOutput(*this, time_current);
183}

Member Data Documentation

◆ block_material_factory_

std::shared_ptr<nimble::BlockMaterialInterfaceFactoryBase> nimble::DataManager::block_material_factory_ = nullptr
protected

◆ boundary_condition_

std::shared_ptr<nimble::BoundaryConditionManager> nimble::DataManager::boundary_condition_ = nullptr
protected

◆ exodus_output_

std::shared_ptr<nimble::ExodusOutput> nimble::DataManager::exodus_output_ = nullptr
protected

◆ field_ids_

nimble::FieldIds nimble::DataManager::field_ids_
protected

◆ mesh_

const nimble::GenesisMesh& nimble::DataManager::mesh_
protected

◆ model_data_

std::shared_ptr<nimble::ModelDataBase> nimble::DataManager::model_data_ = nullptr
protected

◆ parser_

const nimble::Parser& nimble::DataManager::parser_
protected

◆ vector_communicator_

std::shared_ptr<nimble::VectorCommunicator> nimble::DataManager::vector_communicator_ = nullptr
protected

The documentation for this class was generated from the following files: