Abstract Models
popinn.AbstractModel
¤
Abstract base class for all models.
The __call__ and D (derivative) methods are concrete and should not be overridden by subclasses.
Subclasses must implement the abstract hook _eval(coords, aux_inputs), which __call__ dispatches to.
Source code in src/popinn/models.py
_eval(coords, aux_inputs)
¤
Abstract method.
Evaluates the model at one grid point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
jaxtyping.Float[jax.Array, num_coords]
|
Stacked coordinate array,
one entry per coordinate axis (e.g. |
required |
aux_inputs
|
tuple
|
Auxiliary inputs (e.g. PDE parameters, sensor-sampled functions, etc.). Empty for models with no auxiliary inputs (PINN). |
required |
Returns:
| Type | Description |
|---|---|
jaxtyping.Float[jax.Array, '']
|
The model output as a scalar JAX array. |
Source code in src/popinn/models.py
__call__(*args)
¤
Evaluate the model at one point.
Coordinates are passed as individual scalars; auxiliary inputs are passed as a single trailing tuple:
model(x, t, (a, b)) # x & t are the coordinates; a & b are the auxiliary inputs.
For models with no auxiliary inputs, e.g. popinn.PINN, the auxiliary tuple
can be empty, or omitted completely:
model(x, t, ()) # explicit empty aux -- equivalent to:
model(x, t) # no aux
Note the auxiliary inputs must be a tuple specifically, not a list or array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
The coordinate scalars, optionally followed by the aux tuple. |
()
|
Returns:
| Type | Description |
|---|---|
jaxtyping.Float[jax.Array, '']
|
The model output as a scalar JAX array. |
Source code in src/popinn/models.py
D(*argnums)
¤
Build the derivative of the model with respect to one or more coordinates.
Returns a function with the same call signature as the model whose output is the requested derivative.
Derivative syntax
Each entry of argnums indexes a coordinate argument (0 -> first coordinate, 1 -> second, ...);
chaining differentiates repeatedly. For example, for a model with two coordinates x & t,
derivatives are taken & evaluated like:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*argnums
|
int
|
Coordinate indices to differentiate with respect to, applied left to right. |
()
|
Returns:
| Type | Description |
|---|---|
collections.abc.Callable
|
A function with the same signature as the model that returns the requested scalar derivative. |
Source code in src/popinn/models.py
popinn.AbstractP2INN
¤
Abstract Parameterized Physics-Informed Neural Network.
Composes a parameter encoder, a coordinate encoder, and a manifold network: the coordinates and parameters are encoded separately, their embeddings concatenated, and the manifold network maps to a scalar. Subclasses must provide the three sub-networks as fields.
Source code in src/popinn/models.py
_eval(coords, aux_inputs)
¤
Concatenate coordinate and parameter embeddings, then pass through manifold network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
jaxtyping.Float[jax.Array, num_coords]
|
Array of coordinate values, one coordinate per axis, e.g. |
required |
aux_inputs
|
tuple
|
Tuple of scalar PDE parameters, e.g. |
required |
Returns:
| Type | Description |
|---|---|
jaxtyping.Float[jax.Array, '']
|
The model output as a scalar JAX array. |
Source code in src/popinn/models.py
popinn.AbstractDeepONet
¤
Abstract Deep Operator Network.
Evaluates a sum over a product of branch and trunk embeddings: the trunk encodes the coordinates, each branch encodes one auxiliary input (e.g., a sensor-sampled function), and their elementwise product is summed and offset by a bias. Subclasses must provide the branch list, trunk, and bias as fields.
Source code in src/popinn/models.py
_eval(coords, aux_inputs)
¤
Sum element-wise product of trunk (coordinate) and branch (auxiliary) embeddings and add bias.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
jaxtyping.Float[jax.Array, num_coords]
|
Stacked coordinate array, shape (num_coords,), fed to the trunk. |
required |
aux_inputs
|
tuple
|
Tuple containing arrays (sensor-sampled function) and/or scalars (PDE parameters). Each top level element of the tuple is mapped to its own branch network. |
required |
Returns:
| Type | Description |
|---|---|
jaxtyping.Float[jax.Array, '']
|
The model output as a scalar JAX array. |