Author: Ivan Yashchuk
Organization: Chainer, as part of NumFocus
Mentor: Hiroyuki V Yamazaki
Author: Ivan Yashchuk
Organization: Chainer, as part of NumFocus
Mentor: Hiroyuki V Yamazaki
# Solves Heat equation on a periodic domain, using raw VecScatter | |
from __future__ import division | |
import sys, petsc4py | |
petsc4py.init(sys.argv) | |
from petsc4py import PETSc | |
from mpi4py import MPI | |
import numpy | |
class Heat(object): |
static char help[] ="Solves a simple time-dependent linear PDE (the heat equation).\n\ | |
Input parameters include:\n\ | |
-m <points>, where <points> = number of grid points\n\ | |
-time_dependent_rhs : Treat the problem as having a time-dependent right-hand side\n\ | |
-use_ifunc : Use IFunction/IJacobian interface\n\ | |
-debug : Activate debugging printouts\n\ | |
-nox : Deactivate x-window graphics\n\n"; | |
/* |
using PyFenicsAD | |
using Zygote | |
using PyCall | |
using Turing | |
import LinearAlgebra: norm | |
using Random, Distributions | |
fenics = pyimport("fenics") | |
fenics.set_log_level(fenics.LogLevel.ERROR) | |
fa = pyimport("fenics_adjoint") |