GraphNet: Discrete element modeling for network connected materials
Applications to polymeric networks
Public Member Functions | Public Attributes | List of all members
sacNetwork Class Reference

#include <sac_network.h>

Inheritance diagram for sacNetwork:
Inheritance graph
[legend]
Collaboration diagram for sacNetwork:
Collaboration graph
[legend]

Public Member Functions

 sacNetwork ()
 Default constructor. More...
 
 ~sacNetwork ()
 Default destructor. More...
 
 sacNetwork (sacNetwork const &)
 Copy constructor. More...
 
 sacNetwork (string &fname, bool from_dump=false)
 Constructor that instantiates a sacNetwork object according to given {fname} file. Please note that there are no checks made on the GMSH .msh filepath and that responsibility is left to the user. More...
 
void clear ()
 Clears extra variables declared by sacNetwork object. Called by destructor. More...
 
void malloc_network ()
 Extends parent class' function to add memory allocation for extra class variables. More...
 
void load_network (string &)
 Overrides parent class' function to initialize extra variables. Called by sacNetwork(string& fname). More...
 
virtual void get_forces (bool) override
 Overrides parent class' function. Calculates forces along edges of the polymer network graph (i.e forces in each polymer). The forces are then assigned to nodes which prepares the network for the optimization step. If update_damage is true, the appropriate damage metric is also updated. If damage exceeds predefined thresholds, the edge is broken. Hidden lengths are also opened according to damage in these hidden bonds. The function does not return anything as it updates the objects forces directly. More...
 
- Public Member Functions inherited from Network
 Network ()
 Implements a network of discrete chains. More...
 
 Network (Network const &source)
 Copy constuctor for class Network. More...
 
 Network (string &fname, bool from_dump=false)
 Constructor that instantiates a Network object according to given {fname} file. Please note that there are no checks made on the GMSH .msh filepath and that responsibility is left to the user. More...
 
virtual ~Network ()
 Destructor for class network. More...
 
Network const & operator= (Network const &other)
 Overloads assignment operator (=) to implement copy constructor. More...
 
virtual void build_network ()
 This function is for users to build custom networks. It has no body and implements nothing. More...
 
void side_nodes (float max_x=MAXBOUND_X, float max_y=MAXBOUND_Y)
 Gives the boundary nodes for a network. More...
 
void remove_duplicates (int &)
 Removes duplicate edges. A much more efficient version can be made of this program. But it is called only once in the simulation, so this should be fine. More...
 
void add_long_range_egdes_y (int, float)
 Adds y-directional long range edges to the network. Chooses two nodes uniformly at random from the n_add divisions in x_direction such that the distance between them is at least 0.25*L_MEAN and at max L_MEAN. More...
 
void add_long_range_egdes_random (int, float)
 Adds random long range edges to the network. Chooses two nodes uniformly at random and adds an edge with x/L = 0.25 (i.e. prestressed) More...
 
void load_from_dump (string &)
 This function loads the last network state from a dump file. This is called by the Network constructor load_from_dump is set to true. Do not load from dump if network has already broken. More...
 
void apply_crack (Cracklist &)
 Adds random cracks in the Network object. This is implemented by removing all connections and nodes that lie {entirely} within the ellipses specified in alist. Please note this assumption may be relaxed and a probabilistic measure may be introduced to remove some connections so as to simulate small world networks (cluster networks) This is managed by the PROB_REMOVAL parameter in params.h. More...
 
void make_edge_connections (float dely_allowed=10.0)
 Adds PBC bonds to the network according to dely_allowed. More...
 
virtual void move_top_plate ()
 Moves the top plate according to velocity supplied in vel.h. More...
 
virtual void get_plate_forces (float *, int)
 Writes the forces on the top plate the supplied plate_forces array. More...
 
virtual void optimize (float eta=0.1, float alpha=0.9, int max_iter=800)
 Equilibriates the Network object using RMSProp algorithm due to G. Hinton et al (a gradient based force minimization over each node). Stops when maximum force on node is less than TOL specified in params.h or max_iter is reached. More...
 
virtual void qd_optimize (float C=0.001, int max_iter=800)
 Equilibriates the Network object using an Implicit scheme based on solving the quasi-dynamic equation. More...
 
float get_weight ()
 Gets the total length of all polymer chains active in the network. More...
 
float set_weight (float)
 Sets the total length of all polymer chains according to supplied weight parameter. Also prints out the new average polymer contour lengths. More...
 
bool get_stats (float force_threshold=1000.0)
 Prints out certain statistics of the network object. More...
 
int get_current_edges ()
 Gets the active (load-bearing) edges in the Network object. Also prints out that info to STDOUT or piped OUT. More...
 
virtual void plotNetwork (int, bool)
 Plots the graph of the network. Note the edges in the graph just signify connection between two nodes and do not represent the actual polymer geometry in any sense. Note that this plot will be saved as .png file in the folder specified by FLDR_STRING in params.h. More...
 
void copy (Network const &source)
 Implements the body of the copy constuctor. Allocates memory and does the appropriate assignments. More...
 
void dump (int, bool first_time=false)
 Dumps the network information for an iteration in a file. Filename would be <FLDR_STRING>.txt with <FLDR_STRING taken from params.h If <FLDR_STRING>.txt exists, <FLDR_STRING>_i.txt would be created where i is an integer decided based on copies present in current folder. More...
 

Public Attributes

int * m
 
float * sacdamage
 
- Public Attributes inherited from Network
bool cracked
 Flag to check if the network has cracks. More...
 
int n_nodes
 Stores number of crosslinker nodes in the network. More...
 
int n_elems
 Stores number of polymer connections in the network. More...
 
int n_rside
 Stores number of crosslinker nodes on the right edge of the network sample. More...
 
int n_lside
 Stores number of crosslinker nodes on the left edge of the network sample. More...
 
int n_bside
 Stores number of crosslinker nodes on the bottom edge of the network sample. More...
 
int n_tside
 Stores number of crosslinker nodes on the top edge of the network sample. More...
 
float * R
 Stores the position of all nodes of the graph in a flat n_nodes*DIM size array. More...
 
int * edges
 Stores the i,j pairs that form edges, size is n_elems*2. More...
 
float * forces
 Stores the forces on all nodes of the network in a flat n_nodes*DIM size array. More...
 
float * damage
 Stores the damage in each edge of the network. More...
 
float * L
 Stores the contour length of the edge. More...
 
bool * PBC
 Tag to check if an edge is a periodic boundary condition edge. More...
 
int * lsideNodes
 Stores index of crosslinker nodes on the left edge of the network sample. More...
 
int * rsideNodes
 Stores index of crosslinker nodes on the right edge of the network sample. More...
 
int * tsideNodes
 Stores index of crosslinker nodes on the top edge of the network sample. More...
 
int * bsideNodes
 Stores index of crosslinker nodes on the bottom edge of the network sample. More...
 
bool initialized
 Internal variable to check if Network object is initialized. More...
 
float __init_force
 Initial force on the plate (simulation stopped if force goes below this.) More...
 
float weight_multiplier = 1.0
 Weight multiplier in case of weight increases. More...
 
int iter_offset = 0
 Offsets iterations in the figure names, if starting where a previous simulation ended. More...
 
int * moving_nodes
 Stores index of all nodes where no boundary condition is applied (i.e. they participate in optimization) More...
 
int n_moving
 Stores number of moving nodes. More...
 

Constructor & Destructor Documentation

sacNetwork::sacNetwork ( )

Default constructor.

sacNetwork::~sacNetwork ( )

Default destructor.

sacNetwork::sacNetwork ( sacNetwork const &  source)

Copy constructor.

sacNetwork::sacNetwork ( string &  fname,
bool  from_dump = false 
)

Constructor that instantiates a sacNetwork object according to given {fname} file. Please note that there are no checks made on the GMSH .msh filepath and that responsibility is left to the user.

Parameters
fname–> takes a filename and instantiates Network object

Member Function Documentation

void sacNetwork::clear ( )
virtual

Clears extra variables declared by sacNetwork object. Called by destructor.

Reimplemented from Network.

void sacNetwork::get_forces ( bool  update_damage = false)
overridevirtual

Overrides parent class' function. Calculates forces along edges of the polymer network graph (i.e forces in each polymer). The forces are then assigned to nodes which prepares the network for the optimization step. If update_damage is true, the appropriate damage metric is also updated. If damage exceeds predefined thresholds, the edge is broken. Hidden lengths are also opened according to damage in these hidden bonds. The function does not return anything as it updates the objects forces directly.

Parameters
update_damage(bool) –> flag to update damage

Reimplemented from Network.

Reimplemented in MPI_Network.

void sacNetwork::load_network ( string &  fname)
virtual

Overrides parent class' function to initialize extra variables. Called by sacNetwork(string& fname).

Reimplemented from Network.

void sacNetwork::malloc_network ( )
virtual

Extends parent class' function to add memory allocation for extra class variables.

Reimplemented from Network.

Member Data Documentation

int* sacNetwork::m
float* sacNetwork::sacdamage

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