MultiScaleReactionDiffusion<T>
Models & Types · AiDotNet.PhysicsInformed.PDEs
A two-scale reaction-diffusion equation: the same physics at a coarse and a fine length scale, with a coupling term that penalises the two disagreeing where they overlap.
Inheritance: PDESpecificationBase<T> → MultiScaleReactionDiffusion<T>
Implements: IMultiScalePDE<T>
For Beginners
Some systems do the same thing at two very different sizes at once — heat spreading through a whole engine block while also spreading within each grain of the metal. Modelling only the coarse scale misses the fine detail; modelling only the fine one needs impossibly many points. A multi-scale model runs both and asks them to agree.
How It Works
This is the reference IMultiScalePDE, and until it existed there was none:
MultiScalePINN takes one in its constructor and the library implemented the interface zero
times, so the type could not be constructed at all (#2105).
The residual at each scale is the heat/diffusion form ∂u/∂t − k ∂²u/∂x², with a different
diffusivity per scale — a large one for the coarse field and a small one for the fine.
Example
var pde = new MultiScaleReactionDiffusion<double>(
coarseDiffusivity: 1.0,
fineDiffusivity: 0.01);
var architecture = new NeuralNetworkArchitecture<double>(
InputType.OneDimensional, NeuralNetworkTaskType.Regression, inputSize: 2, outputSize: 1);
var pinn = new MultiScalePINN<double>(
architecture, pde, new IBoundaryCondition<double>[] { new DirichletBoundaryCondition<double>() });
Constructors
| Constructor | Summary |
|---|---|
MultiScaleReactionDiffusion(double coarseDiffusivity, double fineDiffusivity, double coarseLength, double fineLength, double fineScaleWeight) |
Initializes a two-scale reaction-diffusion equation. |
Properties
| Property | Summary |
|---|---|
T[] ScaleCharacteristicLengths { get; } |
|
int InputDimension { get; } |
|
int NumberOfScales { get; } |
|
int OutputDimension { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
T ComputeResidual(Vector<T> inputs, Vector<T> outputs, PDEDerivatives<T> derivatives) |
|
T GetScaleLossWeight(int scaleIndex) |
|
Tensor<T> ComputeScaleCoupling(int coarseIndex, int fineIndex, Tensor<T> inputs, Tensor<T> coarseOutputs, Tensor<T> fineOutputs, PDEDerivatives<T> coarseDerivatives, PDEDerivatives<T> fineDerivatives) |
|
Tensor<T> ComputeScaleResidual(int scaleIndex, Tensor<T> inputs, Tensor<T> outputs, PDEDerivatives<T> derivatives) |
|
Tensor<T> ComputeTapeResidual(Tensor<T> inputs, Tensor<T> outputs, PDEDerivatives<T> derivatives) |
|
int GetScaleOutputDimension(int scaleIndex) |