From 158048aecb8fc5ccb202d8dc46f02d6724b3318c Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Wed, 5 Feb 2025 15:22:01 -0500 Subject: [PATCH 01/11] Remove old travis yaml --- .travis.yml | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 227d3ff..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: python -python: - - 3.6.10 -env: - - BUILD_TYPE="Release" - -before_install: - - sudo apt-get update - - sudo apt-get install gfortran - # 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 - - git submodule init - - git submodule update - - rm -rf classic - - ln -s ../ classic - -install: - - export PYTHONPATH=${PWD}:$PYTHONPATH - - export CLAW=${PWD} - - export FC=gfortran - - cd classic - -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/classic/ - - 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 From e78690d181458fa10d649342f0883d91d83c42f4 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Wed, 5 Feb 2025 15:22:32 -0500 Subject: [PATCH 02/11] Add test badge to README --- README.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 7b7c273..de65352 100644 --- a/README.txt +++ b/README.txt @@ -1 +1,7 @@ -This repository will host the classic single-grid Clawpack code. +# Classic Clawpack + +This package hosts the original version of the single-grid Clawpack code. + +![Tests](https://github.com/clawpack/classic/actions/workflows/testing.yml/badge.svg) + +- [Documentation](https://www.clawpack.org) \ No newline at end of file From 45275496607a6fbd1c156fdbfc98506580d87708 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Wed, 5 Feb 2025 15:25:59 -0500 Subject: [PATCH 03/11] Fix path error with flake run --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 01844d0..40c2489 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -43,7 +43,7 @@ jobs: - name: Lint with flake8 run: | - cd ${CLAW}/geoclaw + cd ${CLAW}/classic # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide From a3e595ccd538275dc7c0fd2655e9936a58088782 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Wed, 5 Feb 2025 15:29:07 -0500 Subject: [PATCH 04/11] Remove unused afterframe python files --- examples/advection_2d_annulus/afterframe.py | 3 --- tests/advection_2d_annulus/afterframe.py | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 examples/advection_2d_annulus/afterframe.py delete mode 100644 tests/advection_2d_annulus/afterframe.py diff --git a/examples/advection_2d_annulus/afterframe.py b/examples/advection_2d_annulus/afterframe.py deleted file mode 100644 index 4f43e52..0000000 --- a/examples/advection_2d_annulus/afterframe.py +++ /dev/null @@ -1,3 +0,0 @@ -axis('equal') -axis([-1.1,1.1,-1.1,1.1]) - diff --git a/tests/advection_2d_annulus/afterframe.py b/tests/advection_2d_annulus/afterframe.py deleted file mode 100644 index 4f43e52..0000000 --- a/tests/advection_2d_annulus/afterframe.py +++ /dev/null @@ -1,3 +0,0 @@ -axis('equal') -axis([-1.1,1.1,-1.1,1.1]) - From cbf45875675cb2d34f867a515861e6ac968e13ac Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Wed, 5 Feb 2025 16:34:51 -0500 Subject: [PATCH 05/11] Modify clawpack python installation --- .github/workflows/testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 40c2489..8fd6dde 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -39,7 +39,8 @@ jobs: path: classic - name: Install clawpack run: | - pip install --user -e $CLAW + pip install --no-build-isolation --editable $CLAW + # pip install --user -e $CLAW - name: Lint with flake8 run: | From ccd562316c2844b032a079386351d2643336277c Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Thu, 6 Feb 2025 11:18:50 -0500 Subject: [PATCH 06/11] Remove __future__ import --- src/python/classic/test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python/classic/test.py b/src/python/classic/test.py index 3d0b2b6..21bbae1 100644 --- a/src/python/classic/test.py +++ b/src/python/classic/test.py @@ -6,7 +6,6 @@ results and looking for errors. """ -from __future__ import absolute_import import os import glob From c68db1cafb8e82dafb0834a76655f89b8285819f Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Thu, 6 Feb 2025 11:48:41 -0500 Subject: [PATCH 07/11] Move and rename acoustics 1d test into examples directory --- .../regression_data/claw_git_diffs.txt | 0 .../regression_data/claw_git_status.txt | 0 .../regression_data/regression_data_test2.txt | 0 .../regression_data/regression_data_test3.txt | 0 tests/acoustics_1d_heterogeneous/Makefile | 60 ----- tests/acoustics_1d_heterogeneous/README.rst | 12 - tests/acoustics_1d_heterogeneous/__init__.py | 0 tests/acoustics_1d_heterogeneous/qinit.f | 65 ----- .../regression_test.py | 45 ---- tests/acoustics_1d_heterogeneous/setaux.f | 38 --- tests/acoustics_1d_heterogeneous/setplot.py | 39 --- tests/acoustics_1d_heterogeneous/setprob.f | 35 --- tests/acoustics_1d_heterogeneous/setrun.py | 229 ------------------ 13 files changed, 523 deletions(-) rename {tests => examples}/acoustics_1d_heterogeneous/regression_data/claw_git_diffs.txt (100%) rename {tests => examples}/acoustics_1d_heterogeneous/regression_data/claw_git_status.txt (100%) rename {tests => examples}/acoustics_1d_heterogeneous/regression_data/regression_data_test2.txt (100%) rename {tests => examples}/acoustics_1d_heterogeneous/regression_data/regression_data_test3.txt (100%) delete mode 100644 tests/acoustics_1d_heterogeneous/Makefile delete mode 100644 tests/acoustics_1d_heterogeneous/README.rst delete mode 100644 tests/acoustics_1d_heterogeneous/__init__.py delete mode 100644 tests/acoustics_1d_heterogeneous/qinit.f delete mode 100644 tests/acoustics_1d_heterogeneous/regression_test.py delete mode 100644 tests/acoustics_1d_heterogeneous/setaux.f delete mode 100644 tests/acoustics_1d_heterogeneous/setplot.py delete mode 100644 tests/acoustics_1d_heterogeneous/setprob.f delete mode 100644 tests/acoustics_1d_heterogeneous/setrun.py diff --git a/tests/acoustics_1d_heterogeneous/regression_data/claw_git_diffs.txt b/examples/acoustics_1d_heterogeneous/regression_data/claw_git_diffs.txt similarity index 100% rename from tests/acoustics_1d_heterogeneous/regression_data/claw_git_diffs.txt rename to examples/acoustics_1d_heterogeneous/regression_data/claw_git_diffs.txt diff --git a/tests/acoustics_1d_heterogeneous/regression_data/claw_git_status.txt b/examples/acoustics_1d_heterogeneous/regression_data/claw_git_status.txt similarity index 100% rename from tests/acoustics_1d_heterogeneous/regression_data/claw_git_status.txt rename to examples/acoustics_1d_heterogeneous/regression_data/claw_git_status.txt diff --git a/tests/acoustics_1d_heterogeneous/regression_data/regression_data_test2.txt b/examples/acoustics_1d_heterogeneous/regression_data/regression_data_test2.txt similarity index 100% rename from tests/acoustics_1d_heterogeneous/regression_data/regression_data_test2.txt rename to examples/acoustics_1d_heterogeneous/regression_data/regression_data_test2.txt diff --git a/tests/acoustics_1d_heterogeneous/regression_data/regression_data_test3.txt b/examples/acoustics_1d_heterogeneous/regression_data/regression_data_test3.txt similarity index 100% rename from tests/acoustics_1d_heterogeneous/regression_data/regression_data_test3.txt rename to examples/acoustics_1d_heterogeneous/regression_data/regression_data_test3.txt diff --git a/tests/acoustics_1d_heterogeneous/Makefile b/tests/acoustics_1d_heterogeneous/Makefile deleted file mode 100644 index f3f2989..0000000 --- a/tests/acoustics_1d_heterogeneous/Makefile +++ /dev/null @@ -1,60 +0,0 @@ - -# 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 = classic # Clawpack package to use -EXE = xclaw # 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 ?= - -# --------------------------------- -# package sources for this program: -# --------------------------------- - -include $(CLAW)/classic/src/1d/Makefile.classic_1d - -# --------------------------------------- -# package sources specifically to exclude -# (i.e. if a custom replacement source -# under a different name is provided) -# --------------------------------------- - -EXCLUDE_MODULES = \ - -EXCLUDE_SOURCES = \ - -# ---------------------------------------- -# List of custom sources for this program: -# ---------------------------------------- -MODULES = \ - -SOURCES = \ - qinit.f \ - setprob.f \ - setaux.f \ - $(CLAW)/riemann/src/rp1_acoustics_variable.f90 \ - -#------------------------------------------------------------------- -# Include Makefile containing standard definitions and make options: -include $(CLAWMAKE) - diff --git a/tests/acoustics_1d_heterogeneous/README.rst b/tests/acoustics_1d_heterogeneous/README.rst deleted file mode 100644 index 2fee8ff..0000000 --- a/tests/acoustics_1d_heterogeneous/README.rst +++ /dev/null @@ -1,12 +0,0 @@ - -.. _classic_tests_acoustics_1d_heterogeneous: - -Acoustics 1D Example 1 ------------------------------------------- - -1D acoustics in a piecewise constant medium to illustrate reflection and -transmission at an interface. - -Quick regression test version: regression_tests.py - -* Checks sum of p values and of u values for two frames. diff --git a/tests/acoustics_1d_heterogeneous/__init__.py b/tests/acoustics_1d_heterogeneous/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/acoustics_1d_heterogeneous/qinit.f b/tests/acoustics_1d_heterogeneous/qinit.f deleted file mode 100644 index 6e57528..0000000 --- a/tests/acoustics_1d_heterogeneous/qinit.f +++ /dev/null @@ -1,65 +0,0 @@ -c -c -c========================================================= - subroutine qinit(meqn,mbc,mx,xlower,dx,q,maux,aux) -c========================================================= -c -c # Set initial conditions for q. -c # Pulse in pressure, zero velocity -c -c - implicit none - - integer, intent(in) :: meqn, mbc, mx, maux - double precision, intent(in) :: xlower, dx, aux - double precision, intent(out) :: q - dimension q(meqn, 1-mbc:mx+mbc) - dimension aux(maux, 1-mbc:mx+mbc) - - common /cqinit/ beta,ic - double precision beta - integer ic - - integer i - double precision xcell -c -c - do 150 i=1,mx - xcell = xlower + (i-0.5d0)*dx - - go to (10,20,30) ic - - 10 continue -c # half ellipse: - if (xcell.gt.-4d0 .and. xcell.lt.-2d0) then - q(1,i) = dsqrt(1.d0 - (xcell+3.d0)**2) - else - q(1,i) = 0.d0 - endif - q(2,i) = q(1,i) - go to 150 - - 20 continue -c # single discontinuity: - if (xcell .lt. -2.d0) then - q(1,i) = 1.d0 - else - q(1,i) = 0.d0 - endif - q(2,i) = q(1,i) - go to 150 - - 30 continue -c # Gaussian and square pulse: - q(1,i) = dexp(-beta*(xcell+2.0d0)**2) - if (dabs(q(1,i)) .lt. 1d-30) q(1,i) = 0.d0 - if (xcell.gt.-4.d0 .and. xcell.lt.-3.d0) then - q(1,i) = q(1,i) + 0.5d0 - endif - q(2,i) = q(1,i) - go to 150 - - 150 continue -c - return - end diff --git a/tests/acoustics_1d_heterogeneous/regression_test.py b/tests/acoustics_1d_heterogeneous/regression_test.py deleted file mode 100644 index 1cc2380..0000000 --- a/tests/acoustics_1d_heterogeneous/regression_test.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Regression tests for a 1D heterogeneous acoustics test -""" - -from __future__ import absolute_import -import sys -import unittest - -import clawpack.classic.test as test - - -class Acoustics1DHeterogeneousTest(test.ClassicRegressionTest): - r"""Basic test for an 1D heterogeneous acoustics 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(indices=[0, 1], save=save, frame_num=1, - file_name='regression_data_test2.txt') - self.check_frame(indices=[0, 1], save=save, frame_num=2, - file_name='regression_data_test3.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 = Acoustics1DHeterogeneousTest() - try: - test.setUp() - test.runTest(save=True) - finally: - test.tearDown() - sys.exit(0) - unittest.main() \ No newline at end of file diff --git a/tests/acoustics_1d_heterogeneous/setaux.f b/tests/acoustics_1d_heterogeneous/setaux.f deleted file mode 100644 index dde66d6..0000000 --- a/tests/acoustics_1d_heterogeneous/setaux.f +++ /dev/null @@ -1,38 +0,0 @@ -c ============================================ - subroutine setaux(mbc,mx,xlower,dx,maux,aux) -c ============================================ -c -c # set auxiliary arrays -c # variable coefficient acoustics -c # aux(i,1) = impedance Z in i'th cell -c # aux(i,2) = sound speed c in i'th cell -c -c # Piecewise constant medium with single interface at x=0 -c # Density and sound speed to left and right are set in setprob.f -c - implicit none - - integer, intent(in) :: mbc, mx, maux - double precision, intent(in) :: xlower, dx - double precision, intent(out) :: aux - dimension aux(maux, 1-mbc:mx+mbc) - - common /comaux/ Zl, cl, Zr, cr - double precision Zl, cl, Zr, cr - - integer i - double precision xcell - - do i=1-mbc,mx+mbc - xcell = xlower + (i-0.5d0)*dx - if (xcell .lt. 0.0d0) then - aux(1,i) = Zl - aux(2,i) = cl - else - aux(1,i) = Zr - aux(2,i) = cr - endif - enddo - - return - end diff --git a/tests/acoustics_1d_heterogeneous/setplot.py b/tests/acoustics_1d_heterogeneous/setplot.py deleted file mode 100644 index bc630f7..0000000 --- a/tests/acoustics_1d_heterogeneous/setplot.py +++ /dev/null @@ -1,39 +0,0 @@ -from __future__ import absolute_import -def setplot(plotdata): - plotdata.clearfigures() - - # Figures corresponding to Figure 9.5 of LeVeque, "Finite Volume - # Methods for Hyperbolic Problems," 2002 (though more of them) - - # Tuples of (variable name, variable number) - figdata = [('Pressure', 0), - ('Velocity', 1)] - - # Afteraxes function: draw a vertical dashed line at the interface - # between different media - def draw_interface(current_data): - import pylab - pylab.plot([0., 0.], [-1000., 1000.], 'k--') - - for varname, varid in figdata: - plotfigure = plotdata.new_plotfigure(name=varname, figno=varid) - - plotaxes = plotfigure.new_plotaxes() - plotaxes.xlimits = [-5., 5.] - plotaxes.ylimits = [-0.5, 1.5] # Good for both vars because of near-unit impedance - plotaxes.title = varname - plotaxes.afteraxes = draw_interface - - plotitem = plotaxes.new_plotitem(plot_type='1d_plot') - plotitem.plot_var = varid - plotitem.color = 'b' - - plotdata.printfigs = True # Whether to output figures - plotdata.print_format = 'png' # What type of output format - plotdata.print_framenos = 'all' # Which frames to output - plotdata.print_fignos = 'all' # Which figures to print - plotdata.html = True # Whether to create HTML files - plotdata.latex = False # Whether to make LaTeX output - - return plotdata - diff --git a/tests/acoustics_1d_heterogeneous/setprob.f b/tests/acoustics_1d_heterogeneous/setprob.f deleted file mode 100644 index 31e9fc0..0000000 --- a/tests/acoustics_1d_heterogeneous/setprob.f +++ /dev/null @@ -1,35 +0,0 @@ - subroutine setprob - - implicit none - - common /cqinit/ beta,ic - integer ic - double precision beta - - common /comaux/ Zl, cl, Zr, cr - double precision rhol, Zl, cl, rhor, Zr, cr -c -c # Set the material parameters for the acoustic equations -c - character*25 fname - - fname = 'setprob.data' - call opendatafile(7, fname) - -c # choice of initial data: - read(7,*) ic -c # beta for initial conditions: - read(7,*) beta -c -c # Piecewise constant medium with single interface at x=0 -c # Density and sound speed to left and right: - read(7,*) rhol - read(7,*) cl - Zl = rhol*cl - - read(7,*) rhor - read(7,*) cr - Zr = rhor*cr - - return - end diff --git a/tests/acoustics_1d_heterogeneous/setrun.py b/tests/acoustics_1d_heterogeneous/setrun.py deleted file mode 100644 index 59c5ceb..0000000 --- a/tests/acoustics_1d_heterogeneous/setrun.py +++ /dev/null @@ -1,229 +0,0 @@ -""" -Module to set up run time parameters for Clawpack -- classic code. - -The values set in the function setrun are then written out to data files -that will be read in by the Fortran code. - -""" - -from __future__ import absolute_import -import os -import numpy as np - -#------------------------------ -def setrun(claw_pkg='classic'): -#------------------------------ - - """ - Define the parameters used for running Clawpack. - - INPUT: - claw_pkg expected to be "classic" for this setrun. - - OUTPUT: - rundata - object of class ClawRunData - - """ - - from clawpack.clawutil import data - - - assert claw_pkg.lower() == 'classic', "Expected claw_pkg = 'classic'" - - num_dim = 1 - rundata = data.ClawRunData(claw_pkg, num_dim) - - #------------------------------------------------------------------ - # Problem-specific parameters to be written to setprob.data: - #------------------------------------------------------------------ - # Sample setup to write one line to setprob.data ... - probdata = rundata.new_UserData(name='probdata',fname='setprob.data') - probdata.add_param('ic', 1, 'Initial condition type') - probdata.add_param('beta', 5., 'Gaussian hump width parameter') - probdata.add_param('rhol', 1., 'Density left of interface') - probdata.add_param('cl', 1., 'Sound speed left of interface') - probdata.add_param('rhor', 4., 'Density right of interface') - probdata.add_param('cr', 0.5, 'Sound speed right of interface') - - #------------------------------------------------------------------ - # Standard Clawpack parameters to be written to claw.data: - #------------------------------------------------------------------ - - clawdata = rundata.clawdata # initialized when rundata instantiated - - - # --------------- - # Spatial domain: - # --------------- - - # Number of space dimensions: - clawdata.num_dim = num_dim - - # Lower and upper edge of computational domain: - clawdata.lower[0] = -5. # xlower - clawdata.upper[0] = 5. # xupper - - # Number of grid cells: - clawdata.num_cells[0] = 500 # mx - - - # --------------- - # Size of system: - # --------------- - - # Number of equations in the system: - clawdata.num_eqn = 2 - - # Number of auxiliary variables in the aux array (initialized in setaux) - clawdata.num_aux = 2 - - # Index of aux array corresponding to capacity function, if there is one: - clawdata.capa_index = 0 - - - # ------------- - # Initial time: - # ------------- - - clawdata.t0 = 0. - - - # Restart from checkpoint file of a previous run? - # Note: If restarting, you must also change the Makefile to set: - # RESTART = True - # If restarting, t0 above should be from original run, and the - # restart_file 'fort.qNNNN' specified below should be in - # the OUTDIR indicated in Makefile. - - clawdata.restart = False # True to restart from prior results - clawdata.restart_file = 'fort.q0006' # File to use for restart data - - - # ------------- - # Output times: - #-------------- - - # Specify at what times the results should be written to fort.q files. - # Note that the time integration stops after the final output time. - - clawdata.output_style = 1 - - if clawdata.output_style==1: - # Output ntimes frames at equally spaced times up to tfinal: - # Can specify num_output_times = 0 for no output - clawdata.num_output_times = 2 - clawdata.tfinal = 5. - clawdata.output_t0 = False # output at initial (or restart) time? - - elif clawdata.output_style == 2: - # Specify a list or numpy array of output times: - # Include t0 if you want output at the initial time. - clawdata.output_times = [0., 0.1] - - elif clawdata.output_style == 3: - # Output every step_interval timesteps over total_steps timesteps: - clawdata.output_step_interval = 2 - clawdata.total_steps = 4 - clawdata.output_t0 = True # output at initial (or restart) time? - - - clawdata.output_format = 'ascii' # 'ascii', 'binary', 'netcdf' - - clawdata.output_q_components = 'all' # could be list such as [True,True] - clawdata.output_aux_components = 'none' # could be list - clawdata.output_aux_onlyonce = True # output aux arrays only at t0 - - - # --------------------------------------------------- - # Verbosity of messages to screen during integration: - # --------------------------------------------------- - - # The current t, dt, and cfl will be printed every time step - # at AMR levels <= verbosity. Set verbosity = 0 for no printing. - # (E.g. verbosity == 2 means print only on levels 1 and 2.) - clawdata.verbosity = 0 - - - - # -------------- - # Time stepping: - # -------------- - - # if dt_variable==True: variable time steps used based on cfl_desired, - # if dt_variable==False: fixed time steps dt = dt_initial always used. - clawdata.dt_variable = True - - # Initial time step for variable dt. - # (If dt_variable==0 then dt=dt_initial for all steps) - clawdata.dt_initial = 1. - - # Max time step to be allowed if variable dt used: - clawdata.dt_max = 1.e9 - - # Desired Courant number if variable dt used - clawdata.cfl_desired = 0.9 - # max Courant number to allow without retaking step with a smaller dt: - clawdata.cfl_max = 1.0 - - # Maximum number of time steps to allow between output times: - clawdata.steps_max = 50000 - - - # ------------------ - # Method to be used: - # ------------------ - - # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters - clawdata.order = 2 - - - # Number of waves in the Riemann solution: - clawdata.num_waves = 2 - - # List of limiters to use for each wave family: - # Required: len(limiter) == num_waves - # Some options: - # 0 or 'none' ==> no limiter (Lax-Wendroff) - # 1 or 'minmod' ==> minmod - # 2 or 'superbee' ==> superbee - # 3 or 'vanleer' ==> van Leer - # 4 or 'mc' ==> MC limiter - clawdata.limiter = [4,4] - - clawdata.use_fwaves = False # True ==> use f-wave version of algorithms - - # Source terms splitting: - # src_split == 0 or 'none' ==> no source term (src routine never called) - # src_split == 1 or 'godunov' ==> Godunov (1st order) splitting used, - # src_split == 2 or 'strang' ==> Strang (2nd order) splitting used, not recommended. - clawdata.source_split = 'none' - - - # -------------------- - # Boundary conditions: - # -------------------- - - # Number of ghost cells (usually 2) - clawdata.num_ghost = 2 - - # Choice of BCs at xlower and xupper: - # 0 or 'user' => user specified (must modify bcNamr.f to use this option) - # 1 or 'extrap' => extrapolation (non-reflecting outflow) - # 2 or 'periodic' => periodic (must specify this at both boundaries) - # 3 or 'wall' => solid wall for systems where q(2) is normal velocity - - clawdata.bc_lower[0] = 'extrap' # at xlower - clawdata.bc_upper[0] = 'extrap' # at xupper - - return rundata - - # end of function setrun - # ---------------------- - - -if __name__ == '__main__': - # Set up run-time parameters and write all data files. - import sys - rundata = setrun(*sys.argv[1:]) - rundata.write() - From 465a6aad35933c496678fd0fef9bdac5de58585d Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Thu, 6 Feb 2025 20:49:52 -0500 Subject: [PATCH 08/11] Convert advection_2d_annulus to examples directory --- .../test_acoustics_1d_heterogeneous.py | 50 +++++++++++++++++++ .../regression_data/claw_git_diffs.txt | 0 .../regression_data/claw_git_status.txt | 0 .../old_regression_data_test2.txt | 0 .../old_regression_data_test3.txt | 0 .../regression_data/regression_data_test2.txt | 0 .../regression_data/regression_data_test3.txt | 0 .../test_advection_2d_annulus.py | 4 ++ 8 files changed, 54 insertions(+) create mode 100644 examples/acoustics_1d_heterogeneous/test_acoustics_1d_heterogeneous.py rename {tests => examples}/advection_2d_annulus/regression_data/claw_git_diffs.txt (100%) rename {tests => examples}/advection_2d_annulus/regression_data/claw_git_status.txt (100%) rename {tests => examples}/advection_2d_annulus/regression_data/old_regression_data_test2.txt (100%) rename {tests => examples}/advection_2d_annulus/regression_data/old_regression_data_test3.txt (100%) rename {tests => examples}/advection_2d_annulus/regression_data/regression_data_test2.txt (100%) rename {tests => examples}/advection_2d_annulus/regression_data/regression_data_test3.txt (100%) rename tests/advection_2d_annulus/regression_test.py => examples/advection_2d_annulus/test_advection_2d_annulus.py (91%) diff --git a/examples/acoustics_1d_heterogeneous/test_acoustics_1d_heterogeneous.py b/examples/acoustics_1d_heterogeneous/test_acoustics_1d_heterogeneous.py new file mode 100644 index 0000000..dd43352 --- /dev/null +++ b/examples/acoustics_1d_heterogeneous/test_acoustics_1d_heterogeneous.py @@ -0,0 +1,50 @@ +""" +Regression tests for a 1D heterogeneous acoustics test +""" + +from __future__ import absolute_import +import sys +import unittest + +import clawpack.classic.test as test + + +class Acoustics1DHeterogeneousTest(test.ClassicRegressionTest): + r"""Basic test for an 1D heterogeneous acoustics test case""" + + def runTest(self, save=False): + + # Write out data files + self.load_rundata() + + # Modify data for test run + self.rundata.clawdata.num_output_times = 2 + self.rundata.clawdata.tfinal = 5.0 + self.rundata.clawdata.output_t0 = False + self.write_rundata_objects() + + # Run code + self.run_code() + + # Perform tests + self.check_frame(indices=[0, 1], save=save, frame_num=1, + file_name='regression_data_test2.txt') + self.check_frame(indices=[0, 1], save=save, frame_num=2, + file_name='regression_data_test3.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 = Acoustics1DHeterogeneousTest() + try: + test.setUp() + test.runTest(save=True) + finally: + test.tearDown() + sys.exit(0) + unittest.main() \ No newline at end of file diff --git a/tests/advection_2d_annulus/regression_data/claw_git_diffs.txt b/examples/advection_2d_annulus/regression_data/claw_git_diffs.txt similarity index 100% rename from tests/advection_2d_annulus/regression_data/claw_git_diffs.txt rename to examples/advection_2d_annulus/regression_data/claw_git_diffs.txt diff --git a/tests/advection_2d_annulus/regression_data/claw_git_status.txt b/examples/advection_2d_annulus/regression_data/claw_git_status.txt similarity index 100% rename from tests/advection_2d_annulus/regression_data/claw_git_status.txt rename to examples/advection_2d_annulus/regression_data/claw_git_status.txt diff --git a/tests/advection_2d_annulus/regression_data/old_regression_data_test2.txt b/examples/advection_2d_annulus/regression_data/old_regression_data_test2.txt similarity index 100% rename from tests/advection_2d_annulus/regression_data/old_regression_data_test2.txt rename to examples/advection_2d_annulus/regression_data/old_regression_data_test2.txt diff --git a/tests/advection_2d_annulus/regression_data/old_regression_data_test3.txt b/examples/advection_2d_annulus/regression_data/old_regression_data_test3.txt similarity index 100% rename from tests/advection_2d_annulus/regression_data/old_regression_data_test3.txt rename to examples/advection_2d_annulus/regression_data/old_regression_data_test3.txt diff --git a/tests/advection_2d_annulus/regression_data/regression_data_test2.txt b/examples/advection_2d_annulus/regression_data/regression_data_test2.txt similarity index 100% rename from tests/advection_2d_annulus/regression_data/regression_data_test2.txt rename to examples/advection_2d_annulus/regression_data/regression_data_test2.txt diff --git a/tests/advection_2d_annulus/regression_data/regression_data_test3.txt b/examples/advection_2d_annulus/regression_data/regression_data_test3.txt similarity index 100% rename from tests/advection_2d_annulus/regression_data/regression_data_test3.txt rename to examples/advection_2d_annulus/regression_data/regression_data_test3.txt diff --git a/tests/advection_2d_annulus/regression_test.py b/examples/advection_2d_annulus/test_advection_2d_annulus.py similarity index 91% rename from tests/advection_2d_annulus/regression_test.py rename to examples/advection_2d_annulus/test_advection_2d_annulus.py index 1583a32..8edde85 100644 --- a/tests/advection_2d_annulus/regression_test.py +++ b/examples/advection_2d_annulus/test_advection_2d_annulus.py @@ -17,6 +17,10 @@ def runTest(self, save=False): # Write out data files self.load_rundata() + + self.rundata.clawdata.num_output_times = 2 + self.rundata.clawdata.tfinal = 0.5 + self.write_rundata_objects() # Run code From 5d0b0fb32596fdfaf0aea6b0383cbdc8c63c79e3 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Thu, 6 Feb 2025 20:50:47 -0500 Subject: [PATCH 09/11] Remove tests advection_2d --- tests/advection_2d_annulus/Makefile | 65 ------- tests/advection_2d_annulus/README.rst | 11 -- tests/advection_2d_annulus/__init__.py | 0 tests/advection_2d_annulus/mapc2p.f | 15 -- tests/advection_2d_annulus/mapc2p.py | 14 -- tests/advection_2d_annulus/qinit.f | 22 --- tests/advection_2d_annulus/setaux.f | 73 -------- tests/advection_2d_annulus/setplot.py | 91 --------- tests/advection_2d_annulus/setprob.f | 29 --- tests/advection_2d_annulus/setrun.py | 246 ------------------------- tests/advection_2d_annulus/stream.f | 14 -- 11 files changed, 580 deletions(-) delete mode 100644 tests/advection_2d_annulus/Makefile delete mode 100644 tests/advection_2d_annulus/README.rst delete mode 100644 tests/advection_2d_annulus/__init__.py delete mode 100644 tests/advection_2d_annulus/mapc2p.f delete mode 100644 tests/advection_2d_annulus/mapc2p.py delete mode 100644 tests/advection_2d_annulus/qinit.f delete mode 100644 tests/advection_2d_annulus/setaux.f delete mode 100644 tests/advection_2d_annulus/setplot.py delete mode 100644 tests/advection_2d_annulus/setprob.f delete mode 100644 tests/advection_2d_annulus/setrun.py delete mode 100644 tests/advection_2d_annulus/stream.f diff --git a/tests/advection_2d_annulus/Makefile b/tests/advection_2d_annulus/Makefile deleted file mode 100644 index aa8c4e6..0000000 --- a/tests/advection_2d_annulus/Makefile +++ /dev/null @@ -1,65 +0,0 @@ - -# 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 = classic # Clawpack package to use -EXE = xclaw # 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 ?= - -# --------------------------------- -# package sources for this program: -# --------------------------------- - -include $(CLAW)/classic/src/2d/Makefile.classic_2d - -# --------------------------------------- -# package sources specifically to exclude -# (i.e. if a custom replacement source -# under a different name is provided) -# --------------------------------------- - -EXCLUDE_MODULES = \ - -EXCLUDE_SOURCES = \ - - -# --------------------------------- -# List of custom sources for this program: -# --------------------------------- - -MODULES = \ - -SOURCES = \ - mapc2p.f \ - qinit.f \ - $(CLAW)/riemann/src/rpn2_vc_advection.f90 \ - $(CLAW)/riemann/src/rpt2_vc_advection.f90 \ - setaux.f \ - setprob.f \ - stream.f - -#------------------------------------------------------------------- -# Include Makefile containing standard definitions and make options: -include $(CLAWMAKE) - diff --git a/tests/advection_2d_annulus/README.rst b/tests/advection_2d_annulus/README.rst deleted file mode 100644 index 208c7e5..0000000 --- a/tests/advection_2d_annulus/README.rst +++ /dev/null @@ -1,11 +0,0 @@ - -.. _classic_examples_advection_2d_annulus: - -Two-dimensional advection around an annulus -=========================================== - -On a mapped grid, as specified in `mapc2p.f` and `mapc2p.py`. - -Quick regression test version: regression_tests.py - -* Checks sum of q values over left and right half, for two frames. diff --git a/tests/advection_2d_annulus/__init__.py b/tests/advection_2d_annulus/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/advection_2d_annulus/mapc2p.f b/tests/advection_2d_annulus/mapc2p.f deleted file mode 100644 index 844790f..0000000 --- a/tests/advection_2d_annulus/mapc2p.f +++ /dev/null @@ -1,15 +0,0 @@ -c -c ===================================================== - subroutine mapc2p(xc,yc,xp,yp) -c ===================================================== -c -c # on input, (xc,yc) is a computational grid point -c # on output, (xp,yp) is corresponding point in physical space -c - implicit double precision (a-h,o-z) -c -c # Polar coordinates, xc = r, yc = theta - xp = xc * dcos(yc) - yp = xc * dsin(yc) - return - end diff --git a/tests/advection_2d_annulus/mapc2p.py b/tests/advection_2d_annulus/mapc2p.py deleted file mode 100644 index 072b930..0000000 --- a/tests/advection_2d_annulus/mapc2p.py +++ /dev/null @@ -1,14 +0,0 @@ - - -from __future__ import absolute_import -def mapc2p(xc,yc): - """ - Specifies the mapping to curvilinear coordinates -- should be consistent - with mapc2p.f - """ - from numpy import sin, cos - - # Polar coordinates (xc = r, yc = theta) - xp = xc * cos(yc) - yp = xc * sin(yc) - return xp,yp diff --git a/tests/advection_2d_annulus/qinit.f b/tests/advection_2d_annulus/qinit.f deleted file mode 100644 index 596a299..0000000 --- a/tests/advection_2d_annulus/qinit.f +++ /dev/null @@ -1,22 +0,0 @@ -c ===================================================== - subroutine qinit(meqn,mbc,mx,my,xlower,ylower, - & dx,dy,q,maux,aux) -c ===================================================== -c -c - implicit double precision (a-h,o-z) - dimension q(meqn, 1-mbc:mx+mbc, 1-mbc:my+mbc) - common /cqinit/ A1,beta1,x1,y1, A2,beta2,x2,y2 - - do i=1,mx - xc = xlower + (i-0.5d0)*dx - do j=1,my - yc = ylower + (j-0.5d0)*dy - call mapc2p(xc,yc,xp,yp) - q(1,i,j) = A1*exp(-beta1*((xp - x1)**2 + (yp - y1)**2)) - & +A2*exp(-beta2*((xp - x2)**2 + (yp - y2)**2)) - enddo - enddo - - return - end diff --git a/tests/advection_2d_annulus/setaux.f b/tests/advection_2d_annulus/setaux.f deleted file mode 100644 index 2b0bfcf..0000000 --- a/tests/advection_2d_annulus/setaux.f +++ /dev/null @@ -1,73 +0,0 @@ -c ============================================ - subroutine setaux(mbc,mx,my,xlower,ylower,dxc,dyc, - & maux,aux) -c ============================================ -c -c # set auxiliary arrays for advection on a curvilinear grid -c -c # on input, (xc(i),yc(j)) gives uniformly spaced computational grid. -c # on output, -c # aux(i,j,1) is edge velocity at "left" boundary of grid point (i,j) -c # aux(i,j,2) is edge velocity at "bottom" boundary of grid point (i,j) -c # aux(i,j,3) = kappa is ratio of cell area to dxc*dyc -c - implicit double precision (a-h,o-z) - double precision, intent(inout), - & dimension(3, 1-mbc:mx+mbc,1-mbc:my+mbc) :: aux - dimension xccorn(5),yccorn(5),xpcorn(5),ypcorn(5) -c -c - do 20 j=1-mbc,my+mbc - do 20 i=1-mbc,mx+mbc -c -c # computational points (xc,yc) are mapped to physical -c # coordinates (xp,yp) by mapc2p: -c -c # lower left corner: - xccorn(1) = xlower + (i-1)*dxc - yccorn(1) = ylower + (j-1)*dyc - call mapc2p(xccorn(1),yccorn(1),xpcorn(1),ypcorn(1)) - -c # upper left corner: - xccorn(2) = xccorn(1) - yccorn(2) = yccorn(1) + dyc - call mapc2p(xccorn(2),yccorn(2),xpcorn(2),ypcorn(2)) -c -c # upper right corner: - xccorn(3) = xccorn(1) + dxc - yccorn(3) = yccorn(1) + dyc - call mapc2p(xccorn(3),yccorn(3),xpcorn(3),ypcorn(3)) -c -c # lower right corner: - xccorn(4) = xccorn(1) + dxc - yccorn(4) = yccorn(1) - call mapc2p(xccorn(4),yccorn(4),xpcorn(4),ypcorn(4)) -c -c -c # compute edge velocities by differencing stream function: -c - aux(1,i,j) = (stream(xpcorn(2),ypcorn(2)) - & - stream(xpcorn(1),ypcorn(1)))/ dyc -c - aux(2,i,j) = -(stream(xpcorn(4),ypcorn(4)) - & - stream(xpcorn(1),ypcorn(1)))/ dxc - -c -c -c # compute area of physical cell from four corners: - - xpcorn(5) = xpcorn(1) - ypcorn(5) = ypcorn(1) - area = 0.d0 - do ic=1,4 - area = area + 0.5d0 * (ypcorn(ic)+ypcorn(ic+1)) * - & (xpcorn(ic+1)-xpcorn(ic)) - enddo - - aux(3,i,j) = area / (dxc*dyc) -c - 20 continue -c - return - - end diff --git a/tests/advection_2d_annulus/setplot.py b/tests/advection_2d_annulus/setplot.py deleted file mode 100644 index e2e7246..0000000 --- a/tests/advection_2d_annulus/setplot.py +++ /dev/null @@ -1,91 +0,0 @@ - -""" -Set up the plot figures, axes, and items to be done for each frame. - -This module is imported by the plotting routines and then the -function setplot is called to set the plot parameters. - -""" - -from __future__ import absolute_import -from .mapc2p import mapc2p -import numpy as np - -#-------------------------- -def setplot(plotdata): -#-------------------------- - - """ - Specify what is to be plotted at each frame. - Input: plotdata, an instance of pyclaw.plotters.data.ClawPlotData. - Output: a modified version of plotdata. - - """ - - - from clawpack.visclaw import colormaps - - plotdata.clearfigures() # clear any old figures,axes,items data - - - # Figure for pcolor plot - plotfigure = plotdata.new_plotfigure(name='q[0]', figno=0) - - # Set up for axes in this figure: - plotaxes = plotfigure.new_plotaxes() - plotaxes.xlimits = 'auto' - plotaxes.ylimits = 'auto' - plotaxes.title = 'q[0]' - plotaxes.scaled = True - - # Set up for item on these axes: - plotitem = plotaxes.new_plotitem(plot_type='2d_pcolor') - plotitem.plot_var = 0 - plotitem.pcolor_cmap = colormaps.red_yellow_blue - plotitem.pcolor_cmin = -1. - plotitem.pcolor_cmax = 1. - plotitem.add_colorbar = True - plotitem.celledges_show = 0 - plotitem.patchedges_show = 1 - plotitem.MappedGrid = True - plotitem.mapc2p = mapc2p - plotitem.show = True # show on plot? - - # Figure for contour plot - plotfigure = plotdata.new_plotfigure(name='contour', figno=1) - - # Set up for axes in this figure: - plotaxes = plotfigure.new_plotaxes() - plotaxes.xlimits = 'auto' - plotaxes.ylimits = 'auto' - plotaxes.title = 'q[0]' - plotaxes.scaled = True - - # Set up for item on these axes: - plotitem = plotaxes.new_plotitem(plot_type='2d_contour') - plotitem.plot_var = 0 - plotitem.contour_levels = np.linspace(-0.9, 0.9, 10) - plotitem.contour_colors = 'k' - plotitem.patchedges_show = 1 - plotitem.MappedGrid = True - plotitem.mapc2p = mapc2p - plotitem.show = True # show on plot? - - - # Parameters used only when creating html and/or latex hardcopy - # e.g., via pyclaw.plotters.frametools.printframes: - - plotdata.printfigs = True # print figures - plotdata.print_format = 'png' # file format - plotdata.print_framenos = 'all' # list of frames to print - plotdata.print_fignos = 'all' # list of figures to print - plotdata.html = True # create html files of plots? - plotdata.html_homelink = '../README.html' # pointer for top of index - plotdata.latex = True # create latex file of plots? - plotdata.latex_figsperline = 2 # layout of plots - plotdata.latex_framesperline = 1 # layout of plots - plotdata.latex_makepdf = False # also run pdflatex? - - return plotdata - - diff --git a/tests/advection_2d_annulus/setprob.f b/tests/advection_2d_annulus/setprob.f deleted file mode 100644 index 7ec1408..0000000 --- a/tests/advection_2d_annulus/setprob.f +++ /dev/null @@ -1,29 +0,0 @@ - subroutine setprob - implicit double precision (a-h,o-z) - character*25 fname - common /cqinit/ A1,beta1,x1,y1, A2,beta2,x2,y2 -c -c # read data values for this problem -c -c - iunit = 7 - fname = 'setprob.data' -c # open the unit with new routine from Clawpack 4.4 to skip over -c # comment lines starting with #: - call opendatafile(iunit, fname) - - -c # These parameters are used in qinit.f - read(7,*) A1 - read(7,*) beta1 - read(7,*) x1 - read(7,*) y1 - read(7,*) A2 - read(7,*) beta2 - read(7,*) x2 - read(7,*) y2 - - close(unit=7) - - return - end diff --git a/tests/advection_2d_annulus/setrun.py b/tests/advection_2d_annulus/setrun.py deleted file mode 100644 index 18167f2..0000000 --- a/tests/advection_2d_annulus/setrun.py +++ /dev/null @@ -1,246 +0,0 @@ -""" -Module to set up run time parameters for Clawpack -- classic code. - -The values set in the function setrun are then written out to data files -that will be read in by the Fortran code. - -""" - -from __future__ import absolute_import -import os -import numpy as np - -#------------------------------ -def setrun(claw_pkg='classic'): -#------------------------------ - - """ - Define the parameters used for running Clawpack. - - INPUT: - claw_pkg expected to be "classic" for this setrun. - - OUTPUT: - rundata - object of class ClawRunData - - """ - - from clawpack.clawutil import data - - - assert claw_pkg.lower() == 'classic', "Expected claw_pkg = 'classic'" - - num_dim = 2 - rundata = data.ClawRunData(claw_pkg, num_dim) - - #------------------------------------------------------------------ - # Problem-specific parameters to be written to setprob.data: - #------------------------------------------------------------------ - probdata = rundata.new_UserData(name='probdata', fname='setprob.data') - - probdata.add_param('A1', 1., 'Amplitude of first Gaussian hump') - probdata.add_param('beta1', 40., 'Decay rate of first Gaussian hump') - probdata.add_param('x1', -0.5, 'X coordinate of center of first Gaussian hump') - probdata.add_param('y1', 0., 'Y coordinate of center of first Gaussian hump') - probdata.add_param('A2', -1., 'Amplitude of second Gaussian hump') - probdata.add_param('beta2', 40., 'Decay rate of second Gaussian hump') - probdata.add_param('x2', 0.5, 'X coordinate of center of second Gaussian hump') - probdata.add_param('y2', 0., 'Y coordinate of center of second Gaussian hump') - - #------------------------------------------------------------------ - # Standard Clawpack parameters to be written to claw.data: - #------------------------------------------------------------------ - - clawdata = rundata.clawdata # initialized when rundata instantiated - - - # --------------- - # Spatial domain: - # --------------- - - # Number of space dimensions: - clawdata.num_dim = num_dim - - # Lower and upper edge of computational domain: - clawdata.lower[0] = 0.2 # xlower - clawdata.upper[0] = 1. # xupper - clawdata.lower[1] = 0. # ylower - clawdata.upper[1] = 2.*np.pi # yupper - - # Number of grid cells: - clawdata.num_cells[0] = 40 # mx - clawdata.num_cells[1] = 120 # my - - - # --------------- - # Size of system: - # --------------- - - # Number of equations in the system: - clawdata.num_eqn = 1 - - # Number of auxiliary variables in the aux array (initialized in setaux) - clawdata.num_aux = 3 - - # Index of aux array corresponding to capacity function, if there is one: - clawdata.capa_index = 3 - - - # ------------- - # Initial time: - # ------------- - - clawdata.t0 = 0. - - - # Restart from checkpoint file of a previous run? - # Note: If restarting, you must also change the Makefile to set: - # RESTART = True - # If restarting, t0 above should be from original run, and the - # restart_file 'fort.qNNNN' specified below should be in - # the OUTDIR indicated in Makefile. - - clawdata.restart = False # True to restart from prior results - clawdata.restart_file = 'fort.q0006' # File to use for restart data - - - # ------------- - # Output times: - #-------------- - - # Specify at what times the results should be written to fort.q files. - # Note that the time integration stops after the final output time. - - clawdata.output_style = 1 - - if clawdata.output_style==1: - # Output ntimes frames at equally spaced times up to tfinal: - # Can specify num_output_times = 0 for no output - clawdata.num_output_times = 2 - clawdata.tfinal = 0.5 - clawdata.output_t0 = True # output at initial (or restart) time? - - elif clawdata.output_style == 2: - # Specify a list or numpy array of output times: - # Include t0 if you want output at the initial time. - clawdata.output_times = [0., 0.1] - - elif clawdata.output_style == 3: - # Output every step_interval timesteps over total_steps timesteps: - clawdata.output_step_interval = 2 - clawdata.total_steps = 4 - clawdata.output_t0 = True # output at initial (or restart) time? - - - clawdata.output_format = 'ascii' # 'ascii', 'binary', 'netcdf' - - clawdata.output_q_components = 'all' # could be list such as [True,True] - clawdata.output_aux_components = 'none' # could be list - clawdata.output_aux_onlyonce = True # output aux arrays only at t0 - - - # --------------------------------------------------- - # Verbosity of messages to screen during integration: - # --------------------------------------------------- - - # The current t, dt, and cfl will be printed every time step - # at AMR levels <= verbosity. Set verbosity = 0 for no printing. - # (E.g. verbosity == 2 means print only on levels 1 and 2.) - clawdata.verbosity = 0 - - - - # -------------- - # Time stepping: - # -------------- - - # if dt_variable==True: variable time steps used based on cfl_desired, - # if dt_variable==False: fixed time steps dt = dt_initial always used. - clawdata.dt_variable = True - - # Initial time step for variable dt. - # (If dt_variable==0 then dt=dt_initial for all steps) - clawdata.dt_initial = 0.1 - - # Max time step to be allowed if variable dt used: - clawdata.dt_max = 1.e9 - - # Desired Courant number if variable dt used - clawdata.cfl_desired = 0.9 - # max Courant number to allow without retaking step with a smaller dt: - clawdata.cfl_max = 1. - - # Maximum number of time steps to allow between output times: - clawdata.steps_max = 50000 - - - # ------------------ - # Method to be used: - # ------------------ - - # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters - clawdata.order = 2 - - # Use dimensional splitting? (not yet available for AMR) - clawdata.dimensional_split = 'unsplit' - - # For unsplit method, transverse_waves can be - # 0 or 'none' ==> donor cell (only normal solver used) - # 1 or 'increment' ==> corner transport of waves - # 2 or 'all' ==> corner transport of 2nd order corrections too - clawdata.transverse_waves = 'all' - - - # Number of waves in the Riemann solution: - clawdata.num_waves = 1 - - # List of limiters to use for each wave family: - # Required: len(limiter) == num_waves - # Some options: - # 0 or 'none' ==> no limiter (Lax-Wendroff) - # 1 or 'minmod' ==> minmod - # 2 or 'superbee' ==> superbee - # 3 or 'vanleer' ==> van Leer - # 4 or 'mc' ==> MC limiter - clawdata.limiter = ['vanleer'] - - clawdata.use_fwaves = False # True ==> use f-wave version of algorithms - - # Source terms splitting: - # src_split == 0 or 'none' ==> no source term (src routine never called) - # src_split == 1 or 'godunov' ==> Godunov (1st order) splitting used, - # src_split == 2 or 'strang' ==> Strang (2nd order) splitting used, not recommended. - clawdata.source_split = 'none' - - - # -------------------- - # Boundary conditions: - # -------------------- - - # Number of ghost cells (usually 2) - clawdata.num_ghost = 2 - - # Choice of BCs at xlower and xupper: - # 0 or 'user' => user specified (must modify bcNamr.f to use this option) - # 1 or 'extrap' => extrapolation (non-reflecting outflow) - # 2 or 'periodic' => periodic (must specify this at both boundaries) - # 3 or 'wall' => solid wall for systems where q(2) is normal velocity - - clawdata.bc_lower[0] = 'extrap' # at xlower - clawdata.bc_upper[0] = 'extrap' # at xupper - - clawdata.bc_lower[1] = 'periodic' # at ylower - clawdata.bc_upper[1] = 'periodic' # at yupper - - return rundata - - # end of function setrun - # ---------------------- - - -if __name__ == '__main__': - # Set up run-time parameters and write all data files. - import sys - rundata = setrun(*sys.argv[1:]) - rundata.write() - diff --git a/tests/advection_2d_annulus/stream.f b/tests/advection_2d_annulus/stream.f deleted file mode 100644 index d301816..0000000 --- a/tests/advection_2d_annulus/stream.f +++ /dev/null @@ -1,14 +0,0 @@ -c -c ================================================= - function stream(x,y) -c ================================================= -c -c # Stream function in physical space (x,y). -c # Clockwise rotation, rotates fully in time 1. - - implicit double precision (a-h,o-z) - - stream = 3.1415926535897931d0 *(x**2 + y**2) -c - return - end From 406efee53704746b72f7bd241fa0cace5a0de8ec Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Thu, 6 Feb 2025 20:54:14 -0500 Subject: [PATCH 10/11] Move acoustics 3D test --- .../regression_data/claw_git_diffs.txt | 0 .../regression_data/claw_git_status.txt | 0 .../regression_data/regression_data_test2.txt | 0 .../regression_data/regression_data_test3.txt | 0 .../test_acoustics_3d_heterogeneous.py | 6 +- tests/README.txt | 23 -- tests/__init__.py | 0 tests/acoustics_3d_heterogeneous/Makefile | 68 ---- tests/acoustics_3d_heterogeneous/__init__.py | 0 tests/acoustics_3d_heterogeneous/bc3.f | 354 ------------------ tests/acoustics_3d_heterogeneous/qinit.f | 35 -- tests/acoustics_3d_heterogeneous/setaux.f | 35 -- tests/acoustics_3d_heterogeneous/setplot3.m | 131 ------- tests/acoustics_3d_heterogeneous/setprob.f | 22 -- tests/acoustics_3d_heterogeneous/setrun.py | 248 ------------ 15 files changed, 5 insertions(+), 917 deletions(-) rename {tests => examples}/acoustics_3d_heterogeneous/regression_data/claw_git_diffs.txt (100%) rename {tests => examples}/acoustics_3d_heterogeneous/regression_data/claw_git_status.txt (100%) rename {tests => examples}/acoustics_3d_heterogeneous/regression_data/regression_data_test2.txt (100%) rename {tests => examples}/acoustics_3d_heterogeneous/regression_data/regression_data_test3.txt (100%) rename tests/acoustics_3d_heterogeneous/regression_test.py => examples/acoustics_3d_heterogeneous/test_acoustics_3d_heterogeneous.py (88%) delete mode 100644 tests/README.txt delete mode 100644 tests/__init__.py delete mode 100644 tests/acoustics_3d_heterogeneous/Makefile delete mode 100644 tests/acoustics_3d_heterogeneous/__init__.py delete mode 100644 tests/acoustics_3d_heterogeneous/bc3.f delete mode 100644 tests/acoustics_3d_heterogeneous/qinit.f delete mode 100644 tests/acoustics_3d_heterogeneous/setaux.f delete mode 100644 tests/acoustics_3d_heterogeneous/setplot3.m delete mode 100644 tests/acoustics_3d_heterogeneous/setprob.f delete mode 100644 tests/acoustics_3d_heterogeneous/setrun.py diff --git a/tests/acoustics_3d_heterogeneous/regression_data/claw_git_diffs.txt b/examples/acoustics_3d_heterogeneous/regression_data/claw_git_diffs.txt similarity index 100% rename from tests/acoustics_3d_heterogeneous/regression_data/claw_git_diffs.txt rename to examples/acoustics_3d_heterogeneous/regression_data/claw_git_diffs.txt diff --git a/tests/acoustics_3d_heterogeneous/regression_data/claw_git_status.txt b/examples/acoustics_3d_heterogeneous/regression_data/claw_git_status.txt similarity index 100% rename from tests/acoustics_3d_heterogeneous/regression_data/claw_git_status.txt rename to examples/acoustics_3d_heterogeneous/regression_data/claw_git_status.txt diff --git a/tests/acoustics_3d_heterogeneous/regression_data/regression_data_test2.txt b/examples/acoustics_3d_heterogeneous/regression_data/regression_data_test2.txt similarity index 100% rename from tests/acoustics_3d_heterogeneous/regression_data/regression_data_test2.txt rename to examples/acoustics_3d_heterogeneous/regression_data/regression_data_test2.txt diff --git a/tests/acoustics_3d_heterogeneous/regression_data/regression_data_test3.txt b/examples/acoustics_3d_heterogeneous/regression_data/regression_data_test3.txt similarity index 100% rename from tests/acoustics_3d_heterogeneous/regression_data/regression_data_test3.txt rename to examples/acoustics_3d_heterogeneous/regression_data/regression_data_test3.txt diff --git a/tests/acoustics_3d_heterogeneous/regression_test.py b/examples/acoustics_3d_heterogeneous/test_acoustics_3d_heterogeneous.py similarity index 88% rename from tests/acoustics_3d_heterogeneous/regression_test.py rename to examples/acoustics_3d_heterogeneous/test_acoustics_3d_heterogeneous.py index 6ce6fc9..4409ca0 100644 --- a/tests/acoustics_3d_heterogeneous/regression_test.py +++ b/examples/acoustics_3d_heterogeneous/test_acoustics_3d_heterogeneous.py @@ -2,7 +2,6 @@ Regression tests for 3D heterogeneous acoustics problem. """ -from __future__ import absolute_import import sys import unittest @@ -17,6 +16,11 @@ def runTest(self, save=False): # Write out data files self.load_rundata() + + self.rundata.clawdata.num_cells = [20, 20, 20] + self.rundata.clawdata.num_output_times = 2 + self.rundata.clawdata.tfinal = 1.0 + self.write_rundata_objects() # Run code diff --git a/tests/README.txt b/tests/README.txt deleted file mode 100644 index 9d1b5e2..0000000 --- a/tests/README.txt +++ /dev/null @@ -1,23 +0,0 @@ -This directory is for regression tests. - -To run all tests, at the command line type: - nosetests -or, for more verbose output: - nosetests -sv - -Each test does a short run and computes a few numbers based on all solution -values to see if they agree with archived results. - - -Developers: To create new archived results for a test case, go into the -directory and type: - python regression_tests.py True -Then 'git add' and issue a pull request if you believe the new results are -more correct. - -You can also run `make .output` as usual in a subdirectory if you want to -examine all the output, which is removed automatically if nosetests runs a -test and it passes. (If it fails, the output is preserved in a directory -with a name like `Acoustics1DHeterogeneousTest_output` if the failing test -was in drirectory `acoustics_1d_heterogeneous`.) - diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/acoustics_3d_heterogeneous/Makefile b/tests/acoustics_3d_heterogeneous/Makefile deleted file mode 100644 index 8fa9b72..0000000 --- a/tests/acoustics_3d_heterogeneous/Makefile +++ /dev/null @@ -1,68 +0,0 @@ - -# 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 = classic # Clawpack package to use -EXE = xclaw # 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 ?= - -# --------------------------------- -# package sources for this program: -# --------------------------------- - -include $(CLAW)/classic/src/3d/Makefile.classic_3d - -# --------------------------------------- -# package sources specifically to exclude -# (i.e. if a custom replacement source -# under a different name is provided) -# --------------------------------------- - -EXCLUDE_MODULES = \ - -EXCLUDE_SOURCES = \ - inlinelimiter.f90 - - -# --------------------------------- -# List of custom sources for this program: -# --------------------------------- - -MODULES = \ - -SOURCES = \ - qinit.f \ - setprob.f \ - bc3.f \ - setaux.f \ - $(CLAW)/riemann/src/rpn3_vc_acoustics.f90 \ - $(CLAW)/riemann/src/rpt3_vc_acoustics.f90 \ - $(CLAW)/riemann/src/rptt3_vc_acoustics.f90 \ - $(CLAW)/classic/src/3d/limiter.f90 \ - $(CLAW)/classic/src/3d/philim.f90 - -#------------------------------------------------------------------- -# Include Makefile containing standard definitions and make options: -include $(CLAWMAKE) - diff --git a/tests/acoustics_3d_heterogeneous/__init__.py b/tests/acoustics_3d_heterogeneous/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/acoustics_3d_heterogeneous/bc3.f b/tests/acoustics_3d_heterogeneous/bc3.f deleted file mode 100644 index b10c0ed..0000000 --- a/tests/acoustics_3d_heterogeneous/bc3.f +++ /dev/null @@ -1,354 +0,0 @@ - -c -c -c ===================================================== - subroutine bc3(meqn,mbc,mx,my,mz,xlower, - & ylower,zlower,dx,dy,dz,q,maux,aux,t,dt,mthbc) -c ===================================================== -c -c # Standard boundary condition choices for claw3 -c -c # At each boundary k = 1 (xlower), 2 (xupper), -c # 3 (ylower), 4 (yupper), -c # 5 (zlower), 6 (zupper): -c # mthbc(k) = 0 for user-supplied BC's (must be inserted!) -c # = 1 for zero-order extrapolation -c # = 2 for periodic boundary coniditions -c # = 3 for solid walls, assuming this can be implemented -c # by reflecting the data about the boundary and then -c # negating the 2'nd (for k=1,2) or 3'rd (for k=3,4) -c # or 4'th (for k=5,6) component of q. -c ------------------------------------------------ -c -c # Extend the data from the interior cells (1:mx, 1:my, 1:mz) -c # to a layer of mbc ghost cells outside the region. -c - implicit double precision (a-h,o-z) - dimension q(meqn,1-mbc:mx+mbc,1-mbc:my+mbc,1-mbc:mz+mbc) - dimension aux(maux,1-mbc:mx+mbc,1-mbc:my+mbc,1-mbc:mz+mbc) - dimension mthbc(6) - -c -c -c------------------------------------------------------- -c # left boundary (xlower): -c------------------------------------------------------- - go to (100,110,120,130) mthbc(1)+1 -c - 100 continue -c # user-specified boundary conditions go here in place of error output - write(6,*) '*** ERROR *** mthbc(1)=0 and no BCs specified in bc3' - stop - go to 199 -c - 110 continue -c # zero-order extrapolation: - do 115 m=1,meqn - do 115 ibc=1,mbc - do 115 j = 1-mbc, my+mbc - do 115 k = 1-mbc, mz+mbc - q(m,1-ibc,j,k) = q(m,1,j,k) - 115 continue - go to 199 - - 120 continue -c # periodic: - do 125 m=1,meqn - do 125 ibc=1,mbc - do 125 j = 1-mbc, my+mbc - do 125 k = 1-mbc, mz+mbc - q(m,1-ibc,j,k) = q(m,mx+1-ibc,j,k) - 125 continue - go to 199 - - 130 continue -c # solid wall (assumes 2'nd component is velocity or momentum in x): - do 135 m=1,meqn - do 135 ibc=1,mbc - do 135 j = 1-mbc, my+mbc - do 135 k = 1-mbc, mz+mbc - q(m,1-ibc,j,k) = q(m,ibc,j,k) - 135 continue -c # negate the normal velocity: - do 136 ibc=1,mbc - do 136 j = 1-mbc, my+mbc - do 136 k = 1-mbc, mz+mbc - q(2,1-ibc,j,k) = -q(2,ibc,j,k) - 136 continue - go to 199 - - 199 continue -c -c------------------------------------------------------- -c # right boundary (xupper): -c------------------------------------------------------- - go to (200,210,220,230) mthbc(2)+1 -c - 200 continue -c # user-specified boundary conditions go here in place of error output - write(6,*) '*** ERROR *** mthbc(2)=0 and no BCs specified in bc3' - stop - go to 299 - - 210 continue -c # zero-order extrapolation: - do 215 m=1,meqn - do 215 ibc=1,mbc - do 215 j = 1-mbc, my+mbc - do 215 k = 1-mbc, mz+mbc - q(m,mx+ibc,j,k) = q(m,mx,j,k) - 215 continue - go to 299 - - 220 continue -c # periodic: - do 225 m=1,meqn - do 225 ibc=1,mbc - do 225 j = 1-mbc, my+mbc - do 225 k = 1-mbc, mz+mbc - q(m,mx+ibc,j,k) = q(m,ibc,j,k) - 225 continue - go to 299 - - 230 continue -c # solid wall (assumes 2'nd component is velocity or momentum in x): - do 235 m=1,meqn - do 235 ibc=1,mbc - do 235 j = 1-mbc, my+mbc - do 235 k = 1-mbc, mz+mbc - q(m,mx+ibc,j,k) = q(m,mx+1-ibc,j,k) - 235 continue -c # negate the normal velocity: - do 236 ibc=1,mbc - do 236 j = 1-mbc, my+mbc - do 236 k = 1-mbc, mz+mbc - q(2,mx+ibc,j,k) = -q(2,mx+1-ibc,j,k) - 236 continue - go to 299 - - 299 continue -c -c------------------------------------------------------- -c # bottom boundary (ylower): -c------------------------------------------------------- - go to (300,310,320,330) mthbc(3)+1 -c - 300 continue -c # user-specified boundary conditions go here in place of error output - write(6,*) '*** ERROR *** mthbc(3)=0 and no BCs specified in bc3' - stop - go to 399 -c - 310 continue -c # zero-order extrapolation: - do 315 m=1,meqn - do 315 jbc=1,mbc - do 315 i = 1-mbc, mx+mbc - do 315 k = 1-mbc, mz+mbc - q(m,i,1-jbc,k) = q(m,i,1,k) - 315 continue - go to 399 - - 320 continue -c # periodic: - do 325 m=1,meqn - do 325 jbc=1,mbc - do 325 i = 1-mbc, mx+mbc - do 325 k = 1-mbc, mz+mbc - q(m,i,1-jbc,k) = q(m,i,my+1-jbc,k) - 325 continue - go to 399 - - 330 continue -c # solid wall (assumes 3'rd component is velocity or momentum in y): - do 335 m=1,meqn - do 335 jbc=1,mbc - do 335 i = 1-mbc, mx+mbc - do 335 k = 1-mbc, mz+mbc - q(m,i,1-jbc,k) = q(m,i,jbc,k) - 335 continue -c # negate the normal velocity: - do 336 jbc=1,mbc - do 336 i = 1-mbc, mx+mbc - do 336 k = 1-mbc, mz+mbc - q(3,i,1-jbc,k) = -q(3,i,jbc,k) - 336 continue - go to 399 - - 399 continue -c -c------------------------------------------------------- -c # top boundary (yupper): -c------------------------------------------------------- - go to (400,410,420,430) mthbc(4)+1 -c - 400 continue -c # user-specified boundary conditions go here in place of error output - write(6,*) '*** ERROR *** mthbc(4)=0 and no BCs specified in bc3' - stop - go to 499 - - 410 continue -c # zero-order extrapolation: - do 415 m=1,meqn - do 415 jbc=1,mbc - do 415 i = 1-mbc, mx+mbc - do 415 k = 1-mbc, mz+mbc - q(m,i,my+jbc,k) = q(m,i,my,k) - 415 continue - go to 499 - - 420 continue -c # periodic: - do 425 m=1,meqn - do 425 jbc=1,mbc - do 425 i = 1-mbc, mx+mbc - do 425 k = 1-mbc, mz+mbc - q(m,i,my+jbc,k) = q(m,i,jbc,k) - 425 continue - go to 499 - - 430 continue -c # solid wall (assumes 3'rd component is velocity or momentum in y): - do 435 m=1,meqn - do 435 jbc=1,mbc - do 435 i = 1-mbc, mx+mbc - do 435 k = 1-mbc, mz+mbc - q(m,i,my+jbc,k) = q(m,i,my+1-jbc,k) - 435 continue -c # negate the normal velocity: - do 436 jbc=1,mbc - do 436 i = 1-mbc, mx+mbc - do 436 k = 1-mbc, mz+mbc - q(3,i,my+jbc,k) = -q(3,i,my+1-jbc,k) - 436 continue - go to 499 - - 499 continue - -c -c------------------------------------------------------- -c # boundary (zlower): -c------------------------------------------------------- - go to (500,510,520,530) mthbc(5)+1 -c - 500 continue -c # user-specified boundary conditions go here in place of error output - write(6,*) '*** ERROR *** mthbc(5)=0 and no BCs specified in bc3' - stop - go to 599 -c - 510 continue -c # zero-order extrapolation: - do 515 m=1,meqn - do 515 kbc=1,mbc - do 515 i = 1-mbc, mx+mbc - do 515 j = 1-mbc, my+mbc - q(m,i,j,1-kbc) = q(m,i,j,1) - 515 continue - go to 599 - - 520 continue -c # periodic: - do 525 m=1,meqn - do 525 kbc=1,mbc - do 525 i = 1-mbc, mx+mbc - do 525 j = 1-mbc, my+mbc - q(m,i,j,1-kbc) = q(m,i,j,mz+1-kbc) - 525 continue - go to 599 - - 530 continue -c # solid wall (assumes 4'rd component is velocity or momentum in y): - do 535 m=1,meqn - do 535 kbc=1,mbc - do 535 i = 1-mbc, mx+mbc - do 535 j = 1-mbc, my+mbc - q(m,i,j,1-kbc) = q(m,i,j,kbc) - 535 continue -c # negate the normal velocity: - do 536 kbc=1,mbc - do 536 i = 1-mbc, mx+mbc - do 536 j = 1-mbc, my+mbc - q(4,i,j,1-kbc) = -q(4,i,j,kbc) - 536 continue - go to 599 - - 599 continue -c -c------------------------------------------------------- -c # boundary (zupper): -c------------------------------------------------------- - go to (600,610,620,630) mthbc(6)+1 -c - 600 continue -c # user-specified boundary conditions go here in place of error output -c write(6,*) '*** ERROR *** mthbc(6)=0 and no BCs specified in bc3' -c stop -c # solid wall with piston in center - do 605 m=1,meqn - do 605 kbc=1,mbc - do 605 i = 1-mbc, mx+mbc - do 605 j = 1-mbc, my+mbc - q(m,i,j,mz+kbc) = q(m,i,j,mz+1-kbc) - 605 continue -c # negate the normal velocity: - do 606 kbc=1,mbc - do 606 i = 1-mbc, mx+mbc - do 606 j = 1-mbc, my+mbc - if (t .lt. 0.1d0) then - xi = xlower + (i-0.5d0)*dx - yj = ylower + (j-0.5d0)*dy - r2 = (xi**2 + yj**2) - s = -dexp(-500.d0*r2)*dexp(-500*t**2) -c write(27,271) t,i,j,r2,s -c 271 format(d16.6,2i5,2d16.6) - if (dabs(s).lt.1d-6) s = 0.d0 - else - s = 0.d0 - endif - q(4,i,j,mz+kbc) = 2.d0*s - q(4,i,j,mz+1-kbc) - 606 continue - go to 699 - - 610 continue -c # zero-order extrapolation: - do 615 m=1,meqn - do 615 kbc=1,mbc - do 615 i = 1-mbc, mx+mbc - do 615 j = 1-mbc, my+mbc - q(m,i,j,mz+kbc) = q(m,i,j,mz) - 615 continue - go to 699 - - 620 continue -c # periodic: - do 625 m=1,meqn - do 625 kbc=1,mbc - do 625 i = 1-mbc, mx+mbc - do 625 j = 1-mbc, my+mbc - q(m,i,j,mz+kbc) = q(m,i,j,kbc) - 625 continue - go to 699 - - 630 continue -c # solid wall (assumes 3'rd component is velocity or momentum in y): - do 635 m=1,meqn - do 635 kbc=1,mbc - do 635 i = 1-mbc, mx+mbc - do 635 j = 1-mbc, my+mbc - q(m,i,j,mz+kbc) = q(m,i,j,mz+1-kbc) - 635 continue -c # negate the normal velocity: - do 636 kbc=1,mbc - do 636 i = 1-mbc, mx+mbc - do 636 j = 1-mbc, my+mbc - q(4,i,j,mz+kbc) = -q(4,i,j,mz+1-kbc) - 636 continue - go to 699 - - 699 continue - - return - end - diff --git a/tests/acoustics_3d_heterogeneous/qinit.f b/tests/acoustics_3d_heterogeneous/qinit.f deleted file mode 100644 index 1c031d9..0000000 --- a/tests/acoustics_3d_heterogeneous/qinit.f +++ /dev/null @@ -1,35 +0,0 @@ - -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 aux(maux, 1-mbc:mx+mbc, 1-mbc:my+mbc, - & 1-mbc:mz+mbc) -c -c # set initial data -c --------------------------- -c - - do k = 1,mz - do j = 1,my - do i = 1,mx - q(1,i,j,k) = 0.d0 - q(2,i,j,k) = 0.d0 - q(3,i,j,k) = 0.d0 - q(4,i,j,k) = 0.d0 - enddo - enddo - enddo - - return - end diff --git a/tests/acoustics_3d_heterogeneous/setaux.f b/tests/acoustics_3d_heterogeneous/setaux.f deleted file mode 100644 index 1293a30..0000000 --- a/tests/acoustics_3d_heterogeneous/setaux.f +++ /dev/null @@ -1,35 +0,0 @@ -c ================================================================== - subroutine setaux(mbc,mx,my,mz,xlower,ylower, - & zlower,dx,dy,dz,maux,aux,t0) -c ================================================================== -c -c # set auxiliary arrays -c -c # acoustics in a heterogeneous medium: -c # aux(i,j,k,1) = impedance Z in (i,j) cell -c # aux(i,j,k,2) = sound speed c in (i,j) cell -c -c - implicit double precision (a-h,o-z) - double precision aux(maux, 1-mbc:mx+mbc, 1-mbc:my+mbc, - & 1-mbc:mz+mbc) - common /comaux/ z1,c1,z2,c2 - - - do k = 1-mbc,mz+mbc - do j = 1-mbc,my+mbc - do i = 1-mbc,mx+mbc - zcell = zlower + (k-0.5d0)*dz - if (zcell .lt. 0.d0) then - aux(1,i,j,k) = z1 - aux(2,i,j,k) = c1 - else - aux(1,i,j,k) = z2 - aux(2,i,j,k) = c2 - endif - enddo - enddo - enddo - - return - end diff --git a/tests/acoustics_3d_heterogeneous/setplot3.m b/tests/acoustics_3d_heterogeneous/setplot3.m deleted file mode 100644 index 5bc197e..0000000 --- a/tests/acoustics_3d_heterogeneous/setplot3.m +++ /dev/null @@ -1,131 +0,0 @@ -% SETPLOT3 sets user defined plotting parameters -% -% User defined Matlab script for setting various Clawpack plotting -% parameters. This script is called by PLOTCLAW3. A default -% version of this script can be found in claw/matlab/setplot3.m and -% copied to users working directory and modifed to set things up -% differently. -% -% Parameters that can be set with SETPLOT3 -% -% OutputFlag - set to 'ascii' (default) to read ascii output -% from files fort.qXXXX where XXXX is Frame # -% or to 'hdf' to read hdf output files. -% from files fort.qXXXX.hdf -% set to 'aux' to read aux array values from -% fort.aXXXX instead of q from fort.qXXXX -% These files are created only if -% outaux = .true. in out3.f -% -% OutputDir - set to '.' to read data from current working -% directory (default) or set to path -% to output directory. -% -% PlotType - type of plot to produce: -% - 1 = pcolor on slices (with optional contours -% and isosurfaces) -% - 2 = contour lines in 3d on white slices -% - 3 = Schlieren plot on slices -% - 4 = scatter plot of q vs. r -% -% mq - which component of q to plot -% UserVariable - Set to 1 to specify a user defined variable. -% UserVariableFile - name of m-file mapping data to q -% MappedGrid - set to 1 if mapc2p.m exists for nonuniform grid -% MaxFrames - max number of frames -% MaxLevels - max number of AMR levels -% PlotData - Data on refinement level k is plotted only if -% PlotData(k) == 1 -% PlotGrid - PLot grid lines on level k is PlotGrid(k) /= 0 -% PlotGridEdges - Plot 2d patch borders if PlotGridEdges(k) /= 0 -% PlotCubeEdges - Plot 3d patch cubes if PlotCubeEdges(k) /= 0 -% ContourValues - Set to desired contour values, or [] for no ... -% lines. -% xSliceCoords - vector of x slice constants -% ySliceCoords - vector of y slice constants -% zSliceCoords - vector of z slice constants -% x0,y0,z0 - center for scatter plots. -% ScatterStyle - symbols for scatter plots. -% LineStyle - same as ScatterStyle. -% IsosurfValues - constants for isosurfaces -% IsosurfColors - colors for isosurfaces. -% UserMap1d - set to 1 if 'map1d' file exists. -% -% All parameters can be modified by typing 'k' at the PLOTCLAW3 prompt. -% -% See also PLOTCLAW3, setPlotGrid, setPlotGridEdges. - -OutputDir = '_output'; - -setviews; % set viewpoints so that view(xSlice), for example, can be used. - - -PlotType = 1; % type of plot to produce: - % 1 = pcolor on slices (with optional contours, - % and isosurfaces) - % 2 = contour lines in 3d on transparent slices - % 3 = Schlieren plot on slices - % 4 = scatter plot of q vs. r - -mq = 1; % which component of q to plot -UserVariable = 0; % set to 1 to specify a user-defined variable -UserVariableFile = ' '; % name of m-file mapping data to q -MappedGrid = 0; % set to 1 if mapc2p.m exists for nonuniform grid -MaxFrames = 1000; % max number of frames to loop over -MaxLevels = 6; % max number of AMR levels - -PlotData = [1 1 1 0 0 0]; % Data on refinement level k is plotted only - % if k'th component is nonzero -PlotGrid = [0 0 0 0 0 0]; % Plot grid lines on each level? -PlotGridEdges = [0 0 0 0 0 0]; % Plot edges of patches of each grid at - % this level on slices? -PlotCubeEdges = [0 0 0 0 0 0]; % Plot edges of cube of refinement patch at - % this level? - -% --------------------------------------------------------------------- -% The next three parameters are vectors of x,y,z coordinates of 2d slices -% to be displayed for PlotType = 1,2,3. -% Empty ==> no slices in that direction. - -xSliceCoords = [0.0, 0.5]; -ySliceCoords = 0.5; -zSliceCoords = 0.5; - -% --------------------------------------------------------------------- -% ContourValues is a vector of values used to draw contour lines. -% The valid settings for this parameter are identical to those used by the -% Matlab contour plotting routine. See also CONTOUR. In particular: -% If ContourValues is the empty matrix, no contour lines will be drawn. -% If ContourValues is a vector, these values will be used for contours. -% If ContourValues is an integer, this number of levels will be drawn, -% with values chosen based on the data. (May not work well with -% AMR data since different levels may be chosen on different grids. - -ContourValues = []; - -% --------------------------------------------------------------------- -% Isosurfaces. Plot surfaces at q = IsosurfValue(i) -% If empty, no isosurfaces will be drawn. - -IsosurfValues = []; - -IsosurfColors = 'b'; % Colors for each surface. - % Set to 'q' to get colors from the - % current colormaps. Use STRVCAT to get - % multiple colors, i.e. strvcat('b','r','g','y'); - -% --------------------------------------------------------------------- -% plot q(r) vs. r = sqrt((x-x0)^2 + (y-y0)^2 + (z-z0)^2); -% for scatter plot (PlotType==4): -% The default is to plot q(i,j,k) vs. -% r(i,j,k) = (x(i,j,k)-x0)^2 + (y(i,j,k)-y0)^2 + (z(i,j,k)-z0)^2 -x0 = 0.5; -y0 = 0.5; -z0 = 0.5; - -UserMap1d = 0; % set to 1 and provide map1d.m file to specify a different - % mapping of (x,y,z,q) to (r,q) for scatter plots. - -ScatterStyle = setplotstyle('ro','bx','k.','rs','bv','k^'); -% determines symbol and color for plotting scatter data on -% each refinement level. diff --git a/tests/acoustics_3d_heterogeneous/setprob.f b/tests/acoustics_3d_heterogeneous/setprob.f deleted file mode 100644 index 8c5731c..0000000 --- a/tests/acoustics_3d_heterogeneous/setprob.f +++ /dev/null @@ -1,22 +0,0 @@ - subroutine setprob - implicit double precision (a-h,o-z) - common /comaux/ z1,c1,z2,c2 -c -c # Set the material parameters for the acoustic equations -c - !open(unit=7,file='setprob.data',status='old',form='formatted') - call opendatafile(7, 'setprob.data') -c -c # Piecewise constant medium with single interface as specified -c # in setaux.f - -c # Impedance and sound speed in the two materials: - - read(7,*) z1 - read(7,*) c1 - read(7,*) z2 - read(7,*) c2 - - return - end - diff --git a/tests/acoustics_3d_heterogeneous/setrun.py b/tests/acoustics_3d_heterogeneous/setrun.py deleted file mode 100644 index 06d41ce..0000000 --- a/tests/acoustics_3d_heterogeneous/setrun.py +++ /dev/null @@ -1,248 +0,0 @@ -""" -Module to set up run time parameters for Clawpack -- classic code. - -The values set in the function setrun are then written out to data files -that will be read in by the Fortran code. - -""" - -from __future__ import absolute_import -import os -import numpy as np - -#------------------------------ -def setrun(claw_pkg='classic'): -#------------------------------ - - """ - Define the parameters used for running Clawpack. - - INPUT: - claw_pkg expected to be "classic" for this setrun. - - OUTPUT: - rundata - object of class ClawRunData - - """ - - from clawpack.clawutil import data - - - assert claw_pkg.lower() == 'classic', "Expected claw_pkg = 'classic'" - - num_dim = 3 - rundata = data.ClawRunData(claw_pkg, num_dim) - - #------------------------------------------------------------------ - # Problem-specific parameters to be written to setprob.data: - #------------------------------------------------------------------ - probdata = rundata.new_UserData(name='probdata',fname='setprob.data') - probdata.add_param('z1', 2., 'Impedance in lower part of domain') - probdata.add_param('c1', 2., 'Sound speed in lower part of domain') - probdata.add_param('z2', 1., 'Impedance in upper part of domain') - probdata.add_param('c2', 1., 'Sound speed in upper part of domain') - - #------------------------------------------------------------------ - # Standard Clawpack parameters to be written to claw.data: - #------------------------------------------------------------------ - - clawdata = rundata.clawdata # initialized when rundata instantiated - - - # --------------- - # Spatial domain: - # --------------- - - # Number of space dimensions: - clawdata.num_dim = 3 - - # Lower and upper edge of computational domain: - clawdata.lower[0] = -1. # xlower - clawdata.upper[0] = 1. # xupper - clawdata.lower[1] = -1. # ylower - clawdata.upper[1] = 1. # yupper - clawdata.lower[2] = -1. # zlower - clawdata.upper[2] = 1. # zupper - - # Number of grid cells: - clawdata.num_cells[0] = 20 # mx - clawdata.num_cells[1] = 20 # my - clawdata.num_cells[2] = 20 # mz - - - # --------------- - # Size of system: - # --------------- - - # Number of equations in the system: - clawdata.num_eqn = 4 - - # Number of auxiliary variables in the aux array (initialized in setaux) - clawdata.num_aux = 2 - - # Index of aux array corresponding to capacity function, if there is one: - clawdata.capa_index = 0 - - - # ------------- - # Initial time: - # ------------- - - clawdata.t0 = 0. - - - # Restart from checkpoint file of a previous run? - # Note: If restarting, you must also change the Makefile to set: - # RESTART = True - # If restarting, t0 above should be from original run, and the - # restart_file 'fort.chkNNNNN' specified below should be in - # the OUTDIR indicated in Makefile. - - clawdata.restart = False # True to restart from prior results - clawdata.restart_file = 'fort.chk00006' # File to use for restart data - - - # ------------- - # Output times: - #-------------- - - # Specify at what times the results should be written to fort.q files. - # Note that the time integration stops after the final output time. - - clawdata.output_style = 1 - - if clawdata.output_style==1: - # Output ntimes frames at equally spaced times up to tfinal: - # Can specify num_output_times = 0 for no output - clawdata.num_output_times = 2 - clawdata.tfinal = 1.0 - clawdata.output_t0 = True # output at initial (or restart) time? - - elif clawdata.output_style == 2: - # Specify a list or numpy array of output times: - # Include t0 if you want output at the initial time. - clawdata.output_times = [0., 0.1] - - elif clawdata.output_style == 3: - # Output every step_interval timesteps over total_steps timesteps: - clawdata.output_step_interval = 2 - clawdata.total_steps = 4 - clawdata.output_t0 = True # output at initial (or restart) time? - - - clawdata.output_format = 'ascii' # 'ascii', 'binary', 'netcdf' - - clawdata.output_q_components = 'all' # could be list such as [True,True] - clawdata.output_aux_components = 'none' # could be list - clawdata.output_aux_onlyonce = True # output aux arrays only at t0 - - - # --------------------------------------------------- - # Verbosity of messages to screen during integration: - # --------------------------------------------------- - - # The current t, dt, and cfl will be printed every time step - # at AMR levels <= verbosity. Set verbosity = 0 for no printing. - # (E.g. verbosity == 2 means print only on levels 1 and 2.) - clawdata.verbosity = 1 - - - - # -------------- - # Time stepping: - # -------------- - - # if dt_variable==True: variable time steps used based on cfl_desired, - # if dt_variable==False: fixed time steps dt = dt_initial always used. - clawdata.dt_variable = True - - # Initial time step for variable dt. - # (If dt_variable==0 then dt=dt_initial for all steps) - clawdata.dt_initial = 0.01 - - # Max time step to be allowed if variable dt used: - clawdata.dt_max = 1.e9 - - # Desired Courant number if variable dt used - clawdata.cfl_desired = 0.9 - # max Courant number to allow without retaking step with a smaller dt: - clawdata.cfl_max = 1. - - # Maximum number of time steps to allow between output times: - clawdata.steps_max = 50000 - - - # ------------------ - # Method to be used: - # ------------------ - - # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters - clawdata.order = 2 - - # Use dimensional splitting? (not yet available for AMR) - clawdata.dimensional_split = 'unsplit' - - # For unsplit method, transverse_waves can be - # 0 ==> donor cell (only normal solver used) - # 10 ==> transverse terms - # 11 ==> double transverse terms too - # 22 ==> 2nd order corrections too - clawdata.transverse_waves = 22 - - - # Number of waves in the Riemann solution: - clawdata.num_waves = 2 - - # List of limiters to use for each wave family: - # Required: len(limiter) == num_waves - # Some options: - # 0 or 'none' ==> no limiter (Lax-Wendroff) - # 1 or 'minmod' ==> minmod - # 2 or 'superbee' ==> superbee - # 3 or 'vanleer' ==> van Leer - # 4 or 'mc' ==> MC limiter - clawdata.limiter = [3,3] - - clawdata.use_fwaves = False # True ==> use f-wave version of algorithms - - # Source terms splitting: - # src_split == 0 or 'none' ==> no source term (src routine never called) - # src_split == 1 or 'godunov' ==> Godunov (1st order) splitting used, - # src_split == 2 or 'strang' ==> Strang (2nd order) splitting used, not recommended. - clawdata.source_split = 'none' - - - # -------------------- - # Boundary conditions: - # -------------------- - - # Number of ghost cells (usually 2) - clawdata.num_ghost = 2 - - # Choice of BCs at xlower and xupper: - # 0 or 'user' => user specified (must modify bcNamr.f to use this option) - # 1 or 'extrap' => extrapolation (non-reflecting outflow) - # 2 or 'periodic' => periodic (must specify this at both boundaries) - # 3 or 'wall' => solid wall for systems where q(2) is normal velocity - - clawdata.bc_lower[0] = 'extrap' # at xlower - clawdata.bc_upper[0] = 'extrap' # at xupper - - clawdata.bc_lower[1] = 'extrap' # at ylower - clawdata.bc_upper[1] = 'extrap' # at yupper - - clawdata.bc_lower[2] = 'extrap' # at zlower - clawdata.bc_upper[2] = 'user' # at zupper - - return rundata - - # end of function setrun - # ---------------------- - - -if __name__ == '__main__': - # Set up run-time parameters and write all data files. - import sys - rundata = setrun(*sys.argv[1:]) - rundata.write() - From a4c08996cb6cb4c13cf8262a1d5edd7acb9359b3 Mon Sep 17 00:00:00 2001 From: Kyle Mandli Date: Fri, 7 Feb 2025 09:34:05 -0500 Subject: [PATCH 11/11] Add better description and links to README --- README.md | 7 +++++++ README.txt | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 README.md delete mode 100644 README.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..7286992 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Classic Clawpack + +This package hosts the single-grid version of the Clawpack code. All of the Clawpack solvers include the *classic* algorithms described in [LeVeque-FVMHP](https://www.clawpack.org/fvmhp_materials/) [DOI](https://doi.org/10.1017/CBO9780511791253). + +**Links** + - [Documentation](https://www.clawpack.org/) + - ![Tests](https://github.com/clawpack/classic/actions/workflows/testing.yml/badge.svg) diff --git a/README.txt b/README.txt deleted file mode 100644 index de65352..0000000 --- a/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Classic Clawpack - -This package hosts the original version of the single-grid Clawpack code. - -![Tests](https://github.com/clawpack/classic/actions/workflows/testing.yml/badge.svg) - -- [Documentation](https://www.clawpack.org) \ No newline at end of file