PdeSolver 1.0.0
dotnet add package PdeSolver --version 1.0.0
NuGet\Install-Package PdeSolver -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PdeSolver" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PdeSolver" Version="1.0.0" />
<PackageReference Include="PdeSolver" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PdeSolver --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PdeSolver, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PdeSolver@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PdeSolver&version=1.0.0
#tool nuget:?package=PdeSolver&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PdeSolver
A .NET library for solving 1D parabolic partial differential equations using the Crank-Nicolson finite difference method.
PDE Form
The solver handles PDEs of the form:
$$u_t = a(t,x), u_{xx} + b(t,x), u_x + c(t,x), u + f(t,x)$$
where:
a(t,x)— diffusion coefficientb(t,x)— advection coefficientc(t,x)— reaction coefficientf(t,x)— source term
Installation
dotnet add package PdeSolver
Quick Start
using PdeSolver;
// Define domain: x in [0,1], t in [0,0.1]
var domain = new Domain1D(0.0, 1.0, 0.0, 0.1);
// Create grid: 101 spatial points, 1000 time steps
var grid = new Grid1D(domain, 101, 1000);
// Define PDE (heat equation with sin(πx) initial condition)
var pde = new Pde1D
{
Diffusion = (t, x) => 1.0,
Initial = (t, x) => Math.Sin(Math.PI * x),
BoundaryLeft = (t, x) => 0.0,
BoundaryRight = (t, x) => 0.0
};
// Solve
var solver = PdeSolverFactory.CreateSolver1D(grid, pde);
double[] solution = solver.Solve();
Features
- Crank-Nicolson scheme — second-order accurate in both time and space
- Configurable theta parameter — set
solver.Thetato 0.0 (explicit), 0.5 (Crank-Nicolson), or 1.0 (implicit) - Flexible coefficients — diffusion, advection, reaction, and source can be functions of
(t, x) - Dirichlet boundary conditions — left and right boundary values as functions of
(t, x) - NuGet-ready — packaged for distribution via NuGet
API Reference
Core Types
| Type | Description |
|---|---|
Domain1D |
Defines spatial [xL, xR] and temporal [t0, t1] bounds |
Grid1D |
Uniform discretization with Nx spatial points and Nt time steps |
Pde1D |
PDE definition: coefficients, initial condition, boundary conditions |
BoundaryType |
Enum: Dirichlet, Neumann, Gamma |
BoundaryConfig1D |
Stores boundary types for left/right boundaries |
CoefficientFunction |
Delegate: double CoefficientFunction(double t, double x) |
Solver
| Type | Description |
|---|---|
CrankNicolsonSolver1D |
Main solver class (in PdeSolver.Schemes namespace) |
PdeSolverFactory |
Factory with CreateSolver1D(grid, pde) method |
Examples
See the examples project for complete working examples:
- Heat equation — with exact solution comparison
- Advection-diffusion — Gaussian bump transport
- Reaction-diffusion with source — approach to steady state
Building
# Restore and build
dotnet build
# Run tests
dotnet test
# Run examples
dotnet run --project examples/PdeSolver.Examples
# Create NuGet package
dotnet pack src/PdeSolver -c Release
Project Structure
PdeSolver/
├── PdeSolver.sln
├── src/
│ └── PdeSolver/ # Class library (NuGet package)
│ ├── BoundaryType.cs
│ ├── BoundaryConfig1D.cs
│ ├── CoefficientFunction.cs
│ ├── Domain1D.cs
│ ├── Grid1D.cs
│ ├── Pde1D.cs
│ ├── PdeSolverFactory.cs
│ ├── TridiagonalSolver.cs
│ └── Schemes/
│ └── CrankNicolsonSolver1D.cs
├── tests/
│ └── PdeSolver.Tests/ # xUnit test project
└── examples/
└── PdeSolver.Examples/ # Console demo app
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 113 | 4/13/2026 |