|
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:14 pm Post subject: fatal error : can't open module file 'mainmodule.mod' |
|
|
!===============================================================================
! Global module
!===============================================================================
module Globals
real(, allocatable, save :: u(, flux(
integer, save :: cells, ntmaxi
real(, save :: cflcoe, domlen, dt, timeout, timeto, dx
end module Globals
!===============================================================================
! Main module
!===============================================================================
module MainModule
use Globals
implicit none
contains
!----------------------------------------------------------------------------
! Purpose: to read initial parameters of the problem
!----------------------------------------------------------------------------
subroutine reader
open(unit=1, file='b1god.ini', status='unknown')
read(1, *)cflcoe
read(1, *)domlen
read(1, *)cells
read(1, *)ntmaxi
read(1, *)timeout
close(1)
write(*, *)
write(*, *)'Input data echoed to screen'
write(*, *)
write(*, *)'cflcoe =', cflcoe
write(*, *)'domlen =', domlen
write(*, *)'cells =', cells
write(*, *)'ntmaxi =', ntmaxi
write(*, *)'timeout =', timeout
end subroutine reader
!---------------------------------------------------------------------------
! Purpose: to set initial conditions for solution U
! and initialise other variables
!---------------------------------------------------------------------------
subroutine initia(domlen, cells)
real(, intent(in) :: domlen
integer, intent(in) :: cells
integer i
real( xleft, xpos, xmiddle, xright
allocate(flux(0 : cells+1))
allocate(u (0 : cells+1))
dx = domlen/real(cells)
do i = 0, cells + 1
flux(i) = 0.0
u (i) = 0.0
end do
xleft = 0.3*domlen
xright = 0.7*domlen
do i = 1, cells
xpos = (real(i)-1.0)*dx
if(xpos < xleft) then
u(i) = -0.5
else if(xleft <= xpos .and. xpos <=xright) then
u(i) = 1.0
else
u(i) = 0
endif
end do
end subroutine initia
!---------------------------------------------------------------------------
! Purpose: to apply boundary conditions
!---------------------------------------------------------------------------
subroutine bcondi(cells)
integer, intent (in) :: cells
u(0) = u(1)
u(cells + 1) = u(cells)
end subroutine bcondi
!---------------------------------------------------------------------------
! Purpose: to apply the CFL condition to compute a stable time step DT
!---------------------------------------------------------------------------
subroutine cflcon(cflcoe, cells, time, timeout)
real(, intent(in) :: cflcoe, time, timeout
integer, intent(in) :: cells
real( smax
integer i
smax = -1.0e+06
do i = 0, cells + 1
if(abs(u(i)) >= smax) smax = abs(u(i))
end do
dt = cflcoe*dx/smax ! Choosing the time step
if(time + dt> timeout) then
dt = timeout - time
endif
end subroutine cflcon
!---------------------------------------------------------------------------
! Purpose: to update the solution to a new time level
! @using the explicit conservative formula
!---------------------------------------------------------------------------
subroutine update(cells)
integer, intent(in) :: cells
real( dtodx
integer i
dtodx = dt / dx
do i = 1, cells
u(i) = u(i) + dtodx*(flux(i-1) - flux(i)) !(2.29)
end do
end subroutine update
!----------------------------------------------------------------- |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Thu Jun 01, 2017 8:28 pm Post subject: |
|
|
Can you post it without smilies. |
|
Back to top |
|
|
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: Düsseldorf, Germany
|
Posted: Thu Jun 01, 2017 8:49 pm Post subject: |
|
|
The smilies are automatically generated by phpbb. I think, the easiest or may be only way to avoid this is to mark the text and use the "Code" button. Example:
Code: | real(8), allocatable, save :: u(:), flux(:) |
Without this, the same text is displayed like this:
real(, allocatable, save :: u(, flux(
Wilfried
Last edited by Wilfried Linder on Thu Jun 01, 2017 8:52 pm; edited 1 time in total |
|
Back to top |
|
|
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: Düsseldorf, Germany
|
Posted: Thu Jun 01, 2017 8:51 pm Post subject: |
|
|
I just found another way: After writing the post and before sending it, activate the option "Disable Smilies in this post". Same text as before:
real(8), allocatable, save :: u(:), flux(:) |
|
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 10:54 pm Post subject: |
|
|
Change the name of the file from "Global Module.txt" to, say, b1god.f90. There seem to be two lines containing "ENDIF" that should have been present after line 185 but are lost.
As you were advised earlier, use a unit number such as 11 instead of 1 for the input and output files.
After you make these changes, make sure that you have the data file b1god.ini in the same directory. You can compile and link the program with the command
Code: | ftn95 b1god.f90 /link |
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2826 Location: South Pole, Antarctica
|
Posted: Sat Jun 03, 2017 6:05 am Post subject: |
|
|
Agree with all comments. Just will add that specifically for novices and generally for anyone is better to use these commands so that you will understand what the code is doing in real time
Code: |
ftn95 b1god.f90 /link /checkmate >zzz |
where zzz will be compiler generated file containing errors, comments and warnings. And the /checkmate (same as /undef) is one very nice debugging option, do not use it when the code will be completely error-free as it slows down the execution.
Then if b1god.EXE file will be created run it via debugger
and hitting F7 see step by step execution of your program. Other debugger's commands are in the menu and are are completely self-explanatory to anyone including your dogs and cats (most of computer games children play today are
infinitely more complex and no one ever RTFM)
What specifically is the data in the initial data file b1god.ini ? |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1888
|
Posted: Sat Jun 03, 2017 3:13 pm Post subject: Re: |
|
|
DanRRight wrote: | What specifically is the data in the initial data file b1god.ini ? |
The file is in the Zip file to which a link was posted in http://forums.silverfrost.com/viewtopic.php?t=3522 . It contains five lines of input data for the program:
Running with /checkmate reveals a bug in the program: Subroutine Riemann leaves ustar undefined if ul <= ur . |
|
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
|