[petsc-users] how to read netcdf into petsc
Ed Bueler
elbueler at alaska.edu
Fri Feb 27 23:34:05 CST 2015
Dear Petsc --
There is a "--download-netcdf" configure option that seems to work for me.
The petscviewer.h (in petsc-maint) has a PetscViewerNetcdfOpen()
declaration, but that seems to not be linkable, perhaps because it has no
implementation of it:
$ make mahaffy
/home/ed/petsc-maint/linux-c-opt/bin/mpicc -o mahaffy.o -c -fPIC -Wall
-Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O
-I/home/ed/petsc-maint/include -I/home/ed/petsc-maint/linux-c-opt/include
`pwd`/mahaffy.c
/home/ed/petsc-maint/linux-c-opt/bin/mpicc -fPIC -Wall -Wwrite-strings
-Wno-strict-aliasing -Wno-unknown-pragmas -O -o mahaffy mahaffy.o
-Wl,-rpath,/home/ed/petsc-maint/linux-c-opt/lib
-L/home/ed/petsc-maint/linux-c-opt/lib -lpetsc
-Wl,-rpath,/home/ed/petsc-maint/linux-c-opt/lib -lflapack -lfblas -lX11
-lpthread -lnetcdf -lm -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8 -Wl,-rpath,/usr/lib/x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -lmpichf90 -lgfortran -lm -lgfortran -lm -lquadmath
-lm -lmpichcxx -lstdc++ -Wl,-rpath,/home/ed/petsc-maint/linux-c-opt/lib
-L/home/ed/petsc-maint/linux-c-opt/lib
-Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8 -Wl,-rpath,/usr/lib/x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu -ldl
-Wl,-rpath,/home/ed/petsc-maint/linux-c-opt/lib -lmpich -lopa -lmpl -lrt
-lpthread -lgcc_s -ldl
mahaffy.o: In function `ReadThicknessFromNetCDF':
mahaffy.c:(.text+0x2cbb): undefined reference to `PetscViewerNetcdfOpen'
collect2: error: ld returned 1 exit status
make: [mahaffy] Error 1 (ignored)
/bin/rm -f mahaffy.o
In particular, src/sys/classes/viewer/impls/ does not have a netcdf/ case.
So what is the recommended way to read a netcdf file into a petsc vec?
Should I go via python and netcdf4-python or something, using
bin/pythonscripts/PetscBinaryIO.py to write a petsc binary, and then read
that?
Dump to ascii and read that?--yes, this is a taunt.
Thanks for help!
Ed
--
Ed Bueler
Dept of Math and Stat and Geophysical Institute
University of Alaska Fairbanks
Fairbanks, AK 99775-6660
301C Chapman and 410D Elvey
907 474-7693 and 907 474-7199 (fax 907 474-5394)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150227/e0eaa133/attachment.html>
More information about the petsc-users
mailing list