ffeatools.modules.FFEA_rod.FFEA_rod Class Reference

Public Member Functions

def __init__ (self, filename=None, rod_no=0, num_rods=1, num_elements=0)
 
def get_num_dimensions (self, row)
 
def get_trajectory_length (self)
 
def load_trajectory (self)
 
def write_rod (self, filename)
 
def get_p_i (self, x)
 
def set_avg_energies (self)
 
def scale (self, scale_factor)
 
def translate (self, shift, translate_curr=True, translate_equil=True)
 
def calc_centroid (self, equil=False)
 
def rotate (self, xyz)
 

Data Fields

 rod_no
 
 filename
 
 end_of_header
 
 rod_id
 
 num_elements
 
 length
 
 num_rods
 
 num_frames
 
 equil_r
 
 equil_m
 
 current_r
 
 current_m
 
 perturbed_x_energy_positive
 
 perturbed_y_energy_positive
 
 perturbed_z_energy_positive
 
 twisted_energy_positive
 
 perturbed_x_energy_negative
 
 perturbed_y_energy_negative
 
 perturbed_z_energy_negative
 
 twisted_energy_negative
 
 material_params
 
 B_matrix
 
 p_i
 
 unperturbed_energy_type
 
 unperturbed_energy_dof
 
 unperturbed_energy
 
 centroid_traj
 
 initial_centroid
 

Detailed Description

Class for an FFEA rod object containing the raw data for an FFEA rod object.
The raw data is contained in attributes containing 3-D numpy arrays. One
dimension for time, another for the index, and the third for the positions.

Attributes:
    Header:
    filename: filename of the rod that's been loaded.
    end_of_header: line number where the header ends.
    rod_id: unique identifier for the rod. not used outside of the simulation
    itself.
    num_elements: number of nodes that make up the rod.
    length: length of the 1-D array that containing the rod's positional data.
    For example, a 10-element long 3-D rod has a num_elements of 30.
    num_rods: total number of rods in the simulation.
    
    Contents:
    current_r - current position of the nodes in the rod.
    current_m - current vectors for the material frames.
    equil_r - equilibrium configuration of the rod
    equil_m - equilibrium material frame of the rod
    perturbed x, y, z and twist energy, positive and negative - results
    from each stage of the numerical derivatives taken during the simulation.
    material_params - each node has the structure [stretch, twist, blank]
    B_matrix - the parameter for the bending energy. This one is a 4-element
    array specifying the contents of the 2x2 B matrix.
    
    Dragons:
    unperturbed_energy_type - an estimate of the unperturbed energy given
    by type (e.g. stretch, bend, twist)
    unperturbed_energy_dof - an estimate of the unperturbed energy, by
    degree of freedom (x, y, z, twist)

Constructor & Destructor Documentation

◆ __init__()

def ffeatools.modules.FFEA_rod.FFEA_rod.__init__ (   self,
  filename = None,
  rod_no = 0,
  num_rods = 1,
  num_elements = 0 
)
Initialize the rod object and load the contents of the trajectory.

Params:
    filename - the path to the .rodtraj file to be loaded.
    rod_no - give the rod a unique ID, if you like
    
Returns:
    nothing. But it populates every attribute in this object, save for
    dragons.

Member Function Documentation

◆ calc_centroid()

def ffeatools.modules.FFEA_rod.FFEA_rod.calc_centroid (   self,
  equil = False 
)

◆ get_num_dimensions()

def ffeatools.modules.FFEA_rod.FFEA_rod.get_num_dimensions (   self,
  row 
)
Get the number of dimensions for the row. For example, equil_r is stored
in row 1, and it's positions, so it's 3D. This will return 4 for
B_matrix because the B_matrix of each node is 4 elements long.

Referenced by ffeatools.modules.FFEA_rod.FFEA_rod.load_trajectory().

◆ get_p_i()

def ffeatools.modules.FFEA_rod.FFEA_rod.get_p_i (   self,
  x 
)
The rod trajectory files are only given in terms of the node positions.
If we want p_i, we have to reconstruct it.
Params: x, the array containing node positions (e.g. current_r, equil_r)
for each frame.
Returns: an array containing the p_i vectors for each frame.

◆ get_trajectory_length()

def ffeatools.modules.FFEA_rod.FFEA_rod.get_trajectory_length (   self)
Get the number of frames in the trajectory.
Input: nothing, but the file header info must already be loaded (see
__init__).
Output: sets the self.num_frames attribute.

◆ load_trajectory()

def ffeatools.modules.FFEA_rod.FFEA_rod.load_trajectory (   self)
Loads the trajectory. Fast, but also messy. The basic idea is that it allocates
a load of very large numpy arrays, then iterates over every frame, calling
rod_file.readline() for each line, loading that frame for that line into
the array, and then does .readline() again. It does that 14 times for the
14 rows in each frame. No, it's not pretty, you're right. It's not.
At least it's not trying to be clever.

Inputs: none, it already has the filename set in self.filename and all
the meta info.
Outputs: none, but it populates all the 'contents' arrays.

◆ rotate()

def ffeatools.modules.FFEA_rod.FFEA_rod.rotate (   self,
  xyz 
)

◆ scale()

def ffeatools.modules.FFEA_rod.FFEA_rod.scale (   self,
  scale_factor 
)

◆ set_avg_energies()

def ffeatools.modules.FFEA_rod.FFEA_rod.set_avg_energies (   self)
The rod has 4 degrees of freedon (x, y, z and twist) and 3 energy types
(stretch, bend and twist). This function creates 2 arrays, filtering
the energy by either DOF or energy type. It uses the average of the
positive and negative perturbations done by the numerical differentation
of the energy function. So it's not any more wrong than the differentiation
itself. Right?
This function isn't actually used in the rod analysis anywhere, it's mostly
for testing.
Params: none, but make sure to initialize the rod properly beforehand.
Returns: none, but populates the attributes unperturbed_energy_type and
unperturbed_energy_dof.

◆ translate()

def ffeatools.modules.FFEA_rod.FFEA_rod.translate (   self,
  shift,
  translate_curr = True,
  translate_equil = True 
)

◆ write_rod()

def ffeatools.modules.FFEA_rod.FFEA_rod.write_rod (   self,
  filename 
)

Field Documentation

◆ B_matrix

ffeatools.modules.FFEA_rod.FFEA_rod.B_matrix

◆ centroid_traj

ffeatools.modules.FFEA_rod.FFEA_rod.centroid_traj

◆ current_m

◆ current_r

◆ end_of_header

ffeatools.modules.FFEA_rod.FFEA_rod.end_of_header

◆ equil_m

◆ equil_r

◆ filename

◆ initial_centroid

ffeatools.modules.FFEA_rod.FFEA_rod.initial_centroid

◆ length

ffeatools.modules.FFEA_rod.FFEA_rod.length

◆ material_params

ffeatools.modules.FFEA_rod.FFEA_rod.material_params

◆ num_elements

◆ num_frames

◆ num_rods

ffeatools.modules.FFEA_rod.FFEA_rod.num_rods

◆ p_i

◆ perturbed_x_energy_negative

ffeatools.modules.FFEA_rod.FFEA_rod.perturbed_x_energy_negative

◆ perturbed_x_energy_positive

ffeatools.modules.FFEA_rod.FFEA_rod.perturbed_x_energy_positive

◆ perturbed_y_energy_negative

ffeatools.modules.FFEA_rod.FFEA_rod.perturbed_y_energy_negative

◆ perturbed_y_energy_positive

ffeatools.modules.FFEA_rod.FFEA_rod.perturbed_y_energy_positive

◆ perturbed_z_energy_negative

ffeatools.modules.FFEA_rod.FFEA_rod.perturbed_z_energy_negative

◆ perturbed_z_energy_positive

ffeatools.modules.FFEA_rod.FFEA_rod.perturbed_z_energy_positive

◆ rod_id

ffeatools.modules.FFEA_rod.FFEA_rod.rod_id

◆ rod_no

ffeatools.modules.FFEA_rod.FFEA_rod.rod_no

◆ twisted_energy_negative

ffeatools.modules.FFEA_rod.FFEA_rod.twisted_energy_negative

◆ twisted_energy_positive

ffeatools.modules.FFEA_rod.FFEA_rod.twisted_energy_positive

◆ unperturbed_energy

ffeatools.modules.FFEA_rod.FFEA_rod.unperturbed_energy

◆ unperturbed_energy_dof

ffeatools.modules.FFEA_rod.FFEA_rod.unperturbed_energy_dof

◆ unperturbed_energy_type

ffeatools.modules.FFEA_rod.FFEA_rod.unperturbed_energy_type

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