Skip to content

Commit

Permalink
psProcess changes (#52)
Browse files Browse the repository at this point in the history
* Changed function to enable flux smoothing and added missing psProcess functions in pybindings

* Fix spellcheck typos
  • Loading branch information
tobre1 authored Nov 30, 2023
1 parent f9ac913 commit ec4e4a8
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 24 deletions.
35 changes: 24 additions & 11 deletions Python/pyWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,40 +409,53 @@ PYBIND11_MODULE(VIENNAPS_MODULE_NAME, module) {
});

// psProcess
pybind11::class_<psProcess<T, D>, psSmartPointer<psProcess<T, D>>>(module,
"Process")
pybind11::class_<psProcess<T, D>>(module, "Process")
// constructors
.def(pybind11::init(&psSmartPointer<psProcess<T, D>>::New<>))

.def(pybind11::init())
.def(pybind11::init<DomainType>(), pybind11::arg("domain"))
.def(
pybind11::init<DomainType, psSmartPointer<psProcessModel<T, D>>, T>(),
pybind11::arg("domain"), pybind11::arg("model"),
pybind11::arg("duration"))
// methods
.def("apply", &psProcess<T, D>::apply, "Run the process.")
.def("setDomain", &psProcess<T, D>::setDomain, "Set the process domain.")
.def("setProcessModel",
&psProcess<T, D>::setProcessModel<psProcessModel<T, D>>,
"Set the process model. This has to be a pre-configured process "
"model.")
.def("setProcessDuration", &psProcess<T, D>::setProcessDuration,
"Set the process duration.")
.def("setSourceDirection", &psProcess<T, D>::setSourceDirection,
"Set source direction of the process.")
.def("setNumberOfRaysPerPoint", &psProcess<T, D>::setNumberOfRaysPerPoint,
"Set the number of rays to traced for each particle in the process. "
"The number is per point in the process geometry")
"The number is per point in the process geometry.")
.def("setMaxCoverageInitIterations",
&psProcess<T, D>::setMaxCoverageInitIterations,
"Set the number of iterations to initialize the coverages.")
.def("setPrintTimeInterval", &psProcess<T, D>::setPrintTimeInterval,
"Sets the minimum time between printing intermediate results during "
"the process. If this is set to a non-positive value, no "
"intermediate results are printed.")
.def("setProcessModel",
&psProcess<T, D>::setProcessModel<psProcessModel<T, D>>,
"Set the process model.")
.def("apply", &psProcess<T, D>::apply, "Run the process.")
.def("setIntegrationScheme", &psProcess<T, D>::setIntegrationScheme,
"Set the integration scheme for solving the level-set equation. "
"Should be used out of the ones specified in "
"Possible integration schemes are specified in "
"lsIntegrationSchemeEnum.")
.def("setTimeStepRatio", &psProcess<T, D>::setTimeStepRatio,
"Set the CFL condition to use during advection. The CFL condition "
"sets the maximum distance a surface can be moved during one "
"advection step. It MUST be below 0.5 to guarantee numerical "
"stability. Defaults to 0.4999.");
"stability. Defaults to 0.4999.")
.def("enableFluxSmoothing", &psProcess<T, D>::enableFluxSmoothing,
"Enable flux smoothing. The flux at each surface point, calculated "
"by the ray tracer, is averaged over the surface point neighbors.")
.def("disableFluxSmoothing", &psProcess<T, D>::disableFluxSmoothing,
"Disable flux smoothing")
.def("getProcessDuration", &psProcess<T, D>::getProcessDuration,
"Returns the duration of the recently run process. This duration "
"can sometimes slightly vary from the set process duration, due to "
"the maximum time step according to the CFL condition.");

// psAdvectionCallback
pybind11::class_<psAdvectionCallback<T, D>,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Below the results after 1, 2, and 3 seconds of etching are shown.
<img src="https://raw.githubusercontent.com/ViennaTools/ViennaPS/master/data/images/hole_etching.svg" width=700 style="background-color:white;">
</div>

By changing the dimension of the hole etching example (_D = 2_), we can easily simulate the profile of a trench etching process with the same plasma chemistry. Here we can, for example, vary the mask tapering angle to observe increased microtrenching, as shown below.
By changing the dimension of the hole etching example (_D = 2_), we can easily simulate the profile of a trench etching process with the same plasma chemistry. Here we can, for example, vary the mask tapering angle to observe increased micro-trenching, as shown below.
<div align="center">
<img src="https://raw.githubusercontent.com/ViennaTools/ViennaPS/master/data/images/sidewall_tapering.svg" width=700 style="background-color:white;">
</div>
Expand Down Expand Up @@ -157,7 +157,7 @@ If you want to contribute to ViennaPS, make sure to follow the [LLVM Coding guid

## Authors

Current contributors: Tobias Reiter, Julius Piso, Josip Bobinac, Xaver Klemenschits
Current contributors: Tobias Reiter, Julius Piso

Contact us via: [email protected]

Expand Down
12 changes: 8 additions & 4 deletions app/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ template <int D> class Application {
psProcess<NumericType, D> process;
process.setDomain(processGeometry);
process.setProcessModel(model);
process.setSmoothFlux(processParams->smoothFlux);
if (processParams->smoothFlux)
process.enableFluxSmoothing();
process.setNumberOfRaysPerPoint(processParams->raysPerPoint);
process.setProcessDuration(processParams->processTime);
process.setIntegrationScheme(params->integrationScheme);
Expand All @@ -139,7 +140,8 @@ template <int D> class Application {
psProcess<NumericType, D> process;
process.setDomain(processGeometry);
process.setProcessModel(model);
process.setSmoothFlux(processParams->smoothFlux);
if (processParams->smoothFlux)
process.enableFluxSmoothing();
process.setNumberOfRaysPerPoint(processParams->raysPerPoint);
process.setProcessDuration(processParams->processTime);
process.setIntegrationScheme(params->integrationScheme);
Expand All @@ -159,7 +161,8 @@ template <int D> class Application {
process.setDomain(processGeometry);
process.setProcessModel(model);
process.setMaxCoverageInitIterations(10);
process.setSmoothFlux(processParams->smoothFlux);
if (processParams->smoothFlux)
process.enableFluxSmoothing();
process.setNumberOfRaysPerPoint(processParams->raysPerPoint);
process.setProcessDuration(processParams->processTime);
process.setIntegrationScheme(params->integrationScheme);
Expand All @@ -179,7 +182,8 @@ template <int D> class Application {
process.setDomain(processGeometry);
process.setProcessModel(model);
process.setMaxCoverageInitIterations(10);
process.setSmoothFlux(processParams->smoothFlux);
if (processParams->smoothFlux)
process.enableFluxSmoothing();
process.setNumberOfRaysPerPoint(processParams->raysPerPoint);
process.setProcessDuration(processParams->processTime);
process.setIntegrationScheme(params->integrationScheme);
Expand Down
2 changes: 1 addition & 1 deletion app/ApplicationParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct ApplicationParameters {
NumericType processTime = 1;
int raysPerPoint = 3000;
NumericType etchStopDepth = std::numeric_limits<NumericType>::lowest();
NumericType smoothFlux = 1.;
int smoothFlux = 1.;
// Plasma etching
// fluxes in in (1e15 atoms/cm³)
NumericType etchantFlux = 1.8e3;
Expand Down
31 changes: 25 additions & 6 deletions include/psProcess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,60 @@ template <typename NumericType, int D> class psProcess {
passedProcessModel);
}

// Set the process model. This can be either a pre-configured process model or
// a custom process model. A custom process model must interface the
// psProcessModel class.
template <typename ProcessModelType>
void setProcessModel(psSmartPointer<ProcessModelType> passedProcessModel) {
model = std::dynamic_pointer_cast<psProcessModel<NumericType, D>>(
passedProcessModel);
}

// Set the process domain.
void setDomain(psSmartPointer<psDomain<NumericType, D>> passedDomain) {
domain = passedDomain;
}

/// Set the source direction, where the rays should be traced from.
// Set the source direction, where the rays should be traced from.
void setSourceDirection(const rayTraceDirection passedDirection) {
sourceDirection = passedDirection;
}

// Set the duration of the process.
void setProcessDuration(NumericType passedDuration) {
processDuration = passedDuration;
}

// Returns the duration of the recently run process. This duration can
// sometimes slightly vary from the set process duration, due to the maximum
// time step according to the CFL condition.
NumericType getProcessDuration() const { return processTime; }

// Set the number of rays to traced for each particle in the process.
// The number is per point in the process geometry.
void setNumberOfRaysPerPoint(long numRays) { raysPerPoint = numRays; }

// Set the number of iterations to initialize the coverages.
void setMaxCoverageInitIterations(size_t maxIt) { maxIterations = maxIt; }

void setSmoothFlux(bool pSmoothFlux) { smoothFlux = pSmoothFlux; }
/// Enable flux smoothing. The flux at each surface point, calculated
/// by the ray tracer, is averaged over the surface point neighbors.
void enableFluxSmoothing() { smoothFlux = true; }

// Disable flux smoothing.
void disableFluxSmoothing() { smoothFlux = false; }

// Set the integration scheme for solving the level-set equation.
// Possible integration schemes are specified in lsIntegrationSchemeEnum.
void
setIntegrationScheme(const lsIntegrationSchemeEnum passedIntegrationScheme) {
integrationScheme = passedIntegrationScheme;
}

/// Set the CFL condition to use during advection.
/// The CFL condition sets the maximum distance a surface can
/// be moved during one advection step. It MUST be below 0.5
/// to guarantee numerical stability. Defaults to 0.4999.
// Set the CFL condition to use during advection.
// The CFL condition sets the maximum distance a surface can
// be moved during one advection step. It MUST be below 0.5
// to guarantee numerical stability. Defaults to 0.4999.
void setTimeStepRatio(const double &cfl) { timeStepRatio = cfl; }

// Sets the minimum time between printing intermediate results during the
Expand All @@ -82,6 +100,7 @@ template <typename NumericType, int D> class psProcess {
printTime = passedTime;
}

// Run the process.
void apply() {
/* ---------- Process Setup --------- */
if (!model) {
Expand Down

0 comments on commit ec4e4a8

Please sign in to comment.