From b1e2c51da0518e97808b067caf853aa394bb6156 Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Thu, 6 Feb 2025 12:04:52 +0100 Subject: [PATCH 1/4] Small fixes in examples --- .gitignore | 2 +- examples/holeEtching/config.txt | 8 ++--- examples/holeEtching/holeEtching.cpp | 31 +++++++++---------- examples/oxideRegrowth/oxideRegrowth.cpp | 2 -- examples/oxideRegrowth/oxideRegrowth.py | 1 - .../models/psMultiParticleProcess.hpp | 8 +++-- include/viennaps/models/psSF6O2Etching.hpp | 4 +-- include/viennaps/models/psSF6O2Parameters.hpp | 8 ++--- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 54e15872..8f2316f6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ dist/ dependencies/ *.ipynb old_* -*_old.* +*_old* *a.out install* *.vtk diff --git a/examples/holeEtching/config.txt b/examples/holeEtching/config.txt index 4502feda..89ff0f32 100644 --- a/examples/holeEtching/config.txt +++ b/examples/holeEtching/config.txt @@ -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 @@ -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 diff --git a/examples/holeEtching/holeEtching.cpp b/examples/holeEtching/holeEtching.cpp index 7e6cf8d6..5a9cc34e 100644 --- a/examples/holeEtching/holeEtching.cpp +++ b/examples/holeEtching/holeEtching.cpp @@ -4,17 +4,17 @@ #include #include -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 { @@ -22,21 +22,21 @@ int main(int argc, char *argv[]) { return 1; } + // set parameter units + units::Length::setUnit(params.get("lengthUnit")); + units::Time::setUnit(params.get("timeUnit")); + // geometry setup - auto geometry = ps::SmartPointer>::New(); - ps::MakeHole( + auto geometry = SmartPointer>::New(); + MakeHole( 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("lengthUnit")); - ps::units::Time::setUnit(params.get("timeUnit")); - // use pre-defined model SF6O2 etching model - ps::SF6O2Parameters modelParams; + SF6O2Parameters modelParams; modelParams.ionFlux = params.get("ionFlux"); modelParams.etchantFlux = params.get("etchantFlux"); modelParams.oxygenFlux = params.get("oxygenFlux"); @@ -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>::New(modelParams); + auto model = SmartPointer>::New(modelParams); // process setup - ps::Process process; + Process 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( diff --git a/examples/oxideRegrowth/oxideRegrowth.cpp b/examples/oxideRegrowth/oxideRegrowth.cpp index 9eb1d0c7..be453bce 100644 --- a/examples/oxideRegrowth/oxideRegrowth.cpp +++ b/examples/oxideRegrowth/oxideRegrowth.cpp @@ -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"); diff --git a/examples/oxideRegrowth/oxideRegrowth.py b/examples/oxideRegrowth/oxideRegrowth.py index 26282e0e..70e92da4 100644 --- a/examples/oxideRegrowth/oxideRegrowth.py +++ b/examples/oxideRegrowth/oxideRegrowth.py @@ -82,7 +82,6 @@ process.setDomain(domain) process.setProcessModel(model) process.setProcessDuration(params["targetEtchDepth"] / params["nitrideEtchRate"] * 60.0) -process.setPrintTimeInterval(30.0) process.apply() diff --git a/include/viennaps/models/psMultiParticleProcess.hpp b/include/viennaps/models/psMultiParticleProcess.hpp index 315ba46a..f2ef61c4 100644 --- a/include/viennaps/models/psMultiParticleProcess.hpp +++ b/include/viennaps/models/psMultiParticleProcess.hpp @@ -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.) @@ -132,7 +135,8 @@ class IonParticle NumericType(1.)); auto direction = viennaray::ReflectionConedCosine( - rayDir, geomNormal, rngState, std::max(incomingAngle, minAngle_)); + rayDir, geomNormal, rngState, + M_PI_2 - std::min(incomingAngle, minAngle_)); return std::pair>{sticking, direction}; } diff --git a/include/viennaps/models/psSF6O2Etching.hpp b/include/viennaps/models/psSF6O2Etching.hpp index ea8c979e..84f742e0 100644 --- a/include/viennaps/models/psSF6O2Etching.hpp +++ b/include/viennaps/models/psSF6O2Etching.hpp @@ -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; @@ -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; diff --git a/include/viennaps/models/psSF6O2Parameters.hpp b/include/viennaps/models/psSF6O2Parameters.hpp index 607c1001..83a54148 100644 --- a/include/viennaps/models/psSF6O2Parameters.hpp +++ b/include/viennaps/models/psSF6O2Parameters.hpp @@ -2,6 +2,8 @@ #include "../psConstants.hpp" +#include + namespace viennaps { using namespace viennacore; @@ -13,10 +15,8 @@ template struct SF6O2Parameters { NumericType oxygenFlux = 1.0e2; // sticking probabilities - std::unordered_map beta_F = {{Material::Si, 0.7}, - {Material::Mask, 0.7}}; - std::unordered_map beta_O = {{Material::Si, 1.}, - {Material::Mask, 1.}}; + std::unordered_map beta_F = {{1, 0.7}, {0, 0.7}}; + std::unordered_map beta_O = {{1, 1.}, {0, 1.}}; NumericType etchStopDepth = std::numeric_limits::lowest(); bool fluxIncludeSticking = false; From a8c44da00638719a082e100a9e28b7a28947af62 Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Thu, 6 Feb 2025 13:43:17 +0100 Subject: [PATCH 2/4] Fix cone angle in multi particle process --- CMakeLists.txt | 2 +- include/viennaps/models/psMultiParticleProcess.hpp | 9 +++++---- tests/multiParticleProcess/multiParticleProcess.cpp | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e291286..434a7e6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/include/viennaps/models/psMultiParticleProcess.hpp b/include/viennaps/models/psMultiParticleProcess.hpp index f2ef61c4..296052b1 100644 --- a/include/viennaps/models/psMultiParticleProcess.hpp +++ b/include/viennaps/models/psMultiParticleProcess.hpp @@ -100,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(1.)), - static_cast(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 @@ -267,7 +268,7 @@ class MultiParticleProcess : public ProcessModel { } 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., diff --git a/tests/multiParticleProcess/multiParticleProcess.cpp b/tests/multiParticleProcess/multiParticleProcess.cpp index 592a7fce..a7afbe9f 100644 --- a/tests/multiParticleProcess/multiParticleProcess.cpp +++ b/tests/multiParticleProcess/multiParticleProcess.cpp @@ -37,7 +37,9 @@ template void RunTest() { return material == Material::Si ? -(fluxes[0] + fluxes[1]) : 0; }); - Process(domain, model, 1.).apply(); + Process process(domain, model, 1.); + process.setNumberOfRaysPerPoint(100); + process.apply(); LSTEST_ASSERT_VALID_LS(domain->getLevelSets().back(), NumericType, D); } From 505a5026c6b457dc5b6183c834f9635b0b567edc Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Thu, 6 Feb 2025 13:46:48 +0100 Subject: [PATCH 3/4] fix SF6O2 --- include/viennaps/models/psSF6O2Etching.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/viennaps/models/psSF6O2Etching.hpp b/include/viennaps/models/psSF6O2Etching.hpp index 84f742e0..87d3cd61 100644 --- a/include/viennaps/models/psSF6O2Etching.hpp +++ b/include/viennaps/models/psSF6O2Etching.hpp @@ -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; From d80d270c9378fbd0e24a25ed42c5a1366ea30c19 Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Thu, 6 Feb 2025 13:57:34 +0100 Subject: [PATCH 4/4] update holeEtching python example --- examples/holeEtching/holeEtching.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/holeEtching/holeEtching.py b/examples/holeEtching/holeEtching.py index 4768e7aa..0a07a63f 100644 --- a/examples/holeEtching/holeEtching.py +++ b/examples/holeEtching/holeEtching.py @@ -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( @@ -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() @@ -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)