f3dasm_simulate.abaqus.circle_particles.CircleParticles

class CircleParticles(length, width, radius_mu, radius_std, vol_req, num_guess_max=50000, num_fiber_max=750, num_cycle_max=15, dist_min_factor=1.1)[source]

Bases: MicrostructureGenerator

2D RVE with different size of disks/circles

Parameters:

MicrostructureGenerator (class) – parent class of microstructure generater

Initialization

Parameters:
  • length (float) – length of RVE

  • width (float) – width of RVE

  • radius_mu (float) – mean of circle’s radius

  • radius_std (float) – std of circle’s radius

  • vol_req (float) – required volume fraction

  • num_guess_max (int, optional) – maximum guess for fibers, by default 50000

  • num_fiber_max (int, optional) – maximum fiber inside RVE, by default 750

  • num_cycle_max (int, optional) – iteration cycles, by default 15

  • dist_min_factor (float, optional) – distance factor, by default 2.07

List of Public Methods

circle_plot

2d rve plot for circle inclusion

crate_rgmsh

create rgmsh numpy array for crate

fiber_volume

calculate the fiber volume of the current fiber

generate_first_heuristic_fibers

Move fiber to its reference point

generate_microstructure

generating micro-structure

generate_random_fibers

generate random fibers with different radiis

min_dis_index

This function is used to identify the index of closest fiber of every fiber, which is very import for the first heuristic stirring to get more space placing the new disks.

new_positions

This is the function used to determine the locations of disks considering the boundary of RVE.

overlap_check

overlap check betwwen new fiber and the original ones

plot_microstructure

plot figure for RVE

rgmsh_plot

contour or voxel plot of the discrete microstructure

sphere_coordinate

generate coordinate of sphere

sphere_plot

plot 3d rve with sphere inclusion

to_abaqus_format

convert microstructure to abaqus format

to_crate_format

convert microstructure to crate format

Methods

__init__(length, width, radius_mu, radius_std, vol_req, num_guess_max=50000, num_fiber_max=750, num_cycle_max=15, dist_min_factor=1.1)[source]

Initialization

Parameters:
  • length (float) – length of RVE

  • width (float) – width of RVE

  • radius_mu (float) – mean of circle’s radius

  • radius_std (float) – std of circle’s radius

  • vol_req (float) – required volume fraction

  • num_guess_max (int, optional) – maximum guess for fibers, by default 50000

  • num_fiber_max (int, optional) – maximum fiber inside RVE, by default 750

  • num_cycle_max (int, optional) – iteration cycles, by default 15

  • dist_min_factor (float, optional) – distance factor, by default 2.07

_core_iteration()[source]

core iteration part of the micro-structure generation method

Return type:

None

static _first_new_fiber(x, y, r, portion)[source]

generate the first new fiber

Parameters:
  • x (float) – x center

  • y (float) – y center

  • r (float) – radius

  • portion (int) – portion of the fiber(1, 2, 4)

Returns:

new fiber

Return type:

np.ndarray

_parameter_initialization()[source]

Initialize the parameters

Return type:

None

_procedure_initialization()[source]

This function is used to generate the first disk and assign the initial values of the algorithm

Return type:

None

_update_fiber_position(new_fiber, iter)[source]

update the fiber position

Parameters:
  • new_fiber (np.ndarray) – the generated new fiber

  • iter (int) – determine the nex fiber should be analysis

Returns:

iter – he updated number of index

Return type:

int

static circle_plot(fibers, length, width, vol_frac, save_figure=False, fig_name='microstructure.png', **kwargs)

2d rve plot for circle inclusion

Parameters:
  • fibers (np.ndarray) – fiber locations/positions

  • length (float) – length of the rve

  • width (float) – with of the rve

  • vol_frac (float) – reached volume fraction

  • save_figure (bool, optional) – save figure , by default False

  • fig_name (str, optional) – figure name , by default “microstrcuture.png”

Return type:

None

crate_rgmsh(num_discrete=10)[source]

create rgmsh numpy array for crate

Parameters:

num_discrete (int, optional) – number of discrete partition, by default 10

Returns:

2d numpy array that contains the micro-structure information

Return type:

np.ndarray

static fiber_volume(radius)[source]

calculate the fiber volume of the current fiber

Parameters:

radius (float) – radius

Returns:

vol – volume of current fiber(disk)

Return type:

float

static generate_first_heuristic_fibers(ref_point, fiber_temp, dist_factor, rng)[source]

Move fiber to its reference point

Parameters:
  • ref_point (np.ndarray) – Reference point that the fiber should move to

  • fiber_temp (np.ndarray) – The considering fiber

  • dist_factor (float) – the minimum distance factor between two fibers

  • rng (any) – randome generator

Returns:

The updated location of the considering fiber

Return type:

np.ndarray

generate_microstructure(seed=None)[source]

generating micro-structure

Parameters:

seed (any, optional) – seed generator or number , by default None

Return type:

None

static generate_random_fibers(len_start, len_end, wid_start, wid_end, radius_mu, radius_std, rng)[source]

generate random fibers with different radiis

Parameters:
  • len_start (float) – the start location of length

  • len_end (float) – the end location of length

  • wid_start (float) – the start location of width

  • wid_end (float) – the end location of width

  • radius_mu (float) – mean of radius

  • radius_std (float) – standard deviation of radius

  • rng (any) – random seed or generator

Returns:

location information of generated fiber

Return type:

np.ndarray

static min_dis_index(temp_fiber, fiber_pos, fiber_min_dis_vector, ii, cycle)[source]

This function is used to identify the index of closest fiber of every fiber, which is very import for the first heuristic stirring to get more space placing the new disks.

Parameters:
  • temp_fiber (np.ndarray) – the fiber been processed

  • fiber_pos (np.ndarray) – fiber position

  • fiber_min_dis_vector (np.ndarray) – the first column is the index of the closed point, the second column contains the minimum distance between those two points

  • ii (int) – the index of the being processed point

  • cycle (int) – the cycle of the algorithm. At different cycles, the criteria of identifying the closed point are different.

Return type:

Tuple[ndarray, int, float]

Returns:

  • fiber_min_dis_vector (np.ndarray) – The updated minimum distance array

  • min_index (int) – The index of the minimum distance point

  • min_dist (float) – The minimum distance to the minimum distance point

new_positions(x_center, y_center, radius, width, length)[source]

This is the function used to determine the locations of disks considering the boundary of RVE. To be specific, the disk should be divided into two parts or four parts if it is located in the outskirt area

Parameters:
  • x_center (float) – new center of X axis

  • y_center (float) – new center of Y axis

  • radius (float) – radius of the disk

  • width (float) – width of RVE

  • length (float) – length of RVE

Return type:

ndarray

Returns:

  • np.ndarray – XC, YC, split which is the new locations of this fiber (because in some locations, the circles need to be split)

  • ####################################

  • # # 2_2 # #

  • # 4_1 # #4_2 #

  • ####################################

  • # # # #

  • # 2_3 # 1 # 2_4 #

  • # # # #

  • # # # #

  • ####################################

  • # 4_3 # 2_1 # 4_4 #

  • # # # #

  • ####################################

static overlap_check(new_fiber, fiber_pos, dist_factor, fiber_index=0, stage='step_one')[source]

overlap check betwwen new fiber and the original ones

Parameters:
  • new_fiber (np.ndarray) – new fiber location

  • fiber_pos (np.ndarray) – original fibers

  • dist_factor (float) – distance factor which used to control the minimum distance between to fibers

  • fiber_index (int, optional) – fiber index , by default 0

  • stage (str, optional) – stage of the algorithm, by default “step_one”

Returns:

a flag number (1: overlap, 0: non-overlap)

Return type:

int

Raises:

ValueError – not defined stage

plot_microstructure(save_figure=False, fig_name='microstructure.png', **kwargs)[source]

plot figure for RVE

Parameters:
  • save_figure (bool, optional) – save figure or not , by default False

  • fig_name (str, optional) – figure name, by default “RVE.png”

Raises:

NotImplementedError – error report

Return type:

None

rgmsh_plot(save_fig=False, fig_name='rgmsh.png', **kwarg)

contour or voxel plot of the discrete microstructure

Parameters:
  • save_fig (bool, optional) – save figure, by default False

  • fig_name (str, optional) – figure name, by default “rgmsh.png”

Return type:

None

static sphere_coordinate(location_information)

generate coordinate of sphere

Parameters:
  • location_information (np.ndarray) – a numpy array contains center and radius info of a sphere [x, y, z, r]

  • Returns

  • -------ss

  • tuple – coordinate of x, y, z

Return type:

tuple

sphere_plot(fibers, length, width, height, vol_frac, save_figure=False, fig_name='cubic.png')

plot 3d rve with sphere inclusion

Parameters:
  • location_information (np.ndarray) – location information

  • length (float) – length of cubic

  • width (float) – width of cubic

  • height (float) – height of cubic

  • vol_frac (float) – volume fraction

  • save_figure (bool, optional) – a flag to indicate if we want save the figure or not, by default False

  • fig_name (str, optional) – fig name, by default “cubic_rve.png”

Return type:

None

to_abaqus_format(save_file=True, file_name='micro_structure_info.json')[source]

convert microstructure to abaqus format

Parameters:

file_name (str, optional) – file name, by default “micro_structure_info.json”

Raises:

NotImplementedError – error report

Return type:

dict

to_crate_format(file_name='microstructure.rgmsh')

convert microstructure to crate format

Parameters:

file_name (str, optional) – _description_, by default “microstructure.rgmsh”

Return type:

None