Skip to main content

PeriDigmDiscretization

C++: phynexis::peridigm::PeriDigmDiscretization
Python: phynexis.peridigm.PeriDigmDiscretization
Header: src/peridigm/peridigm_discretization.hpp

Description

Represents the spatial discretization of a domain into peridynamic nodes. Supports initialization from STL files, STL models, distance maps, or regular grids.

Constructors

PeriDigmDiscretization()

Default constructor. Creates an empty discretization with type = Type.level_set.

Example:

import phynexis
disc = phynexis.peridigm.PeriDigmDiscretization()
print(disc.type)

Output:

Type.level_set

Methods

init_from_stl(stl_file, num_ele_each)

Initializes the discretization from an STL file.

Parameters:

ParameterTypeDescription
stl_filestrPath to the STL file
num_ele_eachintNumber of elements in each dimension

Example:

disc = phynexis.peridigm.PeriDigmDiscretization()
# Requires a valid STL file:
# disc.init_from_stl("/path/to/model.stl", 20)
# print(len(disc.nodes))

init_from_stl(stl_model, num_ele_each)

Overloaded version that accepts an STLModel object directly.

Parameters:

ParameterTypeDescription
stl_modelSTLModelSTL model object
num_ele_eachintNumber of elements in each dimension

Example:

# stl = phynexis.utils.STLModel()
# ... load or create stl ...
# disc = phynexis.peridigm.PeriDigmDiscretization()
# disc.init_from_stl(stl, 20)

init_from_distance_map(txt_file)

Initializes the discretization from a distance map text file.

Parameters:

ParameterTypeDescription
txt_filestrPath to the distance map file

initialize_from_grid(corner, len, num_ele_each)

Initializes the discretization from a regular grid.

Parameters:

ParameterTypeDescription
cornerVec3dCorner of the grid (minimum x,y,z)
lenVec3dLength of the grid in each dimension
num_ele_eachintNumber of elements in each dimension

Example:

disc = phynexis.peridigm.PeriDigmDiscretization()
corner = phynexis.utils.Vec3d(0, 0, 0)
length = phynexis.utils.Vec3d(1, 1, 1)
disc.initialize_from_grid(corner, length, 10)
print(len(disc.nodes))

make_porosity(porosity)

Scales node volumes to achieve the specified porosity fraction.

Parameters:

ParameterTypeDescription
porosityfloatDesired porosity (0–1)

write_node_file(result_dir)

Writes node information to the specified directory.

Parameters:

ParameterTypeDescription
result_dirstrOutput directory path

get_node_size()

Returns the average node size computed from adjacent node distances.

Returns: float — average node size

Properties

PropertyTypeAccessDescription
typePeriDigmDiscretization.Typeread/writeDiscretization type (level_set or tetmesh)
domain_splittorDomainSplittorread/writeDomain splittor used
nodeslist[Vec3d]read/writeNode positions
node_block_indiceslist[int]read/writeBlock index for each node
node_volslist[float]read/writeVolume for each node

Enums

Type

ValueDescription
level_setLevel set based discretization
tetmeshTetrahedral mesh based discretization