|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
riogurky
Joined: 01 Jun 2017 Posts: 7
|
Posted: Thu Jun 01, 2017 6:19 pm Post subject: invalid character, no implicit type, unclassifiable statemen |
|
|
*------------------------------------------------------------------------------*
*
C Driver program
*
IMPLICIT NONE
*
C Declaration of variables:
*
INTEGER ITEST, CELLS, N, NFREQ, NTMAXI
*
REAL CFLCOE, DOMLEN, DT, TIME, TIMEOUT, TIMETO
*
COMMON / DATAIN/ CFLCOE, DOMLEN, ITEST, CELLS,
& NFREQ, NTMAXI, TIMEOUT
COMMON /DELTAT/ DT
*
DATA TIMETO /1.0E-07/
*
C Parameters of problem are read in form
C file "b1god.ini"
*
CALL READER
*
C initial conditions are set up
*
CALL INITIA(DOMLEN, ITEST, CELLS)
*
WRITE(6,*)'---------------------------------------------------------------'
WRITE(6,*)' Time step N TIME TIMEOUT'
WRITE(6,*)'---------------------------------------------------------------'
*
C Time marching procedure
*
TIME = 0.0
*
DO 10 N = 1, NTMAXI
*
C Boundary conditions are set
*
CALL BCONDI(CELLS)
*
C Courant-Friedrichs-Lewy (CFL) condition imposed
*
CALL CFLCON(CFLCOE, CELLS, TIME, TIMEOUT)
*
TIME = TIME + DT
*
C Intercell numerical fluxes are computed
*
CALL FLUXES(CELLS)
*
C Solution is updated according to
c conservative formula
*
CALL UPDATE(CELLS)
*
IF(MOD(N,NFREQ).EQ.0)WRITE(6,20)N, TIME
*
C Check output time
*
IF(ABS(TIME - TIMEOUT).LE.TIMETO)THEN
*
C Solution is written to "numer.out? at
C specified time TIMEOUT
*
CALL OUTPUT(CELLS)
*
WRITE(6,*)'---------------------------------------------------------'
WRITE(6,*)' Number of time steps = ',N
*
STOP
ENDIF
*
10 CONTINUE
*
20 FORMAT(I12,6X, F12.7)
*
END
*
*------------------------------------------------------------------------------*
*
SUBROUTINE READER
*
C Purpose: to read initial parameters of the problem
*
IMPLICIT NONE
*
C Declaration of variables
*
INTEGER ITEST, CELLS, NFREQ, NTMAXI
*
REAL CFLCOE, DOMLEN, TIMEOUT
*
COMMON /DATAIN/ CFLCOE, DOMLEN, ITEST, CELLS, NFREQ,
& NTMAXI, TIMEOUT
*
OPEN(UNIT = 1,FILE = 'b1god.ini',STATUS = 'UNKNOWN')
*
READ(1,*)CFLCOE ! Courant number coefficient
READ(1,*)DOMLEN ! Domain length
READ(1,*)ITEST ! Test problem
READ(1,*)CELLS ! Number of cells in domain
READ(1,*)NFREQ ! Output frequency to screen
READ(1,*)NTMAXI ! Maximum number of time steps
READ(1,*)TIMEOUT ! Output time
*
CLOSE(1)
*
WRITE(6,*)'--------------------------------'
WRITE(6,*)'Data read in is echoed to screen'
WRITE(6,*)'--------------------------------'
WRITE(6,*)'CFLCOE = ',CFLCOE
WRITE(6,*)'DOMLEN = ',DOMLEN
WRITE(6,*)'ITEST = ',ITEST
WRITE(6,*)'CELLS = ',CELLS
WRITE(6,*)'NFREQ = ',NFREQ
WRITE(6,*)'NTMAXI = ',NTMAXI
WRITE(6,*)'TIMEOUT = ',TIMEOUT
WRITE(6,*)'--------------------------------'
*
RETURN
END
*
*------------------------------------------------------------------------------*
*
SUBROUTINE INITI(DOMLEN, ITEST, CELLS)
*
C Purpose: to set initial conditions for solution U
C and initialise other variables. There are
C two choices of initial conditions,
C determined by ITEST
*
C Local variables:
*
C Name Description
* ==== ===========
*
C DX Spatial mesh size
C I Variable in do loop
C ITEST Defines test problem
C FLUX Array for intercell fluxes
C U Array for numerical solution
C XPOS Position along x-axis
C XLEFT Left diaphragm
C XMIDDL Middle diaphragm
C XRIGHT Right diaphragm
*
IMPLICIT NONE
*
C Declaration of variables
*
INTEGER I, |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1888
|
Posted: Thu Jun 01, 2017 7:33 pm Post subject: |
|
|
Posting long source codes in-line in this forum does not work.
There is a limit on the size of a post, which your code exceeded. As you can see, there is a missing portion of your code at the end.
If you post code without [code]...[/code] markers, leading blanks in the code get stripped, leaving the code in a state unfit to be compiled.
It is best to upload the code in a Zip file to a cloud storage site such as Dropbox, make the file accessible to the public, and post a link to the file here.
I suspect that the problem with your code is that it has some lines that exceed 72 in length, but let's hold off the diagnosis until we see an uncorrupted file. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2556 Location: Sydney
|
Posted: Fri Jun 02, 2017 2:16 am Post subject: |
|
|
I'd recommend that you don't use unit 1 to open a file as this can conflict with the screen input/output. I'd suggest you use unit 11.
Also unit 6 is not the file unit for the screen with FTN95 (it is with some other compilers)
With FTN95, either use the following to a file opened on unit 6
WRITE(6,*)'---------------------------------------------------------'
WRITE(6,*)' Number of time steps = ',N
or use the following if you want to write to the screen
WRITE(*,*)'---------------------------------------------------------'
WRITE(*,*)' Number of time steps = ',N
As a general rule, I only open a file with a unit number > 10
It is difficult to tell if you are using free or fixed format code layout, as you appear to be mixing both.
Free format can be preferable for new code, so either change:
*
C Time marching procedure
*
to
!*
!C Time marching procedure
!*
or use the fixed format code layout restrictions for
* comments starting with C or * in column 1 only
* statement numbers are in columns 1 to 5
* continuation in column 6 and
* code in columns 7 to 72
free format is much easier !! |
|
Back to top |
|
|
riogurky
Joined: 01 Jun 2017 Posts: 7
|
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1888
|
Posted: Fri Jun 02, 2017 4:09 am Post subject: |
|
|
There are many lines in the source file (which is contained in the Zip file) that do not obey the rules of fixed format Fortran source. Specifically, many lines begin before column 7. A few lines contains Format strings that continue beyond column 72. Either shorten these or use the /WI compiler option.
Line 395 in Subroutine FLUXES appears to be corrupted:
Code: | DO 10 I =�@0, CELLS |
Replacing this line by
and reformatting the source code to make statements conform to fixed format rules allowed the file to be compiled and linked. |
|
Back to top |
|
|
riogurky
Joined: 01 Jun 2017 Posts: 7
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Fri Jun 02, 2017 6:55 am Post subject: |
|
|
If it is fixed format (old) Fortran code then you should save it in a file with the extension .for or use /FIXED on the FTN95 command line. |
|
Back to top |
|
|
riogurky
Joined: 01 Jun 2017 Posts: 7
|
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2556 Location: Sydney
|
Posted: Fri Jun 02, 2017 10:04 am Post subject: |
|
|
sorry,
there is no way I will look at a .php file That I don't know about |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1888
|
Posted: Fri Jun 02, 2017 1:52 pm Post subject: |
|
|
Riogurky:
I think that you are attempting to do something that is beyond the reach of your capabilities. CFD is an application area that requires a high level of education, mathematical ability and experience. I recognize that you are attempting to learn by running some codes from a textbook, but you are unlikely to succeed at this point in time.
The second Zip file that you linked to contains (i) a copy of the buggy source code and (ii) a PDF document on how to use Dropbox!
The link to Tutorialspoint takes one to the entry page of a Cloud site for compiling and running short programs using Gfortran, and is irrelevant to what you are trying to do if you have a Windows PC and have FTN95 installed on it.
Please spend some time educating yourself regarding Fortran and Fortran programming on Windows. It is far wiser to do that instead of lurching about in the dark and asking others to fix the buggy code for you. |
|
Back to top |
|
|
riogurky
Joined: 01 Jun 2017 Posts: 7
|
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|