Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing framework #91

Merged
merged 3 commits into from
Nov 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
language: python
python:
- 2.7
env:
- BUILD_TYPE="Release"

before_install:
- sudo apt-get update
- sudo apt-get install gfortran liblapack-dev
# Print NumPy version that is already installed by Travis CI:
- python -c "import numpy; print numpy.__version__"
- git clone --branch=master --depth=100 --quiet git://github.com/clawpack/clawpack
- cd clawpack
- python setup.py symlink-only
- rm -rf clawutil
- ln -s ../ clawutil

install:
- export PYTHONPATH=${PWD}:$PYTHONPATH
- export CLAW=${PWD}
- export FC=gfortran
- cd clawutil

before_script:
# Print CPU info for debugging purposes:
- cat /proc/cpuinfo
- gfortran -v
- /usr/bin/f95 -v
- echo "PYTHONPATH="$PYTHONPATH
- echo "CLAW="$CLAW
- echo "FC="$FC

script:
- cd $CLAW/clawutil
- nosetests -sv

after_failure:
- for failed_test_path in *_output ; do cat $failed_test_path/run_output.txt ; cat $failed_test_path/error_output.txt ; done

notifications:
email: false
142 changes: 142 additions & 0 deletions dev/advection_3d_swirl/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@

# Makefile for Clawpack code in this directory.
# This version only sets the local files and frequently changed
# options, and then includes the standard makefile pointed to by CLAWMAKE.
CLAWMAKE = $(CLAW)/clawutil/src/Makefile.common

# See the above file for details and a list of make options, or type
# make .help
# at the unix prompt.


# Adjust these variables if desired:
# ----------------------------------

CLAW_PKG = amrclaw # Clawpack package to use
EXE = xamr # Executable to create
SETRUN_FILE = setrun.py # File containing function to make data
OUTDIR = _output # Directory for output
SETPLOT_FILE = setplot.py # File containing function to set plots
PLOTDIR = _plots # Directory for plots

OVERWRITE ?= True # False ==> make a copy of OUTDIR first
RESTART ?= False # Should = clawdata.restart in setrun

# Environment variable FC should be set to fortran compiler, e.g. gfortran

# Compiler flags can be specified here or set as an environment variable
FFLAGS ?=

# ---------------------------------
# List of sources for this program:
# ---------------------------------

AMRLIB = $(CLAW)/amrclaw/src/3d

MODULES = \
$(AMRLIB)/amr_module.f90 \
$(AMRLIB)/gauges_module.f90
#$(AMRLIB)/regions_module.f90 \

SOURCES = \
qinit.f \
setaux.f \
$(CLAW)/riemann/src/rpn3_vc_advection.f90 \
$(CLAW)/riemann/src/rpt3_vc_advection.f90 \
$(CLAW)/riemann/src/rptt3_vc_advection.f90 \
$(AMRLIB)/amr3.f90 \
$(AMRLIB)/setprob.f90 \
$(AMRLIB)/bc3amr.f \
$(AMRLIB)/opendatafile.f \
$(AMRLIB)/b4step3.f90 \
$(AMRLIB)/qad.f \
$(AMRLIB)/src3.f90 \
$(AMRLIB)/src1d.f90 \
$(AMRLIB)/advanc.f \
$(AMRLIB)/bound.f \
$(AMRLIB)/stepgrid.f \
$(AMRLIB)/stepgrid_dimSplit.f \
$(AMRLIB)/auxcoarsen.f \
$(AMRLIB)/fixcapaq.f \
$(AMRLIB)/estdt.f \
$(AMRLIB)/igetsp.f \
$(AMRLIB)/reclam.f \
$(AMRLIB)/birect.f \
$(AMRLIB)/cleanup.f \
$(AMRLIB)/colate.f \
$(AMRLIB)/errest.f \
$(AMRLIB)/flag2refine.f \
$(AMRLIB)/allowflag.f \
$(AMRLIB)/bufnst.f \
$(AMRLIB)/spest.f \
$(AMRLIB)/errf1.f \
$(AMRLIB)/gfixup.f \
$(AMRLIB)/filval.f \
$(AMRLIB)/filpatch.f \
$(AMRLIB)/prefilp.f \
$(AMRLIB)/flglvl.f \
$(AMRLIB)/fluxad.f \
$(AMRLIB)/fluxsv.f \
$(AMRLIB)/ginit.f \
$(AMRLIB)/grdfit.f \
$(AMRLIB)/intfil.f \
$(AMRLIB)/moment.f \
$(AMRLIB)/nestck.f \
$(AMRLIB)/prepc.f \
$(AMRLIB)/prepf.f \
$(AMRLIB)/projec.f \
$(AMRLIB)/signs.f \
$(AMRLIB)/findcut.f \
$(AMRLIB)/smartbis.f \
$(AMRLIB)/putnod.f \
$(AMRLIB)/putsp.f \
$(AMRLIB)/regrid.f \
$(AMRLIB)/setgrd.f \
$(AMRLIB)/setuse.f \
$(AMRLIB)/stst1.f \
$(AMRLIB)/tick.f \
$(AMRLIB)/trimbd.f \
$(AMRLIB)/update.f \
$(AMRLIB)/nodget.f \
$(AMRLIB)/upbnd.f \
$(AMRLIB)/basic.f \
$(AMRLIB)/outval.f \
$(AMRLIB)/copysol.f \
$(AMRLIB)/outvar.f \
$(AMRLIB)/outmsh.f \
$(AMRLIB)/outtre.f \
$(AMRLIB)/domain.f \
$(AMRLIB)/setflags.f \
$(AMRLIB)/shiftset.f \
$(AMRLIB)/conck.f \
$(AMRLIB)/domshrink.f \
$(AMRLIB)/domprep.f \
$(AMRLIB)/domup.f \
$(AMRLIB)/domcopy.f \
$(AMRLIB)/coarsen.f \
$(AMRLIB)/intcopy.f \
$(AMRLIB)/preintcopy.f \
$(AMRLIB)/icall.f \
$(AMRLIB)/preicall.f \
$(AMRLIB)/step3.f \
$(AMRLIB)/step3x.f \
$(AMRLIB)/step3y.f \
$(AMRLIB)/step3z.f \
$(AMRLIB)/flux3.f \
$(AMRLIB)/flux3_dimSplit.f \
$(AMRLIB)/limiter.f \
$(AMRLIB)/philim.f \
$(AMRLIB)/cstore.f \
$(AMRLIB)/saveqc.f \
$(AMRLIB)/valout.f \
$(AMRLIB)/check.f \
$(AMRLIB)/restrt.f \
$(AMRLIB)/quick_sort1.f \
$(AMRLIB)/init_alloc.f90 \
$(AMRLIB)/resize_alloc.f90 \
$(AMRLIB)/restrt_alloc.f90

#-------------------------------------------------------------------
# Include Makefile containing standard definitions and make options:
include $(CLAWMAKE)

42 changes: 42 additions & 0 deletions dev/advection_3d_swirl/qinit.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
c
c
c
c =====================================================
subroutine qinit(meqn,mbc,mx,my,mz, xlower,ylower,zlower,
& dx,dy,dz,q,maux,aux)
c =====================================================
c
c # Set initial conditions for q.
c
implicit double precision (a-h,o-z)
c
dimension q(meqn,1-mbc:mx+mbc,1-mbc:my+mbc,1-mbc:mz+mbc)
dimension x(1-mbc:mx+mbc)
dimension aux(maux,1-mbc:mx+mbc, 1-mbc:my+mbc,1-mbc:mz+mbc)
c
c # set concentration profile
c ---------------------------
c

do i = 1-mbc,mx+mbc
x(i) = xlower + (i-0.5d0)*dx
enddo

do i = 1,mx
if (x(i) .lt. 0.5d0) then
do j = 1,my
do k = 1,mz
q(1,i,j,k) = 1.d0
enddo
enddo
else
do j = 1,my
do k = 1,mz
q(1,i,j,k) = 0.d0
enddo
enddo
endif
enddo

return
end
1 change: 1 addition & 0 deletions dev/advection_3d_swirl/regression_data_test2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.200000000000000000e+04
1 change: 1 addition & 0 deletions dev/advection_3d_swirl/regression_data_test3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.199999999999999636e+04
40 changes: 40 additions & 0 deletions dev/advection_3d_swirl/regression_data_test_gauge.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
1.000000000000000000e+00 2.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00
1.000000000000000000e+00 2.000000000000000000e+00 5.000000000000000104e-03 0.000000000000000000e+00
1.000000000000000000e+00 2.000000000000000000e+00 1.000000000000000021e-02 0.000000000000000000e+00
1.000000000000000000e+00 2.000000000000000000e+00 1.563368000000000049e-02 0.000000000000000000e+00
1.000000000000000000e+00 2.000000000000000000e+00 2.126737000000000072e-02 1.477252999999999932e-04
1.000000000000000000e+00 2.000000000000000000e+00 2.690104999999999927e-02 1.097038000000000050e-03
1.000000000000000000e+00 2.000000000000000000e+00 3.253472999999999782e-02 5.117519000000000061e-03
1.000000000000000000e+00 2.000000000000000000e+00 3.816842000000000151e-02 1.819296000000000108e-02
1.000000000000000000e+00 2.000000000000000000e+00 4.380209999999999659e-02 5.317273000000000138e-02
1.000000000000000000e+00 2.000000000000000000e+00 4.690104999999999968e-02 8.468288000000000204e-02
1.000000000000000000e+00 2.000000000000000000e+00 5.000000000000000278e-02 1.251821999999999935e-01
1.000000000000000000e+00 2.000000000000000000e+00 5.563367999999999786e-02 2.195988000000000107e-01
1.000000000000000000e+00 2.000000000000000000e+00 6.126737000000000155e-02 3.377436999999999800e-01
1.000000000000000000e+00 2.000000000000000000e+00 6.690105000000000357e-02 4.686629999999999963e-01
1.000000000000000000e+00 2.000000000000000000e+00 7.253473000000000559e-02 5.979729000000000294e-01
1.000000000000000000e+00 2.000000000000000000e+00 7.816842000000000235e-02 7.136303000000000507e-01
1.000000000000000000e+00 2.000000000000000000e+00 8.380210000000000437e-02 8.084964000000000039e-01
1.000000000000000000e+00 2.000000000000000000e+00 8.943578000000000638e-02 8.802767000000000230e-01
1.000000000000000000e+00 2.000000000000000000e+00 9.506947000000000314e-02 9.299880999999999842e-01
1.000000000000000000e+00 2.000000000000000000e+00 9.753473000000000004e-02 9.456459000000000392e-01
2.000000000000000000e+00 2.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00
2.000000000000000000e+00 2.000000000000000000e+00 5.000000000000000104e-03 1.000000000000000000e+00
2.000000000000000000e+00 2.000000000000000000e+00 1.000000000000000021e-02 1.000000000000000000e+00
2.000000000000000000e+00 2.000000000000000000e+00 1.563368000000000049e-02 1.000000000000000000e+00
2.000000000000000000e+00 2.000000000000000000e+00 2.126737000000000072e-02 9.998523000000000271e-01
2.000000000000000000e+00 2.000000000000000000e+00 2.690104999999999927e-02 9.989029999999999854e-01
2.000000000000000000e+00 2.000000000000000000e+00 3.253472999999999782e-02 9.948825000000000029e-01
2.000000000000000000e+00 2.000000000000000000e+00 3.816842000000000151e-02 9.818069999999999853e-01
2.000000000000000000e+00 2.000000000000000000e+00 4.380209999999999659e-02 9.468273000000000383e-01
2.000000000000000000e+00 2.000000000000000000e+00 4.690104999999999968e-02 9.153170999999999946e-01
2.000000000000000000e+00 2.000000000000000000e+00 5.000000000000000278e-02 8.748177999999999788e-01
2.000000000000000000e+00 2.000000000000000000e+00 5.563367999999999786e-02 7.804012000000000171e-01
2.000000000000000000e+00 2.000000000000000000e+00 6.126737000000000155e-02 6.622563000000000200e-01
2.000000000000000000e+00 2.000000000000000000e+00 6.690105000000000357e-02 5.313369999999999482e-01
2.000000000000000000e+00 2.000000000000000000e+00 7.253473000000000559e-02 4.020271000000000261e-01
2.000000000000000000e+00 2.000000000000000000e+00 7.816842000000000235e-02 2.863697000000000048e-01
2.000000000000000000e+00 2.000000000000000000e+00 8.380210000000000437e-02 1.915035999999999961e-01
2.000000000000000000e+00 2.000000000000000000e+00 8.943578000000000638e-02 1.197233000000000047e-01
2.000000000000000000e+00 2.000000000000000000e+00 9.506947000000000314e-02 7.001185000000000047e-02
2.000000000000000000e+00 2.000000000000000000e+00 9.753473000000000004e-02 5.435409000000000074e-02
47 changes: 47 additions & 0 deletions dev/advection_3d_swirl/regression_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""
Regression tests for swril 3D advection.
"""

import sys
import unittest

import clawpack.amrclaw.test as test


class Advection3DSwirlTest(test.AMRClawRegressionTest):
r"""Basic test for a 3D advection test case"""


def runTest(self, save=False):

# Write out data files
self.load_rundata()
self.write_rundata_objects()

# Run code
self.run_code()

# Perform tests
self.check_frame(save=save, frame_num=1,
regression_data_path="regression_data_test2.txt")
self.check_frame(save=save, frame_num=2,
regression_data_path="regression_data_test3.txt")
self.check_gauges(save=save,
regression_data_path='regression_data_test_gauge.txt')

self.success = True



if __name__=="__main__":
if len(sys.argv) > 1:
if bool(sys.argv[1]):
# Fake the setup and save out output
test = Advection3DSwirlTest()
try:
test.setUp()
test.runTest(save=True)
finally:
test.tearDown()
sys.exit(0)
unittest.main()
Loading