← Back to team overview

dolfin team mailing list archive

Re: [Question #149302]: format of vector function in matlab file

 

Question #149302 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/149302

    Status: Open => Answered

Anders Logg proposed the following answer:
On Wed, Mar 16, 2011 at 12:56:46PM -0000, Melanie Jahny wrote:
> New question #149302 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/149302
>
> I need to print a vector valued function in a matlab-file.
> I'm using:
> V = VectorFunctionSpace(mesh, "CG", 2)
> u = TrialFunction(V)
> ...
> solution_file = File( "velocity_test.m" )
> solution_file << u.vector()
>
> For a 5x4 mesh I get a vector of 198 values.
> I'd like to know now, how these values are arranged,
> so that I can arrange them how matlab needs them.
> Is there a possibility to print only the values in x-direction of u?

The values are ordered as follows (for a 2D mesh):

  x-components at all vertices in order
  x-components at all edges in order
  y-components at all vertices in order
  y-components at all edges in order

--
Anders

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.