Skip to content

Commit

Permalink
Add continuous integration with Travis-CI (#67)
Browse files Browse the repository at this point in the history
* Add Travis-CI configuration file

* Remove VTK postprocessing from this package, because python-vtk installation is unreliable

* No longer need to install any extra dependencies

* Remove use of obsoleted firedrake.Expression

* Add continuous integration status button
  • Loading branch information
Alexander G. Zimmerman authored May 11, 2019
1 parent 062d815 commit 99569f1
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 401 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
- docker

branches:
only:
- master

before_install:
- docker pull firedrakeproject/firedrake
- docker run -dti -v `pwd`:/home/firedrake/sapphire -w /home/firedrake --name fd firedrakeproject/firedrake
- docker exec fd ls
- docker exec fd pip3 install pytest

script:
- docker exec fd bash -c "source firedrake/bin/activate && python3 -m pytest -v sapphire/tests"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ is an engine for constructing PDE-based simulations
discretized in space with mixed finite elements
and in time with finite differences.


![](https://travis-ci.org/geo-fluid-dynamics/sapphire.svg?branch=master)
[![DOI](https://zenodo.org/badge/157389237.svg)](https://zenodo.org/badge/latestdoi/157389237)


Expand Down
34 changes: 12 additions & 22 deletions sapphire/benchmarks/freeze_water_in_cavity.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ def dirichlet_boundary_conditions(sim):

W = sim.function_space

dim = sim.mesh.geometric_dimension()

return [fe.DirichletBC(
W.sub(1), (0.,)*dim, "on_boundary"),
W.sub(1), (0., 0.), "on_boundary"),
fe.DirichletBC(W.sub(2), sim.hot_wall_temperature, 1),
fe.DirichletBC(W.sub(2), sim.cold_wall_temperature, 2)]

Expand All @@ -90,22 +88,22 @@ def initial_values(sim):

sim.prandtl_number = sim.prandtl_number.assign(Pr)

dim = sim.mesh.geometric_dimension()
w = fe.Function(sim.function_space)

p, u, T = w.split()

p.assign(0.)

ihat, jhat = sim.unit_vectors()

T_c = sim.cold_wall_temperature.__float__()
u.assign(0.*ihat + 0.*jhat)

w = fe.interpolate(
fe.Expression(
(0.,) + (0.,)*dim + (T_c,),
element = sim.element),
sim.function_space)
T.assign(sim.cold_wall_temperature)

F = heat_driven_cavity_variational_form_residual(
sim = sim,
solution = w)*fe.dx(degree = sim.quadrature_degree)

T_h = sim.hot_wall_temperature.__float__()

problem = fe.NonlinearVariationalProblem(
F = F,
u = w,
Expand Down Expand Up @@ -158,25 +156,17 @@ def variational_form_residual(sim, solution):

class Simulation(sapphire.simulations.convection_coupled_phasechange.Simulation):

def __init__(self, *args, spatial_dimensions, meshsize, **kwargs):
def __init__(self, *args, meshsize, **kwargs):

self.reference_temperature_range__degC = fe.Constant(10.)

self.hot_wall_temperature = fe.Constant(1.)

self.cold_wall_temperature = fe.Constant(0.)

if spatial_dimensions == 2:

Mesh = fe.UnitSquareMesh

elif spatial_dimensions == 3:

Mesh = fe.UnitCubeMesh

super().__init__(
*args,
mesh = Mesh(*(meshsize,)*spatial_dimensions),
mesh = fe.UnitSquareMesh(meshsize, meshsize),
variational_form_residual = variational_form_residual,
initial_values = initial_values,
dirichlet_boundary_conditions = dirichlet_boundary_conditions,
Expand Down
22 changes: 15 additions & 7 deletions sapphire/benchmarks/melt_octadecane_in_cavity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

def initial_values(sim):

return fe.interpolate(
fe.Expression(
(0., 0., 0., sim.cold_wall_temperature.__float__()),
element = sim.element),
sim.function_space)


w = fe.Function(sim.function_space)

p, u, T = w.split()

p.assign(0.)

ihat, jhat = sim.unit_vectors()

u.assign(0.*ihat + 0.*jhat)

T.assign(sim.cold_wall_temperature)

return w


def dirichlet_boundary_conditions(sim):

W = sim.function_space
Expand Down
Empty file.
186 changes: 0 additions & 186 deletions sapphire/postprocessing/vtk.py

This file was deleted.

4 changes: 4 additions & 0 deletions sapphire/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ def assign_parameters(self, parameters):

return self

def unit_vectors(self):

return unit_vectors(self.mesh)


def unit_vectors(mesh):

Expand Down
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

setuptools.setup(
name = 'sapphire',
version = '0.4.3a0',
version = '0.4.4a0',
packages = setuptools.find_packages(),
install_requires = [
'matplotlib',
'numpy',
'scipy',
'vtk']
)
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test__validate__melt_octadecane__regression():
assert(abs(sim.liquid_area - expected_liquid_area) < tolerance)


def freeze_water(endtime, s, tau, rx, nx, rt, nt, q, dim = 2, outdir = ""):
def freeze_water(endtime, s, tau, rx, nx, rt, nt, q, outdir = ""):

mu_l__SI = 8.90e-4 # [Pa s]

Expand All @@ -97,11 +97,9 @@ def freeze_water(endtime, s, tau, rx, nx, rt, nt, q, dim = 2, outdir = ""):
quadrature_degree = q,
element_degree = rx - 1,
time_stencil_size = rt + 1,
spatial_dimensions = dim,
meshsize = nx,
output_directory_path = str(outdir.join(
"freeze_water/"
+ "dim{0}/".format(dim)
+ "s{0}_tau{1}/".format(s, tau)
+ "rx{0}_nx{1}_rt{2}_nt{3}/".format(rx, nx, rt, nt)
+ "q{0}/".format(q))))
Expand Down
Loading

0 comments on commit 99569f1

Please sign in to comment.