Skip to content

Commit

Permalink
refactor examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tobre1 committed May 24, 2024
1 parent 324e028 commit 1fa07e3
Show file tree
Hide file tree
Showing 37 changed files with 406 additions and 652 deletions.
15 changes: 7 additions & 8 deletions examples/GDSReader/GDSReader.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <psDomain.hpp>
#include <psGDSReader.hpp>
#include <psProcess.hpp>
#include <psToDiskMesh.hpp>
#include <psVTKWriter.hpp>

namespace ps = viennaps;

int main(int argc, char **argv) {
using NumericType = double;
Expand All @@ -14,21 +13,21 @@ int main(int argc, char **argv) {
lsBoundaryConditionEnum<D>::REFLECTIVE_BOUNDARY,
lsBoundaryConditionEnum<D>::REFLECTIVE_BOUNDARY,
lsBoundaryConditionEnum<D>::INFINITE_BOUNDARY};
auto mask = psSmartPointer<psGDSGeometry<NumericType, D>>::New(gridDelta);
auto mask = ps::SmartPointer<ps::GDSGeometry<NumericType, D>>::New(gridDelta);
mask->setBoundaryConditions(boundaryConds);
psGDSReader<NumericType, D>(mask, "mask.gds").apply();
ps::GDSReader<NumericType, D>(mask, "mask.gds").apply();

// geometry setup
auto bounds = mask->getBounds();
auto geometry = psSmartPointer<psDomain<NumericType, D>>::New();
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();

// substrate plane
NumericType origin[D] = {0., 0., 0.};
NumericType normal[D] = {0., 0., 1.};
auto plane = psSmartPointer<lsDomain<NumericType, D>>::New(
auto plane = lsSmartPointer<lsDomain<NumericType, D>>::New(
bounds, boundaryConds, gridDelta);
lsMakeGeometry<NumericType, D>(
plane, psSmartPointer<lsPlane<NumericType, D>>::New(origin, normal))
plane, lsSmartPointer<lsPlane<NumericType, D>>::New(origin, normal))
.apply();

geometry->insertNextLevelSet(plane);
Expand Down
56 changes: 27 additions & 29 deletions examples/TEOSTrenchDeposition/multiTEOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,55 @@

#include <psDomain.hpp>
#include <psProcess.hpp>
#include <psUtils.hpp>

#include "parameters.hpp"
namespace ps = viennaps;

int main(int argc, char **argv) {
using NumericType = double;
constexpr int D = 2;

// Parse the parameters
Parameters<NumericType> params;
ps::utils::Parameters params;
if (argc > 1) {
auto config = psUtils::readConfigFile(argv[1]);
if (config.empty()) {
std::cerr << "Empty config provided" << std::endl;
return -1;
}
params.fromMap(config);
params.readConfigFile(argv[1]);
} else {
std::cout << "Usage: " << argv[0] << " <config file>" << std::endl;
return 1;
}

auto geometry = psSmartPointer<psDomain<NumericType, D>>::New();
psMakeTrench<NumericType, D>(
geometry, params.gridDelta /* grid delta */, params.xExtent /*x extent*/,
params.yExtent /*y extent*/, params.trenchWidth /*trench width*/,
params.trenchHeight /*trench height*/,
params.taperAngle /* tapering angle */, 0 /*base height*/,
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
ps::MakeTrench<NumericType, D>(
geometry, params.get("gridDelta") /* grid delta */,
params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/,
params.get("trenchWidth") /*trench width*/,
params.get("trenchHeight") /*trench height*/,
params.get("taperAngle") /* tapering angle */, 0 /*base height*/,
false /*periodic boundary*/, false /*create mask*/,
psMaterial::Si /*material*/)
ps::Material::Si /*material*/)
.apply();

// copy top layer to capture deposition
geometry->duplicateTopLevelSet(psMaterial::SiO2);
geometry->duplicateTopLevelSet(ps::Material::SiO2);

// process model encompasses surface model and particle types
auto model = psSmartPointer<psTEOSDeposition<NumericType, D>>::New(
params.stickingProbabilityP1 /*particle sticking probability*/,
params.depositionRateP1 /*process deposition rate*/,
params.reactionOrderP1 /*process reaction order*/,
params.stickingProbabilityP2, params.depositionRateP2,
params.reactionOrderP2);

psProcess<NumericType, D> process;
auto model = ps::SmartPointer<ps::TEOSDeposition<NumericType, D>>::New(
params.get("stickingProbabilityP1") /*particle sticking probability*/,
params.get("depositionRateP1") /*process deposition rate*/,
params.get("reactionOrderP1") /*process reaction order*/,
params.get("stickingProbabilityP2"), params.get("depositionRateP2"),
params.get("reactionOrderP2"));

ps::Process<NumericType, D> process;
process.setDomain(geometry);
process.setProcessModel(model);
process.setNumberOfRaysPerPoint(params.numRaysPerPoint);
process.setProcessDuration(params.processTime);
process.setNumberOfRaysPerPoint(params.get("numRaysPerPoint"));
process.setProcessDuration(params.get("processTime"));

geometry->saveSurfaceMesh("MulitTEOS_initial.vtp");

process.apply();

geometry->saveSurfaceMesh("MulitTEOS_final.vtp");

if constexpr (D == 2)
geometry->saveVolumeMesh("MulitTEOS_final");
geometry->saveVolumeMesh("MulitTEOS_final");
}
54 changes: 0 additions & 54 deletions examples/TEOSTrenchDeposition/parameters.hpp

This file was deleted.

46 changes: 23 additions & 23 deletions examples/TEOSTrenchDeposition/singleTEOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@

#include <psDomain.hpp>
#include <psProcess.hpp>
#include <psUtils.hpp>

#include "parameters.hpp"
namespace ps = viennaps;

int main(int argc, char **argv) {
using NumericType = double;
constexpr int D = 2;

// Parse the parameters
Parameters<NumericType> params;
ps::utils::Parameters params;
if (argc > 1) {
auto config = psUtils::readConfigFile(argv[1]);
if (config.empty()) {
std::cerr << "Empty config provided" << std::endl;
return -1;
}
params.fromMap(config);
params.readConfigFile(argv[1]);
} else {
std::cout << "Usage: " << argv[0] << " <config file>" << std::endl;
return 1;
}

auto geometry = psSmartPointer<psDomain<NumericType, D>>::New();
psMakeTrench<NumericType, D>(
geometry, params.gridDelta /* grid delta */, params.xExtent /*x extent*/,
params.yExtent /*y extent*/, params.trenchWidth /*trench width*/,
params.trenchHeight /*trench height*/,
params.taperAngle /* tapering angle */, 0 /*base height*/,
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
ps::MakeTrench<NumericType, D>(
geometry, params.get("gridDelta") /* grid delta */,
params.get("xExtent") /*x extent*/, params.get("yExtent") /*y extent*/,
params.get("trenchWidth") /*trench width*/,
params.get("trenchHeight") /*trench height*/,
params.get("taperAngle") /* tapering angle */, 0 /*base height*/,
false /*periodic boundary*/, false /*create mask*/,
psMaterial::Si /*material*/)
ps::Material::Si /*material*/)
.apply();

// copy top layer to capture deposition
geometry->duplicateTopLevelSet(psMaterial::SiO2);
geometry->duplicateTopLevelSet(ps::Material::SiO2);

// process model encompasses surface model and particle types
auto model = psSmartPointer<psTEOSDeposition<NumericType, D>>::New(
params.stickingProbabilityP1 /*particle sticking probability*/,
params.depositionRateP1 /*process deposition rate*/,
params.reactionOrderP1 /*process reaction order*/);
auto model = ps::SmartPointer<ps::TEOSDeposition<NumericType, D>>::New(
params.get("stickingProbabilityP1") /*particle sticking probability*/,
params.get("depositionRateP1") /*process deposition rate*/,
params.get("reactionOrderP1") /*process reaction order*/);

psProcess<NumericType, D> process;
ps::Process<NumericType, D> process;
process.setDomain(geometry);
process.setProcessModel(model);
process.setNumberOfRaysPerPoint(params.numRaysPerPoint);
process.setProcessDuration(params.processTime);
process.setNumberOfRaysPerPoint(params.get("numRaysPerPoint"));
process.setProcessDuration(params.get("processTime"));

geometry->saveSurfaceMesh("SingleTEOS_initial.vtp");

Expand Down
17 changes: 10 additions & 7 deletions examples/atomicLayerDeposition/atomicLayerDeposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@

#include <psDomain.hpp>
#include <psMeanFreePath.hpp>
#include <psUtils.hpp>

#include "geometry.hpp"

namespace viennaps = ps;

int main(int argc, char *argv[]) {
constexpr int D = 2;
using NumericType = double;

psLogger::setLogLevel(psLogLevel::INTERMEDIATE);
ps::Logger::setLogLevel(ps::LogLevel::INTERMEDIATE);

// Parse the parameters
psUtils::Parameters params;
ps::utils::Parameters params;
if (argc > 1) {
params.readConfigFile(argv[1]);
} else {
Expand All @@ -25,21 +28,21 @@ int main(int argc, char *argv[]) {
omp_set_num_threads(params.get<int>("numThreads"));

// Create a domain
auto domain = psSmartPointer<psDomain<NumericType, D>>::New();
auto domain = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
if (params.get<int>("trench") > 0) {
psMakeHole<NumericType, D>(
ps::MakeHole<NumericType, D>(
domain, params.get("gridDelta"),
2 * params.get("verticalWidth") + 2. * params.get("xPad"),
2 * params.get("verticalWidth") + 2. * params.get("xPad"),
params.get("verticalWidth"), params.get("verticalDepth"), 0., 0., false,
false, psMaterial::TiN)
false, ps::Material::TiN)
.apply();
} else {
makeLShape(domain, params, psMaterial::TiN);
makeLShape(domain, params, ps::Material::TiN);
}
// Generate the cell set from the domain
domain->generateCellSet(params.get("verticalDepth") + params.get("topSpace"),
psMaterial::GAS, true);
ps::Material::GAS, true);
auto &cellSet = domain->getCellSet();
// Segment the cells into surface, material, and gas cells
csSegmentCells<NumericType, D>(cellSet).apply();
Expand Down
25 changes: 15 additions & 10 deletions examples/cantileverWetEtching/cantileverWetEtching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <models/psAnisotropicProcess.hpp>

namespace ps = viennaps;

int main(int argc, char **argv) {
using NumericType = double;
constexpr int D = 3;
Expand Down Expand Up @@ -39,10 +41,12 @@ int main(int argc, char **argv) {
REFLECTIVE_BOUNDARY; // boundary conditions in x and y direction
boundaryCons[D - 1] = lsDomain<NumericType, D>::BoundaryType::
INFINITE_BOUNDARY; // open boundary in z direction
auto gds_mask = psSmartPointer<psGDSGeometry<NumericType, D>>::New(gridDelta);
auto gds_mask =
ps::SmartPointer<ps::GDSGeometry<NumericType, D>>::New(gridDelta);
gds_mask->setBoundaryConditions(boundaryCons);
gds_mask->setBoundaryPadding(x_add, y_add);
psGDSReader<NumericType, D>(gds_mask, maskFileName).apply(); // read GDS file
ps::GDSReader<NumericType, D>(gds_mask, maskFileName)
.apply(); // read GDS file

auto mask = gds_mask->layerToLevelSet(
1 /*layer in GDS file*/, 0 /*base z position*/,
Expand All @@ -52,24 +56,25 @@ int main(int argc, char **argv) {
NumericType origin[D] = {0., 0., 0.}; // surface origin
NumericType normal[D] = {0., 0., 1.}; // surface normal
double *bounds = gds_mask->getBounds(); // extent of GDS mask
auto plane = psSmartPointer<lsDomain<NumericType, D>>::New(
auto plane = lsSmartPointer<lsDomain<NumericType, D>>::New(
bounds, boundaryCons, gridDelta);
lsMakeGeometry<NumericType, D>(
plane, psSmartPointer<lsPlane<NumericType, D>>::New(origin, normal))
plane, lsSmartPointer<lsPlane<NumericType, D>>::New(origin, normal))
.apply();

// Set up domain
auto geometry = psSmartPointer<psDomain<NumericType, D>>::New();
geometry->insertNextLevelSetAsMaterial(mask, psMaterial::Mask);
geometry->insertNextLevelSetAsMaterial(plane, psMaterial::Si);
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
geometry->insertNextLevelSetAsMaterial(mask, ps::Material::Mask);
geometry->insertNextLevelSetAsMaterial(plane, ps::Material::Si);
geometry->saveSurfaceMesh("initialGeometry.vtp");

// Anisotropic wet etching process model
auto model = psSmartPointer<psAnisotropicProcess<NumericType, D>>::New(
auto model = ps::SmartPointer<ps::AnisotropicProcess<NumericType, D>>::New(
direction100, direction010, r100, r110, r111, r311,
std::vector<std::pair<psMaterial, NumericType>>{{psMaterial::Si, -1.}});
std::vector<std::pair<ps::Material, NumericType>>{
{ps::Material::Si, -1.}});

psProcess<NumericType, D> process;
ps::Process<NumericType, D> process;
process.setDomain(geometry);
process.setProcessModel(model);
process.setProcessDuration(5. * 60.); // 5 minutes of etching
Expand Down
Loading

0 comments on commit 1fa07e3

Please sign in to comment.