[netcdfgroup] combining f77 and f90 modules with netcdf library
Dave Allured
dave.allured at noaa.gov
Wed Mar 12 18:03:47 MDT 2008
Gorgan,
I believe that the statement "use netcdf" is misplaced. It should
be directly below the statement "subroutine write_3d_field", and
*not* below the module statement. Try that.
Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/
Goran Georgievski wrote:
> Hello,
>
> I have some read/write modules written in free form fortran (Fortran 90)
> and I have some fortran77 code that writes standard fortran binary
> files. However, I would prefer to have output in netcdf format. The
> question is if I can compile and link, fortran90 netcdf write module
> with the fortran 77 code. The platform that I am working on is Linux
> with Intel Fortran Compiler 8.1 and netcdf library version 3.6.0-p1.
>
> ifort compiles the write netcdf module (f90 code), and it compiles the
> main code (f77) if I comment the lines that calls netcdf write
> subroutines. When I am trying to compile including these lines, ifort
> complains that it cannot find the module for writing netcdf. (ERROR in
> opening the Library module file [WRITE_3D_NETCDF_FIELD])
>
> Below are the headers of my netcdf write module and headers of main code
> that calls subroutine to write netcdf field, and the makefile that
> compiles everything. If somebody could tell me what I am doing wrong and
> point me to the solution, I would be the most thankful.
>
> Goran
>
> ----netcdf write module f90 code, write_netcdf_3d_field.f90----
>
> module write_netcdf_3d_field
> use netcdf
>
> implicit none
> contains
>
> subroutine write_3d_field(nx,x_axis,ny,y_axis,nz,z_axis,field1,
> netcdf_outfile)
> ...
> end subroutine write_3d_field
> end module write_netcdf_3d_field
>
> ----main program f77 code, m_buildCLM201regionen_eval_oro.f----
>
>
> PROGRAM m_buildCLM201regionen
> USE write_netcdf_3d_field
> IMPLICIT NONE
>
> ....
>
> CALL write_3d_field(nxg,x_lon,nyg,y_lat,nzg,z_lev,mask,
> >netcdf_file)
>
> STOP
> END
>
> ---- makefile ----
>
> #
> DEVDIR = /home/goran/clm/regiomask
> REMDIR = /home/goran/clm/regiomask
> EXECUTABLE = buildCLM201regionen_eval_oro.exe
> CF = ifort
> FFLAGS = -O3
> NETCDFLIB = -L/usr/local/lib
> NETCDFINC = -I/usr/local/include
> #
> #Objektdateien#########################################################
> #
> OBJFILES = m_buildCLM201regionen_eval_oro.o \
> r_getcoord.o r_regiomask.o t_createmask.o w_regiomask.o \
> hnioerr.o write_netcdf_3d_field.o
> #
> $(EXECUTABLE): $(OBJFILES)
> $(CF) -o $(EXECUTABLE) $(OBJFILES) $(NETCDFLIB) -lnetcdf
> ##
>
> m_buildCLM201regionen_eval_oro.o:
> $(REMDIR)/m_buildCLM201regionen_eval_oro.f ($(CF) $(FFLAGS) -c
> $(REMDIR)/m_buildCLM201regionen_eval_oro.f
>
> r_getcoord.o: $(DEVDIR)/r_getcoord.f
> ($(CF) $(FFLAGS) -c $(DEVDIR)/r_getcoord.f)
> r_regiomask.o: $(DEVDIR)/r_regiomask.f
> ($(CF) $(FFLAGS) -c $(DEVDIR)/r_regiomask.f)
> t_createmask.o: $(REMDIR)/t_createmask.f
> ($(CF) $(FFLAGS) -c $(REMDIR)/t_createmask.f)
> w_regiomask.o: $(DEVDIR)/w_regiomask.f
> ($(CF) $(FFLAGS) -c $(DEVDIR)/w_regiomask.f)
> hnioerr.o : $(DEVDIR)/hnioerr.f90
> ($(CF) $(FFLAGS) -c $(DEVDIR)/hnioerr.f90 $(NETCDFINC))
> write_netcdf_3d_field.o : $(DEVDIR)/write_netcdf_3d_field.f90
> ($(CF) $(FFLAGS) -c
> $(DEVDIR)/write_netcdf_3d_field.f90 $(NETCDFINC))
>
>
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup at unidata.ucar.edu
> For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
More information about the netcdfgroup
mailing list