Skip to content

Instantly share code, notes, and snippets.

View wence-'s full-sized avatar

Lawrence Mitchell wence-

View GitHub Profile
Point (1) = {9.000000000000e-01, 0.000000000000e+00, 0, 0.01};
Point (2) = {-5.078426679081e-02, 3.967631009135e-01, 0, 0.01};
Point (3) = {-9.000000000000e-01, 1.102182119233e-16, 0, 0.01};
Point (4) = {-2.299312842587e-01, -3.273096462360e-01, 0, 0.01};
Line (1) = {1, 2};
Line (2) = {2, 3};
Line (3) = {3, 4};
Line (4) = {4, 1};
Line Loop (7) = {1, 2, 3, 4};
Physical Line (9) = {1, 2, 3, 4};
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define PI_32 "3.14159265358979323846264338327950"
#define PI_16 3.1415926535897932
char *pi(double pi, double remainder)
{
char *ret, spi[37], srem[37];
...
from slepc4py import SLEPc
A = assemble(a).M.handle
eps = SLEPc.EPS().create()
# eps.setDimensions(nev=10, ncv=100)
from ufl import HDiv
from firedrake.fiat_utils import *
class CellIndirection(object):
def __init__(self, fs):
ufl_ele = fs.ufl_element()
# Unwrap non HDiv'd element if necessary
if isinstance(ufl_ele, HDiv):
ele = ufl_ele._element
bzr_branch=''
function find_bzr_branch {
local dir=. dirty head nick
# Parse all the bzr config stuff by hand, rather than calling out
# to the binary, cos it's so damn slow.
until [ "$dir" -ef / ]; do
if [ -d "$dir/.bzr/checkout" ]; then
head=$(readlink -f $dir)
dirty=''
bzr_branch=" ${red}b${green}"
from firedrake import *
from firedrake.petsc import PETSc
m = UnitSquareMesh(1, 1)
V = FunctionSpace(m, 'CG', 1)
u = TrialFunction(V)
v = TestFunction(V)
A = assemble(u*v*dx)
import gc
def howmany(cls):
return len([x for x in gc.get_objects() if isinstance(x, cls)])
from firedrake.matrix import Matrix
from firedrake.petsc import PETSc
import gc
diff --git a/source/pressuresolver/operators.py b/source/pressuresolver/operators.py
index 9cae976..707bcb1 100644
--- a/source/pressuresolver/operators.py
+++ b/source/pressuresolver/operators.py
@@ -51,6 +51,13 @@ class Operator(object):
self.timer_label = ''
self.timer_label += str(ncells)
+ self.B_phi_form = div(self.w)*self.phi_tmp*self.dx
+ self.B_phi = Function(self.V_velocity)
diff --git a/src/dm/impls/plex/plexrefine.c b/src/dm/impls/plex/plexrefine.c
index c6acb18..5667f07 100644
--- a/src/dm/impls/plex/plexrefine.c
+++ b/src/dm/impls/plex/plexrefine.c
@@ -6139,6 +6139,12 @@ static PetscErrorCode CellRefinerCreateLabels(CellRefiner refiner, DM dm, PetscI
ierr = DMLabelGetStratumIS(label, values[val], &pointIS);CHKERRQ(ierr);
ierr = ISGetLocalSize(pointIS, &numPoints);CHKERRQ(ierr);
ierr = ISGetIndices(pointIS, &points);CHKERRQ(ierr);
+ /* Ensure refined label is created with same number of strata as
+ * original (even if no entries here). */
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
bdy = PETSc.DMPlex().create()
bdy.setDimension(1)
bdy.createSquareBoundary([0, 0], [1, 1], [4, 4])