Repository navigation
Oxidation: staggered-grid incompressible mechanics, stress-dependent kinetics, AMG solvers on CPU and GPU - #165
Merged
Merged
Conversation
Rework of the thermal oxidation solver, validated against Kao (1987), Senez et al. (1996) and Drob et al. (2025). Mechanics - The oxide (Maxwell, Eyring stress-dependent viscosity) and the Si3N4 mask form one incompressible Stokes problem on a staggered (MAC) grid, solved coupled in velocity and pressure: Eigen SparseLU in 2-D, AMGCL in 3-D (per-component translations as the near nullspace). The collocated grid's odd-even pressure modes broke thick nitride over thin pads. - Traction-free free surfaces; corner shear history kept on the level sets; new oxide is born stress-free; the Si front is evaluated at its interface points (removes +-1-3 GPa stress stripes on sloped fronts). - Nitride: Maxwell-Eyring creep (Senez 1996 Table II) through OxidationMaskParameters viscosity / shearActivationVolume (0 = elastic); the preset siliconNitrideMask(T) creeps. The mask surface is tracked in a Lagrangian way (OxidationMaskTracker), so its corners keep their shape. - Removed: the biharmonic mask-bending solver (OxidationMaskBending, OxidationConstrainedAmbient), the contact modes, the SIMPLE/Uzawa pressure iteration and the mechanics GPU path, with their parameters (stokes*, pressure*, relaxation, bulkModulus, contact*, anchor*). Stress-dependent kinetics - Reaction rate on the interface normal stress, oxidant diffusivity on the pressure, viscosity on the shear stress. The laws read the stress 2-3 cells into the oxide, extrapolated to the front; diffusion faces carry the harmonic-mean D. A stressed Si cylinder matches the exact 1-D radial model to 0.5 nm. - The stress feedback now reaches the solve (it never did before). Coupling iterations: warm-started one-pass viscosity solves, GMRES on the last LU (accepted only under the step's componentwise test), no gas-side velocity estimate. Diffusion and fronts - CPU solve: AMGCL BiCGSTAB with smoothed-aggregation AMG in double (the Jacobi BiCGSTAB broke down on stiff bird's beaks); the residual is scaled by a typical row instead of max|b|. - Reaction Robin BC scaled by |n_axis| (tilted fronts grew too slowly); reflective boundaries mirror through the outermost grid points. - Si-front normals from central differences of the defined level-set values (the clamped values turned them towards the diagonals); the gas-side velocity averages all nearest oxide nodes. - Grid-index key packed into 64 bits (the hash collided for ~9 of 10 indices, so nodes read each other's stress); sub-cell film fix and faster boundary caches. Level-set fixes - FromSurfaceMesh: element index bounds with distanceEps; a face one ulp off a grid line lost its inner band point (hollow box, then an Expand segfault). - Interior keeps the level-set width; with a guide it fills until the region is closed (it stopped after 100 layers). - Resample: reflective edges stay inside the old extent (sentinel values after a regrid); the broken INTERPOLATE strategy, ResampleStrategyEnum and setStrategy are removed. Build: Eigen 3.4.0 and AMGCL 1.4.4 (header-only) via CPM, installed under include/viennals-<version>/external; THIRD_PARTY_LICENSES. Tests: new OxidationBoundaries, OxidationGridKey, OxidationIsotropy, OxidationKaoCylinder, OxidationNitride, Resample and MakeBoxGridAligned; Oxidation and OxidationModel updated. Docs: docs/OxidationSolver.md rewritten for the new solver; README, Python bindings and stubs, and the LOCOS example follow the API.
3-D LOCOS corner (5 nm grid, 360k velocity-pressure unknowns, 0.01 h, 10 threads): 181.6 s -> 153.9 s on the CPU, 56.6 s with the GPU; interfaces equal to the CPU run within 0.0001 nm. 3-D mechanics - The AMG preconditioner and its equilibration are kept per node set: a coupling iteration, the converged solve and a CFL re-solve change only the viscosities and the right-hand side, and the first solve's preconditioner needs the same iterations for the later ones. A reused solve may take twice the iterations of the fresh one (+20); beyond that, or on failure, it is set up afresh. FGMRES still converges to 1e-9. - The same solver (FGMRES, Schur pressure correction, SA-AMG + ILU0 on the velocities, SPAI0 on the pressure) can run on AMGCL's CUDA backend: hierarchy built on the host, iterations on the device, ~10x faster at 360k unknowns. Diffusion - One solver for CPU and GPU: the CSR system is assembled once and solved by BiCGSTAB with SA-AMG + ILU0, on the CPU or on AMGCL's CUDA backend, with the same parameters, stopping test and acceptance. - The custom GPU BiCGSTAB (Jacobi/ILU0) is removed: on stiff LOCOS bird's-beak systems it needed 160-540 iterations, varying 2.7x under round-off noise; the AMG solver takes 3-4 on either side. Its setup runs on the host: ~2 s more per 0.01 h of the corner than the Jacobi solve. GPU mode - OxidationDeformation::setGpuMode, passed on by Oxidation. Gpu or Auto solve diffusion and 3-D mechanics systems of >= 20000 unknowns on the GPU; smaller systems and the 2-D LU stay on the CPU. Without a usable GPU, Auto warns and continues on the CPU; Gpu stops with an error. - Removed: GpuPreconditioner / setGpuPreconditioner (C++ and Python). - ViennaLS_GPU has one source, gpu/lsOxidationGpu.cu; the headers lsOxidationGpuAbi.hpp and lsOxidationGpuInterface.hpp replace lsOxidationBiCGSTAB.cuh, lsOxidationBiCGSTABAbi.hpp and lsOxidationBiCGSTABInterface.hpp. C ABI version 3: an older library is refused. - CMake: AMGCL include path and OpenMP for ViennaLS_GPU. nvcc's host compiler gets -fopenmp (/openmp on MSVC): OpenMP_CXX_FLAGS is -fopenmp=libomp with clang, which a gcc host rejects. Docs: docs/OxidationSolver.md, README, Python bindings and stubs.
3-D LOCOS corner (5 nm grid, 0.01 h, 10 threads): GPU 56.8 -> 27.4 s, CPU 152.9 -> 77.6 s. Interfaces within 0.0011 nm of the previous code after 0.05 h; 2-D changes only at round-off level (Brent). Parallel CPU work around the solves (results bit-identical) - the gas-side velocity walk of the CFL bound runs in parallel, and getScalarVelocity no longer repeats a failed reaction-boundary search - Si ghost-face front velocities kept for the duration of a mechanics solve; frontVelocityAt reads a per-node list of the REACTION crossings - the 3-D CSR is built in two parallel passes into arrays kept between solves; the equilibrated copy is kept and filled in parallel - dynamic schedules for the write-back and viscosity-update loops Solves (same tolerances) - the Eyring viscosity is solved with Brent's method instead of bisection: same bracket, within 0.5e-10 of the root in log eta, 3.2 evaluations instead of ~37; it agrees with the bisection within 3.8e-11 on 12.8 million solves - the 3-D velocity-pressure solves inside the stress-coupling iteration stop at a relative residual of 1e-7 (10x below the 1e-6 acceptance) instead of 1e-9; the converged solve the interfaces move with stays at 1e-9 (40 % fewer iterations) - on the CPU the AMG and Schur preconditioner run in single precision; FGMRES and its residual stay double (same iterations, 13 % less time) - on the GPU the system matrix stays on the device: only the values are uploaded when the pattern repeats The 8 oxidation tests and the ViennaPS oxidation test pass. Docs: docs/OxidationSolver.md.
Brings in #164: segment loops as omp parallel for, Mesh removeDuplicateNodes, version 5.9.0. Conflicts - lsOxidation*.hpp (5 files): this branch's version. #164's edits there (caches keyed by Index with viennahrle::Index::hash, ViennaCore vector operators instead of detail::vecAdd/vecScaled) apply to code this branch rewrote or removed; taking them over is a separate change. - CMakeLists.txt: both install-target additions kept (Eigen/AMGCL headers, VIENNALS_DEPENDENCIES). - python/viennals/*.pyi: regenerated from the merged module (pybind11-stubgen 2.5.5); adds GpuMode.Auto, which the stubs of this branch were missing. All 63 tests build and pass; the 3-D LOCOS corner (CPU) writes byte-identical output.
ViennaCore 2.4 (the version ViennaPS builds with) returns the squared distance from KDTree::findNearest; 2.2 returned the distance. With 2.4 every Chamfer metric came out squared: two r = 5 circles shifted by sqrt(5) gave mean 2.49 and max 5 instead of 1.43 and 2.24. The distance is now computed from the returned point with ViennaCore's Distance, correct with either version. The CompareChamfer test checks the geometric bound (no surface point farther than the centre shift, up to the mesh resolution); it fails with the old code on ViennaCore 2.4.
- Remove two debug dumps (OX_DUMP_VEL, OX_DUMP_CONC) that wrote solver data to /tmp when the variable was set. - Comments no longer refer to development notes, internal labels and dates; they keep the technical reason. - Nitride: described as elastic with Maxwell creep (it was "linear elastic" in two doc comments and the ViennaLS README). - ViennaPS example READMEs (fin, trench, LOCOS) describe the current solver: incompressible Stokes flow with the expansion as a boundary velocity, velocity and pressure solved together on a staggered grid, reaction rate on the interface normal stress, BiCGSTAB with AMG for the diffusion. They still described the removed SIMPLE iteration and the Jacobi diffusion solver.
lsOxidationDeformation.hpp defined AMGCL_NO_BOOST only after including lsOxidationDiffusion.hpp, which includes AMGCL first, so AMGCL's core was built with Boost.PropertyTree wherever Boost is installed. The Boost in the Linux Python build image uses std::allocator::rebind, which C++20 removed, and the Python module failed to compile. The define now precedes the first AMGCL include, in lsOxidationDiffusion.hpp.
clang-format 17 (used by the CI format check) and 18 break a call with a lambda in the middle of its arguments differently.
vcpkg builds VTK on Windows, and VTK needs gl2ps, whose only download site (geuz.org) times out. vcpkg uses a file already in its downloads folder when the SHA512 matches, so the identical gl2ps-1.4.2.tgz is fetched from distfiles.macports.org first. If that fails, the file is removed and vcpkg downloads as usual.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rework of the thermal oxidation solver (
lsOxidation*). The oxide is now anincompressible Stokes problem on a staggered (MAC) grid, solved coupled in
velocity and pressure, with the Si3N4 mask in the same system. The oxidation
kinetics depend on the oxide stress. Diffusion and 3-D mechanics run on AMGCL,
on the CPU or the GPU. Validated against Kao (1987), Senez et al. (1996) and
Drob et al. (2025); calibration and comparisons are in the ViennaPS PR.
Includes master up to v5.9.0 (#164). Version 5.10.0.
Mechanics
velocity and pressure solved together: Eigen SparseLU in 2-D, AMGCL FGMRES
with a Schur pressure correction in 3-D. The collocated grid's odd-even
pressure modes broke thick nitride over thin pads.
Senez 1996); its surface is tracked in a Lagrangian way so corners keep
their shape.
oxide is born stress-free.
bulkModulus(a numericalcoupling coefficient, not the SiO2 bulk modulus), the mask-bending solver
and the contact modes.
Kinetics and diffusion
viscosity on the shear stress. A stressed Si cylinder matches the exact 1-D
radial model to 0.5 nm.
maskPermeabilityRatio,barrier-only mode).
AMG. It replaces the custom GPU BiCGSTAB (Jacobi/ILU0), which needed 160-540
iterations on stiff bird's-beak systems; AMG takes 3-4.
a grid-index hash that collided for ~9 of 10 indices, so nodes read each
other's stress.
Performance
3-D LOCOS corner (5 nm grid, 360k unknowns, 0.01 h, 10 threads):
181.6 s -> 77.6 s on the CPU, 27.4 s with the GPU.
Fixes outside oxidation
CompareChamfer: distances computed from the points. ViennaCore 2.4 returnsthe squared distance from
KDTree::findNearest, so every Chamfer metriccame out squared; the test now checks the geometric bound.
FromSurfaceMesh: a face one ulp off a grid line lost its inner band point(hollow box, then an
Expandsegfault).Interior: keeps the level-set width; with a guide it fills until theregion is closed (it stopped after 100 layers).
Resample: a level set on a new grid spacing via a surface-mesh roundtrip (exact on analytic tests).
VTKWriter,WriteVisualizationMesh: inline binary instead of appended data(VTK 9.1 cannot read back its own appended files above one 32 kB block);
WriteVisualizationMeshaccepts non-nested stacks such as a LOCOS mask.Build
include/viennals-<version>/external;THIRD_PARTY_LICENSES.md.ViennaLS_GPUhas one source (gpu/lsOxidationGpu.cu), C ABI version 3; anolder library is refused.
Breaking changes
OxidationMaskBending,OxidationConstrainedAmbient.stokes*,pressure*,relaxation,bulkModulus,contact*,anchor*.GpuPreconditioner/setGpuPreconditioner(C++ and Python).Tests and docs
OxidationKaoCylinder, OxidationNitride, Resample, MakeBoxGridAligned;
Oxidation, OxidationModel and CompareChamfer updated. All 63 tests pass
(ViennaCore 2.2.1 and 2.4.0); clang-format 18 and cmake-format clean.
docs/OxidationSolver.mdrewritten for the new solver.