This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firedrake import * | |
n = 20 | |
mesh = UnitIntervalMesh(n) | |
V = FunctionSpace(mesh, "CG", 1) | |
W = V*V | |
U = Function(W) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firedrake as fd | |
# some domain, parameters and FS setup | |
R0 = 6371220. | |
ref_level = 5 | |
basemesh = fd.IcosahedralSphereMesh(radius=R0, | |
refinement_level=0, degree=3) | |
mh = fd.MeshHierarchy(basemesh, ref_level) | |
for mesh in mh: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firedrake import * | |
Mesh = IcosahedralSphereMesh(radius=1.0, refinement_level=5, degree=1) | |
global_normal = Expression(("x[0]", "x[1]", "x[2]")) | |
Mesh.init_cell_orientations(global_normal) | |
V1 = FunctionSpace(Mesh,"BDM",1) | |
V2 = FunctionSpace(Mesh,"DG",0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array([[ 0, 1], | |
[ 0, 0], | |
[ 0, 2], | |
[ 3, 1], | |
[ 1, 1], | |
[ 2, 2], | |
[ 2, 4], | |
[ 5, 3], | |
[ 3, 3], | |
[ 4, 4], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [8]: mesh._base_mesh.topology.interior_facets.local_facet_dat.data | |
Out[8]: | |
array([[ 0, 19], | |
[ 2, 2], | |
[ 0, 17], | |
[ 0, 16], | |
[ 2, 2], | |
[ 2, 2], | |
[ 0, 13], | |
[ 0, 12], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File "thin_advection.py", line 50, in <module> | |
q_solver.solve() | |
File "/Users/colincotter/firedrake/firedrake/src/firedrake/firedrake/variational_solver.py", line 190, in solve | |
self.snes.solve(None, v) | |
File "PETSc/SNES.pyx", line 520, in petsc4py.PETSc.SNES.solve (src/petsc4py.PETSc.c:168312) | |
File "PETSc/petscsnes.pxi", line 253, in petsc4py.PETSc.SNES_Function (src/petsc4py.PETSc.c:33279) | |
File "/Users/colincotter/firedrake/firedrake/src/firedrake/firedrake/solving_utils.py", line 188, in form_function | |
nest=problem._nest) | |
File "/Users/colincotter/firedrake/firedrake/src/firedrake/firedrake/assemble.py", line 66, in assemble | |
inverse=inverse, nest=nest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firedrake import * | |
n0 = 100 | |
mesh = UnitSquareMesh(n0, n0) | |
Vc = mesh.coordinates.function_space() | |
f = Function(Vc).interpolate(Expression(("x[0]","x[1] + (1-x[1])*s*sin(2*pi*x[0])"),s=0.1)) | |
mesh.coordinates.assign(f) | |
V1 = FunctionSpace(mesh,"BDM",1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firedrake import * | |
n0 = 100 | |
mesh = UnitSquareMesh(n0, n0) | |
Vc = mesh.coordinates.function_space() | |
f = Function(Vc).interpolate(Expression(("x[0]","x[1] + (1-x[1])*s*sin(2*pi*x[0])"),s=0.1)) | |
mesh.coordinates.assign(f) | |
V1 = FunctionSpace(mesh,"CG",1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firedrake import * | |
mesh0 = Mesh("circ.msh") | |
Vm = VectorFunctionSpace(mesh0,"CG",2) | |
X = Function(Vm).interpolate(mesh0.coordinates) | |
Vs = FunctionSpace(mesh0,"CG",2) | |
r= Function(Vs).interpolate( sqrt(X[0]*X[0]+X[1]*X[1]) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cellSize = 0.1; | |
radius = 1.0; | |
Point(1) = {0, 0, 0, cellSize}; | |
Point(2) = {-radius, 0, 0, cellSize}; | |
Point(3) = {0, radius, 0, cellSize}; | |
Point(4) = {radius, 0, 0, cellSize}; | |
Point(5) = {0, -radius, 0, cellSize}; | |
Circle(6) = {2, 1, 3}; | |
Circle(7) = {3, 1, 4}; | |
Circle(8) = {4, 1, 5}; |
NewerOlder