Skip to content

Commit

Permalink
Small fixes in examples (#107)
Browse files Browse the repository at this point in the history
* Small fixes in examples

* Fix cone angle in multi particle process

* fix SF6O2

* update holeEtching python example
  • Loading branch information
tobre1 authored Feb 6, 2025
1 parent daa155d commit 9df9392
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dist/
dependencies/
*.ipynb
old_*
*_old.*
*_old*
*a.out
install*
*.vtk
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ CPMAddPackage(

CPMFindPackage(
NAME ViennaRay
VERSION 3.1.1
VERSION 3.1.2
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaRay"
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON})

Expand Down
8 changes: 4 additions & 4 deletions examples/holeEtching/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ maskHeight=1.2 # um
taperAngle=1.193 # degree

# Process parameters
processTime=3
processTime=1
timeUnit=min

# all flux values are units 1e15 / cm²
ionFlux=10.
etchantFlux=3000.
oxygenFlux=1500.
etchantFlux=4.5e3
oxygenFlux=8e2

ionExponent=200
meanEnergy=100 # eV
Expand All @@ -28,7 +28,7 @@ A_O=2 # passivation layer yield constant
A_Si=7 # Si yield constant

etchStopDepth=-10 # maximum etching depth
integrationScheme=EO_1
integrationScheme=EO_2

raysPerPoint=1000

Expand Down
31 changes: 15 additions & 16 deletions examples/holeEtching/holeEtching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
#include <psProcess.hpp>
#include <psUtils.hpp>

namespace ps = viennaps;
using namespace viennaps;

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

ps::Logger::setLogLevel(ps::LogLevel::DEBUG);
Logger::setLogLevel(LogLevel::INTERMEDIATE);
omp_set_num_threads(16);

// Parse the parameters
ps::utils::Parameters params;
utils::Parameters params;
if (argc > 1) {
params.readConfigFile(argv[1]);
} else {
std::cout << "Usage: " << argv[0] << " <config file>" << std::endl;
return 1;
}

// set parameter units
units::Length::setUnit(params.get<std::string>("lengthUnit"));
units::Time::setUnit(params.get<std::string>("timeUnit"));

// geometry setup
auto geometry = ps::SmartPointer<ps::Domain<NumericType, D>>::New();
ps::MakeHole<NumericType, D>(
auto geometry = SmartPointer<Domain<NumericType, D>>::New();
MakeHole<NumericType, D>(
geometry, params.get("gridDelta"), params.get("xExtent"),
params.get("yExtent"), params.get("holeRadius"), params.get("maskHeight"),
params.get("taperAngle"), 0 /* base height */,
false /* periodic boundary */, true /*create mask*/, ps::Material::Si)
false /* periodic boundary */, true /*create mask*/, Material::Si)
.apply();

// set parameter units
ps::units::Length::setUnit(params.get<std::string>("lengthUnit"));
ps::units::Time::setUnit(params.get<std::string>("timeUnit"));

// use pre-defined model SF6O2 etching model
ps::SF6O2Parameters<NumericType> modelParams;
SF6O2Parameters<NumericType> modelParams;
modelParams.ionFlux = params.get("ionFlux");
modelParams.etchantFlux = params.get("etchantFlux");
modelParams.oxygenFlux = params.get("oxygenFlux");
Expand All @@ -46,14 +46,13 @@ int main(int argc, char *argv[]) {
modelParams.Passivation.A_ie = params.get("A_O");
modelParams.Si.A_ie = params.get("A_Si");
modelParams.etchStopDepth = params.get("etchStopDepth");
auto model =
ps::SmartPointer<ps::SF6O2Etching<NumericType, D>>::New(modelParams);
auto model = SmartPointer<SF6O2Etching<NumericType, D>>::New(modelParams);

// process setup
ps::Process<NumericType, D> process;
Process<NumericType, D> process;
process.setDomain(geometry);
process.setProcessModel(model);
process.setMaxCoverageInitIterations(50);
process.setMaxCoverageInitIterations(20);
process.setNumberOfRaysPerPoint(params.get("raysPerPoint"));
process.setProcessDuration(params.get("processTime"));
process.setIntegrationScheme(
Expand Down
29 changes: 17 additions & 12 deletions examples/holeEtching/holeEtching.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
# print intermediate output surfaces during the process
vps.Logger.setLogLevel(vps.LogLevel.INTERMEDIATE)

vps.Length.setUnit(params["lengthUnit"])
vps.Time.setUnit(params["timeUnit"])

# geometry setup, all units in um
geometry = vps.Domain()
vps.MakeHole(
Expand All @@ -31,20 +34,20 @@
taperingAngle=params["taperAngle"],
makeMask=True,
material=vps.Material.Si,
holeShape=vps.HoleShape.Half,
).apply()

# use pre-defined model SF6O2 etching model
model = vps.SF6O2Etching(
ionFlux=params["ionFlux"],
etchantFlux=params["etchantFlux"],
oxygenFlux=params["oxygenFlux"],
meanIonEnergy=params["meanEnergy"],
sigmaIonEnergy=params["sigmaEnergy"],
oxySputterYield=params["A_O"],
etchStopDepth=params["etchStopDepth"],
)
parameters = model.getParameters()
parameters.Mask.rho = 100.
modelParams = vps.SF6O2Parameters()
modelParams.ionFlux = params["ionFlux"]
modelParams.etchantFlux = params["etchantFlux"]
modelParams.oxygenFlux = params["oxygenFlux"]
modelParams.Ions.meanEnergy = params["meanEnergy"]
modelParams.Ions.sigmaEnergy = params["sigmaEnergy"]
modelParams.Passivation.A_ie = params["A_O"]
modelParams.etchStopDepth = params["etchStopDepth"]

model = vps.SF6O2Etching(modelParams)

# process setup
process = vps.Process()
Expand All @@ -53,7 +56,9 @@
process.setMaxCoverageInitIterations(10)
process.setNumberOfRaysPerPoint(int(params["raysPerPoint"]))
process.setProcessDuration(params["processTime"]) # seconds
process.setIntegrationScheme(vps.util.convertIntegrationScheme(params["integrationScheme"]))
process.setIntegrationScheme(
vps.util.convertIntegrationScheme(params["integrationScheme"])
)

# print initial surface
geometry.saveSurfaceMesh(filename="initial.vtp", addMaterialIds=True)
Expand Down
2 changes: 0 additions & 2 deletions examples/oxideRegrowth/oxideRegrowth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ int main(int argc, char **argv) {
process.setProcessModel(model);
process.setProcessDuration(params.get("targetEtchDepth") /
params.get("nitrideEtchRate") * 60.);
process.setPrintTimeInterval(30);

process.apply();

domain->saveVolumeMesh("finalStack");
Expand Down
1 change: 0 additions & 1 deletion examples/oxideRegrowth/oxideRegrowth.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
process.setDomain(domain)
process.setProcessModel(model)
process.setProcessDuration(params["targetEtchDepth"] / params["nitrideEtchRate"] * 60.0)
process.setPrintTimeInterval(30.0)

process.apply()

Expand Down
17 changes: 11 additions & 6 deletions include/viennaps/models/psMultiParticleProcess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class IonParticle

if (B_sp_ >= 0.) {
NumericType cosTheta = -DotProduct(rayDir, geomNormal);
flux *= (1 + B_sp_ * (1 - cosTheta * cosTheta)) * cosTheta;
NumericType angle = std::acos(cosTheta);
if (cosTheta)
flux *= std::max(3. - 6. * angle / M_PI, 0.);
// flux *= (1 + B_sp_ * (1 - cosTheta * cosTheta)) * cosTheta;
}

if (energy_ > 0.)
Expand All @@ -97,12 +100,13 @@ class IonParticle
RNG &rngState) override final {

auto cosTheta = -DotProduct(rayDir, geomNormal);
cosTheta = std::min(cosTheta, NumericType(1.));
assert(cosTheta >= 0 && "Hit backside of disc");
assert(cosTheta <= 1 + 1e-6 && "Error in calculating cos theta");

NumericType incomingAngle =
std::acos(std::max(std::min(cosTheta, static_cast<NumericType>(1.)),
static_cast<NumericType>(0.)));
NumericType incomingAngle = std::acos(cosTheta);
assert(incomingAngle <= M_PI_2 + 1e-6 && "Error in calculating angle");
assert(incomingAngle >= 0 && "Error in calculating angle");

if (energy_ > 0.) {
// Small incident angles are reflected with the energy fraction centered
Expand Down Expand Up @@ -132,7 +136,8 @@ class IonParticle
NumericType(1.));

auto direction = viennaray::ReflectionConedCosine<NumericType, D>(
rayDir, geomNormal, rngState, std::max(incomingAngle, minAngle_));
rayDir, geomNormal, rngState,
M_PI_2 - std::min(incomingAngle, minAngle_));

return std::pair<NumericType, Vec3D<NumericType>>{sticking, direction};
}
Expand Down Expand Up @@ -263,7 +268,7 @@ class MultiParticleProcess : public ProcessModel<NumericType, D> {
}

void addIonParticle(NumericType sourcePower, NumericType thetaRMin = 0.,
NumericType thetaRMax = 90., NumericType minAngle = 0.,
NumericType thetaRMax = 90., NumericType minAngle = 80.,
NumericType B_sp = -1., NumericType meanEnergy = 0.,
NumericType sigmaEnergy = 0.,
NumericType thresholdEnergy = 0.,
Expand Down
6 changes: 3 additions & 3 deletions include/viennaps/models/psSF6O2Etching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class SF6O2Etchant

private:
NumericType sticking(const int matieralId) const {
auto beta = params.beta_F.find(MaterialMap::mapToMaterial(matieralId));
auto beta = params.beta_F.find(matieralId);
if (beta != params.beta_F.end())
return beta->second;

Expand Down Expand Up @@ -445,7 +445,7 @@ class SF6Etchant

private:
NumericType sticking(const int matieralId) const {
auto beta = params.beta_F.find(MaterialMap::mapToMaterial(matieralId));
auto beta = params.beta_F.find(matieralId);
if (beta != params.beta_F.end())
return beta->second;

Expand Down Expand Up @@ -502,7 +502,7 @@ class SF6O2Oxygen

private:
NumericType sticking(const int matieralId) const {
auto beta = params.beta_O.find(MaterialMap::mapToMaterial(matieralId));
auto beta = params.beta_O.find(matieralId);
if (beta != params.beta_O.end())
return beta->second;

Expand Down
8 changes: 4 additions & 4 deletions include/viennaps/models/psSF6O2Parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "../psConstants.hpp"

#include <unordered_map>

namespace viennaps {

using namespace viennacore;
Expand All @@ -13,10 +15,8 @@ template <typename NumericType> struct SF6O2Parameters {
NumericType oxygenFlux = 1.0e2;

// sticking probabilities
std::unordered_map<Material, NumericType> beta_F = {{Material::Si, 0.7},
{Material::Mask, 0.7}};
std::unordered_map<Material, NumericType> beta_O = {{Material::Si, 1.},
{Material::Mask, 1.}};
std::unordered_map<int, NumericType> beta_F = {{1, 0.7}, {0, 0.7}};
std::unordered_map<int, NumericType> beta_O = {{1, 1.}, {0, 1.}};

NumericType etchStopDepth = std::numeric_limits<NumericType>::lowest();
bool fluxIncludeSticking = false;
Expand Down
4 changes: 3 additions & 1 deletion tests/multiParticleProcess/multiParticleProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ template <class NumericType, int D> void RunTest() {
return material == Material::Si ? -(fluxes[0] + fluxes[1]) : 0;
});

Process<NumericType, D>(domain, model, 1.).apply();
Process<NumericType, D> process(domain, model, 1.);
process.setNumberOfRaysPerPoint(100);
process.apply();

LSTEST_ASSERT_VALID_LS(domain->getLevelSets().back(), NumericType, D);
}
Expand Down

0 comments on commit 9df9392

Please sign in to comment.