Skip to content

Instantly share code, notes, and snippets.

View funsim's full-sized avatar
🌿

Simon Wolfgang Funke funsim

🌿
View GitHub Profile
import threading
import signal
import sys
from time import sleep
class MyThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.is_running = False
# Cahn-Hilliard equation
# ======================
#
# This demo is implemented in a single Python file,
# :download:`demo_cahn-hilliard.py`, which contains both the variational
# forms and the solver.
#
# This example demonstrates the solution of a particular nonlinear
# time-dependent fourth-order equation, known as the Cahn-Hilliard
# equation. In particular it demonstrates the use of
@funsim
funsim / point_file.txt
Last active August 29, 2015 14:10
point_file.txt
-5104.28799298 2781.81769799 -3714.02666772 2507.68383598
-4859.68586005 -353.142452365
-4863.93374924 -266.880208176
-4730.24481851 -175.516970468
-4856.56367064 -95.3706611275
-4932.11214897 423.373136254
-4923.97208435 509.385880293
-4469.35931886 1536.19766922
-4377.25158479 1590.4861288
-4406.49389432 1690.11591594
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
-- Build files have been written to: /tmp/tmpSyR5K92014-9-30-13-00_instant_f7fd3ea16ba0ef0c22886aca2a7d5042c8cd960b/ffc_form_d30763470dbe823dbf53c9ef87b671fdf6e034d1
/usr/bin/cmake -H/tmp/tmpSyR5K92014-9-30-13-00_instant_f7fd3ea16ba0ef0c22886aca2a7d5042c8cd960b/ffc_form_d30763470dbe823dbf53c9ef87b671fdf6e034d1 -B/tmp/tmpSyR5K92014-9-30-13-00_instant_f7fd3ea16ba0ef0c22886aca2a7d5042c8cd960b/ffc_form_d30763470dbe823dbf53c9ef87b671fdf6e034d1 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /tmp/tmpSyR5K92014-9-30-13-00_instant_f7fd3ea16ba0ef0c22886aca2a7d5042c8cd960b/ffc_form_d30763470dbe823dbf53c9ef87b671fdf6e034d1/CMa
from dolfin import *
mesh = UnitSquareMesh(2, 2)
V = VectorFunctionSpace(mesh, "DG", 0)
P = FunctionSpace(mesh, "DG", 0)
from dolfin import *
mesh = UnitSquareMesh(2, 2)
V = FunctionSpace(mesh, "DG", 0)
f = interpolate(Expression("x[0]*x[1]"), V)
pvd = File("out.pvd")
pvd << f
@funsim
funsim / python
Created June 19, 2014 21:25
Multi Steady State Pressure difference driven
from opentidalfarm import *
set_log_level(INFO)
# Some domain information extracted from the geo file
basin_x = 2000.
basin_y = 500.
headland_x = 500.
headland_y = 200.
simon@doodson ~/src/da-applications/ohta_kawasaki$ py ohta_kawasaki.py
Passing options to PETSc: -ok_snes_monitor -ok_ksp_converged_reason -ok_ksp_type tfqmr -ok_ksp_monitor -ok_ksp_rtol 1.0e-10 -ok_pc_type fieldsplit -ok_pc_fieldsplit_type schur -ok_pc_fieldsplit_schur_factorization_type lower -ok_pc_fieldsplit_schur_precondition self -ok_fieldsplit_0_ksp_type preonly -ok_fieldsplit_0_ksp_max_it 1 -ok_fieldsplit_0_pc_type ilu -ok_fieldsplit_1_ksp_type richardson -ok_fieldsplit_1_ksp_max_it 1 -ok_fieldsplit_1_pc_type mat -ok_fieldsplit_1_hats_pc_type ilu -ok_fieldsplit_1_hats_pc_mg_log -ok_fieldsplit_1_hats_pc_mg_monitor -ok_fieldsplit_1_hats_ksp_type preonly -ok_fieldsplit_1_hats_ksp_max_it 1 -ok_fieldsplit_0_pc_ml_maxCoarseSize 1024 -ok_fieldsplit_1_hats_pc_ml_maxCoarseSize 1024 -ok_fieldsplit_0_pc_ml_DampingFactor 1.5 -ok_fieldsplit_1_hats_pc_ml_DampingFactor 1.5 -ok_fieldsplit_0_pc_hypre_boomeramg_agg_nl 3 -ok_fieldsplit_1_hats_pc_hypre_boomeramg_agg_nl 3 -ok_fieldsplit_1_hats_pc_hypre_boomeramg_strong_t
from dolfin import *
import math
def stokes(n):
# Load mesh and subdomains
mesh = UnitSquareMesh(n, n)
u_analytical = Expression(("-sin(pi*x[0])", "0.0"))