class pd3::python::core::Study
class pd3::python::core::Study
: public pd3.python.protocols.protoStudy
Python intermediate for libpd3._Study.
Allow for the construction of a system, specification of study conditions, and finally the abillity to run a study.
Summary
| Members | Descriptions |
|---|---|
stress |
Property to set the stress states. |
__init__(self, Optional[Callable[[State], Result]], Optional[np.ndarray]) |
General constructor for starting a study. |
create_node(self, *args) → Node |
Overloaded function to create a node in the system. |
connect(self, Node, Node, Burgers, Miller, Miller, int) |
Connects 2 given nodes with a dislocation segment. |
remove_node(self, Node) |
Removes nodes and connecting segments. |
remove_segment(self, Node, Node) |
Removes nodes segment between nodes. |
load_file(self, str) |
Binds a pd3.Series from file path to the system. |
load_protobuf(self, Series) |
Binds a pd3.Series protobuf to the system. |
export_protobuf(self) → Series |
Creates a pd3.Series protobuf from system. |
log(self, int, Optional[float], LoggerType, str) |
Writes data in a given format. |
run(self) |
Runs the simulation to max_steps. |
step(self) |
Runs a single simulation step. |
study_condition(self, Callable[[State], Result]) |
Property to set a study condition callback. |
line(study, Burgers, Miller, Miller) →Line |
Creates a dislocation utils.Line. |
Members
stress
Property to set the stress states.
Study.stress defines a property and a setter that sets a 3x3 stress tensor. Caution: Symmetry is not enforced.
__init__
__init__(self, study_condition : Optional[Callable[[State], Result]]=None, stress : Optional[np.ndarray]=None)
General constructor for starting a study.
Creates a Study and optionally seeds initial parameters:
Parameters
-
study_conditioncallback to manage a study. See Study.study_condition -
stressthe external stress applied on the system. See Study.stress
create_node
create_node(self, *args) → Node
Overloaded function to create a node in the system.
create_node will add a Node to the active pd3::System. For convenience, the function is overloaded as follows:
Parameters
np.ndarrayThe numpy vector where to create a node.
or
Parameters
-
np.ndarrayThe numpy vector where to create a node. -
node_typeThe pd3::NodeType of this node.
or
Parameters
xyzThe position in space which to create the node.
or
Parameters
-
xyzThe position in space which to create the node. -
node_typeThe pd3::NodeType of this node.
connect
connect(self, node_1 : Node, node_2 : Node, burgers : Burgers, plane : Miller=Miller((0, 0, 0)), normal : Miller=Miller((0, 0, 0)), cell : int=0)
Connects 2 given nodes with a dislocation segment.
Connects 2 dislocation nodes with a dislocation line segment specified by the arguments. It is important to note that the dislocation segment will be recorded relative to node_1.
Parameters
-
node_1the leading node. -
node_2the trailing node. -
burgersthe relative burgers vector fromnode_1tonode_2. -
planethe slip plane that the dislocation line is on. -
normalthe stacking fault normal for this segment. -
cellthe periodic cell reflection for the given segment.
remove_node
remove_node(self, node : Node)
Removes nodes and connecting segments.
Parameters
nodethe node to remove.
remove_segment
remove_segment(self, node : Node, connect : Node)
Removes nodes segment between nodes.
NOTE: This does not remove the nodes, just the segment.
Parameters
-
nodea node of the segment to remove. -
connectthe other node of the segment to remove.
load_file
load_file(self, file_path : str)
Binds a pd3.Series from file path to the system.
Given a .pb or .pbtxt pd3.Series file path, this will bind the contents to the study system.
load_protobuf
load_protobuf(self, series : Series)
Binds a pd3.Series protobuf to the system.
Provided a pd3.Series protobuf, this binds the first state to the system.
Parameters
seriesA pd3.Series protobuf with the desired system.
export_protobuf
export_protobuf(self) → Series
Creates a pd3.Series protobuf from system.
Creates and binds the current system to a pd3.Series protobuf.
log
log(self, time_step : int=0, dt : Optional[float]=None, type : LoggerType=config_pb2.PROTO, location : str="/tmp/results")
Writes data in a given format.
Exports data (defaults to timestep 0) with a given type (of pd3::LoggerType, defaulting to PROTO) to a particular location.
run
run(self)
Runs the simulation to max_steps.
Runs the simulation to max_step prescribed in the config. Note that Study.study_condition will be called 1 + max_steps size, where the first call allows a chance for applying some sort of initial condition.
step
step(self)
Runs a single simulation step.
Runs a single simulation step. Note that Study.study_condition will only be called once.
study_condition
study_condition(self, callback : Callable[[State], Result])
Property to set a study condition callback.
Study.study_condition defines a property and a setter for establishing a callback during simulation. This callback can be used to prescribe boundary conditions, initial conditions, or to permute the system.
line
line(study, burgers : Burgers, plane : Miller=Miller((0, 0, 0)), normal : Miller=Miller((0, 0, 0))) → Line
Creates a dislocation utils.Line.
Creates a dislocation line with a set plane, stacking fault normal and burgers vector.
Parameters
-
studySelf instance. -
burgersThe burgers vector that the line should have. -
planeThe slip plane that the dislocation line lies on. -
normalThe stacking fault normal of the provided line.