Class DomainDecompositionPINN<T>
- Namespace
- AiDotNet.PhysicsInformed.PINNs
- Assembly
- AiDotNet.dll
Domain Decomposition Physics-Informed Neural Network for large-scale problems.
public class DomainDecompositionPINN<T> : PhysicsInformedNeuralNetwork<T>, INeuralNetworkModel<T>, INeuralNetwork<T>, IFullModel<T, Tensor<T>, Tensor<T>>, IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>, IModelSerializer, ICheckpointableModel, IParameterizable<T, Tensor<T>, Tensor<T>>, IFeatureAware, IFeatureImportance<T>, ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>, IGradientComputable<T, Tensor<T>, Tensor<T>>, IJitCompilable<T>, IInterpretableModel<T>, IInputGradientComputable<T>, IDisposable
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
DomainDecompositionPINN<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
For Beginners: Domain decomposition is a strategy for solving large problems by breaking them into smaller, manageable pieces. Think of it like solving a jigsaw puzzle:
- Each piece (subdomain) is solved separately
- The pieces must fit together at the edges (interface conditions)
Why Use Domain Decomposition?
- Memory: Large domains require too much memory for one network
- Parallelism: Subdomains can be trained independently (partially)
- Accuracy: Local networks can specialize for local behavior
- Geometry: Complex domains can be split into simpler shapes
Types of Decomposition:
Non-overlapping (used here): |-------|-------| | D1 | D2 | Interface at boundary |-------|-------|
Overlapping: |----------| | D1 |---| |----------| | D2 | |----|------| Overlap region
Interface Conditions: At subdomain interfaces, we enforce:
- Continuity: u_1 = u_2 (solutions match)
- Flux continuity: du_1/dn = du_2/dn (derivatives match)
Training Strategy:
- Train each subdomain network on its local domain
- Enforce interface conditions at boundaries
- Iterate until global convergence
References:
- Jagtap, A.D., and Karniadakis, G.E. "Extended Physics-Informed Neural Networks (XPINNs): A Generalized Space-Time Domain Decomposition Based Deep Learning Framework" Communications in Computational Physics, 2020.
Constructors
DomainDecompositionPINN(NeuralNetworkArchitecture<T>, IPDESpecification<T>, IBoundaryCondition<T>[], List<SubdomainDefinition<T>>, List<PhysicsInformedNeuralNetwork<T>>?, IInitialCondition<T>?, int, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>>?, double, double, double, double, int)
Creates a Domain Decomposition PINN with specified subdomains.
public DomainDecompositionPINN(NeuralNetworkArchitecture<T> architecture, IPDESpecification<T> pdeSpecification, IBoundaryCondition<T>[] boundaryConditions, List<SubdomainDefinition<T>> subdomains, List<PhysicsInformedNeuralNetwork<T>>? subdomainNetworks = null, IInitialCondition<T>? initialCondition = null, int numCollocationPointsPerSubdomain = 5000, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>>? optimizer = null, double pdeWeight = 1, double boundaryWeight = 1, double interfaceWeight = 10, double interfaceGradientWeight = 1, int schwarzIterations = 1)
Parameters
architectureNeuralNetworkArchitecture<T>Base network architecture (used for creating subdomain networks if not provided).
pdeSpecificationIPDESpecification<T>The PDE specification.
boundaryConditionsIBoundaryCondition<T>[]Boundary conditions for the global domain.
subdomainsList<SubdomainDefinition<T>>Subdomain definitions specifying bounds for each region.
subdomainNetworksList<PhysicsInformedNeuralNetwork<T>>Custom networks for each subdomain (null = create defaults).
initialConditionIInitialCondition<T>Initial condition (optional).
numCollocationPointsPerSubdomainintCollocation points per subdomain.
optimizerIGradientBasedOptimizer<T, Tensor<T>, Tensor<T>>Base optimizer (subdomain optimizers derived from this).
pdeWeightdoubleWeight for PDE residual loss (default: 1.0).
boundaryWeightdoubleWeight for boundary condition loss (default: 1.0).
interfaceWeightdoubleWeight for interface continuity loss (default: 10.0).
interfaceGradientWeightdoubleWeight for interface gradient matching (default: 1.0).
schwarzIterationsintNumber of Schwarz iterations per epoch (default: 1).
Remarks
For Beginners: Parameters to tune:
- interfaceWeight: Higher values enforce stricter continuity
- interfaceGradientWeight: Important for smooth global solutions
- schwarzIterations: More iterations = better coupling but slower
The Schwarz method is an iterative approach where:
- Solve each subdomain with current interface values
- Exchange boundary data between subdomains
- Repeat until convergence
Properties
Interfaces
Gets all interface definitions.
public IReadOnlyList<InterfaceDefinition<T>> Interfaces { get; }
Property Value
SubdomainCount
Gets the number of subdomains.
public int SubdomainCount { get; }
Property Value
Subdomains
Gets all subdomain definitions.
public IReadOnlyList<SubdomainDefinition<T>> Subdomains { get; }
Property Value
Methods
GetGlobalSolution(T[])
Gets the solution at a point by finding the appropriate subdomain.
public T[] GetGlobalSolution(T[] point)
Parameters
pointT[]Input coordinates.
Returns
- T[]
Solution value from the containing subdomain network.
GetSubdomainNetwork(int)
Gets a specific subdomain network.
public PhysicsInformedNeuralNetwork<T> GetSubdomainNetwork(int index)
Parameters
indexintSubdomain index.
Returns
- PhysicsInformedNeuralNetwork<T>
The subdomain PINN.
SolveWithDecomposition(int, double, bool, int)
Solves the PDE using domain decomposition.
public DomainDecompositionTrainingHistory<T> SolveWithDecomposition(int epochs = 10000, double learningRate = 0.001, bool verbose = true, int batchSize = 256)
Parameters
epochsintTotal number of training epochs.
learningRatedoubleLearning rate for optimization.
verboseboolWhether to print progress.
batchSizeintBatch size for training.
Returns
- DomainDecompositionTrainingHistory<T>
Domain decomposition training history with per-subdomain metrics.