MultiFidelityPINN<T>
Models & Types · AiDotNet.PhysicsInformed.PINNs
Multi-fidelity Physics-Informed Neural Network for combining data of different accuracy levels.
Inheritance: NeuralNetworkBase<T> → PhysicsInformedNeuralNetwork<T> → MultiFidelityPINN<T>
How It Works
For Beginners: Multi-fidelity learning combines data from multiple sources with different accuracy levels:
Low-Fidelity Data (Cheap, Abundant):
- Coarse simulations
- Simplified physical models
- Fast but approximate calculations
- Example: 2D simulation of a 3D problem
High-Fidelity Data (Expensive, Scarce):
- Fine-mesh simulations
- Physical experiments
- High-accuracy calculations
- Example: Wind tunnel measurements
The Multi-Fidelity Approach:
- Train on abundant low-fidelity data to learn general trends
- Use scarce high-fidelity data to correct errors
- Learn the correlation between fidelity levels
- Enforce physics constraints at all fidelity levels
Mathematical Model (Meng and Karniadakis 2020, Eq. 6-7): u_HF(x) = F_l(x, u_LF(x)) + F_nl(x, u_LF(x))
Where:
- u_LF(x): Low-fidelity network NN_L
- F_l: a linear network (no activation) that captures a linear cross-fidelity correlation
- F_nl: a nonlinear network (this model’s own layers) for the nonlinear part
Both correlation networks read the coordinates AND the low-fidelity prediction, so the model learns how the fidelities relate rather than an additive correction. The joint loss is MSE_LF + MSE_HF + MSE_f (Eq. 8), with the PDE residual of the composite solution.
References:
- Meng, X., and Karniadakis, G.E. “A composite neural network that learns from
multi-fidelity data: Application to function approximation and inverse PDE problems” Journal of Computational Physics, 2020.
Example
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputSize: 2, outputSize: 1);
var pde = new HeatEquation<float>();
// No IBoundaryCondition implementation ships with the library: write your own with
// IsOnBoundary, ComputeBoundaryResidual and Name, then put instances in this array.
var bc = Array.Empty<IBoundaryCondition<float>>();
var mfPinn = new MultiFidelityPINN<float>(architecture, pde, bc);
Constructors
| Constructor | Summary |
|---|---|
MultiFidelityPINN(NeuralNetworkArchitecture<T> architecture, IPDESpecification<T> pdeSpecification, IBoundaryCondition<T>[] boundaryConditions, IInitialCondition<T> initialCondition, PhysicsInformedNeuralNetwork<T> lowFidelityNetwork, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, MultiFidelityPINNOptions options) |
Initializes the model from an already-resolved options instance. |
Properties
| Property | Summary |
|---|---|
PhysicsInformedNeuralNetwork<T> LowFidelityNetwork { get; } |
Gets the low-fidelity network for external access. |
bool IsLowFidelityFrozen { get; } |
Gets whether the low-fidelity network is frozen. |
Methods
| Method | Summary |
|---|---|
MultiFidelityTrainingHistory<T> SolveMultiFidelity(int epochs, int? pretrainingEpochs, double learningRate, bool verbose, int batchSize) |
Solves the PDE using multi-fidelity training. |
Tensor<T> Forward(Tensor<T> input) |
The multi-fidelity solution u_HF(x) = F_l(x, u_LF(x)) + F_nl(x, u_LF(x)) (Meng and Karniadakis 2020). |
Tensor<T> ForwardForTraining(Tensor<T> input) |
|
Vector<T> GetFidelityCorrection(Vector<T> point) |
Gets the correction (difference between fidelity levels) at a point: u_HF(x) - u_LF(x). |
Vector<T> GetHighFidelitySolution(Vector<T> point) |
Gets the high-fidelity prediction at a point. |
Vector<T> GetLowFidelitySolution(Vector<T> point) |
Gets the low-fidelity prediction at a point. |
void SetHighFidelityData(Tensor<T> inputs, Tensor<T> outputs) |
Sets the high-fidelity training data. |
void SetLowFidelityData(Tensor<T> inputs, Tensor<T> outputs) |
Sets the low-fidelity training data. |
void SetLowFidelityFrozen(bool frozen) |
Freezes or unfreezes the low-fidelity network. |