Skip to content

Commit

Permalink
Merge branch 'sharpclaw2d'
Browse files Browse the repository at this point in the history
  • Loading branch information
ketch committed May 22, 2011
2 parents 6b2d971 + 2994e81 commit 69c3a1d
Show file tree
Hide file tree
Showing 77 changed files with 967 additions and 2,547 deletions.
49 changes: 46 additions & 3 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
FC ?= gfortran
F2PY ?= f2py

ONE_D_CLASSIC = $(PYCLAW)/src/fortran/1d/classic

TWO_D_CLASSIC ?= $(PYCLAW)/src/fortran/2d/classic
TWO_D_CLASSIC = $(PYCLAW)/src/fortran/2d/classic

ONE_D_SHARPCLAW ?= $(PYCLAW)/src/fortran/1d/sharpclaw
ONE_D_SHARPCLAW = $(PYCLAW)/src/fortran/1d/sharpclaw

TWO_D_SHARPCLAW ?= $(PYCLAW)/src/fortran/2d/sharpclaw
TWO_D_SHARPCLAW = $(PYCLAW)/src/fortran/2d/sharpclaw

ONE_D_CLASSIC_SOURCES = $(ONE_D_CLASSIC)/step1.f $(ONE_D_CLASSIC)/limiter.f $(ONE_D_CLASSIC)/philim.f

ONE_D_SHARPCLAW_SOURCES = $(ONE_D_SHARPCLAW)/flux1.f90 $(ONE_D_SHARPCLAW)/reconstruct.f90 $(ONE_D_SHARPCLAW)/workspace.f90 $(ONE_D_SHARPCLAW)/ClawParams.f90

#TWO_D_CLASSIC_SOURCES = $(TWO_D_CLASSIC)/dimsp2.f $(TWO_D_CLASSIC)/step2ds.f $(TWO_D_CLASSIC)/flux2.f $(ONE_D_CLASSIC)/limiter.f $(ONE_D_CLASSIC)/philim.f

TWO_D_SHARPCLAW_SOURCES = $(TWO_D_SHARPCLAW)/workspace.f90 $(TWO_D_SHARPCLAW)/ClawParams.f90 $(ONE_D_SHARPCLAW)/reconstruct.f90 $(TWO_D_SHARPCLAW)/flux1.f90 $(TWO_D_SHARPCLAW)/flux2.f90

TWO_D_CLASSIC_SOURCES = $(TWO_D_CLASSIC)/dimsp2.f step2ds.o flux2.o limiter.o philim.o

classic1.so: $(ONE_D_CLASSIC_SOURCES) $(RP_SOURCE)
${F2PY} -m classic1 -c $^

sharpclaw1.so: $(ONE_D_SHARPCLAW_SOURCES) $(RP_SOURCE)
${F2PY} -m sharpclaw1 -c $(ONE_D_SHARPCLAW_SOURCES) $(RP_SOURCE)


classic2.so: $(TWO_D_CLASSIC_SOURCES) $(RP_SOURCE)
${F2PY} -m classic2 -c $(TWO_D_CLASSIC_SOURCES) $(RP_SOURCE)

sharpclaw2.so: $(TWO_D_SHARPCLAW_SOURCES) $(RP_SOURCE)
${F2PY} -m sharpclaw2 -c $(TWO_D_SHARPCLAW_SOURCES) $(RP_SOURCE)

step2ds.o: $(TWO_D_CLASSIC)/step2ds.f
$(FC) -o step2ds.o -c $(TWO_D_CLASSIC)/step2ds.f

flux2.o: $(TWO_D_CLASSIC)/flux2.f
$(FC) -o flux2.o -c $(TWO_D_CLASSIC)/flux2.f

limiter.o: $(ONE_D_CLASSIC)/limiter.f
$(FC) -o limiter.o -c $(ONE_D_CLASSIC)/limiter.f

philim.o: $(ONE_D_CLASSIC)/philim.f
$(FC) -o philim.o -c $(ONE_D_CLASSIC)/philim.f

clean:
rm -f *.o *.so *.pyc *.log

clobber: clean
rm -rf _output/
rm -rf _plots/
28 changes: 6 additions & 22 deletions apps/acoustics/1d/homogeneous/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
PYCLAWMAKE = $(PYCLAW)/Makefile.common

include $(PYCLAWMAKE)

# This makefile uses the Fortran compiler and flags from PETSc. This
# means that PETSc needs to be configured with Fortran support which
# would otherwise not be necessary. However, using arbitrary environment
Expand All @@ -10,40 +8,26 @@ include $(PYCLAWMAKE)

FCOMPILE_SINGLE = ${FC} -c ${FC_FLAGS} ${FFLAGS} ${FCPPFLAGS}

LIBOBJ = \
limiter.o \
philim.o

STEP1_SOURCE = ${ONE_D_CLASSIC}/step1.f $(RIEMANN)/src/rp1_acoustics.f
RP_SOURCE = $(RIEMANN)/src/rp1_acoustics.f

F2PY = f2py
PYTHON = python
MODULE = assembly

all: step1.so flux1.so ${MODULE}.so

step1.so: $(STEP1_SOURCE) $(LIBOBJ)
${F2PY} -m step1 -c $^

flux1.so: $(ONE_D_SHARPCLAW)/flux1.f90 $(SOURCE)
f2py -m flux1 -c $(ONE_D_SHARPCLAW)/flux1.f90 $(RIEMANN)/src/rp1_acoustics.f $(ONE_D_SHARPCLAW)/reconstruct.f90 $(ONE_D_SHARPCLAW)/workspace.f90
all: classic1.so sharpclaw1.so ${MODULE}.so

${MODULE}.so: ${MODULE}.pyx ${MODULE}impl.h ${MODULE}impl.c petscdadef.h
CC='${PCC}' CFLAGS='${PCC_FLAGS}' F90='${FC_LINKER}' FFLAGS='${FFLAGS}' LDFLAGS='${FC_LINKER_FLAGS}' ${PYTHON} setup.py -q build_ext --inplace
${RM} -r build ${MODULE}_wrap.c

limiter.o: $(ONE_D_CLASSIC)/limiter.f
$(FCOMPILE_SINGLE) -c -o $@ $^

philim.o: $(ONE_D_CLASSIC)/philim.f
$(FCOMPILE_SINGLE) -c -o $@ $^

clean:
rm -f *.o *.so *.pyc
rm -f *.o *.so *.pyc *.log

clobber: clean
rm -f -r _output/
rm -f -r _plots
rm -f -r _plots/

include $(PYCLAWMAKE)

include ${PETSC_DIR}/conf/variables

9 changes: 5 additions & 4 deletions apps/acoustics/1d/homogeneous/acoustics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ def acoustics(use_PETSc=False,kernel_language='Fortran',soltype='classic',iplot=
# Import the appropriate classes
#======================================================
if use_PETSc:
from petsc4py import PETSc
import petclaw as myclaw
if soltype=='classic':
from petclaw.evolve.clawpack import PetClawSolver1D as mySolver
elif soltype=='sharpclaw':
from petclaw.evolve.sharpclaw import PetSharpClawSolver1D as mySolver
else: raise Exception('Unrecognized value of soltype.')
from petclaw.controller import Controller
else: #Pure pyclaw
import pyclaw as myclaw
if soltype=='classic':
from pyclaw.evolve.clawpack import ClawSolver1D as mySolver
elif soltype=='sharpclaw':
from pyclaw.evolve.sharpclaw import SharpClawSolver1D as mySolver
else: raise Exception('Unrecognized value of soltype.')
from pyclaw.controller import Controller

from pyclaw.solution import Solution
from petclaw.controller import Controller

#========================================================================
# Instantiate the solver and define the system of equations to be solved
Expand Down Expand Up @@ -63,9 +63,9 @@ def acoustics(use_PETSc=False,kernel_language='Fortran',soltype='classic',iplot=
grid.aux_global['cc']=np.sqrt(rho/bulk)
if kernel_language=='Fortran':
if soltype=='classic':
from step1 import cparam
from classic1 import cparam
elif soltype=='sharpclaw':
from flux1 import cparam
from sharpclaw1 import cparam
for key,value in grid.aux_global.iteritems(): setattr(cparam,key,value)


Expand All @@ -86,6 +86,7 @@ def acoustics(use_PETSc=False,kernel_language='Fortran',soltype='classic',iplot=

claw.solutions['n'] = Solution(grid)
claw.solver = solver
print claw.output_format

claw.nout = 10
claw.outdir = outdir
Expand Down
2 changes: 1 addition & 1 deletion apps/acoustics/1d/homogeneous/acoustics_implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def acoustics(kernel_language='Python',petscPlot=False,iplot=False,htmlplot=Fals
grid.aux_global['bulk']=bulk
grid.aux_global['zz']=np.sqrt(rho*bulk)
grid.aux_global['cc']=np.sqrt(rho/bulk)
from step1 import cparam
from classic1 import cparam
for key,value in grid.aux_global.iteritems(): setattr(cparam,key,value)
grid.meqn=2
if sclaw:
Expand Down
106 changes: 0 additions & 106 deletions apps/acoustics/1d/homogeneous/acoustics_implicit/fort.q0000

This file was deleted.

106 changes: 0 additions & 106 deletions apps/acoustics/1d/homogeneous/acoustics_implicit/fort.q0001

This file was deleted.

Loading

0 comments on commit 69c3a1d

Please sign in to comment.