Skip to content

Instantly share code, notes, and snippets.

View eikehmueller's full-sized avatar

Eike Hermann Mueller eikehmueller

View GitHub Profile
Traceback (most recent call last):
File "divide.py", line 23, in <module>
par_loop('for(int i=0; i<f3.dofs; i++) { f3[i][0] = f1[i][0]/f2[i][0]; }',dS,{'f3':(f3,WRITE), 'f1':(f1,READ), 'f2':(f2,READ)})
File "/Users/eikemueller/PostDocBath/EllipticSolvers/firedrake/firedrake/parloops.py", line 137, in par_loop
op2args.append(_map['itspace'](mesh, measure))
File "/Users/eikemueller/PostDocBath/EllipticSolvers/firedrake/firedrake/parloops.py", line 18, in <lambda>
'itspace': lambda mesh, measure: mesh.interior_facets.measure_set(measure)
TypeError: measure_set() takes exactly 3 arguments (2 given)
@eikehmueller
eikehmueller / gist:aa8cf77a5f484ea8ca29
Created May 27, 2014 09:02
assemble div grad phi
from firedrake import *
n = 32
mesh = UnitSquareMesh(n,n)
V_u = FunctionSpace(mesh,'RT',1)
V_phi = FunctionSpace(mesh,'CG',1)
expression = Expression('(1.-cos(2.*pi*x[0]))*(1.-cos(2.*pi*x[1]))')
phi = Function(V_phi)
from firedrake import *
mesh = UnitIcosahedralSphereMesh(refinement_level=0)
V_u = FunctionSpace(mesh,'RT',1,name='RT1')
phi = Function(V_u)
phi.assign(0.0)
kernel = 'for(int i=0; i<phi.dofs; i++) { phi[i][0] += 1; }'
for facet in (ds,dS):
w = TestFunction(self.V_velocity)
self.data = Function(self.V_velocity)
SBR_x = Function(self.V_velocity).project(Expression(('0','-x[2]','x[1]')))
SBR_y = Function(self.V_velocity).project(Expression(('x[2]','0','-x[0]')))
SBR_z = Function(self.V_velocity).project(Expression(('-x[1]','x[0]','0')))
M_SBR_x = assemble(dot(w,SBR_x)*dx)
M_SBR_y = assemble(dot(w,SBR_y)*dx)
M_SBR_z = assemble(dot(w,SBR_z)*dx)
kernel_code = '''void lump_SBR(double *data,
double *SBR_x,
Traceback (most recent call last):
File "driver.py", line 35, in <module>
hmesh = MeshHierarchy(mesh,refinement_levels)
File "/Users/eikemueller/PostDocBath/EllipticSolvers/firedrake/firedrake/multigrid.py", line 39, in __init__
for i, dm in enumerate(dm_hierarchy)]
File "/Users/eikemueller/PostDocBath/EllipticSolvers/firedrake/firedrake/mesh.py", line 244, in __init__
distribute=distribute)
File "/Users/eikemueller/PostDocBath/EllipticSolvers/firedrake/firedrake/mesh.py", line 341, in _from_dmplex
(self.num_vertices(), geometric_dim))
File "dmplex.pyx", line 506, in firedrake.dmplex.reordered_coords (firedrake/dmplex.c:7958)
mat = PETSc.Mat().create()
mat.setType(mat.Type.PYTHON)
func = Function(self.operator.V_pressure)
nrow = func.dof_dset.size * func.dof_dset.cdim
ncol = func.dof_dset.size * func.dof_dset.cdim
mat.setSizes(((nrow,None),(ncol,None)))
mat.setPythonContext(self.operator)
self.sor = PETSc.PC().create()
self.sor.setType(self.sor.Type.SOR)
self.sor.setOperators(mat)
def apply(self,phi):
'''Apply operator.
Apply the operator :math:`H` to a field :math:`phi` in a matrix free way by
applying the individual components in turn and return the result :math:`H\phi`.
:arg phi: Pressure field :math:`phi` to apply the operator to
'''
# Calculate action of B
B_phi = assemble(div(self.w)*phi*self.dx)
# divide by lumped velocity mass matrix
File "driver.py", line 127, in <module>
mesh_hierarchy = MeshHierarchy(coarse_mesh,param_grid['nlevel'])
File "/Users/eikemueller/PostDocBath/EllipticSolvers/firedrake/firedrake/multigrid.py", line 45, in __init__
dmplex.filter_exterior_facet_labels(rdm)
File "dmplex.pyx", line 512, in firedrake.dmplex.filter_exterior_facet_labels (firedrake/dmplex.c:8150)
RuntimeError: 62
#PBS -l select=1
#PBS -A n02-NEJ005576
#PBS -q debug
#PBS -M e.mueller@bath.ac.uk
# Make sure any symbolic links are resolved to absolute path
export PBS_O_WORKDIR=$(readlink -f $PBS_O_WORKDIR)
echo Running in $PBS_O_WORKDIR
cd $PBS_O_WORKDIR
#!/bin/bash --login
#PBS -N %(jobname)s
#PBS -l walltime=%(walltime)s:0
#PBS -l select=%(nodes)d
#PBS -A n02-NEJ005576
#PBS -M e.mueller@bath.ac.uk
#PBS -q %(queue)s
# Make sure any symbolic links are resolved to absolute path