-
Notifications
You must be signed in to change notification settings - Fork 0
/
DREM3D.cpp
123 lines (102 loc) · 4.02 KB
/
DREM3D.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include <chrono>
#include <iostream>
#include <lsBooleanOperation.hpp>
#include <lsExpand.hpp>
#include <lsGeometricAdvect.hpp>
#include <lsMakeGeometry.hpp>
#include <lsToDiskMesh.hpp>
#include <lsToMesh.hpp>
#include <lsToSurfaceMesh.hpp>
#include <lsVTKWriter.hpp>
#include <lsWriteVisualizationMesh.hpp>
#include "BoschProcess.hpp"
#include "MakeMask.hpp"
#include "PillarMask.hpp"
int main() {
omp_set_num_threads(32);
constexpr int D = 3;
typedef double NumericType;
double gridDelta = 0.05; // 0.125;
NumericType maskRadius = 1.25 / 2.;
NumericType lineDistance = 0.51;
NumericType unitCellLength = (2 * maskRadius + lineDistance);
double extent = 2 * unitCellLength;
double bounds[2 * D] = {-extent, extent, -extent, extent};
if constexpr (D == 3) {
bounds[4] = -extent;
bounds[5] = extent;
}
typename lsDomain<NumericType, D>::BoundaryType boundaryCons[D];
for (unsigned i = 0; i < D - 1; ++i) {
boundaryCons[i] =
lsDomain<NumericType, D>::BoundaryType::REFLECTIVE_BOUNDARY;
}
boundaryCons[D - 1] =
lsDomain<NumericType, D>::BoundaryType::INFINITE_BOUNDARY;
auto mask = lsSmartPointer<lsDomain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
auto levelSet = lsSmartPointer<lsDomain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
std::array<NumericType, 3> maskOrigin = {};
if constexpr (D == 2) {
MakeMask<NumericType, D> maskCreator(levelSet, mask);
maskCreator.setMaskOrigin(maskOrigin);
maskCreator.setMaskRadius(maskRadius);
maskCreator.apply();
}
if constexpr (D == 3) {
PillarMask<NumericType, D> maskCreator(levelSet, mask);
maskCreator.setMaskOrigin(maskOrigin);
maskCreator.setMaskRadius(maskRadius);
maskCreator.setLineDistance(lineDistance);
maskCreator.apply();
}
std::cout << "Output initial" << std::endl;
auto mesh = lsSmartPointer<lsMesh<NumericType>>::New();
// lsToMesh<NumericType, D>(levelSet, mesh).apply();
// lsVTKWriter(mesh, "Surface_i_p.vtp").apply();
lsToSurfaceMesh<NumericType, D>(levelSet, mesh).apply();
lsVTKWriter(mesh, "Surface_i.vtp").apply();
// lsToMesh<NumericType, D>(mask, mesh).apply();
// lsVTKWriter(mesh, "Surface_m_p.vtp").apply();
lsToSurfaceMesh<NumericType, D>(mask, mesh).apply();
lsVTKWriter(mesh, "Surface_m.vtp").apply();
// Take average from etch rate measurements in Fig6.c from Chang2018
NumericType etchRate = -0.25;
BoschProcess<NumericType, D> processKernel;
processKernel.setMask(mask);
processKernel.setNumCycles(80);
processKernel.setIsotropicRate(etchRate *
0.6); // * 1.2 / 2 because it is a radius
processKernel.setCycleEtchDepth(etchRate);
processKernel.setStartWidth(2 * maskRadius);
processKernel.setSubstrate(levelSet);
processKernel.setBottomWidth(2 * maskRadius);
// processKernel.setStartOfTapering(-24.5);
processKernel.setSausageCycling(10);
processKernel.setSausageCycleDepth(2 * etchRate);
processKernel.setLateralEtchRatio(0.5);
auto start = std::chrono::high_resolution_clock::now();
processKernel.apply();
auto stop = std::chrono::high_resolution_clock::now();
std::cout << "Geometric advect took: "
<< std::chrono::duration_cast<std::chrono::milliseconds>(stop -
start)
.count()
<< " ms" << std::endl;
std::cout << "Final structure has " << levelSet->getNumberOfPoints()
<< " LS points" << std::endl;
// levelSet->print();
lsToSurfaceMesh<NumericType, D>(levelSet, mesh).apply();
lsVTKWriter(mesh, "surface.vtp").apply();
lsToMesh<NumericType, D>(levelSet, mesh).apply();
lsVTKWriter(mesh, "points-1.vtp").apply();
std::cout << "Making volume output..." << std::endl;
auto volumeMeshing =
lsSmartPointer<lsWriteVisualizationMesh<NumericType, D>>::New();
volumeMeshing->insertNextLevelSet(mask);
volumeMeshing->insertNextLevelSet(levelSet);
volumeMeshing->setFileName("bosch");
volumeMeshing->apply();
return 0;
}