Skip to content

Instantly share code, notes, and snippets.

View wence-'s full-sized avatar

Lawrence Mitchell wence-

View GitHub Profile
# FS DoFs DV BW_direct t_direct BW_inc t_inc
DG0xDG0 15130900 1154.4 4375.99 0.263802 2471.65 0.467054
DG0xDG1 30261800 2308.79 4457.83 0.517918 3120.45 0.739891
DG0xCG1 15433518 1177.48 4334.26 0.271669 1611.49 0.730679
DG0xCG2 30564418 2331.88 6500.66 0.358714 1458.63 1.59867
DG0xCG3 45695318 3486.28 4704.13 0.74111 1321.04 2.63904
DG1xDG0 45392700 3463.19 4318.28 0.801983 1489.39 2.32523
DG1xDG1 90785400 6926.38 4366.01 1.58643 961.072 7.20693
DG1xCG1 46300554 3532.45 4916.55 0.718482 563.266 6.27138
DG1xCG2 91693254 6995.64 4856.23 1.44055 791.048 8.84351
"""
Solve the linearised Boussinesq equations in a vertical slice using
an extruded mesh.
"""
from firedrake import *
m = UnitIntervalMesh(5)
mesh = ExtrudedMesh(m, layers=4, layer_height=0.25)
from firedrake import *
m = PeriodicUnitIntervalMesh(5)
mesh = ExtrudedMesh(m, layers=5, layer_height=1.0/5)
#1D spaces in horizontal
IUh0 = FiniteElement("CG", "interval", 1)
IUh1 = FiniteElement("DG", "interval", 0)
#1D spaces in vertical
diff --git a/python/firedrake/nullspace.py b/python/firedrake/nullspace.py
index 382f039..0daf197 100644
--- a/python/firedrake/nullspace.py
+++ b/python/firedrake/nullspace.py
@@ -1,5 +1,5 @@
from petsc4py import PETSc
-from types import IndexedFunctionSpace
+from types import IndexedFunctionSpace, Function
from firedrake import *
m = PeriodicUnitIntervalMesh(4)
V = FunctionSpace(m, 'CG', 1)
print m.coordinates.dat.data
u = Function(V)
PetscErrorCode PetscSectionSetField(PetscSection s, PetscInt field, PetscSection sub)
{
PetscErrorCode ierr;
const char *fieldName;
PetscFunctionBegin;
PetscValidHeaderSpecific(s,PETSC_SECTION_CLASSID,1);
PetscValidHeaderSpecific(sub,PETSC_SECTION_CLASSID,1);
if ((field <0) || (field >= s->numFields)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Section field %d should be in [%d, %d)", field, 0, s->numFields);
ierr = PetscObjectReference((PetscObject) sub);CHKERRQ(ierr);
s->field[field] = sub;
from firedrake import *
mesh = IcosahedralSphereMesh(radius=1, refinement_level=2)
kernel = op2.Kernel("""void outward_normal (double** coords , double** normal )
{
double v0[3] ;
double v1[3] ;
double n[3] ;
double x[3] ;
double dot ;
Point(1) = {0, 0, 0, 1.0};
Point(2) = {1, 0, 0, 1.0};
Point(3) = {1, 0.5, 0, 1.0};
Point(4) = {0.5, 0.5, 0, 1.0};
Point(5) = {0.5, 1, 0, 1.0};
Point(6) = {0, 1, 0, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
diff --git a/src/PETSc/DM.pyx b/src/PETSc/DM.pyx
index b265921..3c25aa1 100644
--- a/src/PETSc/DM.pyx
+++ b/src/PETSc/DM.pyx
@@ -2,7 +2,6 @@
class DMType(object):
DA = S_(DMDA_type)
- ADDA = S_(DMADDA_type)
COMPOSITE = S_(DMCOMPOSITE)
diff --git a/firedrake/dmplex.pyx b/firedrake/dmplex.pyx
index 576405f..42760d2 100644
--- a/firedrake/dmplex.pyx
+++ b/firedrake/dmplex.pyx
@@ -104,7 +104,7 @@ def facet_numbering(PETSc.DM plex, kind,
# Second cell
if facet_cells.shape[1] > 1:
cell = facet_cells[f,1]
- if cell > 0:
+ if cell >= 0: