This project aims to provide an code framework for efficiently solving the inverse homogenization problems to design microstructure.
- OpenVDB
- CUDA11
- gflags
- glm
- Eigen3
We have packed dependencies into a conda environment (except CUDA and compilers), you can create it by:
conda env create -f environment.ymlThen you activate it by:
conda activate homo3dAfter the dependency is installed, the code can be compiled using cmake:
mkdir build
cd build
cmake ..
make -j4If the conda environment is activated, cmake will automatically checkout the dependencies in this environment.
-
-reso: the resolution of the discretized domain, e.g.,-reso 128defines an$128\times128\times128$ domain. Default value is 128. -
-obj: the objective to be optimized, options arebulk,shear,nprandcustom, which optimizes the bulk modulus, shear modulus, Poisson's ratio and custom objective respectively. Default isbulk -
-init: the method for initializing the density field, the common and default option israndc, which set the initialization via a set of trigonometric function basis. You can set this option tomanualto set the initialization from a OpenVDB file. -
-sym: symmetry requirement on the structure, onlyreflect3,reflect6androtate3are supported. Default isreflect6. -
-vol: volume ratio for material usage ranging from$(0,1)$ , default is0.3 -
-E: Young's modulus of base material. Default is1e1(Recommanded, inappropriate value will cause numerical problem due to poor representation range of Fp16. You can rescale the elastic matrix latter). -
-mu: Poisson's ratio of base material. Default is0.3 -
-prefix: output path suffixed with/ -
-in: variable input determined by other options, e.g., a OpenVDB file path when the argument of-initismanual. -
-N: maximal iteration number, default is300. -
-relthres: the relative residual tolerance on FEM equation, default is1e-2. (Themasterbranch may not work well with tolerance smaller than1e-5. Usually, the default value is enough to produce a satisfactory result).
optimizing the bulk modulus :
./homo3d -reso 128 -obj bulk -init randc -sym reflect6 -vol 0.3 -mu 0.3After the optimization finished, the optimized density field is stored in <prefix>/rho in OpenVDB format.
3rd party softwares like Rhino (with grasshopper plugin Dendro) or Blender may be used to extract the solid part.
The optimized elastic matrix is stored in <prefix>/C in binary format, which is an array of 36 float precision numbers.
To optimizing custom objective, option -obj custom should be used and add your objective and optimization routine in Framework.cu file, where we have provide few examples:
void example_opti_bulk(cfg::HomoConfig config) {
// ...
}
void example_opti_npr(cfg::HomoConfig config) {
// ...
}
void example_yours(cfg::HomoConfig config) {
// Add your routines here....
}
void runCustom(cfg::HomoConfig config) {
//example_opti_bulk(config);
//example_opti_npr(config);
example_yours(cfg::HomoConfig config); // uncomment this line
}If you care more about accuracy rather than performance, please checkout the branch mix-fp64 and uses a smaller tolerance on the relative residual of FEM equation:
./homo3d -reso 128 -vol 0.1 -relthres 1e-6 # set tolerence to 1e-6Other version (branch) such as mix-fp64fp32 uses a mixed precision scheme and requires less memory.
If you are using this project in your academic research, please include the following citation
@ARTICLE{Zhang2023-ti,
title = "An optimized, easy-to-use, open-source {GPU} solver for
large-scale inverse homogenization problems",
author = "Zhang, Di and Zhai, Xiaoya and Liu, Ligang and Fu, Xiao-Ming",
journal = "Structural and Multidisciplinary Optimization",
volume = 66,
pages = "Article 207",
month = sep,
year = 2023
}
