Add 31 PRBench task specifications (instructions, task.yaml, paper markdown; ground truth withheld)
a48f2b1 verified |
Download tasks/task_bude_2021/instruction.md from Rise-AGI/PRBench: direct link, hf CLI and curl.
- Browser
- Download file 11 kB
-
https://huggingface.co/datasets/Rise-AGI/PRBench/resolve/main/tasks/task_bude_2021/instruction.md
- Command line
-
hf download hf://datasets/Rise-AGI/PRBench/tasks/task_bude_2021/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/Rise-AGI/PRBench/resolve/main/tasks/task_bude_2021/instruction.md
11 kB
| # Paper Reproduction Task | |
| You are given a plasma physics paper to reproduce. Your goal is to read the paper, understand its methodology, and implement electromagnetic wave simulations to reproduce 7 key figures and 1 table. | |
| --- | |
| ## 1. Article Information | |
| | Field | Value | | |
| |-------|-------| | |
| | **Title** | Accelerating simulations of electromagnetic waves in hot, magnetized fusion plasmas | | |
| | **Authors** | R H S Budé, D Van Eester, J van Dijk, R J E Jaspers and A B Smolders | | |
| | **DOI** | 10.1088/1361-6587/abd619 | | |
| | **Paper File** | `Bude2021.md` (in the same task directory) | | |
| --- | |
| ## 2. What You Must Do | |
| ### Step 1: Read and Analyze the Paper | |
| Read the full paper at `Bude2021.md`. Write a detailed analysis document at `reproduction/ANALYSIS.md` that covers: | |
| 1. **Methodology**: Describe the three electromagnetic wave solver models (Truncated Taylor, Truncated Polynomial Fit, All-Orders) | |
| 2. **Key Formulas**: List and explain every formula needed for the reproduction, including: | |
| - The 1D Helmholtz equation | |
| - Hot plasma dielectric tensor (Stix/Swanson notation) | |
| - Plasma Dispersion Function | |
| - Differential operator replacement for polynomial fit model | |
| - RRSE error metric | |
| - Power absorption calculation | |
| 3. **Algorithm Details**: Describe the polynomial fitting procedure, finite difference stencil construction, and boundary condition implementation | |
| 4. **Physical Observables**: Explain what each figure/table measures and its physical significance | |
| ### Step 2: Implement the Simulation | |
| Write all code under `reproduction/`. You need: | |
| - Core simulation modules (see Section 6 below) | |
| - Individual scripts for each figure/table | |
| ### Step 3: Generate Data Files | |
| Run your scripts to produce CSV data files under `data/`. See Section 5 for exact specifications. | |
| --- | |
| ## 3. Input Parameters | |
| ### 3.1 Machine Parameters (JET-like) | |
| | Parameter | Symbol | Value | Unit | | |
| |-----------|--------|-------|------| | |
| | Major Radius | $R_0$ | 2.97 | m | | |
| | Minor Radius | $a$ | 1.05 | m | | |
| | Spill-over Radius | $a_s$ | 1.35 | m | | |
| | Magnetic Field Axis | $B_0$ | 3.45 | T | | |
| | Toroidal Mode | $n_{\text{tor}}$ | 27 | - | | |
| | Frequency | $f$ | 51.0 | MHz | | |
| ### 3.2 Plasma Profiles | |
| **Density ($n$) and Temperature ($T$):** | |
| - **Core ($|x| < a_p$)**: $G_{\text{core}}(x) = (G_0 - G_p)(1 - (x/a_p)^2)^\alpha + G_p$ | |
| - **Edge ($|x| \ge a_p$)**: $G_{\text{edge}}(x) = G_p e^{-|x-a_p|/\lambda}$ | |
| - Transition point $a_p = 0.95$ m. | |
| **Specific Coefficients:** | |
| | Profile | Axis Value ($G_0$) | Edge Value ($G_s$) | $\alpha$ | $\lambda$ | | |
| |---------|--------------------|--------------------|----------|-----------| | |
| | Density ($n_e, n_i$) | $7 \times 10^{19}$ m$^{-3}$ | $2 \times 10^{19}$ m$^{-3}$* | 1.0 | 0.05 | | |
| | Temperature ($T_e, T_i$) | 5 keV | 100 eV | 1.5 | 0.05 | | |
| *Note: Paper text says $n_s = 2 \times 10^{19}$, $G_p$ must be calculated to ensure continuity or assumed $G_p \approx G_s$ given the context.* | |
| **Species:** | |
| - Deuterium (Major): Fully ionized. | |
| - Hydrogen (Minor): 5% concentration ($n_H = 0.05 n_e$, $n_D = 0.95 n_e$). | |
| --- | |
| ## 4. Banned Libraries & Practices | |
| The following are **NOT allowed**: | |
| | Banned | Reason | | |
| |--------|--------| | |
| | `plasma-py` (simulation modules) | Must implement dielectric tensor and wave solvers from scratch. | | |
| | Closed-source solvers | Code must be pure Python/NumPy/SciPy. | | |
| | Symbolic Math (SymPy) | Numerical differentiation/fitting should be used as per the paper. | | |
| **Allowed:** `numpy`, `scipy` (specifically `scipy.special` for Bessel/Error functions, `scipy.sparse`, `scipy.linalg`). | |
| --- | |
| ## 5. Data Files to Reproduce | |
| ### 5.1 Figure 2: Plasma Profiles | |
| **File**: `data/fig2_profiles.csv` | |
| - **X-axis**: $x$ [m] (-1.5 to 1.5) | |
| - **Y-axes**: $n_e$ [$10^{19}$ m$^{-3}$], $T_e$ [keV] | |
| - **Description**: Verify the parabolic core and exponential edge implementation. | |
| ### 5.2 Figures 3 & 4: Dielectric Tensor Approximation | |
| **File**: `data/fig3_4_tensor_fit.csv` | |
| - **Context**: $x = -0.1$ m (Hydrogen resonance layer). | |
| - **X-axis**: Normalized wavenumber $k_x \rho_{LH}$ (-3 to 3). | |
| - **Y-axes**: $\text{Re}(\epsilon_{11})$. | |
| - **Series**: Calculated exact values, 2nd Order Taylor, 6th Order Polynomial Fit. | |
| - **Fit Window**: $W = 1.0$ (approx, check paper visual). | |
| ### 5.3 Figure 5: Electric Field Comparison | |
| **File**: `data/fig5_efield.csv` | |
| - **Domain**: $-0.9 < x < -0.1$ m (IBW region). | |
| - **Resolution**: $N = 2017$. | |
| - **Y-axis**: $|E_x|$ [V/m]. | |
| - **Series**: Truncated Taylor, Truncated Polynomial ($N_p=8, W=1.2$). | |
| - **Note**: The paper compares these against All-Orders. If All-Orders is too expensive, comparing Taylor vs Poly is sufficient. | |
| ### 5.4 Figure 6: Absorbed Power Distribution | |
| **File**: `data/fig6_power.csv` | |
| - **Description**: Comparison of power absorption profiles derived from Poynting flux (Eq 50). | |
| - **X-axis**: $x$ [m] (-1.5 to 1.5). | |
| - **Y-axis**: $P_{abs}$ [arbitrary units]. | |
| - **Series**: | |
| - Per Species: Electron (e), Hydrogen (H), Deuterium (D). | |
| - Total Power. | |
| - **Models**: | |
| - Truncated Taylor (illustrating unphysical oscillations/smearing). | |
| - Truncated Polynomial Fit ($N_p=8$) (proxy for All-Orders if necessary, as they are visually identical in the paper). | |
| - **Calculation**: $\vec{J}_p$ must be calculated by applying the respective differential operator ($\bar{\bar{M}}_{op}$) to the solution field $\vec{E}$. | |
| ### 5.5 Figure 7: Convergence (RRSE) | |
| **File**: `data/fig7_error_scaling.csv` | |
| - **X-axis**: Number of grid points $N$ (Log scale, 100 to 10,000). | |
| - **Y-axis**: RRSE (Log scale). | |
| - **Series**: Truncated Taylor, Truncated Polynomial Fit ($N_p=8$). | |
| - **Reference**: High resolution Polynomial Fit ($N=12601$) can act as proxy for "All-Orders" if full spectral code is not implemented. | |
| ### 5.6 Figure 8: Computational Time | |
| **File**: `data/fig8_timing.csv` | |
| - **X-axis**: $N$ (Log scale). | |
| - **Y-axis**: Time [s] (Log scale). | |
| - **Series**: Matrix Setup Time, Matrix Solve Time (for Poly and Taylor models). | |
| ### 5.7 Table 1: Computational Cost Extrapolation | |
| **File**: `data/table1_extrapolation.csv` | |
| - **Description**: Extrapolation of runtime scaling to 2D and 3D cases based on 1D benchmarks. | |
| - **Inputs**: Slope ($\alpha$) and intercept data derived from Figure 8 (Timing). | |
| - **Methodology**: | |
| 1. **Fit**: Perform linear regression on log-log timing data (from Fig 8) for $N > 2000$ to obtain scaling laws $T \propto N^\alpha$ for Setup and Solve phases. | |
| 2. **Extrapolate**: Calculate predicted times for: | |
| - $N_{2D} = 200^2 = 40,000$ | |
| - $N_{3D} = 200^3 = 8,000,000$ | |
| 3. **Dimensional Scaling**: Apply the paper's approximation that computational time scales with stencil size $s$ raised to the dimension $D$ ($t \propto s^D$). | |
| - Truncated Taylor: $s=3$. | |
| - Truncated Polynomial: $s=9$ (for $N_p=8$). | |
| - **Output Columns**: Model Name, Matrix Setup $\alpha$, Matrix Invert $\alpha$, Stencil Size, Time (1D), Time (2D), Time (3D). | |
| ### 5.8 Figure 9: Parameter Sweep (RRSE vs Fit Window) | |
| **File**: `data/fig9_param_sweep.csv` | |
| - **Context**: Section 6, analyzing the sensitivity of the Truncated Polynomial Fit model to the window size $W$ and polynomial order $N_p$. | |
| - **Fixed Parameter**: Grid resolution $N = 2017$. | |
| - **X-axis**: Fit Window $W$ ($0.5$ to $3.0$, step $\approx 0.1$). | |
| - **Y-axis**: RRSE (Log scale). | |
| - **Series**: | |
| - Polynomial Orders: $N_p \in \{4, 6, 8, 10, 12\}$. | |
| - Baseline: Truncated Taylor model error (constant line). | |
| - **Reference**: Use a high-resolution simulation ($N \approx 12601$, $N_p=12$) as the ground truth for error calculation. | |
| ### 5.9 Figure 10: Component Approximation | |
| **File**: `data/fig10_function_approx.csv` | |
| - **Context**: Section 7 (Discussion), comparing approximation methods for the specific term $f(k) = I_n(\lambda)e^{-\lambda}$ (where $\lambda = \frac{1}{2} k^2 \rho^2$). | |
| - **Parameters**: Use $n=0$ (Modified Bessel function of the first kind) and normalized units where $\rho=1$. | |
| - **X-axis**: Normalized wavenumber $k \rho$ (Range: $-2.5$ to $2.5$). | |
| - **Y-axis**: Function Value. | |
| - **Series**: | |
| 1. **Exact**: $I_0(0.5 k^2) e^{-0.5 k^2}$. | |
| 2. **Taylor**: 4th Order Taylor expansion around $k=0$. | |
| 3. **Polynomial Fit**: 4th Order fit over window $W=2$ (i.e., fit range $[-2, 2]$). | |
| --- | |
| ## 6. Code Structure | |
| ### 6.1 Core Modules | |
| **Path**: `reproduction/` | |
| 1. `plasma.py`: | |
| - Functions for $n(x)$, $T(x)$, $B(x)$. | |
| - `get_plasma_parameters(x)` returning $\omega_{pj}, \Omega_{cj}, v_{th}, \rho_L$. | |
| 2. `dielectric.py`: | |
| - `calc_K_tensor(x, k_x, ...)`: Implements Eq (11)-(18). | |
| - Uses `scipy.special.wofz` for $Z(\zeta)$. | |
| 3. `solvers.py`: | |
| - `TaylorSolver`: Constructs sparse matrix using Eq (40)-(43). | |
| - `PolyFitSolver`: | |
| - Performs polynomial fitting of tensor elements. | |
| - Constructs sparse matrix using Eq (46)-(48). | |
| - Handles Finite Difference stencils for high order derivatives. | |
| 4. `run_sim.py`: | |
| - Orchestrates the grid generation, solving, and data export. | |
| ### 6.2 Figure Scripts | |
| | Figure/Table | Script Path | | |
| |--------|-------------| | |
| | Fig 2 | `reproduction/fig2_profiles.py` | | |
| | Fig 3,4 | `reproduction/fig3_4_tensor.py` | | |
| | Fig 5 | `reproduction/fig5_fields.py` | | |
| | Fig 6 | `reproduction/fig6_power.py` | | |
| | Fig 7 | `reproduction/fig7_convergence.py` | | |
| | Fig 8 | `reproduction/fig8_timing.py` | | |
| | Fig 9 | `reproduction/fig9_params.py` | | |
| | Fig 10 | `reproduction/fig10_approx.py` | | |
| | Table 1 | `reproduction/table1_scaling.py` | | |
| ### 6.3 Analysis Document | |
| **Path**: `reproduction/ANALYSIS.md` | |
| Must contain your analysis of the paper's methodology and all formulas needed for reproduction. | |
| ### 6.4 Output Directories | |
| - Data files: `data/` | |
| - Code files: `reproduction/` | |
| --- | |
| ## 7. Deliverables Summary | |
| Upon completion, the following files must exist: | |
| 1. `reproduction/ANALYSIS.md` — Your methodology and formula analysis | |
| 2. `reproduction/plasma.py` through `reproduction/run_sim.py` — Core simulation modules | |
| 3. `reproduction/fig2_profiles.py` through `reproduction/table1_scaling.py` — Figure/table scripts | |
| 4. `data/fig2_profiles.csv` through `data/table1_extrapolation.csv` — Output data files (9 total) | |
| Export data with 8 decimal places (`%.8e`). | |
| --- | |
| ## 8. Reproduction Requirements | |
| ### 8.1 Computational Constraints | |
| | Requirement | Value | Notes | | |
| |-------------|-------|-------| | |
| | **Memory** | 8 GB | High N simulations (10k+) require sparse matrices. | | |
| | **Precision** | Complex Double | `complex128` in numpy is essential. | | |
| | **Optimization** | Vectorization | Tensor calculation must be vectorized over $k$ or $x$. | | |
| | **Total Time Limit** | ~4 hours | For all figures, assuming 1D models only. | | |
| ### 8.2 Output Format | |
| - **Data Files**: CSV format with headers. | |
| - **Precision**: 8 decimal places for floating point values. | |
| --- |