Welcome to E8 :: [eon8]

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll also be able to use the shoutbox, customize your profile, change themes, gain reputation points for submitting content, while also communicating with other members via your own private messenger, plus much more!

 

This message will be removed once you have signed in.

Sign in to follow this  
kxrxoxnxixc

Weird...I posted some fortran code

13 posts in this topic

Mmm...same thought I had, perhaps Fortran is too old school for most recent browsers to realize it belongs in a code block or something. IDK, still weird though, you would think it wouldn't really matter, but either way, fortran looks like a bitch, literally, you have to tell it to to do EVERYTHING you want it to do. The new languages spoil us new coders.

Share this post


Link to post
Share on other sites

When I go fix computers sometimes I get old people who used to code with it. They say it was really difficult to deal with.

Maybe try posting it without putting it in a code box.

Share this post


Link to post
Share on other sites

Yeah ill try to, IDK it looked super tough...like if something is supposed to move five places, you tell it to move five places with five different commands, or atleast that what it looked like.

Share this post


Link to post
Share on other sites

***So here is like, 1/100th of the source code***

I decided that I had to treat boundary conditions as follows:

!

! The reduced solution is represented as Y = Y0 + YBC*cbc + YFE*cfe

!

! Here, Y0 is the point at which the basis was generated.

! Each column of YBC corresponds to the flow solution of the problem

! at Y0 with boundary conditions differentiated with respect to

! parameter I. The YFE stuff is as usual.

!

implicit none

!

! Set parameters that are independent.

!

integer, parameter :: liv = 60

integer, parameter :: maxbcrb = 3

integer, parameter :: maxferb = 6

integer, parameter :: maxnx = 31

integer, parameter :: maxny = 31

integer, parameter :: maxparb = 5

integer, parameter :: maxparf = 5

!

! Set parameters that are dependent on parameters.

!

! The assignment of LDAFL should really read (ldafl = 29*min(nx,ny)).

!

integer, parameter :: ldafl = 29 * maxny

integer, parameter :: maxcofrb = maxbcrb + maxferb

integer, parameter :: maxelm = 2 * ( maxnx - 1 ) * ( maxny - 1 )

integer, parameter :: maxnfl = &

2 * ( 2 * maxnx - 1 ) * ( 2 * maxny - 1 ) + maxnx * maxny

integer, parameter :: maxnp = ( 2 * maxnx - 1 ) * ( 2 * maxny - 1 )

integer, parameter :: maxpar = maxparb + maxparf + 1

!

! Set parameters that are dependent on parameters that are dependent

! on parameters.

!

integer, parameter :: lv = 78+maxpar*(maxpar+21)/2

!

double precision afl(ldafl,maxnfl)

double precision arb(maxcofrb,maxcofrb)

double precision area(3,maxelm)

character ( len = 9 ) chtime

character ( len = 80 ) command

double precision cost

double precision cost0

double precision costb

double precision costp

double precision costu

double precision costv

character ( len = 8 ) date

double precision detlog

double precision detman

double precision difcof(maxcofrb)

character ( len = 30 ) disfil

double precision dopt(maxpar)

double precision dpar

double precision drey

logical dvneq

logical echo

double precision epsdif

character ( len = 2 ) eqn(maxnfl)

real estart

real estop

double precision etaq(3)

double precision factj

double precision gfl(maxnfl)

double precision gflafl(maxnfl)

double precision gflnrm

double precision gflopt(maxnfl)

double precision gflrb(maxnfl)

double precision gflsav(maxnfl)

double precision gflsen(maxnfl)

double precision gfltar(maxnfl)

double precision gfltay(maxnfl)

double precision gfltmp(maxnfl)

double precision grb(maxcofrb)

double precision grbarb(maxcofrb)

double precision grbopt(maxcofrb)

double precision grbsav(maxcofrb)

double precision grbsen(maxcofrb)

double precision grbtay(maxcofrb)

character ( len = 20 ) gridx

character ( len = 20 ) gridy

double precision gsen(maxcofrb)

double precision hx

double precision hy

integer i

integer ibs

integer ibump

integer icolrb(maxcofrb)

integer ierror

integer ifs

integer ihi

integer ijac

integer ilo

integer indx(3,maxnp)

integer info

integer iopt(maxpar)

integer ipar

integer ipivfl(maxnfl)

integer ipivrb(maxcofrb)

integer iprint

integer isotri(maxelm)

integer itemp

integer ival

integer ival1

integer ival2

integer ivopt(liv)

integer iwrite

integer j

integer jhi

integer jlo

integer jtay

integer klo

integer lchar

integer lenc

logical s_eqi

integer maxnew

integer maxopt

integer maxsim

integer mhi

integer mlo

integer nbcrb

integer ncofrb

integer nelem

integer neqnfl

integer nferb

integer nhi

integer nlband

integer nlo

integer node(6,maxelm)

integer nodelm(maxnp)

integer np

integer npar

integer nparb

integer nparf

integer npe

integer nprof(2*maxny-1)

integer nsenfl

integer ntay

integer numdif

integer numnew

integer numopt

integer numsim

integer nx

integer ny

double precision p(maxnp)

double precision par(maxpar)

double precision parafl(maxpar)

double precision pararb(maxpar)

double precision pardif ( maxpar)

double precision paropt(maxpar)

double precision parrb(maxpar)

double precision parsav(maxpar)

double precision parsen(maxpar)

double precision partar(maxpar)

double precision phifl(3,6,10,maxelm)

double precision phirb(3,maxcofrb,15,maxelm)

double precision rb(maxnfl,maxcofrb)

character ( len = 20 ) region

double precision resfl(maxnfl)

double precision resflsav(maxnfl)

double precision resfltmp(maxnfl)

double precision resrb(maxcofrb)

double precision reynld

double precision reytay

double precision rbase(maxcofrb,maxcofrb)

double precision rmax

double precision senfl(maxnfl,maxcofrb)

double precision senrb(maxcofrb,maxcofrb)

double precision splbmp(maxparb+2)

double precision splflo(maxparf)

real tarray(2)

double precision taubmp(maxparb+2)

double precision tauflo(maxparf)

character ( len = 30 ) tecfil

double precision temp

character ( len = 10 ) time

double precision tolnew

double precision tolopt

double precision tolsim

character ( len = 10 ) tstart

character ( len = 10 ) tstop

double precision u(maxnp)

double precision v(maxnp)

double precision value

double precision vopt(lv)

double precision wateb

double precision watep

double precision wateu

double precision watev

double precision wquad(3)

double precision xbl

double precision xbr

double precision xc(maxnp)

double precision xmax

double precision xmin

double precision xopt(maxpar)

double precision xprof

double precision xquad(3,maxelm)

double precision xrange

double precision xsiq(3)

double precision ybl

double precision ybr

double precision yc(maxnp)

double precision ymax

double precision ymin

double precision yquad(3,maxelm)

double precision yrange

!

call timestamp ( )

iprint = 1

!

! Get initial CPU clock reading.

!

call etime ( tarray )

estart = tarray(1) + tarray(2)

echo = .false.

call hello ( maxnx, maxny )

!

! Get the starting time.

!

call date_and_time ( date, time )

tstart = time

!

! Open the file in which we record the user input.

!

open ( unit = 17, file = 'arby.in', status = 'replace' )

write ( *, '(a)' ) ' '

write ( *, '(a)' ) 'ARBY4 - Init: Initialize all data.'

call init(afl,arb,area,command,cost,costb,costp,costu, &

costv,difcof,disfil,drey,epsdif,eqn,etaq,gfl,gflafl, &

gflrb,gflsav,gflsen,gfltar,gfltay,grb,grbarb,grbsav, &

grbsen,grbtay,gridx,gridy,hx,hy,ibs,ibump,icolrb,ierror, &

ifs,ihi,ijac,ilo,indx,iopt,ipar, &

ipivfl,ipivrb,isotri,iwrite,jhi,jlo, &

ldafl,maxcofrb,maxelm,maxnew,maxnfl,maxnp, &

maxny,maxopt,maxpar,maxparb,maxparf,maxsim, &

nbcrb,ncofrb,nelem,neqnfl,nferb, &

nlband,node,nodelm,np,npar,nparb,nparf,npe,nprof,nsenfl,ntay, &

numnew,numopt,numsim,nx, &

ny,par,parafl,pararb,pardif,parrb,parsav,parsen,partar, &

phifl,phirb,rbase,rb,region,resfl,resflsav,resrb,reynld, &

reytay,senfl, &

senrb,splbmp,splflo,taubmp,tauflo,tecfil,tolnew,tolopt, &

tolsim,value,wateb,watep,wateu,watev,wquad,xbl,xbr, &

xc,xmax,xmin,xprof,xquad,xrange,xsiq, &

ybl,ybr,yc,ymax,ymin,yquad,yrange)

!

! Read the next command from the user

!

10 continue

if ( iprint > 0 ) then

write ( *, '(a)' ) ' '

write ( *, '(a)' ) 'Enter command:'

end if

11 continue

read ( *, '(a)', end = 110, err = 120 ) command

if ( echo ) then

write ( *, '(a)' ) trim ( command )

end if

write ( 17, '(a)' ) trim ( command )

!

! Check for output-suppressing semicolon at end.

!

if ( lenc > 0 ) then

if ( command(lenc:lenc) == ';' ) then

iprint = 0

command(lenc:lenc) = ' '

lenc = lenc-1

else

iprint = 1

end if

end if

15 continue

if ( command(1:1) == '#') then

go to 11

else if ( command == ' ') then

go to 11

end if

if ( iprint > 0) then

write ( *, '(a)' ) ' '

end if

!

! COMPARE

!

if ( s_eqi ( command,'compare')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - Compare:'

write ( *, '(a)' ) ' Compare full solutions GFL and GFLSAV.'

end if

call fxfl(area,eqn,gfl,ifs,indx,nelem,neqnfl,node,np,npar,nparf, &

par,phifl,region,resfl,splflo,tauflo,xrange,yc,yrange)

call fxfl(area,eqn,gflsav,ifs,indx,nelem,neqnfl,node,np,npar, &

nparf,par,phifl,region,resflsav,splflo,tauflo,xrange,yc,yrange)

gfltmp(1:neqnfl) = gfl(1:neqnfl) - gflsav(1:neqnfl)

resfltmp(1:neqnfl) = resfl(1:neqnfl) - resflsav(1:neqnfl)

call nrmflo ( gfltmp, indx, neqnfl, np, resfltmp )

!

! COSTFL

!

else if ( s_eqi ( command,'costfl')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - Cost FL:'

write ( *, '(a)' ) ' Evaluate the cost function for GFL.'

write ( *, '(a)' ) ' '

end if

call getcst(cost,costb,costp,costu,costv,gfl,gfltar,indx,neqnfl,np, &

nparb,nprof,ny,splbmp,taubmp,wateb,watep,wateu,watev,xbl,xbr,ybl,ybr,yc)

write ( *, '(a,g14.6)' ) 'Cost of GFL:',cost

!

! COSTRB

!

else if ( s_eqi ( command,'costrb')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - Cost RB:'

write ( *, '(a)' ) ' Evaluate the cost function for GRB.'

write ( *, '(a)' ) ' '

end if

call grb2fl(gfl,gflrb,grb,maxnfl,ncofrb,neqnfl,rb)

call getcst(cost,costb,costp,costu,costv,gfl,gfltar,indx,neqnfl,np, &

nparb,nprof,ny,splbmp,taubmp,wateb,watep,wateu,watev,xbl,xbr,ybl,ybr,yc)

write ( *, '(a,g14.6)' ) 'Cost of GRB:',cost

!

! DETFPFL

!

else if ( s_eqi ( command,'detfpfl')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - DET FP FL'

write ( *, '(a)' ) ' Compute determinant of full jacobian.'

end if

call fpfl(afl,area,eqn,gfl,indx,ldafl,maxelm,nelem,neqnfl, &

nlband,node,np,npar,par,phifl)

call dfacfl(afl,ldafl,neqnfl,nlband,nlband,ipivfl,info)

call ddetfl(afl,detlog,detman,ipivfl,ldafl,neqnfl,nlband,nlband)

write ( *, '(a,g14.6,a,g14.6)' ) 'Determinant = ', detman, &

' * 10 ** ', detlog

!

! DETFPRB

!

else if ( s_eqi ( command,'detfprb')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - DET FP RB'

write ( *, '(a)' ) ' Compute the reduced jacobian,'

write ( *, '(a)' ) ' and its determinant.'

end if

call fprb(arb,area,grb,indx,maxcofrb,maxelm,maxnfl,nbcrb, &

ncofrb,nelem,nferb,node,np,nx,ny,phirb,rb,reynld,xc,xrange,yc,yrange)

call dfacrb(arb,maxcofrb,ncofrb,ipivrb,info)

call ddetrb(arb,detlog,detman,ipivrb,maxcofrb,ncofrb)

write ( *, '(a,g14.6,a,g14.6)' ) 'Determinant = ', detman, &

' * 10 ** ', detlog

!

! DIFFPRB

!

else if ( s_eqi ( command,'diffprb')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - DIF FP RB'

write ( *, '(a)' ) ' Estimate reduced jacobian by finite diff.'

end if

pararb(1:npar) = par(1:npar)

grbarb(1:ncofrb) = grb(1:ncofrb)

arb(1:maxcofrb,1:maxcofrb) = 0.0D+00

call diffprb(arb,area,epsdif,grb,indx,maxcofrb,maxelm, &

maxnfl,nbcrb,ncofrb,nelem,nferb,node,np,npar,nparf,nx, &

ny,par,phirb,rb,resrb,reynld,tauflo,xc,xrange,yc,yrange)

!

! DIFSENFL

!

else if ( s_eqi ( command,'difsenfl')) then

if ( ipar <= 0 .or. ipar > npar) then

write ( *, '(a)' ) ' '

write ( *, '(a)' ) 'ARBY4 - Warning!'

write ( *, '(a)' ) ' Cancelling the DIFSENFL command.'

write ( *, '(a,i6)' ) ' IPAR = ',ipar

write ( *, '(a)' ) ' but IPAR must be at least 0'

write ( *, '(a,i6)' ) ' and no more than NPAR = ',npar

go to 10

end if

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - DifSenFL:'

write ( *, '(a)' ) ' Estimate full solution sensitivity '

write ( *, '(a)' ) ' with respect to parameter ',ipar

write ( *, '(a)' ) ' via finite differences.'

end if

ipar = npar

dpar = drey

parsen(1:npar) = par(1:npar)

gflsen(1:neqnfl) = gfl(1:neqnfl)

call difsenfl(afl,area,difcof,dpar,eqn,gfl,gflafl,ifs,ijac,indx,ipar, &

ipivfl,iwrite,ldafl,maxcofrb,maxelm,maxnew,maxnfl,ncofrb,nelem,neqnfl, &

nlband,node,np,npar,nparf,par,parafl,phifl,region,resfl,senfl,splflo, &

tauflo,tolnew,xrange,yc,yrange)

!

! DIFSENRB

!

else if ( s_eqi ( command,'difsenrb')) then

if ( ipar <= 0.or.ipar > npar) then

write ( *, '(a)' ) ' '

write ( *, '(a)' ) 'ARBY4 - Warning!'

write ( *, '(a)' ) ' Cancelling the DIFSENRB command.'

write ( *, '(a,i6)' ) ' IPAR = ', ipar

write ( *, '(a)' ) ' but IPAR must be at least 0'

write ( *, '(a,i6)' ) ' and no more than NPAR = ', npar

go to 10

end if

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - Dif Sen RB:'

write ( *, '(a)' ) ' Estimate reduced solution sensitivity '

write ( *, '(a,i6)' ) ' with respect to parameter ', ipar

write ( *, '(a)' ) ' via finite differences.'

end if

ipar = npar

dpar = drey

parsen(1:npar) = par(1:npar)

grbsen(1:ncofrb) = grb(1:ncofrb)

call difsenrb(arb,area,difcof,dpar,grb,grbarb,indx,ipar,ipivrb,iwrite, &

maxcofrb,maxelm,maxnew,maxnfl,nbcrb,ncofrb,nelem,nferb,node,np,npar, &

nparf,nx,ny,par,pararb,phirb,rb,resrb,senrb,tauflo,tolnew,xc,xrange, &

yc,yrange)

!

! DisPlot

!

else if ( s_eqi ( command,'displot')) then

if ( iprint > 0) then

write ( *, '(a)' ) 'ARBY4 - DisPlot: Write data to DISPLAY plot file.'

end if

call intprs(gfl,indx,nelem,neqnfl,node,np,p)

u(1:np) = gfl(indx(1,1:np))

v(1:np) = gfl(indx(2,1:np))

Share this post


Link to post
Share on other sites

Which according to calculus can be done, because technically you never get to zero, but arbitrarily close such that it is considered zero. something like:0.0000000000000000000000000000000000000000000000000000000000000000000000000

00001

>.< calc is wicked. Can't wait for calc II e.e

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this