meshing

Define space grids and composition profiles.

meshing.geo_grid(zmin, zmax, nz, q)[source]

Make space grid according to geometric progression.

Parameters:
  • zmin (float) – Start position.

  • zmax (float) – End position.

  • nz (int) – Number of elements.

  • q (float) – Common ratio.

Returns:

Geometric grid.

Return type:

1D array

meshing.make_step_profile(z, zstep, x_left, x_right)[source]

Make step profiles.

Parameters:
  • z (1D array) – Node positions, shape (nz,).

  • zstep (float) – Position of the step. If zstep falls on the z grid, the value at zstep is the average of the end-values.

  • x_left (dict of floats) – Atom fractions on the left-hand side.

  • x_right (dict of floats) – Atom fractions on the right-hand side.

Returns:

x – Atom fraction profiles on z grid.

Return type:

dict of 1D arrays

meshing.make_smooth_step_profile(z, zstep, x_left, x_right)[source]

Make smooth step profiles.

Parameters:
  • z (1D array) – Node positions, shape (nz,).

  • zstep (float) – Position of the step. If zstep falls on the z grid, the value at zstep is the average of the end-values.

  • x_left (dict of floats) – Atom fractions on the left-hand side.

  • x_right (dict of floats) – Atom fractions on the right-hand side.

Returns:

x – Atom fraction profiles on z grid.

Return type:

dict of 1D arrays

meshing.make_x_full(x_sides, nx=20)[source]

Map the composition space.

Only supports binary and ternary systems.

Parameters:
  • x_sides (dict of dicts) – End values of the atom fractions of each constituent.

  • nx (int, optional) – Number of steps in each dimension of the composition grid. The default is 20.

Raises:

Exception – If the system contains more than two independent constituents.

Returns:

x_full – Atom fraction grid, shape (n_inds, nx**n_inds).

Return type:

2D array

meshing.make_xtab(x)[source]

Make 2D array from dict of 1D arrays.

Parameters:

x (dict of 1D arrays) – n_inds composition arrays, shape (nx_i,).

Returns:

points – Composition array, shape (product(nx_i), n_inds).

Return type:

2D array