File size: 2,505 Bytes
258a5b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 2D Poisson Equation Dataset

Numerical solutions to the 2D Poisson equation with mixed boundary conditions using Dedalus spectral methods.

![Sample Plot](sample_plot.png)

## Equation

The 2D Poisson equation boundary value problem:

**PDE**: ∇²u = f(x,y)     in Ω = [0, Lx] × [0, Ly]

**Boundary Conditions**:
- u(x,0) = g(x)     (Dirichlet on bottom)
- ∂u/∂y(x,Ly) = h(x)   (Neumann on top)

## Variables

The dataset returns a dictionary with the following fields:

### Coordinates
- `spatial_coordinates`: (2, Nx, Ny) - Combined X,Y coordinate meshgrids

### Solution Fields  
- `solution_field`: (Nx, Ny) - Solution u(x,y)
- `forcing_function`: (Nx, Ny) - Random forcing function f(x,y)

### Boundary Conditions
- `boundary_condition_bottom`: (Nx,) - Bottom Dirichlet BC g(x)
- `boundary_condition_top_gradient`: (Nx,) - Top Neumann BC h(x)

## Dataset Parameters

- **Domain**: [0, 2π] × [0, π] (2D rectangular domain)
- **Grid points**: 256 × 128 (Nx × Ny)
- **Discretization**: Fourier(x) × Chebyshev(y) spectral methods
- **Solver**: Dedalus LBVP (Linear Boundary Value Problem)

### Randomization
- **Forcing function**: Generated using Gaussian processes with random length scales
- **Boundary conditions**: Fixed sinusoidal bottom BC, zero top gradient BC
- **Amplitude**: Random amplitude scaling for forcing functions (0.5 to 3.0)

## Physical Context

This dataset simulates steady-state physical systems governed by the 2D Poisson equation. 
The equation models phenomena where the spatial distribution depends on source/sink terms, including:

**Applications**:
- Electrostatic potential in the presence of charge distributions
- Steady-state heat conduction with internal heat sources  
- Fluid stream functions for incompressible flow
- Gravitational potential from mass distributions

## Usage

```python
from dataset import PoissonDataset

# Create dataset
dataset = PoissonDataset()

# Generate a sample
sample = next(iter(dataset))

# Access solution data
spatial_coords = sample["spatial_coordinates"]  # X, Y meshgrids
solution = sample["solution_field"]            # u(x,y)
forcing = sample["forcing_function"]           # f(x,y)
```

## Visualization

Run the plotting script to visualize samples:

```bash
python plot_sample.py      # 2D visualization of forcing, solution, and BCs
```

## Data Generation

Generate the full dataset:

```bash
python generate_data.py
```

This creates train/test splits saved as chunked parquet files in the `data/` directory.