Surface Diffusion Parameters
#include <process/psSurfaceDiffusion.hpp>
SurfaceDiffusionParameters configure the graph-based surface diffusion solver used by process models that expose surface diffusion coefficients.
Surface diffusion is not a standalone pre-built ProcessModel. It is a process-level capability used by compatible surface models, and it can also be used directly through SurfaceDiffusionStencil and SurfaceDiffusionSolver.
Process Parameters
The parameters configure graph construction for process-integrated surface diffusion. They are set through the standard Process::setParameters(...) interface.
| Field | Type | Default | Description |
|---|---|---|---|
stabilityFactor | double | 1.0 | Factor used by process-integrated diffusion when choosing stable explicit substeps. |
kNeighbors | int | 16 | Number of nearest neighbors considered when radius <= 0. |
radius | double | 0.0 | Radius-based neighbor search cutoff. 0.0 uses kNeighbors instead. |
normalCutoff | double | 0.25 | Minimum normal dot product allowed between neighboring points. |
sigmaNormal | double | 0.35 | Controls how strongly normal differences reduce diffusion weights. |
normalizeByLocalScale | bool | true | Scale weights by the local point spacing. |
symmetrizeWeights | bool | true | Build symmetric graph weights from the directed neighbor graph. |
Example Usage
C++
using namespace viennaps;
SurfaceDiffusionParameters diffusion;
diffusion.kNeighbors = 16;
diffusion.radius = 0.0;
diffusion.normalCutoff = 0.25;
Process<double, 3> process(domain, model, processTime);
process.setParameters(diffusion);
process.apply();
Python
import viennaps as vps
diffusion = vps.SurfaceDiffusionParameters()
diffusion.kNeighbors = 16
diffusion.radius = 0.0
diffusion.normalCutoff = 0.25
process = vps.Process(domain, model, process_time)
process.setParameters(diffusion)
process.apply()
Standalone Solver
ViennaPS also exposes the underlying graph solver directly. It builds a neighborhood graph from surface point positions and normals, then applies a graph Laplacian to diffuse scalar data along the surface while reducing coupling across sharp changes in surface normal.
The checked-in example computes a particle flux on a trench geometry, builds a PointCloud from the flux mesh nodes and normals, and repeatedly applies SurfaceDiffusionSolver::stepExplicit(...) to smooth the particleFlux field.
PointCloud<double> cloud;
cloud.positions = flux->getNodes();
cloud.normals = *flux->getNormals();
SurfaceDiffusionParameters params;
params.kNeighbors = 16;
SurfaceDiffusionSolver<double> solver(
SurfaceDiffusionStencil<double>(cloud, params));
auto currentFlux = *flux->getCellData().getScalarData("particleFlux");
currentFlux = solver.stepExplicit(currentFlux, 1e-3, 1.0);
Practical Notes
- Use
radiuswhen a physical cutoff is known; otherwise usekNeighbors. - Increase
kNeighborsorradiusif the graph is too disconnected. - Raise
normalCutoffto reduce diffusion across corners and steep surface changes. SurfaceDiffusionParametersonly affect process-integrated diffusion when the selected process model provides surface diffusion coefficients.
