3 views

Uploaded by jahid

lecture1

- 2017_Sem_1
- Dynamical
- course outline v2
- BCM Brewe Non Linear Stability
- Careers Scott p1
- Fluid Os
- Gaussian Beams
- cv 2pg
- PLMAT 2019 COVERAGE
- Assignment m.e (Elp) Ept&d
- David Brin - An Ever Reddening Glow
- Rtiwari Rd Book 03a
- Math Problems G12-1
- National Science Foundation: nsf06308
- TUGAS DESTILASI NABILA.docx
- 587536
- lec3
- chapter5 home to school connection
- lec8
- 06 mpc jbr stanford

You are on page 1of 19

Sauro Succi

Shasta.f (SHASTA)

Conti.1

c periodic boundary conditions (thru buffers at j=0 and j=NX+1)

c

c //////////////////////////////////////////////////////

c Disclaimer: Just a warm-up example, not a fully

debugged/validated

c no liability is taken for improper use

c S. Succi, AC274, Fall semester 2016

c ----------------------------------------------------------

Conti.2

parameter (NX=100,NM=4)

dimension x(NX),u(0:NX+1),f(0:NX+1),fnew(0:NX+1)

dimension def(NX)

dimension fmom(0:NM),hent(0:NM)

c --------------------------------------

open(31,file='moment.out')

open(32,file='entropy.out')

open(36,file='movie.out')

c --------------------------------------

c baseline parameters and input data

c ifd=0 centered, ifd=1 upwind

write(6,*) 'enter ifd'

read(5,*) ifd

write(6,*) ifd

Nsteps = 100

nout = 2 ! output every 10 steps

sizex = 1.0

dif = 0.0

vel = 0.1

adif = -0.125 ! antidiffusion

dx = sizex/float(nx-1)

Conti.3

cfl = 0.1

dtd = 1.0

if(dif.ne.0.0) dtd = dx*dx/dif

if(vel.ne.0.0) dta = dx/vel

dt = cfl*min(dta,dtd)

write(6,*) 'dx and dt',dx,dt

delta = dif*dt/(dx*dx)

Conti.4

c initial conditions: unnormalized (play with them)

wid = 4

sigma = wid*dx ! play with width

xm = 0.5*(sizex-sigma)

xp = 0.5*(sizex+sigma)

do j=1,NX

x(j) = dx*float(j-1)

c xj = (x(j)-sizex/2)/sigma

c f(j) = exp(-0.5*xj*xj)

c box

f(j) = 0.0

if(x(j).gt.xm.and.x(j).lt.xp) f(j) = 1.0

xj = (x(j)-sizex/2)/(sizex/2)

u(j) = vel*(1-xj*xj)

end do

u(0) = u(nx)

u(nx+1) = u(1)

Conti.5

c time-stepper ---------------------------------

do it=1,Nsteps

f(0) = f(nx)

f(nx+1) = f(1)

do j=1,NX

alfal = u(j-1)*dt/dx

alfac = u(j)*dt/dx

alfar = u(j+1)*dt/dx

c build the tridiagonal coefficients

if(ifd.eq.0) then

c centered conservative (unstable)

a = delta+0.5*alfal

b = delta-0.5*alfar

c = 1.0-2.0*delta

fnew(j) = a*f(j-1)+c*f(j)+b*f(j+1)

endif

Conti.6

c upwind -----------------------------

if(ifd.eq.1) then

if(u(j).gt.0) then

a = alfal+delta ! f(j)-f(j-1)

b = delta

c = 1.-alfac-2.0*delta

else ! f(j+1)-f(j)

a = delta

b = delta-alfar

c = 1.0+alfac-2.0*delta

endif

fnew(j) = a*f(j-1)+c*f(j)+b*f(j+1)

endif

end do

c prepare for new timestep

do j=1,NX

f(j) = fnew(j)

end do

Conti.7

c diagnostics: standard moments, tail moment and entropies

if(mod(it,nout).eq.0) then

do m=0,NM

fmom(m) = 0.0

hent(m) = 0.0

end do

xmom = 0.0

do j=1,NX

fj = f(j)*dx

fmom(0) = fmom(0) + fj

fmom(1) = fmom(1) + fj*x(j)

fmom(2) = fmom(2) + fj*x(j)*x(j)

hent(3) = hent(3) - fj*fj*fj

hent(4) = hent(4) - fj*fj*fj*fj

c probe the tail, should grow exponentially in time

if(x(j).gt.0.99*sizex) xmom=xmom+fj

c output for gnuplot movies

write(36,*) j,f(j),u(j)

end do

Conti.8

c blank lines for gnuplot movies

write(36,'(bn)')

write(36,'(bn)')

c monitor the moments in time

fmean = fmom(1)/fmom(0)

fvar = fmom(2)/fmom(0)-fmean*fmean

write(31,*),

it,fmom(0),fmean,fvar,xmom/fmom(0)

write(32,*), it,hent(2),hent(3),hent(4)

endif

write(6,*) 'completed time

step',it,fmom(0)

c end evolution -----------------------------------------

------------

end do

stop

end

SHASTA.1

SHASTA

c periodic boundary conditions (thru buffers

at j=0 and j=NX+1)

c

/////////////////////////////////////////////////

////////////////////

c Disclaimer: Just a warm-up example, not a

fully debugged/validated

c no liability is taken for improper use

c S. Succi, AC274, Fall semester 2016

SHASTA.2

open(31,file='moment.out')

open(32,file='entropy.out')

open(36,file='movie.out')

c baseline parameters and input data

c 0: no antidif, no limiter, 1: antidif only, 2:

antidif+limiter

write(6,*) 'enter shasta option'

read(5,*) lop

write(6,*) lop

Nsteps = 100

nout = 2 ! output every 10 steps

sizex = 1.0

dif = 0.0

vel = 1.0

adif = -0.125 ! antidiffusion

dx = sizex/float(nx-1)

SHASTA.3

cfl = 0.1

dtd = 1.0

if(dif.ne.0.0) dtd = dx*dx/dif

if(vel.ne.0.0) dta = dx/vel

dt = cfl*min(dta,dtd)

write(6,*) 'dx and dt',dx,dt

delta = dif*dt/(dx*dx)

SHASTA.4

c initial conditions: unnormalized (play wity them)

sigma = 4.0*dx ! play with width

xm = 0.5*(sizex-sigma)

xp = 0.5*(sizex+sigma)

do j=1,NX

x(j) = dx*float(j-1)

c box

f(j) = 0.0

if(x(j).gt.xm.and.x(j).lt.xp) f(j) = 1.0

xj = (x(j)-sizex/2)/(sizex/2)

u(j) = vel*(1-xj*xj)

end do

requires double-neighbor info

u(-1) = u(nx-1)

u(0) = u(nx)

u(nx+1) = u(1)

u(nx+2) = u(2)

SHASTA.5

c time-stepper ---------------------------------

do it=1,Nsteps

f(-1) = f(nx-1)

f(0) = f(nx)

f(nx+1) = f(1)

f(nx+2) = f(2)

do j=1,NX

alfal = u(j-1)*dt/dx

alfac = u(j)*dt/dx

alfar = u(j+1)*dt/dx

ql = (0.5+alfac)/(1.0-(alfal-alfac))

qr = (0.5-alfac)/(1.0+(alfar-alfac))

a = 0.5*ql*ql

b = 0.5*qr*qr

c = ql+qr-0.5*(ql*ql+qr*qr)

fnew(j) = a*f(j-1)+c*f(j)+b*f(j+1)

SHASTA.6

fluxl = 0.0

fluxr = 0.0

if (lop.eq.1) then

fluxr = abs(adif)*(f(j+1)-f(j))

fluxl = adif*(f(j-1)-f(j))

fnew(j) = fnew(j) + fluxl - fluxr

write(6,*) 'lop',lop, fluxl,fluxr

endif

SHASTA.7

c ***************************** WARNING !!!!

c This option is based on eq. 23 of Boris-Book paper

c I did not re-derive myself. Boris-Book only gives the

c rightward flux (fluxr) expression, so there might be an

c ambiguity/error in the way i constructed the left flux (fluxl)

c Their notation leaves several ambiguities on the signs of the fluxes

c so, although it seems to give reasonable results,

c I have no guarantee that the implementation is correct

c ****************************************

SHASTA.8

c flux limiter: compact form

dl1 = f(j-1)-f(j)

dl2 = f(j-2)-f(j-1)

dr1 = f(j+1)-f(j)

dr2 = f(j+2)-f(j+1)

sr1 = 0.0

if(abs(dr1).gt.0.) sr1 = dr1/abs(dr1)

sl1 = 0.0

if(abs(dl1).gt.0.) sl1 = dl1/abs(dl1)

fminr = min(min(dr1*sr1,abs(adif)*abs(dr1)),dr2*sr1)

fluxr = sr1*max(0.0,fminr)

fminl = min(min(dl1*sl1,adif*abs(dl1)),dl2*sl1)

fluxl = sl1*max(0.0,fminl)

c prepare for new timestep

do j=1,NX

f(j) = fnew(j)

end do

SHASTA.9

as in all previous codlets

adr1.f page 7

- 2017_Sem_1Uploaded bySilokshan Balasingam
- DynamicalUploaded byagergsrg
- course outline v2Uploaded byapi-281216761
- BCM Brewe Non Linear StabilityUploaded byMamatha Binu
- Careers Scott p1Uploaded byLinda Muhlhauser
- Fluid OsUploaded byCCristian Cabello Cervantes
- Gaussian BeamsUploaded byAvik Roy
- cv 2pgUploaded byapi-402695723
- PLMAT 2019 COVERAGEUploaded byAsher Manangan
- Assignment m.e (Elp) Ept&dUploaded byEngrAneelKumarAkhani
- David Brin - An Ever Reddening GlowUploaded byl33l00
- Rtiwari Rd Book 03aUploaded bymghgol
- Math Problems G12-1Uploaded byscribd-in-action
- National Science Foundation: nsf06308Uploaded byNSF
- TUGAS DESTILASI NABILA.docxUploaded byNabila Izmi Farikh
- 587536Uploaded byKantarathAphisutarasunthorn
- lec3Uploaded byanon_275995795
- chapter5 home to school connectionUploaded byapi-262315666
- lec8Uploaded byYogita Nathe
- 06 mpc jbr stanfordUploaded byVuongTrinh
- 612_e1_2014_wsol (1)Uploaded byKushal Bn
- Optimal Parabolic Section with Freeboard.docxUploaded byjon
- Correlation Co EFFICIENTUploaded byjegadeeesh
- ATK 2Uploaded bySemoga Membantu
- Berkley_viewcontent_1 (2)Uploaded byRajib Banerjee
- TimeTableefUploaded byRhay Jeevan
- keyUploaded bySatish Tattikota
- Sect Prop XyUploaded byLam Tran
- mixtosUploaded bysergio
- MIT6_01SCS11_11_1_1Uploaded byPablo Gutierrez

- sph matlabUploaded byjahid
- WRE_41_WRE_427_2010-11.pdfUploaded byjahid
- diracdelta1Uploaded byKamuran Aldemir
- diracdelta1Uploaded byKamuran Aldemir
- diffusion.gaussian.kernel.pdf.pdfUploaded byfpttmm
- 62Uploaded bydamavand28
- Chapter-1.pdfUploaded byfrancessich
- Bridge LoadsUploaded byRick Hunter
- WRE_41_WRE_427_2010-11Uploaded byjahid
- Secondary - 2018 - Class - 9 & 10 - Math full.pdf opt.pdfUploaded byjahid
- Adaptive Grid Refinement in FortraneUploaded byjahid
- Delta FunctionUploaded byShaunak Patel
- Chapter 1 - Water Wave MechanicsUploaded byPaul Nguyen
- 4a GIS Fundamentals_raster (2)Uploaded byjahid
- schlickReport.pdfUploaded byma sungsang
- Lectures10 11 PracticeUploaded byjahid
- MaterialUploaded byjahid
- diracdelta1Uploaded byKamuran Aldemir
- Chapter 6 PointerUploaded byjahid
- Stability SPH PaperUploaded byjahid
- HackUploaded byJacob Heckman
- WRE-2013-2014 (L-4,T-2)Uploaded byjahid
- Solving-PDEs-in-C++Uploaded byjahid
- Lecture5 PracticeUploaded byjahid
- WRE-2012-2013 (L-4,T-2)Uploaded byjahid
- lecture6-7practiceUploaded byjahid
- Delta FunctionUploaded byShaunak Patel
- Delta FunctionUploaded byShaunak Patel
- WRE-2014-2015 (L-4,T-2)Uploaded byjahid
- Scientific VisualizationUploaded byjahid

- SE E TC 2015 Course 14 JuneUploaded byAnonymous kT0ONW
- Isi Mtech Cs 04Uploaded byapi-26401608
- Lecture 2 Linear First-Order PDEs.pdfUploaded bySrinivas Jangili
- physicsUploaded byAyam Mas
- 04_Strain_01_Strain.pdfUploaded bySivaMayaSiva
- 5-1 Trigonometric IdentitiesUploaded byseniorss17
- Complex-Variables.pdfUploaded byckvirtualize
- Stats Revision Slides (From Maria Molina-Domene) (1)Uploaded bysai
- 7ce159 (1)Uploaded byashwa
- Bishop 1975Uploaded byDaniel Badiani
- 7.a New Interscale and Intrascale OrthonormalWaveletUploaded byjebilee
- [hsgs.edu.vn] Inequalities_Marathon.pdfUploaded byNguyen Huu Quan
- Adaptive Control 2nd. Edt. by Karl.J.astrom - Solution ManuelUploaded byAji Brahma Nugroho
- V.a. Krechmar-A Problem Book in Algebra-Mir Publishers, Moscow (1978)Uploaded byMarc Hellstroem
- Chapter 5Uploaded byapi-26228448
- Reduction to Canonical (or Normal Form Riemann Method) by md raisinghaniaUploaded bypanka
- Pa 3 AaaaaaaUploaded bySrivenu Chinna
- R-REC-P.1057-2-200708-I!!PDF-EUploaded byAlexander Lopez
- Gas Lift Paper 1Uploaded bymuki10
- HW02 Ch03 Equiv ForcesUploaded byTulong Zhu
- Cantor SetUploaded byJohan Papado
- calculusUploaded byAnonymous ECHdwh5H4
- James Ruse 2000 3U TrialUploaded byBlueZebra
- Stabilization With Relaxed ControlsUploaded byfx_amv
- 20050243020 Vlasov Computation of Prismatic SHellsUploaded byMaliOdKužine
- C0603021013.pdfUploaded bytheijes
- DifferentiationUploaded byPranjal Sharma
- markov_chains_4Uploaded byAravind Raja
- Coupled Oscillators Guide (1)Uploaded byJustin Wong
- Stress HW Solns2Uploaded byAadii Ali