Interface IMultiScalePDE<T>
- Namespace
- AiDotNet.PhysicsInformed.Interfaces
- Assembly
- AiDotNet.dll
Defines the interface for multi-scale Partial Differential Equations.
public interface IMultiScalePDE<T> : IPDESpecification<T>
Type Parameters
TThe numeric type (float, double, etc.) used for calculations.
- Inherited Members
Remarks
For Beginners: Multi-scale PDEs describe phenomena that occur across multiple length or time scales. Examples include:
- Turbulent flows (large eddies to small vortices)
- Materials science (atomic to macroscopic behavior)
- Climate modeling (local weather to global patterns)
- Biological systems (molecular to tissue level)
Why Multi-scale is Challenging: Traditional single-scale methods struggle because:
- Fine scale requires tiny mesh elements (expensive)
- Coarse scale misses important details
- Different scales have different time dynamics
Multi-scale Solution Strategy:
- Decompose solution into scale components: u = u_coarse + u_fine
- Learn each scale with appropriate resolution
- Couple scales through cross-scale interactions
- Use appropriate loss weights for each scale
Key Concepts:
- Characteristic Length Scale: The typical size of features at each scale
- Scale Separation: When scales are well-separated (e.g., 10x ratio)
- Cross-scale Coupling: How different scales interact
- Homogenization: Averaging fine-scale behavior for coarse-scale equations
Properties
NumberOfScales
Gets the number of scales in the problem.
int NumberOfScales { get; }
Property Value
Remarks
For Beginners: This indicates how many distinct length/time scales are present. For example:
- 2 scales: macro + micro (common in composite materials)
- 3 scales: macro + meso + micro (turbulence modeling)
ScaleCharacteristicLengths
Gets the characteristic length scales of the problem.
T[] ScaleCharacteristicLengths { get; }
Property Value
- T[]
Remarks
For Beginners: Characteristic lengths define the "size" of each scale. Example for a composite material:
- ScaleCharacteristics[0] = 1.0 (macroscopic, meters)
- ScaleCharacteristics[1] = 0.001 (fiber scale, millimeters)
- ScaleCharacteristics[2] = 0.000001 (molecular scale, micrometers)
Methods
ComputeScaleCoupling(int, int, T[], T[], T[], PDEDerivatives<T>, PDEDerivatives<T>)
Computes the coupling term between two scales.
T ComputeScaleCoupling(int coarseIndex, int fineIndex, T[] inputs, T[] coarseOutputs, T[] fineOutputs, PDEDerivatives<T> coarseDerivatives, PDEDerivatives<T> fineDerivatives)
Parameters
coarseIndexintIndex of the coarser scale.
fineIndexintIndex of the finer scale.
inputsT[]The coordinates.
coarseOutputsT[]Solution at the coarse scale.
fineOutputsT[]Solution at the fine scale.
coarseDerivativesPDEDerivatives<T>Derivatives at the coarse scale.
fineDerivativesPDEDerivatives<T>Derivatives at the fine scale.
Returns
- T
The coupling residual (should be zero when scales are properly coupled).
Remarks
For Beginners: Coupling terms ensure consistency between scales. For example, in homogenization:
- Coarse scale "sees" averaged effect of fine scale
- Fine scale is modulated by coarse scale gradient
Mathematically:
- Upscaling: Average fine-scale solution matches coarse-scale solution
- Downscaling: Fine-scale boundary conditions come from coarse-scale solution
ComputeScaleResidual(int, T[], T[], PDEDerivatives<T>)
Computes the PDE residual at a specific scale.
T ComputeScaleResidual(int scaleIndex, T[] inputs, T[] outputs, PDEDerivatives<T> derivatives)
Parameters
scaleIndexintThe index of the scale (0 = coarsest, increasing = finer).
inputsT[]The spatial and temporal coordinates.
outputsT[]The predicted solution values at this scale.
derivativesPDEDerivatives<T>The derivatives of the solution at this scale.
Returns
- T
The PDE residual at this scale.
GetScaleLossWeight(int)
Gets the recommended loss weight for each scale.
T GetScaleLossWeight(int scaleIndex)
Parameters
scaleIndexintThe scale index.
Returns
- T
Recommended weight for this scale's loss contribution.
Remarks
For Beginners: Different scales may need different loss weights because:
- Coarse scale dominates in magnitude
- Fine scale captures important details
- Imbalanced gradients can cause training difficulties
Common strategies:
- Weight proportional to 1/scale_length (finer scales get higher weights)
- Adaptive weighting based on gradient magnitudes
GetScaleOutputDimension(int)
Gets the output dimension for a specific scale.
int GetScaleOutputDimension(int scaleIndex)
Parameters
scaleIndexintThe scale index.
Returns
- int
Number of output components at this scale.
Remarks
Different scales may have different output dimensions. For example, in turbulence:
- Coarse scale: mean velocity (3 components)
- Fine scale: velocity fluctuations (3 components) + Reynolds stresses (6 components)