Hi, all!)))
I compiling ROMS and SWAN coupling application with mpif90 (I use Linux with gfrotran, but MCT did not support gfortran for Linux, but mpif90 ok - may be I wrong, but this wrote in README).
And then I build my application, arising next error:
cd Build; /usr/local/mpich2/bin/mpif90 -c -frepack-arrays -ffree-form -ffree-line-length-none -g -fbounds-check -I/root/program_files/ROMS/roms3/MCT/include ocean_coupler.f90
ocean_coupler.f90:436.32:
IF (A(i).eq.1.0_r8/0.0_r8) THEN
1
Error: Division by zero in (1)
ocean_coupler.f90:438.17:
END IF
1
Error: Expecting END DO statement at (1)
make: *** [Build/ocean_coupler.o] Error 1
In ocean_coupler.f90:
CASE ('Wlen') ! wave length
CALL AttrVect_exportRAttr (wav2ocn_AV, TRIM(code), A, Asize)
Iimport=Iimport+1
DO i=1,Asize
A(i)=MAX(0.0_r8,A(i))
IF (A(i).eq.1.0_r8/0.0_r8) THEN
A(i)=Lwave_max
END IF
END DO
scale=1.0_r8 ! m
add_offset=0.0_r8
CALL ROMS_import2d (ng, tile, &
& id, gtype, scale, add_offset, &
& Asize, A, &
& IstrR, IendR, JstrR, JendR, &
& LBi, UBi, LBj, UBj, &
& Fields(id)%ImpMin, Fields(id)%ImpMax, &
& FORCES(ng)%Lwave, &
& status)
And no one about this error in search)))
Where I wrong or this ROMS bug?
Division by zero!!!
Re: Division by zero!!!
some compilers dont seem to be able to handle this.
go ahead and just comment out that line.
go ahead and just comment out that line.
-
- Posts: 45
- Joined: Fri Feb 06, 2009 5:20 pm
- Location: NNSTU, The Nizhniy Novgorod State Technical University named after R.E.Alekseev, Russia
Re: Division by zero!!!
Thanks for help))))
-
- Posts: 61
- Joined: Mon Jul 20, 2009 2:41 pm
- Location: Port And Costal Engineering Laboratory
Re: Division by zero!!!
I have the same trouble.
If i comment out the line ,whether will it have a bad effect on the model running.
If i comment out the line ,whether will it have a bad effect on the model running.
Re: Division by zero!!!
If I understand the situation, I have experienced this as well with gfortran 4.5.0 (20090604; experimental; trunk rev. 148180). Commenting the statement in Master/mct_roms_swan.h does fix the problem, and does not cause any problems during the simulation. However, post-processing may have an issue, depending on what you have SWAN output -- the statement prevents a +Infinity from appearing. When I have it create a Matlab output file (SWAN layout type 4) of the average wavelength, SWAN crashes. For compilers which cannot handle 1.0_r8/0.0_r8, a different form of the expression may be required.
[Although I have not thought it through, perhaps A(i)=MIN(Lwave_max,A(i)) would work?]
[Although I have not thought it through, perhaps A(i)=MIN(Lwave_max,A(i)) would work?]
Re: Division by zero!!!
If I remember correctly, I did the above fix at one point and it worked fine.