Re: what is wrong with this code?can someone walk me through this?

"e p chandler" <epc8@xxxxxxxx> wrote in message
On Mar 26, 10:08 pm, madhu0...@xxxxxxxxx wrote:
i did not use any diagnostic program. i dont even know anything abt
it. i dont know anything abt fortran or coding..this is my project at
school thats due in 20days..cani run this code on any compiler, i mean
is it compatible with any? shud it return the same values on any

pls bear with my silly questions, i am very stressed out abt this..

You CAN get your program to compile if you

1. remove leading spaces on each line
2. change




3. compile as free format source

DERIV_FX and DERIV_FY are variables NOT functions passed as arguments
to routines so there is no need to make them EXTERNAL.

Making the numerical changes suggested by others DOES not make any
difference in the output except for trailing digits for the value of

When I compiled and ran the program it printed:

*** Parameters read from file particle.par
The Stokes is equal to:
n_t= 1. y= 0.000023255106965997813
n_t= 0.995 y= 0.000023138831431167825
n_t= 0.990025 y= 0.000023023137274011985
n_t= 0.985074875 y= 0.000022908021587641927
n_t= 0.9801495006250001 y= 0.000022793481479703716
n_t= 0.9752487531218751 y= 0.0000226795140723052
n_t= 0.9703725093562657 y= 0.000022566116501943672
n_t= 0.9655206468094844 y= 0.000022453285919433955
n_t= 0.960693043575437 y= 0.000022341019489836785

Note that your value of Stokes is NOT between 0.1 and 2.0 as desired.
Maybe better input data will help. Maybe better values for other
constants will help.

Check the program listing against your formulas and equations. Verify
that your program is correctly transcribed.
Insert WRITE statements in the program to display the value of
variables as the program runs. Compare these to manual calculations.

What are reasonable ranges for the input variables? Try combinations
of LOW, MID and HIGH values for the input variables and see what you

At this point there is no substitute for pouring over your program
listing and output with paper, pencil and a calculator.

With MINOR changes the program DOES compile. You don't have obvious
errors involving mismatched arguments to subroutines or common blocks
that do not match. You may have other

programming errors
logical errors
bad numerical behavior.

Other than the "Non-Fortran" flavor of your program, there is nothing
obviously wrong that jumps out except

goto 5
followed by
STOP. :-).

Good luck.

-- e

So, from the various suggestions given by others in this post, you should be
able to compile and run your program. You can then get answers but don't
know if they are correct or where the problem may be if there is one.
Your problem description seems well defined with parameters and differential
equations. These equations seem to require numerical solutions. It may be
more efficient to take one step back from FORTRAN and program the problem in
a computer algebra system such as MathCAD, Matlab, etc.
This approach has several advantages. You can be better assured that the
numerical results will reflect only your input and not a coding error If the
results look strange, you can more easily focus your attention. You can play
around with the problem statement changing input and checking output. You
will be free of possible errors in your differentiation and integration
procedures. You will also be able to output intermediate results which you
can then compare to your FORTRAN code. Finally, some CAS programs have
graphical tools that are simple to implement and can be very valuable, for
example showing where functions become discontinuous. In the end, you will
have a program that you know works (or not) and can then (re)program in
FORTRAN. These CAS programs are easy to use but are expensive. Universities
probably can provide free access.


Relevant Pages

  • Re: what is wrong with this code?can someone walk me through this?
    ... i dont know anything abt fortran or coding..this is my project at ... You CAN get your program to compile if you ... The Stokes is equal to: ... What are reasonable ranges for the input variables? ...
  • Re: reading more data than the record size (RECL)
    ... end snip ... This overhead is there to allow Fortran ... compile the original source code with g95, ... Think of it as a variant on the ASCII vrs ...
  • Re: Fortran programmerss favorite report-writing tools
    ... preprocessing to compile so it's easy to add to existing code. ... same input method as when fortran was first invented. ... and the compiler is then translating it into machine code. ... a good candidate for a formulat translator seems to be texmacs. ...
  • re: Upgrading an OLD (Fortran Powerstation 4.0) compiler
    ... convert and compile as f90 and fix any errors ... compiler options for windows - most vendors have 30 day demo versions. ... ivf - Intel Visual fortran, ... SUBROUTINE FortranCall ...
  • Re: Toward a Forth thats easier to learn
    ... Barriers cease to be barriers once you're past them. ... For variables, what emerged as a style in the early days was a compromise: LSE users put in more variables than a Forth purist, but fewer than a Fortran programmer. ... Compile a line and either save it or execute it and throw it ...