Skip to content

Instantly share code, notes, and snippets.

View wence-'s full-sized avatar

Lawrence Mitchell wence-

View GitHub Profile
! Save core/non-core/l1/l2 distinction in mesh node_classes
if (have_halos) then
tmp = entity_counts(0) ! number of vertices in topology mesh (-1?)
! Number of nodes in mesh?
if ( dofs_per(mesh_dim(mesh)) > 0 ) then
tmp = ((tmp + 1) * dofs_per(mesh_dim(mesh))) - 1
end if
! Count core nodes (primary sort key -2)
mesh%node_classes(CORE_ENTITY) = count(entity_sort_list(1:tmp, 0) == -2)
! Count non-core nodes (primary sort key -1)
from mpi4py import MPI
from pyop2 import op2
import numpy as np
op2.init(backend='sequential')
c = MPI.COMM_WORLD
if c.size != 2:
c.Abort()
=== modified file 'python/fluidity/bcs.py'
--- python/fluidity/bcs.py 2013-05-29 13:25:20 +0000
+++ python/fluidity/bcs.py 2013-05-31 09:14:46 +0000
@@ -82,39 +82,54 @@
# Add method argument if it's given
if "method" in kwargs:
args = tuple(list(args) + [kwargs["method"]])
+ self._cached_setup = {}
+
+ def _setup(self, domain, b):
from firedrake import *
from pyop2 import op2
m = UnitSquareMesh(40, 40)
V = VectorFunctionSpace(m, 'CG', 1)
f = Function(V)
k = op2.Kernel("""
void k(double *x, double *coords) {
double dx = coords[0] - 0.5;
diff --git a/python/firedrake/solving.py b/python/firedrake/solving.py
index 4480426..cb01c61 100644
--- a/python/firedrake/solving.py
+++ b/python/firedrake/solving.py
@@ -471,11 +471,11 @@ def _assemble(f, tensor=None, bcs=None):
op2.INC, (test.interior_facet_node_map(bcs)[op2.i[0]],
trial.interior_facet_node_map(bcs)[
op2.i[1]]),
- flatten=True)
+ flatten=has_vec_fs(test))

Solving PDEs

Problem setup

Consider a weak variational problem

diff --git a/python/firedrake/core_types.pyx b/python/firedrake/core_types.pyx
index 3a97056..b6427f7 100644
--- a/python/firedrake/core_types.pyx
+++ b/python/firedrake/core_types.pyx
@@ -830,9 +830,12 @@ class FunctionSpaceBase(object):
else:
self.interior_facet_node_list = None
- self.exterior_facet_node_list = \
- np.array(<int[:mesh.exterior_facets.count,:element_f.ndof]>
from firedrake import *
dimension = 1
mesh = UnitIntervalMesh(10)
U = FunctionSpace(mesh, "CG", 2)
H = FunctionSpace(mesh, "CG", 1)
W = U * H # Mixed function space
q = Function(W)
# Define trial and test functions
git_branch=''
function find_git_branch {
local dir=. head staged dirty stash
until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
git_branch=" ${red}g${green}"
head=$(< "$dir/.git/HEAD")
dirty=''
git --git-dir="${dir}git" --work-tree="${dir}" diff --no-ext-diff \
--quiet --exit-code || \
from firedrake import *
from pyop2 import op2
from copy import copy
op2.init(likwid=True, simd_isa='avx', compiler='gnu')
from pyop2 import profiling as p
#m = UnitTriangleMesh()
m = Mesh('spacefilling6.node')
m = ExtrudedMesh(m, layers=51, layer_height=0.1)