Table of Contents

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

T

The numeric type used for calculations.

Inheritance
DomainDecompositionPINN<T>
Implements
IFullModel<T, Tensor<T>, Tensor<T>>
IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>
IParameterizable<T, Tensor<T>, Tensor<T>>
ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>
IGradientComputable<T, Tensor<T>, Tensor<T>>
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?

  1. Memory: Large domains require too much memory for one network
  2. Parallelism: Subdomains can be trained independently (partially)
  3. Accuracy: Local networks can specialize for local behavior
  4. Geometry: Complex domains can be split into simpler shapes

Types of Decomposition:

  1. Non-overlapping (used here): |-------|-------| | D1 | D2 | Interface at boundary |-------|-------|

  2. Overlapping: |----------| | D1 |---| |----------| | D2 | |----|------| Overlap region

Interface Conditions: At subdomain interfaces, we enforce:

  1. Continuity: u_1 = u_2 (solutions match)
  2. Flux continuity: du_1/dn = du_2/dn (derivatives match)

Training Strategy:

  1. Train each subdomain network on its local domain
  2. Enforce interface conditions at boundaries
  3. 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

architecture NeuralNetworkArchitecture<T>

Base network architecture (used for creating subdomain networks if not provided).

pdeSpecification IPDESpecification<T>

The PDE specification.

boundaryConditions IBoundaryCondition<T>[]

Boundary conditions for the global domain.

subdomains List<SubdomainDefinition<T>>

Subdomain definitions specifying bounds for each region.

subdomainNetworks List<PhysicsInformedNeuralNetwork<T>>

Custom networks for each subdomain (null = create defaults).

initialCondition IInitialCondition<T>

Initial condition (optional).

numCollocationPointsPerSubdomain int

Collocation points per subdomain.

optimizer IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>>

Base optimizer (subdomain optimizers derived from this).

pdeWeight double

Weight for PDE residual loss (default: 1.0).

boundaryWeight double

Weight for boundary condition loss (default: 1.0).

interfaceWeight double

Weight for interface continuity loss (default: 10.0).

interfaceGradientWeight double

Weight for interface gradient matching (default: 1.0).

schwarzIterations int

Number 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:

  1. Solve each subdomain with current interface values
  2. Exchange boundary data between subdomains
  3. Repeat until convergence

Properties

Interfaces

Gets all interface definitions.

public IReadOnlyList<InterfaceDefinition<T>> Interfaces { get; }

Property Value

IReadOnlyList<InterfaceDefinition<T>>

SubdomainCount

Gets the number of subdomains.

public int SubdomainCount { get; }

Property Value

int

Subdomains

Gets all subdomain definitions.

public IReadOnlyList<SubdomainDefinition<T>> Subdomains { get; }

Property Value

IReadOnlyList<SubdomainDefinition<T>>

Methods

GetGlobalSolution(T[])

Gets the solution at a point by finding the appropriate subdomain.

public T[] GetGlobalSolution(T[] point)

Parameters

point T[]

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

index int

Subdomain 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

epochs int

Total number of training epochs.

learningRate double

Learning rate for optimization.

verbose bool

Whether to print progress.

batchSize int

Batch size for training.

Returns

DomainDecompositionTrainingHistory<T>

Domain decomposition training history with per-subdomain metrics.