test case - bad linking netcdf

Everything related to the preinstalled test cases in COHERENS. Additionally, you can find here the necessary files to setup a test case.If you have developed a new test case and you want to share it with other users, feel free to post a new thread.

Moderator: Katrijn

Post Reply
ddewolfe
Posts: 5
Joined: Sun Jan 11, 2015 2:47 pm
Full name: Dave DeWolfe

test case - bad linking netcdf

Post by ddewolfe »

Hi.... I am new to Coherens but not Fortran, Linux and netcdf. My machine is OSX 10.10 (Yosemite) and I have a working netcdf installed by MacPorts. I use ncview for a variety of model outputs.

When I compile the test case all goes well until link time. I get:

gfortran -I/opt/local/include -O0 -o coherens currents.o datatypes.o density.o depths.o diffusion.o fluxes.o grid.o gridpars.o iopars.o meteo.o modids.o nestgrids.o obconds.o optics.o paralpars.o physpars.o relaxation.o structures.o switches.o syspars.o tide.o timepars.o turbpars.o turbulence.o waves.o array_interp.o cf90_routines.o check_model.o cif_routines.o comms_MPI.o datatypes_init.o default_model.o diagnostic_routines.o error_routines.o fft_library.o grid_interp.o grid_routines.o inout_paral.o inout_routines.o math_library.o model_output.o modvars_routines.o nla_library.o paral_comms.o paral_utilities.o petsc_routines.o reset_model.o rng_library.o time_routines.o turbulence_routines.o utility_routines.o check_sediments.o default_sediments.o reset_sediments.o sediment_output.o sedvars_routines.o biology_output.o biovars_routines.o check_biology.o default_biology.o reset_biology.o Advection_Terms.o Allocate_Arrays.o Bottom_Fluxes.o Corrector_Terms.o Density_Equations.o Diffusion_Coefficients.o Diffusion_Terms.o Grid_Arrays.o Harmonic_Analysis.o Hydrodynamic_Equations.o Inundation_Schemes.o Model_Finalisation.o Model_Initialisation.o Model_Parameters.o Nested_Grids.o Open_Boundary_Conditions.o Open_Boundary_Data_2D.o Open_Boundary_Data_Prof.o Parallel_Initialisation.o Relaxation_Zones.o Structures_Model.o Surface_Boundary_Data_1D.o Surface_Data.o Surface_Fluxes.o Surface_Grids.o Surface_Waves.o Tidal_Forcing.o Time_Averages.o Time_Series.o Transport_Equations.o Turbulence_Equations.o Usrdef_Harmonic_Analysis.o Usrdef_Model.o Usrdef_Nested_Grids.o Usrdef_Output.o Usrdef_Structures.o Usrdef_Surface_Data.o Usrdef_Time_Averages.o Usrdef_Time_Series.o Sediment_Model.o Usrdef_Sediment.o Biological_Model.o Usrdef_Biology.o -L/opt/local/lib -lnetcdf \
Coherens_Program.o
Undefined symbols for architecture x86_64:
"___netcdf_MOD_nf90_abort", referenced from:
___cf90_routines_MOD_cf90_abort in cf90_routines.o
"___netcdf_MOD_nf90_close", referenced from:
___cf90_routines_MOD_cf90_close in cf90_routines.o
.... etc etc

Using gfortran 4.9.2. Any thoughts?

Many thanks
Dave
ddewolfe
Posts: 5
Joined: Sun Jan 11, 2015 2:47 pm
Full name: Dave DeWolfe

Re: test case - bad linking netcdf

Post by ddewolfe »

OK - got it. Here's what I did..

in coherensflags.cmp:
changed
# netCDF library file
NETCDF_LIB_FILE = netcdf
to
# netCDF library file
NETCDF_LIB_FILE = netcdff

in the makefile changed output from coherens to coherenszz. There was a name conflict with the symbolic link COHERENS.

In the Run script, changed program name to coherenszz.

Now all works fine. Hope this is helpful for someone.

Dave
pooran
Posts: 12
Joined: Fri Nov 06, 2015 5:26 pm
Full name: pooran khedri

Re: test case - bad linking netcdf

Post by pooran »

Hi all
I have similar problem,I changed coherensflags.cmp and makefile too.
I dont undrestand This statment "In the Run script, changed program name to coherenszz."
When I compile the test case .I get
make[1]: Leaving directory '/home/pkh/work/kkk'
pkh@pkh-P61-USB3-B3:~/work/kkk$ ./coherenszz
./coherenszz: error while loading shared libraries: libnetcdff.so.6: cannot open shared object file: No such file or directory
please guide me.

grateful
pooran
Post Reply