foamgen.smesh

Structured meshing module

synopsis

Create structured VTK mesh.

Functions

clean_files()

Delete unnecessary files.

por_fs_res(delta, fname, dsize, porosity, …)

Residual function for finding target porosity and strut content.

por_res(delta, fname, porosity)

Residual function for finding target porosity.

structured_mesh(fname, porosity, strut_content)

Create foam discretized on structured cartesian mesh.

voxelize_morphology(fname, delta)

Create foam on equidistant cartesian mesh.

foamgen.smesh.clean_files()[source]

Delete unnecessary files.

foamgen.smesh.por_fs_res(delta, fname, dsize, porosity, strut_content)[source]

Residual function for finding target porosity and strut content.

Adjusts the size of the box, in which the foam is binarized and strut size parameter. Bigger box leads to thinner walls and higher porosity. Higher strut size parameter leads to higher strut content.

voxelize_morphology() is used to create walls. foamreconstr program is used to create struts and optimize strut content.

Requires *Tessellation.gnu file.

Parameters
  • delta (float) – box size in voxels

  • fname (str) – base filename

  • dsize (float) – box size

  • porosity (float) – target foam porosity

  • strut_content (float) – target foam strut content

Returns

squared difference between target and actual porosity

Return type

float

foamgen.smesh.por_res(delta, fname, porosity)[source]

Residual function for finding target porosity.

Adjusts the size of the box, in which the foam is binarized. Bigger box leads to thinner walls and higher porosity.

voxelize_morphology() is used to create walls.

Parameters
  • delta (float) – box size in voxels

  • fname (str) – base filename

  • porosity (float) – target porosity

Returns

squared difference between target and actual porosity

Return type

float

foamgen.smesh.structured_mesh(fname, porosity, strut_content)[source]

Create foam discretized on structured cartesian mesh.

Creates foam with desired porosity and strut content. root_scalar from scipy is used for root finding. This method is not optimal, since the solver doesn’t know that the function takes only integer arguments.

Ultimate output is the *SMesh.vtk file.

Parameters
  • fname (str) – base filename

  • porosity (float) – target foam porosity

  • strut_content (float) – target foam strut content

foamgen.smesh.voxelize_morphology(fname, delta)[source]

Create foam on equidistant cartesian mesh.

Requires *TessellationBox.stl file. Creates *SMesh.vtk file.

Parameters
  • fname (str) – base filename

  • delta (float) – box size

Returns

binvox stdout

Return type

str