forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

fatal error : can't open module file 'mainmodule.mod'

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
riogurky



Joined: 01 Jun 2017
Posts: 7

PostPosted: Thu Jun 01, 2017 6:14 pm    Post subject: fatal error : can't open module file 'mainmodule.mod' Reply with quote

!===============================================================================
! Global module
!===============================================================================
module Globals
real(Cool, allocatable, save :: u(Smile, flux(Smile

integer, save :: cells, ntmaxi

real(Cool, 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(Cool, intent(in) :: domlen
integer, intent(in) :: cells

integer i
real(Cool 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(Cool, intent(in) :: cflcoe, time, timeout
integer, intent(in) :: cells
real(Cool 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(Cool 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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5046
Location: Salford, UK

PostPosted: Thu Jun 01, 2017 8:28 pm    Post subject: Reply with quote

Can you post it without smilies.
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 303
Location: Düsseldorf, Germany

PostPosted: Thu Jun 01, 2017 8:49 pm    Post subject: Reply with quote

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(Cool, allocatable, save :: u(Smile, flux(Smile

Wilfried


Last edited by Wilfried Linder on Thu Jun 01, 2017 8:52 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Wilfried Linder



Joined: 14 Nov 2007
Posts: 303
Location: Düsseldorf, Germany

PostPosted: Thu Jun 01, 2017 8:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
riogurky



Joined: 01 Jun 2017
Posts: 7

PostPosted: Fri Jun 02, 2017 7:14 am    Post subject: Error while compiling Reply with quote

this is the complete file, when compiling there is some errors and fatal error for mainmodule.mod no such fill.

https://www.dropbox.com/s/13u3n43fpc5xrnr/Global%20module.txt?dl=0

Please help me to solve it?
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 739

PostPosted: Fri Jun 02, 2017 10:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1649
Location: South Pole, Antarctica

PostPosted: Sat Jun 03, 2017 6:05 am    Post subject: Reply with quote

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
Code:
sdbg b1god.exe

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
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 739

PostPosted: Sat Jun 03, 2017 3:13 pm    Post subject: Re: Reply with quote

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:
Code:
0.8
1.5
75
100
0.5

Running with /checkmate reveals a bug in the program: Subroutine Riemann leaves ustar undefined if ul <= ur .
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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