MPIRUN - writing out text in parallel

Please supply a minimal working code example, which:

  1. Illustrates what you want to achieve
  2. Produces either an error message or some behaviour that is unexpected (and then explain why it is unexpected)
  3. The code should be executable on any system that has dolfin installed. See: Read before posting: How do I get my question answered? - #4 by nate for a list of questions that follows this structure.