Skip to content

Commit

Permalink
Merge pull request #209 from lanl/Nathaniel2
Browse files Browse the repository at this point in the history
Nathaniel2
  • Loading branch information
nathanielmorgan authored Jul 11, 2024
2 parents 3c49b05 + 270a5bb commit a1d2572
Show file tree
Hide file tree
Showing 7 changed files with 647 additions and 69 deletions.
28 changes: 14 additions & 14 deletions single-node-refactor/src/common/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ void bubble_sort(size_t arr[], const size_t num)
} // end for i
} // end function

struct zones_in_MaterialPoint_t
struct zones_in_elem_t
{
private:
size_t num_zones_in_elem_;
public:
zones_in_MaterialPoint_t() {
zones_in_elem_t() {
};

zones_in_MaterialPoint_t(const size_t num_zones_in_elem_inp) {
zones_in_elem_t(const size_t num_zones_in_elem_inp) {
this->num_zones_in_elem_ = num_zones_in_elem_inp;
};

Expand All @@ -138,15 +138,15 @@ struct zones_in_MaterialPoint_t
};

// if material points are defined strictly internal to the element.
struct legendre_in_MaterialPoint_t
struct legendre_in_elem_t
{
private:
size_t num_leg_gauss_in_elem_;
public:
legendre_in_MaterialPoint_t() {
legendre_in_elem_t() {
};

legendre_in_MaterialPoint_t(const size_t num_leg_gauss_in_elem_inp) {
legendre_in_elem_t(const size_t num_leg_gauss_in_elem_inp) {
this->num_leg_gauss_in_elem_ = num_leg_gauss_in_elem_inp;
};

Expand All @@ -165,15 +165,15 @@ struct legendre_in_MaterialPoint_t
};

/// if material points are defined at element interfaces
struct lobatto_in_MaterialPoint_t
struct lobatto_in_elem_t
{
private:
size_t num_lob_gauss_in_elem_;
public:
lobatto_in_MaterialPoint_t() {
lobatto_in_elem_t() {
};

lobatto_in_MaterialPoint_t(const size_t num_lob_gauss_in_elem_inp) {
lobatto_in_elem_t(const size_t num_lob_gauss_in_elem_inp) {
this->num_lob_gauss_in_elem_ = num_lob_gauss_in_elem_inp;
};

Expand Down Expand Up @@ -249,9 +249,9 @@ struct mesh_t
CArrayKokkos<size_t> surfs_in_elem; ///< Surfaces on an element

// CArrayKokkos <size_t> zones_in_elem; ///< Zones in an element
zones_in_MaterialPoint_t zones_in_elem; ///< Zones in an element
lobatto_in_MaterialPoint_t lobatto_in_elem; ///< Gauss Lobatto points in an element
legendre_in_MaterialPoint_t legendre_in_elem; ///< Gauss Legendre points in an element
zones_in_elem_t zones_in_elem; ///< Zones in an element
lobatto_in_elem_t lobatto_in_elem; ///< Gauss Lobatto points in an element
legendre_in_elem_t legendre_in_elem; ///< Gauss Legendre points in an element

// ---- Node Data Definitions ---- //
size_t num_nodes; ///< Number of nodes in the mesh
Expand Down Expand Up @@ -348,10 +348,10 @@ struct mesh_t

nodes_in_elem = DCArrayKokkos<size_t>(num_elems, num_nodes_in_elem, "mesh.nodes_in_elem");
corners_in_elem = CArrayKokkos<size_t>(num_elems, num_nodes_in_elem, "mesh.corners_in_elem");
zones_in_elem = zones_in_MaterialPoint_t(num_zones_in_elem);
zones_in_elem = zones_in_elem_t(num_zones_in_elem);
surfs_in_elem = CArrayKokkos<size_t>(num_elems, num_surfs_in_elem, "mesh.surfs_in_zone");
nodes_in_zone = CArrayKokkos<size_t>(num_zones, num_nodes_in_zone, "mesh.nodes_in_zone");
legendre_in_elem = legendre_in_MaterialPoint_t(num_leg_gauss_in_elem);
legendre_in_elem = legendre_in_elem_t(num_leg_gauss_in_elem);

return;
}; // end method
Expand Down
2 changes: 1 addition & 1 deletion single-node-refactor/src/common/mesh_inputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct mesh_input_t
int num_dims = 3; ///< Number of dimensions for the mesh
mesh_input::source source = mesh_input::none; ///< Source of mesh, file or generate
std::string file_path = ""; ///< Absolute path of mesh file
mesh_input::type type; ///< Type of mesh to generate if
mesh_input::type type; ///< Type of mesh to generate if

double origin[3] = {0.0, 0.0, 0.0}; ///< Mesh origin for generating a mesh
double length[3] = {0.0, 0.0, 0.0}; ///< x,y,z length of generated mesh
Expand Down
31 changes: 28 additions & 3 deletions single-node-refactor/src/common/region.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,18 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ==============================================================================
namespace region
{
// for tagging boundary faces
// for tagging volumes to paint material onto the mesh
enum vol_tag
{
no_volume = 0,
global = 1, // tag every elements in the mesh
box = 2, // tag all elements inside a box
cylinder = 3, // tag all elements inside a cylinder
sphere = 4, // tag all elements inside a sphere
readVoxelFile = 5, // tag all elements in a voxel mesh input WARING: Currently unimplemented
readVoxelFile = 5, // tag all elements in a voxel mesh (structured VTK)
readPolycrystalFile = 6, // tag all elements in a polycrystallince voxel mesh (structured VTK)
readSTLFile = 7, // read a STL file and voxelize it
readVTKFile = 8, // tag all elements in a VTK mesh (unstructured mesh)
};
} // end of namespace

Expand All @@ -62,7 +65,7 @@ static std::map<std::string, region::vol_tag> region_type_map
{ "box", region::box },
{ "sphere", region::sphere },
{ "cylinder", region::cylinder },
{ "readVoxelFile", region::readVoxelFile }
{ "voxel_file", region::readVoxelFile }
};

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -109,12 +112,31 @@ struct reg_fill_t
double origin[3] = {0.0, 0.0, 0.0}; ///< Origin for region
};


/////////////////////////////////////////////////////////////////////////////
///
/// \struct reg_fill_host_t
///
/// \brief Geometry data, on the cpu only, for regions of materials/states
///
/////////////////////////////////////////////////////////////////////////////
struct reg_fill_host_t
{
std::string file_path; ///< path of mesh file

// scale parameters for input mesh files
double scale_x = 1.0;
double scale_y = 1.0;
double scale_z = 1.0;
};

// ----------------------------------
// valid inputs for a material fill
// ----------------------------------
static std::vector<std::string> str_region_inps
{
"type",
"file_path",
"material_id",
"x1",
"x2",
Expand All @@ -124,6 +146,9 @@ static std::vector<std::string> str_region_inps
"z2",
"radius1",
"radius2",
"scale_x",
"scale_y",
"scale_z",
"velocity",
"u",
"v",
Expand Down
4 changes: 3 additions & 1 deletion single-node-refactor/src/common/simulation_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ struct SimulationParameters_t

std::vector<solver_input_t> solver_inputs; ///< Solvers to use during the simulation

DCArrayKokkos<reg_fill_t> region_fills; ///< Region data for simulation mesh, set the initial conditions
CArrayKokkos<reg_fill_t> region_fills; ///< Region data for simulation mesh, set the initial conditions

CArray<reg_fill_host_t> region_fills_host; ///< Region data on CPU, set the initial conditions

}; // simulation_parameters_t

Expand Down
Loading

0 comments on commit a1d2572

Please sign in to comment.