You are here

Gnu compiler

Has anyone compiled the code on one of the gnu fortran compilers (such as g95)?
Forums: 

Ranjan, A few years ago I tried but was unsuccessful. Please let us know if it works. chris

Hi Chris: I managed to get things compiled w/ g95. However, at run time, I get an error at line 439/440 in input.f90: READ (CON,'(//(8X,2A8,F8.0,I8,F8.0,F8.0,F8.0,F8.0,A8))') (AZC(JW), AZSLC(JW), AZMAX(JW), TKEBC(JW),EROUGH(JW), & ARODI(JW),STRICK(JW),TKELATPRDCONST(JW),IMPTKE(JW),JW=1,NWB) According to the manual, the read should stop at AZMAX(.). Not sure what the variables following AZMAX do. I suspect that the gnu compiler creates problems with unknown values.

Hi Ranjan, These are parameters for the version 3.6 TKE algorithm. They are discussed in the most recent manual update at http://www.ce.pdx.edu/w2/ Also, if you haven't downloaded the most recent code, you should do that also. The code was last updated on 10/11/2008. Hope this helps, chris

Chris, thanks. That's working now. To get this going in g95, I declared a REAL(R8) variable assigned to 1.0 in w2_36_gen.f90, az.f90, water_quality, & transport.f90 to take care of the SIGN(.) function compile error. g95 doesn't recognize 1.0 as R8 (R8 is selected_real_kind(15) in w2modules.f90). Use finstr /n "SIGN(" *.f90 on a dos prompt to locate the lines of code. You'll have to change NTRY and ITMAX from REAL to integer type on line 798 in gate-spill-pipe.f90. On line 282 of outputinit.f90, I hardwired to 6. That's about it. I downloaded minGW and used the ming32-make (in the C:\MinGW\bin directory) to create the executable. Makefile below (save it as "makefile" in your favorite editor; mine is notepad++). The gdb for g95 isn't as straight forward as the one for the UNIX environment. Redhat has a free downloadable "Insight" debugger that you might find more user friendly. objects = w2_36_gen.o input.o balances.o date.o density.o endsimulation.o gas-transfer.o gate-spill-pipe.o \ heat-exchange.o hydroinout.o init-cond.o init-geom.o init.o layeraddsub.o \ macrophyte-aux.o output.o outputa.o outputinit.o restart.o shading.o tdg.o temperature.o\ time-varying-data.o transport.o update.o w2modules.o az.o \ water-quality.o waterbody.o withdrawal.o wqconstituents.o FFLAGS = -ffree-line-length-huge -ftrace=full -fzero -c -gstabs+ cequalw2: $(objects) g95 -o cequalw2 $(objects) w2modules.o: w2modules.f90 g95 $(FFLAGS) w2modules.f90 w2_36_gen.o: w2_36_gen.f90 g95 $(FFLAGS) w2_36_gen.f90 input.o: input.f90 g95 $(FFLAGS) input.f90 az.o: az.f90 g95 $(FFLAGS) az.f90 balances.o: balances.f90 g95 $(FFLAGS) balances.f90 date.o: date.f90 g95 $(FFLAGS) date.f90 density.o: density.f90 g95 $(FFLAGS) density.f90 endsimulation.o: endsimulation.f90 g95 $(FFLAGS) endsimulation.f90 gas-transfer.o: gas-transfer.f90 g95 $(FFLAGS) gas-transfer.f90 gate-spill-pipe.o: gate-spill-pipe.f90 g95 $(FFLAGS) gate-spill-pipe.f90 heat-exchange.o: heat-exchange.f90 g95 $(FFLAGS) heat-exchange.f90 hydroinout.o: hydroinout.f90 g95 $(FFLAGS) hydroinout.f90 init-cond.o: init-cond.f90 g95 $(FFLAGS) init-cond.f90 init-geom.o: init-geom.f90 g95 $(FFLAGS) init-geom.f90 init.o: init.f90 g95 $(FFLAGS) init.f90 layeraddsub.o: layeraddsub.f90 g95 $(FFLAGS) layeraddsub.f90 macrophyte-aux.o: macrophyte-aux.f90 g95 $(FFLAGS) macrophyte-aux.f90 output.o: output.f90 g95 $(FFLAGS) output.f90 outputa.o: outputa.f90 g95 $(FFLAGS) outputa.f90 outputinit.o: outputinit.f90 g95 $(FFLAGS) outputinit.f90 restart.o: restart.f90 g95 $(FFLAGS) restart.f90 shading.o: shading.f90 g95 $(FFLAGS) shading.f90 tdg.o: tdg.f90 g95 $(FFLAGS) tdg.f90 temperature.o: temperature.f90 g95 $(FFLAGS) temperature.f90 time-varying-data.o: time-varying-data.f90 g95 $(FFLAGS) time-varying-data.f90 transport.o: transport.f90 g95 $(FFLAGS) transport.f90 update.o: update.f90 g95 $(FFLAGS) update.f90 water-quality.o: water-quality.f90 g95 $(FFLAGS) water-quality.f90 waterbody.o: waterbody.f90 g95 $(FFLAGS) waterbody.f90 withdrawal.o: withdrawal.f90 g95 $(FFLAGS) withdrawal.f90 wqconstituents.o: wqconstituents.f90 g95 $(FFLAGS) wqconstituents.f90

Ranjan, That's great. Thank you for the instructions. chris

Based on the makefile in this post and some editing of my own, I have managed to compile this with gfortran on Centos 5.5 as detailed here: http://w2forum.cee.pdx.edu/?q=node/458 - thanks for providing this thread, it was invaluable. r.b.