ViennaLS
Loading...
Searching...
No Matches
viennals::OxidationDiffusion< T, D > Class Template Referencefinal

Solves the oxidant diffusion step of the Suvorov et al. (10.1007/s10825-006-0003-z) oxidation model on the Cartesian grid carrying two level sets. More...

#include <lsOxidationDiffusion.hpp>

Inheritance diagram for viennals::OxidationDiffusion< T, D >:
viennals::VelocityField< T > viennals::OxidationSolverBase< T, D >

Classes

struct  ReactionBoundarySample
 Sub-grid accurate sample of the reaction boundary crossing closest to a given grid node. Carries the interpolated concentration at the boundary point, plus the axis and offset of the edge on which the crossing lies so that callers can reconstruct the boundary-point position and normal. More...

Public Member Functions

 OxidationDiffusion ()=default
 OxidationDiffusion (SmartPointer< Domain< T, D > > passedReactionInterface, SmartPointer< Domain< T, D > > passedAmbientInterface, OxidationParameters passedParameters={})
 ~OxidationDiffusion ()
void markGeometryChanged ()
 Call after any in-place modification of the level sets (e.g. after ls::Advect) so that the next apply() rebuilds the Cartesian node grid.
void setReactionInterface (SmartPointer< Domain< T, D > > passedInterface)
void setAmbientInterface (SmartPointer< Domain< T, D > > passedInterface)
void setMaskInterface (SmartPointer< Domain< T, D > > passedInterface, int passedMaskSign=1)
void clearMaskInterface ()
void setParameters (OxidationParameters passedParameters)
OxidationParameters getParameters () const
T getEffectiveReactionRate (const Vec3D< T > &coordinate) const
void clearPressureField ()
void setPressure (const IndexType &index, T pressure)
void setPressure (const Vec3D< T > &coordinate, T pressure)
void setOxideSigns (int passedReactionSign, int passedAmbientSign)
 Set signs defining the oxide band. A node is inside oxide if reactionSign * reactionPhi >= 0 and ambientSign * ambientPhi >= 0.
void setSolveBounds (const IndexType &passedMinIndex, const IndexType &passedMaxIndex)
 Restrict the dense Cartesian diffusion solve to a finite index box. This is useful for level sets with infinite boundary conditions.
void clearSolveBounds ()
void apply ()
T getScalarVelocity (const Vec3D< T > &coordinate, int material, const Vec3D< T > &normalVector, unsigned long) final
 Should return a scalar value for the velocity at coordinate for a point of material with the given normalVector.
T getDissipationAlpha (int, int material, const Vec3D< T > &) final
 If lsLocalLaxFriedrichsAnalytical is used as the spatial discretization scheme, this is called to provide the analytical solution for the alpha values, needed for numerical stability.
T getConcentration (const Vec3D< T > &coordinate) const
T getConcentration (const IndexType &index) const
T getReactionBoundaryConcentration (const Vec3D< T > &coordinate) const
T getReactionBoundaryConcentration (const IndexType &index) const
unsigned getIterations () const
T getResidual () const
T getNormalizedResidual () const
bool lastSolveConverged () const
std::size_t getNumberOfSolutionNodes () const
bool hasFiniteConcentrationField () const
const std::unordered_map< std::size_t, T > & getConcentrationCache () const
void setConcentrationCache (std::unordered_map< std::size_t, T > cache)
void setGpuMode (GpuMode mode)
 Set the GPU solver selection mode. See GpuMode for the two options. On CPU-only builds (VIENNALS_GPU_BICGSTAB not defined) this is a no-op.
void setGpuPreconditioner (GpuPreconditioner preconditioner)
 Set the GPU BiCGSTAB preconditioner. Jacobi matches the CPU solver.
void markSolved ()
 Mark the current solution as valid without re-solving. Call this before any parallel advection (lsAdvect) that uses this field as a velocity source to prevent concurrent apply() calls inside getScalarVelocity().
void writeConcentrationToLevelSet ()
 Write per-node concentration into ambientInterface->getPointData() so that lsInterior + lsAdvect can carry it across timestep boundaries. Safe to call regardless of the solved flag; uses the most recent nodes.
void writePressureToLevelSet ()
 Write per-node pressure into ambientInterface->getPointData() so that it survives advection and can warm-start the coupling loop next step.
void writePersistentFields ()
 Convenience wrapper: persist both concentration and pressure in one call.
ReactionBoundarySample getReactionBoundarySample (const Vec3D< T > &coordinate) const
 Return the reaction boundary sample for the grid node nearest to coordinate. Used by the deformation solver to get both the sub-grid concentration and the crossing edge so it can compute a sub-grid normal.
T getScalarVelocityFromSample (const ReactionBoundarySample &sample) const
 Absolute scalar velocity derived from an already-computed boundary sample, avoiding a second call to reactionBoundarySample inside getScalarVelocity.
virtual Vec3D< TgetVectorVelocity (const Vec3D< T > &, int, const Vec3D< T > &, unsigned long)
 Like getScalarVelocity, but returns a velocity value for each cartesian direction.

Static Public Member Functions

template<class... Args>
static auto New (Args &&...args)

Protected Member Functions

bool crosses (T a, T b) const
T valueAt (ConstSparseIterator &it, const IndexType &index) const
bool inBounds (const IndexType &index) const
void initNodeLookup ()
std::size_t lookupNode (const IndexType &index) const
std::size_t linearIndex (const IndexType &index) const
bool increment (IndexType &index) const
std::size_t findNearbyNode (const IndexType &index) const
bool initializeGridFromInterfaces (SmartPointer< Domain< T, D > > reactionInterface, SmartPointer< Domain< T, D > > ambientInterface, SmartPointer< Domain< T, D > > maskInterface, bool useRequestedBounds, const IndexType &requestedMinIndex, const IndexType &requestedMaxIndex, std::size_t maxGridPoints, const std::string &solverName)
bool initializeGridFromMask (SmartPointer< Domain< T, D > > maskInterface, bool useRequestedBounds, const IndexType &requestedMinIndex, const IndexType &requestedMaxIndex, std::size_t maxGridPoints, const std::string &solverName)

Protected Attributes

std::vector< std::size_t > nodeLookupFlat
IndexType minIndex {}
IndexType maxIndex {}
std::array< std::size_t, Dextents {}
std::array< std::size_t, Dstrides {}
T gridDelta = 1.

Static Protected Attributes

static constexpr std::size_t noNode = std::numeric_limits<std::size_t>::max()

Detailed Description

template<class T, int D>
class viennals::OxidationDiffusion< T, D >

Solves the oxidant diffusion step of the Suvorov et al. (10.1007/s10825-006-0003-z) oxidation model on the Cartesian grid carrying two level sets.

The oxide is assumed to lie between the Si/SiO2 reaction interface and the SiO2/O2 ambient interface. Regular Cartesian grid nodes inside this band are solved with finite differences. Whenever an axis-aligned grid edge leaves the oxide, a cross-point is inserted at the zero of the crossed level-set function and a Robin boundary condition is applied there. The diffusion update uses the resulting sub-grid distances in a nonuniform three-point stencil along each Cartesian axis.

The default sign convention matches the multilayer convention described in the paper: oxide is above the reaction interface and below the ambient interface, i.e. reactionPhi >= 0 and ambientPhi <= 0.

Constructor & Destructor Documentation

◆ OxidationDiffusion() [1/2]

template<class T, int D>
viennals::OxidationDiffusion< T, D >::OxidationDiffusion ( )
default

◆ OxidationDiffusion() [2/2]

template<class T, int D>
viennals::OxidationDiffusion< T, D >::OxidationDiffusion ( SmartPointer< Domain< T, D > > passedReactionInterface,
SmartPointer< Domain< T, D > > passedAmbientInterface,
OxidationParameters passedParameters = {} )
inline

◆ ~OxidationDiffusion()

template<class T, int D>
viennals::OxidationDiffusion< T, D >::~OxidationDiffusion ( )
inline

Member Function Documentation

◆ apply()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::apply ( )
inline

◆ clearMaskInterface()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::clearMaskInterface ( )
inline

◆ clearPressureField()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::clearPressureField ( )
inline

◆ clearSolveBounds()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::clearSolveBounds ( )
inline

◆ crosses()

template<class T, int D>
bool viennals::OxidationSolverBase< T, D >::crosses ( T a,
T b ) const
inlineprotectedinherited

◆ findNearbyNode()

template<class T, int D>
std::size_t viennals::OxidationSolverBase< T, D >::findNearbyNode ( const IndexType & index) const
inlineprotectedinherited

◆ getConcentration() [1/2]

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getConcentration ( const IndexType & index) const
inline

◆ getConcentration() [2/2]

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getConcentration ( const Vec3D< T > & coordinate) const
inline

◆ getConcentrationCache()

template<class T, int D>
const std::unordered_map< std::size_t, T > & viennals::OxidationDiffusion< T, D >::getConcentrationCache ( ) const
inline

◆ getDissipationAlpha()

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getDissipationAlpha ( int ,
int ,
const Vec3D< T > &  )
inlinefinalvirtual

If lsLocalLaxFriedrichsAnalytical is used as the spatial discretization scheme, this is called to provide the analytical solution for the alpha values, needed for numerical stability.

Reimplemented from viennals::VelocityField< T >.

◆ getEffectiveReactionRate()

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getEffectiveReactionRate ( const Vec3D< T > & coordinate) const
inline

◆ getIterations()

template<class T, int D>
unsigned viennals::OxidationDiffusion< T, D >::getIterations ( ) const
inline

◆ getNormalizedResidual()

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getNormalizedResidual ( ) const
inline

◆ getNumberOfSolutionNodes()

template<class T, int D>
std::size_t viennals::OxidationDiffusion< T, D >::getNumberOfSolutionNodes ( ) const
inline

◆ getParameters()

template<class T, int D>
OxidationParameters viennals::OxidationDiffusion< T, D >::getParameters ( ) const
inline

◆ getReactionBoundaryConcentration() [1/2]

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getReactionBoundaryConcentration ( const IndexType & index) const
inline

◆ getReactionBoundaryConcentration() [2/2]

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getReactionBoundaryConcentration ( const Vec3D< T > & coordinate) const
inline

◆ getReactionBoundarySample()

template<class T, int D>
ReactionBoundarySample viennals::OxidationDiffusion< T, D >::getReactionBoundarySample ( const Vec3D< T > & coordinate) const
inline

Return the reaction boundary sample for the grid node nearest to coordinate. Used by the deformation solver to get both the sub-grid concentration and the crossing edge so it can compute a sub-grid normal.

◆ getResidual()

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getResidual ( ) const
inline

◆ getScalarVelocity()

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getScalarVelocity ( const Vec3D< T > & ,
int ,
const Vec3D< T > & ,
unsigned long  )
inlinefinalvirtual

Should return a scalar value for the velocity at coordinate for a point of material with the given normalVector.

Reimplemented from viennals::VelocityField< T >.

◆ getScalarVelocityFromSample()

template<class T, int D>
T viennals::OxidationDiffusion< T, D >::getScalarVelocityFromSample ( const ReactionBoundarySample & sample) const
inline

Absolute scalar velocity derived from an already-computed boundary sample, avoiding a second call to reactionBoundarySample inside getScalarVelocity.

◆ getVectorVelocity()

template<class T>
virtual Vec3D< T > viennals::VelocityField< T >::getVectorVelocity ( const Vec3D< T > & ,
int ,
const Vec3D< T > & ,
unsigned long  )
inlinevirtualinherited

Like getScalarVelocity, but returns a velocity value for each cartesian direction.

Reimplemented in viennals::OxidationConstrainedAmbient< T, D >, viennals::OxidationDeformation< T, D >, and viennals::OxidationMaskBending< T, D >.

◆ hasFiniteConcentrationField()

template<class T, int D>
bool viennals::OxidationDiffusion< T, D >::hasFiniteConcentrationField ( ) const
inline

◆ inBounds()

template<class T, int D>
bool viennals::OxidationSolverBase< T, D >::inBounds ( const IndexType & index) const
inlineprotectedinherited

◆ increment()

template<class T, int D>
bool viennals::OxidationSolverBase< T, D >::increment ( IndexType & index) const
inlineprotectedinherited

◆ initializeGridFromInterfaces()

template<class T, int D>
bool viennals::OxidationSolverBase< T, D >::initializeGridFromInterfaces ( SmartPointer< Domain< T, D > > reactionInterface,
SmartPointer< Domain< T, D > > ambientInterface,
SmartPointer< Domain< T, D > > maskInterface,
bool useRequestedBounds,
const IndexType & requestedMinIndex,
const IndexType & requestedMaxIndex,
std::size_t maxGridPoints,
const std::string & solverName )
inlineprotectedinherited

◆ initializeGridFromMask()

template<class T, int D>
bool viennals::OxidationSolverBase< T, D >::initializeGridFromMask ( SmartPointer< Domain< T, D > > maskInterface,
bool useRequestedBounds,
const IndexType & requestedMinIndex,
const IndexType & requestedMaxIndex,
std::size_t maxGridPoints,
const std::string & solverName )
inlineprotectedinherited

◆ initNodeLookup()

template<class T, int D>
void viennals::OxidationSolverBase< T, D >::initNodeLookup ( )
inlineprotectedinherited

◆ lastSolveConverged()

template<class T, int D>
bool viennals::OxidationDiffusion< T, D >::lastSolveConverged ( ) const
inline

◆ linearIndex()

template<class T, int D>
std::size_t viennals::OxidationSolverBase< T, D >::linearIndex ( const IndexType & index) const
inlineprotectedinherited

◆ lookupNode()

template<class T, int D>
std::size_t viennals::OxidationSolverBase< T, D >::lookupNode ( const IndexType & index) const
inlineprotectedinherited

◆ markGeometryChanged()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::markGeometryChanged ( )
inline

Call after any in-place modification of the level sets (e.g. after ls::Advect) so that the next apply() rebuilds the Cartesian node grid.

◆ markSolved()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::markSolved ( )
inline

Mark the current solution as valid without re-solving. Call this before any parallel advection (lsAdvect) that uses this field as a velocity source to prevent concurrent apply() calls inside getScalarVelocity().

◆ New()

template<class T, int D>
template<class... Args>
auto viennals::OxidationDiffusion< T, D >::New ( Args &&... args)
inlinestatic

◆ setAmbientInterface()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setAmbientInterface ( SmartPointer< Domain< T, D > > passedInterface)
inline

◆ setConcentrationCache()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setConcentrationCache ( std::unordered_map< std::size_t, T > cache)
inline

◆ setGpuMode()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setGpuMode ( GpuMode mode)
inline

Set the GPU solver selection mode. See GpuMode for the two options. On CPU-only builds (VIENNALS_GPU_BICGSTAB not defined) this is a no-op.

◆ setGpuPreconditioner()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setGpuPreconditioner ( GpuPreconditioner preconditioner)
inline

Set the GPU BiCGSTAB preconditioner. Jacobi matches the CPU solver.

◆ setMaskInterface()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setMaskInterface ( SmartPointer< Domain< T, D > > passedInterface,
int passedMaskSign = 1 )
inline

◆ setOxideSigns()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setOxideSigns ( int passedReactionSign,
int passedAmbientSign )
inline

Set signs defining the oxide band. A node is inside oxide if reactionSign * reactionPhi >= 0 and ambientSign * ambientPhi >= 0.

◆ setParameters()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setParameters ( OxidationParameters passedParameters)
inline

◆ setPressure() [1/2]

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setPressure ( const IndexType & index,
T pressure )
inline

◆ setPressure() [2/2]

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setPressure ( const Vec3D< T > & coordinate,
T pressure )
inline

◆ setReactionInterface()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setReactionInterface ( SmartPointer< Domain< T, D > > passedInterface)
inline

◆ setSolveBounds()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::setSolveBounds ( const IndexType & passedMinIndex,
const IndexType & passedMaxIndex )
inline

Restrict the dense Cartesian diffusion solve to a finite index box. This is useful for level sets with infinite boundary conditions.

◆ valueAt()

template<class T, int D>
T viennals::OxidationSolverBase< T, D >::valueAt ( ConstSparseIterator & it,
const IndexType & index ) const
inlineprotectedinherited

◆ writeConcentrationToLevelSet()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::writeConcentrationToLevelSet ( )
inline

Write per-node concentration into ambientInterface->getPointData() so that lsInterior + lsAdvect can carry it across timestep boundaries. Safe to call regardless of the solved flag; uses the most recent nodes.

◆ writePersistentFields()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::writePersistentFields ( )
inline

Convenience wrapper: persist both concentration and pressure in one call.

◆ writePressureToLevelSet()

template<class T, int D>
void viennals::OxidationDiffusion< T, D >::writePressureToLevelSet ( )
inline

Write per-node pressure into ambientInterface->getPointData() so that it survives advection and can warm-start the coupling loop next step.

Member Data Documentation

◆ extents

template<class T, int D>
std::array<std::size_t, D> viennals::OxidationSolverBase< T, D >::extents {}
protectedinherited

◆ gridDelta

template<class T, int D>
T viennals::OxidationSolverBase< T, D >::gridDelta = 1.
protectedinherited

◆ maxIndex

template<class T, int D>
IndexType viennals::OxidationSolverBase< T, D >::maxIndex {}
protectedinherited

◆ minIndex

template<class T, int D>
IndexType viennals::OxidationSolverBase< T, D >::minIndex {}
protectedinherited

◆ nodeLookupFlat

template<class T, int D>
std::vector<std::size_t> viennals::OxidationSolverBase< T, D >::nodeLookupFlat
protectedinherited

◆ noNode

template<class T, int D>
std::size_t viennals::OxidationSolverBase< T, D >::noNode = std::numeric_limits<std::size_t>::max()
staticconstexprprotectedinherited

◆ strides

template<class T, int D>
std::array<std::size_t, D> viennals::OxidationSolverBase< T, D >::strides {}
protectedinherited

The documentation for this class was generated from the following file: