On Thu, 2011-11-17 at 13:35 -0600, xiaohl wrote: > Hi Mike > > I created the binary file from a ASCII file by C. > How could I create a file which I could use for petsc with DM routine? >
There are a few ways to do this, but the easiest options are -- 1. write a C program that creates a DM and a Vec, sets the values of the Vec, and calls VecView (like the example you quoted does). 2. use matlab or python/numpy to generate arrays of the correct size/type/order, and then save those arrays to Petsc Binary format using the scripts in $PETSC_DIR/bin/matlab and $PETSC_DIR/bin/pythonscripts Ethan > Hailong > > On Wed, 2 Nov 2011 15:53:27 -0500, Barry Smith <bsmith at mcs.anl.gov> > wrote: > > On Nov 2, 2011, at 3:42 PM, Matthew Knepley wrote: > > > >> On Wed, Nov 2, 2011 at 8:38 PM, xiaohl <xiaohl at ices.utexas.edu> > >> wrote: > >> Hi > >> > >> I am going to implement cell center difference method for > >> u = - K grad p > >> div u = f > >> where p is the pressure , u is the velocity, f is the source term. > >> > >> my goal is to assemble the matrix and test the performance of > >> different linear solvers in parallel. > >> > >> my question is how can I read the input file for K where K is n*n > >> tensor. > >> > >> MatLoad() > > > > Hm, I think you should use a DMDA with n*n size dof and then use > > VecLoad() to load the entries of K. > > > > Barry > > > >> > >> second one is that do you have any similar examples? > >> > >> Nothing with the mixed-discretization of the Laplacian. > >> > >> Matt > >> > >> Hailong > >> > >> > >> > >> -- > >> What most experimenters take for granted before they begin their > >> experiments is infinitely more interesting than any results to which > >> their experiments lead. > >> -- Norbert Wiener > -- ------------------------------------ Ethan Coon Post-Doctoral Researcher Applied Mathematics - T-5 Los Alamos National Laboratory 505-665-8289 http://www.ldeo.columbia.edu/~ecoon/ ------------------------------------