Architectures
All networks are Flax modules selected by config.arch.arch_name and built by create_arch (via create_model). Every architecture shares the same embedding front-end.
Networks
Mlp
A plain multilayer perceptron — the baseline.
ModifiedMlp
The NTK-inspired variant of Wang et al.: two encoder streams
which mitigates gradient pathologies at negligible extra cost.
PirateNet
Physics-informed residual adaptive networks. Each block applies two gated transformations and a learnable skip:
with config.arch.nonlinearity (0 = identity). The network starts shallow and deepens as training demands — the default for the hard benchmarks. Deep dive: PirateNets.
PirateNet input width
The residual blocks require the embedded input to already have hidden_dim features — use a Fourier embedding with embed_dim == hidden_dim (you get a clear error otherwise).
arch.arch_name = "PirateNet"
arch.num_layers = 2 # residual blocks
arch.hidden_dim = 256
arch.out_dim = 1
arch.activation = "tanh" # relu / gelu / swish / sigmoid / tanh / sin
arch.nonlinearity = 0.0 # initial alphaEmbeddings
Fourier features
Random Fourier features lift low-dimensional inputs to a multi-scale basis and defeat spectral bias:
arch.fourier_emb = {"embed_scale": 2.0, "embed_dim": 256}embed_scale sets the frequency content — raise it for finer solution scales (the multi-stage Taylor–Green stages increase it per stage).
Periodic embeddings
Exact periodic boundary conditions, for free: embed selected axes as
arch.periodicity = {
"period": (1.0,), # angular frequency: 2π/L for a domain of length L
"axis": (1,), # which input axes
"trainable": (False,),
}TIP
period is an angular frequency: use 2 * jnp.pi / L for a domain of length L (so 1.0 for a 2π-periodic domain).