Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,8 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

docs/_autosummary/
docs/_autosummary/
AGENTS.md
.codex/
.github/agents/
.vscode/
16 changes: 8 additions & 8 deletions docs/notebooks/00-using-voxelfields.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/notebooks/01-using-solvers.ipynb

Large diffs are not rendered by default.

45 changes: 22 additions & 23 deletions docs/notebooks/02-microstructure-workflow.ipynb

Large diffs are not rendered by default.

23 changes: 8 additions & 15 deletions docs/notebooks/03-ODE-prototyping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
" \n",
" def __post_init__(self):\n",
" \"\"\"Precompute factors required by the spectral solver.\"\"\"\n",
" k_squared = self.vg.rfft_k_squared()\n",
" self._fourier_symbol = - max(self.D_A, self.D_B) * k_squared\n",
" self.initialize_boundary_conditions()\n",
" self._fourier_symbol = - max(self.D_A, self.D_B) * self.k_squared()\n",
" if self.interaction is None:\n",
" self.interaction = lambda u, lib=None: u[0] * u[1]**2\n",
" \n",
Expand All @@ -93,13 +93,6 @@
" @property\n",
" def fourier_symbol(self):\n",
" return self._fourier_symbol\n",
" \n",
" @property\n",
" def bc_type(self):\n",
" return 'periodic'\n",
"\n",
" def pad_bc(self, u):\n",
" return self.vg.bc.pad_periodic(u)\n",
"\n",
" def _eval_interaction(self, u, lib):\n",
" \"\"\"Evaluate interaction term\"\"\"\n",
Expand Down Expand Up @@ -298,9 +291,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 39.9939 s after 10000 iterations (0.004 s/iter)\n",
"GPU-RAM (nvidia-smi) current: 167 MB (167.0 MB max)\n",
"GPU-RAM (torch) current: 19.34 MB (59.22 MB max, 70.00 MB reserved)\n"
"Wall time: 38.3455 s after 10000 iterations (0.0038 s/iter)\n",
"GPU-RAM (nvidia-smi) current: 434 MB (434.0 MB max)\n",
"GPU-RAM (torch) current: 16.26 MB (47.74 MB max, 66.00 MB reserved)\n"
]
}
],
Expand Down Expand Up @@ -368,9 +361,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Wall time: 36.9271 s after 10000 iterations (0.0037 s/iter)\n",
"GPU-RAM (nvidia-smi) current: 167 MB (167.0 MB max)\n",
"GPU-RAM (torch) current: 19.35 MB (45.52 MB max, 70.00 MB reserved)\n"
"Wall time: 37.7972 s after 10000 iterations (0.0038 s/iter)\n",
"GPU-RAM (nvidia-smi) current: 434 MB (434.0 MB max)\n",
"GPU-RAM (torch) current: 16.27 MB (47.75 MB max, 66.00 MB reserved)\n"
]
}
],
Expand Down
18 changes: 9 additions & 9 deletions docs/notebooks/10-appendix-convergence-testing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
}
],
"source": [
"from evoxels.problem_definition import AllenCahnEquation\n",
"from evoxels.problem_definition import TwoPhaseAllenCahn\n",
"from evoxels.utils import rhs_convergence_test\n",
"import sympy as sp\n",
"import sympy.vector as spv\n",
Expand All @@ -409,7 +409,7 @@
" * (CS.z**2/2 - CS.z**3/3)\n",
"\n",
"dx, errors, slope, order = rhs_convergence_test(\n",
" ODE_class = AllenCahnEquation,\n",
" ODE_class = TwoPhaseAllenCahn,\n",
" problem_kwargs = {'eps': 3.0, 'curvature': 0.5},\n",
" test_function = test_fun,\n",
" convention = 'cell_center',\n",
Expand Down Expand Up @@ -518,7 +518,7 @@
"results1 = mms_convergence_test(\n",
" ODE_class = ReactionDiffusion,\n",
" timestepper_cls = PseudoSpectralIMEX,\n",
" problem_kwargs = {\"D\": 1.0, \"BC_type\": 'periodic'},\n",
" problem_kwargs = {\"D\": 1.0},\n",
" test_function = test_funs_rd,\n",
" mode = 'spatial',\n",
" t_powers = [8,9,10,11,12,13,14,15],\n",
Expand All @@ -527,7 +527,7 @@
"results2 = mms_convergence_test(\n",
" ODE_class = ReactionDiffusion,\n",
" timestepper_cls = ForwardEuler,\n",
" problem_kwargs = {\"D\": 1.0, \"BC_type\": 'periodic'},\n",
" problem_kwargs = {\"D\": 1.0},\n",
" test_function = test_funs_rd,\n",
" mode = 'spatial',\n",
" t_powers = [8,9,10,11,12,13,14,15],\n",
Expand All @@ -536,7 +536,7 @@
"results3 = mms_convergence_test(\n",
" ODE_class = ReactionDiffusion,\n",
" timestepper_cls = PseudoSpectralIMEX,\n",
" problem_kwargs = {\"D\": 1.0, \"BC_type\": 'periodic'},\n",
" problem_kwargs = {\"D\": 1.0},\n",
" test_function = test_funs_rd,\n",
" mode = 'temporal',\n",
" t_powers = [8,9,10,11,12,13,14,15],\n",
Expand All @@ -545,7 +545,7 @@
"results4 = mms_convergence_test(\n",
" ODE_class = ReactionDiffusion,\n",
" timestepper_cls = ForwardEuler,\n",
" problem_kwargs = {\"D\": 1.0, \"BC_type\": 'periodic'},\n",
" problem_kwargs = {\"D\": 1.0},\n",
" test_function = test_funs_rd,\n",
" mode = 'temporal',\n",
" t_powers = [8,9,10,11,12,13,14,15],\n",
Expand All @@ -557,7 +557,7 @@
"id": "6e050c23",
"metadata": {},
"source": [
"Helper function from utils to visualize the resulting error landscapes as a function od dt and dx. If the solver exits with NaN error, the L2 norm is set to Nan as well. "
"Helper function from utils to visualize the resulting error landscapes as a function of dt and dx. If the solver exits with NaN error, the L2 norm is set to Nan as well. "
]
},
{
Expand Down Expand Up @@ -593,7 +593,7 @@
"id": "c33093a9",
"metadata": {},
"source": [
"Exmple with coupled reaction diffusion equation"
"Example with coupled reaction diffusion equation"
]
},
{
Expand Down Expand Up @@ -628,7 +628,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 11,
"id": "3143743d",
"metadata": {},
"outputs": [
Expand Down
12 changes: 6 additions & 6 deletions evoxels/precompiled_solvers/allen_cahn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ..problem_definition import AllenCahnEquation
from ..problem_definition import TwoPhaseAllenCahn
from ..solvers import TimeDependentSolver
from ..timesteppers import ForwardEuler
from ..timesteppers import RungeKutta4
from typing import Callable

def run_allen_cahn_solver(
Expand All @@ -9,7 +9,7 @@ def run_allen_cahn_solver(
backend: str,
jit: bool = True,
device: str = "cuda",
time_increment: float = 0.1,
time_increment: float = 0.5,
frames: int = 10,
max_iters: int = 100,
eps: float = 2.0,
Expand All @@ -23,14 +23,14 @@ def run_allen_cahn_solver(
plot_bounds = None,
):
"""
Solves time-dependent Allen-Cahn problem with ForwardEuler timestepper.
Solves time-dependent Allen-Cahn problem with RungeKutta4 timestepper.
"""
solver = TimeDependentSolver(
voxelfields,
fieldnames,
backend,
problem_cls = AllenCahnEquation,
timestepper_cls = ForwardEuler,
problem_cls = TwoPhaseAllenCahn,
timestepper_cls = RungeKutta4,
device=device,
)
solver.solve(
Expand Down
Loading
Loading