Skip to content

Commit

Permalink
Merge pull request clawpack#7 from rjleveque/shockbubble
Browse files Browse the repository at this point in the history
Shockbubble example added
  • Loading branch information
mandli committed Aug 4, 2013
2 parents cf40416 + 1800622 commit 53846f8
Show file tree
Hide file tree
Showing 10 changed files with 1,074 additions and 0 deletions.
162 changes: 162 additions & 0 deletions euler_2d_shockbubble_amrclaw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@

# 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/2d

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

# Local source for thread tests
SOURCES = \
./fdisc.f \
./qinit.f \
./setaux.f \
./setprob.f \
$(CLAW)/riemann/src/rpn2_euler_5wave.f90 \
$(CLAW)/riemann/src/rpt2_euler_5wave.f90 \
$(AMRLIB)/amr2.f90 \
$(AMRLIB)/bc2amr.f \
$(AMRLIB)/b4step2.f \
$(AMRLIB)/qad.f \
$(AMRLIB)/src2.f \
$(AMRLIB)/src1d.f \
$(AMRLIB)/advanc.f \
$(AMRLIB)/bound.f90 \
$(AMRLIB)/stepgrid.f \
$(AMRLIB)/cellave.f \
$(AMRLIB)/fss.f \
$(AMRLIB)/zeroin.f \
$(AMRLIB)/auxcoarsen.f \
$(AMRLIB)/fixcapaq.f \
$(AMRLIB)/estdt.f \
$(AMRLIB)/init_iflags.f \
$(AMRLIB)/igetsp.f \
$(AMRLIB)/reclam.f \
$(AMRLIB)/birect.f \
$(AMRLIB)/cleanup.f \
$(AMRLIB)/colate2.f \
$(AMRLIB)/bufnst2.f \
$(AMRLIB)/spest2.f \
$(AMRLIB)/flag2refine2.f90 \
$(AMRLIB)/flagregions2.f90 \
$(AMRLIB)/errest.f \
$(AMRLIB)/errf1.f \
$(AMRLIB)/gfixup.f \
$(AMRLIB)/filval.f90 \
$(AMRLIB)/filpatch.f90 \
$(AMRLIB)/prefilp.f90 \
$(AMRLIB)/flglvl2.f \
$(AMRLIB)/flagger.f \
$(AMRLIB)/prepregstep.f \
$(AMRLIB)/prepbigstep.f \
$(AMRLIB)/fluxad.f \
$(AMRLIB)/fluxsv.f \
$(AMRLIB)/ginit.f \
$(AMRLIB)/grdfit2.f \
$(AMRLIB)/intfil.f \
$(AMRLIB)/moment.f \
$(AMRLIB)/nestck2.f \
$(AMRLIB)/prepf.f \
$(AMRLIB)/prepc.f \
$(AMRLIB)/projec2.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.f90 \
$(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)/shiftset2.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)/step2.f90 \
$(AMRLIB)/flux2.f \
$(AMRLIB)/inlinelimiter.f \
$(AMRLIB)/cstore.f \
$(AMRLIB)/saveqc.f \
$(AMRLIB)/valout.f \
$(AMRLIB)/check.f \
$(AMRLIB)/restrt.f \
$(AMRLIB)/dumpgauge.f \
$(AMRLIB)/quick_sort1.f \
$(AMRLIB)/opendatafile.f \
$(AMRLIB)/addflags.f \
$(AMRLIB)/domgrid.f \
$(AMRLIB)/drivesort.f \
$(AMRLIB)/flagcheck.f \
$(AMRLIB)/setdomflags.f \
$(AMRLIB)/setIndices.f \
$(AMRLIB)/setPhysBndry.f \
$(AMRLIB)/setPhysBndryFlags.f \
$(AMRLIB)/coarseGridFlagSet.f \
$(AMRLIB)/griddomcopy.f \
$(AMRLIB)/griddomshrink.f \
$(AMRLIB)/griddomup.f \
$(AMRLIB)/baseCheck.f \
$(AMRLIB)/init_alloc.f90 \
$(AMRLIB)/restrt_alloc.f90 \
$(AMRLIB)/resize_alloc.f90 \
# $(AMRLIB)/resize_alloc_static.f90 \
#-------------------------------------------------------------------
# Include Makefile containing standard definitions and make options:
include $(CLAWMAKE)

test:
echo $(FFLAGS)
4 changes: 4 additions & 0 deletions euler_2d_shockbubble_amrclaw/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

Shock-bubble interaction solved with 2-dimensional axi-symmetric Euler
equations and AMR.

31 changes: 31 additions & 0 deletions euler_2d_shockbubble_amrclaw/fdisc.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
c
c
c
c =================================================
function fdisc(x,y)
c =================================================
implicit double precision (a-h,o-z)
common/cdisc/ x0,y0,alf,beta,r0,idisc
c
c # for computing cell averages for initial data that has a
c # discontinuity along some curve. fdisc should be negative to the
c # left of the curve and positive to the right
c # idisc specifies the nature of the discontinuity for two
c # particular cases (a straight line and circle) but this routine
c # can be modified for any other curve.
c
go to (10,20) idisc
c
10 continue
c # straight line through (x0,y0) with normal (alf,beta) pointing
c # into right state
c
fdisc = (x-x0)*alf + (y-y0)*beta
return
c
20 continue
c # circle of radius r0:
fdisc = (x-x0)**2 + (y-y0)**2 - r0**2
c
return
end
50 changes: 50 additions & 0 deletions euler_2d_shockbubble_amrclaw/qinit.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

c
c
c
c =====================================================
subroutine qinit(maxmx,maxmy,meqn,mbc,mx,my,xlower,ylower,
& dx,dy,q,maux,aux)
c =====================================================
c
c # Set initial conditions for q.
c
implicit double precision (a-h,o-z)
dimension q(meqn,1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc)
common /comic/ qin(5),qout(5)
common /cominf/ rinf,vinf,einf
c
c
do 50 i=1,mx
xlow = xlower + (i-1)*dx
do 20 j=1,my
c # set (xlow,ylow) to lower left corner of grid cell:
ylow = ylower + (j-1)*dy
call cellave(xlow,ylow,dx,dy,win)
c # win is now the fraction of the cell that lies inside the circle
do 10 m=1,meqn
q(m,i,j) = win*qin(m) + (1.d0-win)*qout(m)
10 continue
20 continue
if (xlow .lt. 0.2d0) then
c # behind shock:
do 30 j=1,my
q(1,i,j) = rinf
q(2,i,j) = rinf*vinf
q(3,i,j) = 0.d0
q(4,i,j) = einf
q(5,i,j) = 0.d0
30 continue
end if
c
c if (xlow .lt. 0.5d0) then
c # to give two different values of tracer in bubble
c # for better visualization of motion:
c do 40 j=1,my
c q(5,i,j) = 2.d0*q(5,i,j)
c 40 continue
c end if

50 continue
return
end
21 changes: 21 additions & 0 deletions euler_2d_shockbubble_amrclaw/setaux.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
c ============================================
subroutine setaux(maxmx,maxmy,mbc,mx,my,xlower,ylower,dx,dy,
& maux,aux)
c ============================================
c
c # set auxiliary arrays
c # aux(i,j,1) = y coordinate of cell center for cylindrical source terms
c
c
implicit double precision (a-h,o-z)
dimension aux(maux,1-mbc:maxmx+mbc,1-mbc:maxmy+mbc)
c
do 20 i=1-mbc,mx+mbc
do 10 j=1-mbc,my+mbc
yj = ylower + (j-0.5d0)*dy
aux(1,i,j) = yj
10 continue
20 continue
c
return
end
Loading

0 comments on commit 53846f8

Please sign in to comment.