diff --git a/documentation/userGuide/pafiX_userGuide.pdf b/documentation/userGuide/pafiX_userGuide.pdf
old mode 100644
new mode 100755
index c0791cc0c383d8fa177d5aad7770bf0d480bce36..bd4b928871e240f5c2495020ae475965ef1850d0
Binary files a/documentation/userGuide/pafiX_userGuide.pdf and b/documentation/userGuide/pafiX_userGuide.pdf differ
diff --git a/input/input_example.dat b/input/input_example.dat
index 0aa6a278b383b55b784d8c0bd665ca4a06e1d491..affaac836788797f7aafdf4bced22277d0ff59d1 100644
--- a/input/input_example.dat
+++ b/input/input_example.dat
@@ -1,27 +1,27 @@
-pafiX input data
+pafiX v.1.2.0 input data
 ----------------
 dimensions in x,y,z-direction (m,m,m) =
 0.24,0.125,0.04 
 boundary conditions in x,y,z-direction [(w)all/(p)eriodic/(i)n-outlet] =
 p,p,w
 number of cells in x,y,z-direction (-,-,-) =
-20,20,20
+16,16,16
 grid in x,y,z-direction [(u)niform/(s)tretch] =
 u,u,s
 start time-step (-), time-steps to compute (-) =
 1,10
 interval of writing result files, restart files (-,-) =
 10,10000
-CFL number (-) =
-0.4
+CFL number (-), max number interations (-), relative tolerance (-) =
+0.4,200,5.E-3
 in/initial flow (m/s), pressure gradient (N/m**3) =
 3.65,-2.9
 fluid density (kg/m**3), fluid kinematic viscosity (m**2/s) =
 1.2,1.46E-5
 particle number density (-/m**3) or rate (-/s), start seed at nt (-) =
 1E7,1
-particle radius (m), material density (kg/m**3) =
-50E-6,1200
+particle radius (m), material density (kg/m**3), restitution coeff (-) =
+50E-6,1200,0.9
 particle charge: initial, equilibrium (C,C) =
 0.,1E-12
 gravity vector in x,y,z-dir. (m/s**2,m/s**2,m/s**2) =
diff --git a/src/COPYING b/src/COPYING
new file mode 100644
index 0000000000000000000000000000000000000000..f288702d2fa16d3cdf0035b15a9fcbc552cd88e7
--- /dev/null
+++ b/src/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/src/bc.f90 b/src/bc.f90
index a211c927a04087700e29ff5c7b9fc3c29629aa9a..a727a9c1302302887f5ba72abfdd9ca6a94f6db4 100644
--- a/src/bc.f90
+++ b/src/bc.f90
@@ -1,101 +1,83 @@
 !####################################################################
 !> @author Holger Grosshans
-!> @brief boundary condition for velocity and pressure field
-      subroutine bcUVWP
+!> @brief Dirichlet (fixed value) boundary condition for velocity field
+      subroutine bcUVW(myu,myv,myw)
       use var
-      real(kind=pr) :: &
-            ue,uw,ve,vw,we,ww, &
-            uba,ufr,vba,vfr,wba,wfr, &
-            un,us,vn,vs,wn,ws, &
-            alpha,dist
-      integer :: i,j,l,m,mm
+      use parallel
+      real(kind=pr),dimension(ii,jj,ll) :: myu,myv,myw
+      real(kind=pr) :: wval
+      integer :: m
 
-      if (bcx.eq.'w') then
-        ue=0._pr; uw=0._pr; ve=0._pr; vw=0._pr; ww=0._pr; we=0._pr
-      endif
-      if (bcy.eq.'w') then
-        uba=0._pr; ufr=0._pr; vba=0._pr; vfr=0._pr; wba=0._pr; wfr=0._pr 
-      endif
-      if (bcz.eq.'w') then
-        un =0._pr; us =0._pr; vs =0._pr; vn =0._pr; wn =0._pr; ws =0._pr
-      endif
+      wval=0._pr
 
-      
-      if (bcx.eq.'w') then
+      if (bcx.eq.'w') then ! x:      
         if (myid.eq.0) then
           do 1 m=1,gc
-          u(imin-m,:,:)=  uw
-          v(imin-m,:,:)=  v(imin,:,:)-2._pr*(v(imin,:,:)-vw)
-          w(imin-m,:,:)=  w(imin,:,:)-2._pr*(w(imin,:,:)-ww)
+          myu(imin-m,:,:)=  wval
+          myv(imin-m,:,:)=  myv(imin,:,:)-2._pr*(myv(imin,:,:)-wval)
+          myw(imin-m,:,:)=  myw(imin,:,:)-2._pr*(myw(imin,:,:)-wval)
 1         enddo
         endif
         if (myid.eq.nrprocs-1) then
           do 2 m=1,gc
-          u(imax-1+m,:,:)=ue
-          v(imax+m,:,:)=  v(imax,:,:)-2._pr*(v(imax,:,:)-ve)
-          w(imax+m,:,:)=  w(imax,:,:)-2._pr*(w(imax,:,:)-we)
+          myu(imax-1+m,:,:)=wval
+          myv(imax+m,:,:)=  myv(imax,:,:)-2._pr*(myv(imax,:,:)-wval)
+          myw(imax+m,:,:)=  myw(imax,:,:)-2._pr*(myw(imax,:,:)-wval)
 2         enddo
         endif
       elseif (bcx.eq.'p') then
-        ! done through the sync routines
+        call sync(u); call sync(v); call sync(w)  ! done through the sync routines
       elseif (bcx.eq.'i') then
         ! see inflow routine
         if (myid.eq.nrprocs-1) then
            do 8 m=1,gc
-           u(imax+m-1,:,:)=u(imax-1,:,:)
-           v(imax+m,:,:)=  v(imax,:,:)
-           w(imax+m,:,:)=  w(imax,:,:)
-           p(imax+m,:,:)=  p(imax,:,:)
+           myu(imax+m-1,:,:)=myu(imax-1,:,:)
+           myv(imax+m,:,:)=  myv(imax,:,:)
+           myw(imax+m,:,:)=  myw(imax,:,:)
 8          enddo
         endif
       endif
 
-      if (bcy.eq.'w') then
+      if (bcy.eq.'w') then ! y:
         do 3 m=1,gc
-        u(:,jmin-m,:)=  u(:,jmin,:)-2._pr*(u(:,jmin,:)-ufr)
-        u(:,jmax+m,:)=  u(:,jmax,:)-2._pr*(u(:,jmax,:)-uba)
-        v(:,jmin-m,:)=  vfr
-        v(:,jmax-1+m,:)=vba
-        w(:,jmin-m,:)=  w(:,jmin,:)-2._pr*(w(:,jmin,:)-wfr)
-        w(:,jmax+m,:)=  w(:,jmax,:)-2._pr*(w(:,jmax,:)-wba)
+        myu(:,jmin-m,:)=  myu(:,jmin,:)-2._pr*(myu(:,jmin,:)-wval)
+        myu(:,jmax+m,:)=  myu(:,jmax,:)-2._pr*(myu(:,jmax,:)-wval)
+        myv(:,jmin-m,:)=  wval
+        myv(:,jmax-1+m,:)=wval
+        myw(:,jmin-m,:)=  myw(:,jmin,:)-2._pr*(myw(:,jmin,:)-wval)
+        myw(:,jmax+m,:)=  myw(:,jmax,:)-2._pr*(myw(:,jmax,:)-wval)
 3       enddo
       elseif (bcy.eq.'p') then
         do 4 m=1,gc
-        u(:,jmin-m,:)= u(:,jmax+1-m,:)
-        u(:,jmax+m,:)= u(:,jmin-1+m,:)
-        v(:,jmin-m,:)= v(:,jmax+1-m,:)
-        v(:,jmax+m,:)= v(:,jmin-1+m,:)
-        w(:,jmin-m,:)= w(:,jmax+1-m,:)
-        w(:,jmax+m,:)= w(:,jmin-1+m,:)
-        p(:,jmin-m,:)= p(:,jmax+1-m,:)
-        p(:,jmax+m,:)= p(:,jmin-1+m,:)
+        myu(:,jmin-m,:)= myu(:,jmax+1-m,:)
+        myu(:,jmax+m,:)= myu(:,jmin-1+m,:)
+        myv(:,jmin-m,:)= myv(:,jmax+1-m,:)
+        myv(:,jmax+m,:)= myv(:,jmin-1+m,:)
+        myw(:,jmin-m,:)= myw(:,jmax+1-m,:)
+        myw(:,jmax+m,:)= myw(:,jmin-1+m,:)
 4       enddo
       endif
 
-      if (bcz.eq.'w') then
+      if (bcz.eq.'w') then ! z:      
         do 5 m=1,gc
-        u(:,:,lmin-m)=  u(:,:,lmin)-2._pr*(u(:,:,lmin)-us)
-        u(:,:,lmax+m)=  u(:,:,lmax)-2._pr*(u(:,:,lmax)-un)
-        v(:,:,lmin-m)=  v(:,:,lmin)-2._pr*(v(:,:,lmin)-vs)
-        v(:,:,lmax+m)=  v(:,:,lmax)-2._pr*(v(:,:,lmax)-vn)
-        w(:,:,lmin-m)=  ws
-        w(:,:,lmax-1+m)=wn
+        myu(:,:,lmin-m)=  myu(:,:,lmin)-2._pr*(myu(:,:,lmin)-wval)
+        myu(:,:,lmax+m)=  myu(:,:,lmax)-2._pr*(myu(:,:,lmax)-wval)
+        myv(:,:,lmin-m)=  myv(:,:,lmin)-2._pr*(myv(:,:,lmin)-wval)
+        myv(:,:,lmax+m)=  myv(:,:,lmax)-2._pr*(myv(:,:,lmax)-wval)
+        myw(:,:,lmin-m)=  wval
+        myw(:,:,lmax-1+m)=wval
 5       enddo
       elseif (bcz.eq.'p') then
         do 6 m=1,gc
-        u(:,:,lmin-m)= u(:,:,lmax+1-m)
-        u(:,:,lmax+m)= u(:,:,lmin-1+m)
-        v(:,:,lmin-m)= v(:,:,lmax+1-m)
-        v(:,:,lmax+m)= v(:,:,lmin-1+m)
-        w(:,:,lmin-m)= w(:,:,lmax+1-m)
-        w(:,:,lmax+m)= w(:,:,lmin-1+m)
-        p(:,:,lmin-m)= p(:,:,lmax+1-m)
-        p(:,:,lmax+m)= p(:,:,lmin-1+m)
+        myu(:,:,lmin-m)= myu(:,:,lmax+1-m)
+        myu(:,:,lmax+m)= myu(:,:,lmin-1+m)
+        myv(:,:,lmin-m)= myv(:,:,lmax+1-m)
+        myv(:,:,lmax+m)= myv(:,:,lmin-1+m)
+        myw(:,:,lmin-m)= myw(:,:,lmax+1-m)
+        myw(:,:,lmax+m)= myw(:,:,lmin-1+m)
 6       enddo
       endif
 
-
-      return
       end
 
 !####################################################################
@@ -103,243 +85,180 @@
 !> @brief inflow boundary condition
       subroutine inflow
       use var
+      use parallel
       real(kind=pr),dimension(dimj*diml) :: random
-      real(kind=pr) :: &
-            alpha,dist
+      real(kind=pr) :: alpha,dist
       integer :: i,j,l,m,mm
 
-
       call random_number(random)
       alpha=.1_pr
       mm=0
-      do j=jmin,jmax; do l=lmin,lmax
+      do l=lmin,lmax; do j=jmin,jmax
         mm=mm+1
         if (bcy.eq.'w'.and.bcz.eq.'w') dist=delta-max(abs(yc(j)),abs(zc(l)))
         if (bcy.eq.'w'.and.bcz.eq.'p') dist=delta-abs(yc(j))
         if (bcy.eq.'p'.and.bcz.eq.'w') dist=delta-abs(zc(l))
         do m=1,gc
-          u(imin-m,j,l)=max(0._pr,ubulk0*dist/delta + (random(mm)-.5_pr)*alpha*ubulk0)
-          v(imin-m,j,l)=0._pr
-          w(imin-m,j,l)=0._pr
+          u(imin-m,j,l)=max(0._pr,ubulk0*(dist/delta)**(1._pr/6._pr) + (random(mm)-.5_pr)*alpha*ubulk0)
+          v(imin-m,j,l)=(random(mm)-.5_pr)*alpha*ubulk0
+          w(imin-m,j,l)=(random(mm)-.5_pr)*alpha*ubulk0
         enddo
       enddo; enddo
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief boundary condition for electric field
-      subroutine bcE_el
+!> @brief Neumann (zero-gradient) boundary condition
+      subroutine bcNeumann(myvar)
       use var
+      use parallel
+      real(kind=pr) :: myvar(ii,jj,ll)
       integer :: m
 
-
       if (bcx.eq.'w') then
         if (myid.eq.0) then
           do 1 m=1,gc
-          Ex_el(imin-m,:,:)=  Ex_el(imin,:,:)
-          Ey_el(imin-m,:,:)=  Ey_el(imin,:,:)
-          Ez_el(imin-m,:,:)=  Ez_el(imin,:,:)
+          myvar(imin-m,:,:)= myvar(imin,:,:)
 1         enddo
         endif
         if (myid.eq.nrprocs-1) then
           do 2 m=1,gc
-          Ex_el(imax+m,:,:)=  Ex_el(imax,:,:)
-          Ey_el(imax+m,:,:)=  Ey_el(imax,:,:)
-          Ez_el(imax+m,:,:)=  Ez_el(imax,:,:)
+          myvar(imax+m,:,:)= myvar(imax,:,:)
 2         enddo
         endif
       elseif (bcx.eq.'p') then
-        ! done through the sync routines
+        call sync(myvar)  ! done through the sync routines
       elseif (bcx.eq.'i') then
         if (myid.eq.0) then
           do 7 m=1,gc
-          Ex_el(imin-m,:,:)=  Ex_el(imin,:,:)
-          Ey_el(imin-m,:,:)=  Ey_el(imin,:,:)
-          Ez_el(imin-m,:,:)=  Ez_el(imin,:,:)
+          myvar(imin-m,:,:)= myvar(imin,:,:)
 7         enddo
         endif
         if (myid.eq.nrprocs-1) then
           do 8 m=1,gc
-          Ex_el(imax+m,:,:)=  Ex_el(imax,:,:)
-          Ey_el(imax+m,:,:)=  Ey_el(imax,:,:)
-          Ez_el(imax+m,:,:)=  Ez_el(imax,:,:)
+          myvar(imax+m,:,:)= myvar(imax,:,:)
 8         enddo
         endif
       endif
 
       if (bcy.eq.'w') then
         do 3 m=1,gc
-        Ex_el(:,jmin-m,:)=  Ex_el(:,jmin,:)
-        Ex_el(:,jmax+m,:)=  Ex_el(:,jmax,:)
-        Ey_el(:,jmin-m,:)=  Ey_el(:,jmin,:)
-        Ey_el(:,jmax+m,:)=  Ey_el(:,jmax,:)
-        Ez_el(:,jmin-m,:)=  Ez_el(:,jmin,:)
-        Ez_el(:,jmax+m,:)=  Ez_el(:,jmax,:)
+        myvar(:,jmin-m,:)= myvar(:,jmin,:)
+        myvar(:,jmax+m,:)= myvar(:,jmax,:)
 3       enddo
       elseif (bcy.eq.'p') then
         do 4 m=1,gc
-        Ex_el(:,jmin-m,:)= Ex_el(:,jmax+1-m,:)
-        Ex_el(:,jmax+m,:)= Ex_el(:,jmin-1+m,:)
-        Ey_el(:,jmin-m,:)= Ey_el(:,jmax+1-m,:)
-        Ey_el(:,jmax+m,:)= Ey_el(:,jmin-1+m,:)
-        Ez_el(:,jmin-m,:)= Ez_el(:,jmax+1-m,:)
-        Ez_el(:,jmax+m,:)= Ez_el(:,jmin-1+m,:)
+        myvar(:,jmin-m,:)= myvar(:,jmax+1-m,:)
+        myvar(:,jmax+m,:)= myvar(:,jmin-1+m,:)
 4       enddo
       endif
 
       if (bcz.eq.'w') then
         do 5 m=1,gc
-        Ex_el(:,:,lmin-m)=  Ex_el(:,:,lmin)
-        Ex_el(:,:,lmax+m)=  Ex_el(:,:,lmax)
-        Ey_el(:,:,lmin-m)=  Ey_el(:,:,lmin)
-        Ey_el(:,:,lmax+m)=  Ey_el(:,:,lmax)
-        Ez_el(:,:,lmin-m)=  Ez_el(:,:,lmin)
-        Ez_el(:,:,lmax+m)=  Ez_el(:,:,lmax)
+        myvar(:,:,lmin-m)= myvar(:,:,lmin)
+        myvar(:,:,lmax+m)= myvar(:,:,lmax)
 5       enddo
       elseif (bcz.eq.'p') then
         do 6 m=1,gc
-        Ex_el(:,:,lmin-m)= Ex_el(:,:,lmax+1-m)
-        Ex_el(:,:,lmax+m)= Ex_el(:,:,lmin-1+m)
-        Ey_el(:,:,lmin-m)= Ey_el(:,:,lmax+1-m)
-        Ey_el(:,:,lmax+m)= Ey_el(:,:,lmin-1+m)
-        Ez_el(:,:,lmin-m)= Ez_el(:,:,lmax+1-m)
-        Ez_el(:,:,lmax+m)= Ez_el(:,:,lmin-1+m)
+        myvar(:,:,lmin-m)= myvar(:,:,lmax+1-m)
+        myvar(:,:,lmax+m)= myvar(:,:,lmin-1+m)
 6       enddo
       endif
 
-
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief boundary condition for electric potential
-      subroutine bcPhi_el
+!> @brief Dirichlet (fixed value) boundary condition
+      subroutine bcDirichlet(myvar,wval)
       use var
+      use parallel
+      real(kind=pr) :: myvar(ii,jj,ll)
       real(kind=pr) :: wval
       integer :: m
 
-      wval= 0._pr  !zero on a conductive grounded surface
-
       if (bcx.eq.'w') then
         if (myid.eq.0) then
           do 1 m=1,gc
-          phi_el(imin-m,:,:)= -phi_el(imin,:,:)+2._pr*wval
+          myvar(imin-m,:,:)= -myvar(imin,:,:)+2._pr*wval
 1         enddo
         endif
         if (myid.eq.nrprocs-1) then
           do 2 m=1,gc
-          phi_el(imax+m,:,:)= -phi_el(imax,:,:)+2._pr*wval
+          myvar(imax+m,:,:)= -myvar(imax,:,:)+2._pr*wval
 2         enddo
         endif
       elseif (bcx.eq.'p') then
-        ! done through the sync routines
+        call sync(myvar)  ! done through the sync routines
       elseif (bcx.eq.'i') then
         if (myid.eq.0) then
           do 7 m=1,gc
-          phi_el(imin-m,:,:)= phi_el(imin,:,:)
+          myvar(imin-m,:,:)= myvar(imin,:,:)
 7         enddo
         endif
         if (myid.eq.nrprocs-1) then
           do 8 m=1,gc
-          phi_el(imax+m,:,:)= phi_el(imax,:,:)
+          myvar(imax+m,:,:)= myvar(imax,:,:)
 8         enddo
         endif
       endif
 
       if (bcy.eq.'w') then
         do 3 m=1,gc
-        phi_el(:,jmin-m,:)= -phi_el(:,jmin,:)+2._pr*wval
-        phi_el(:,jmax+m,:)= -phi_el(:,jmax,:)+2._pr*wval
+        myvar(:,jmin-m,:)= -myvar(:,jmin,:)+2._pr*wval
+        myvar(:,jmax+m,:)= -myvar(:,jmax,:)+2._pr*wval
 3       enddo
       elseif (bcy.eq.'p') then
         do 4 m=1,gc
-        phi_el(:,jmin-m,:)= phi_el(:,jmax+1-m,:)
-        phi_el(:,jmax+m,:)= phi_el(:,jmin-1+m,:)
+        myvar(:,jmin-m,:)= myvar(:,jmax+1-m,:)
+        myvar(:,jmax+m,:)= myvar(:,jmin-1+m,:)
 4       enddo
       endif
 
       if (bcz.eq.'w') then
         do 5 m=1,gc
-        phi_el(:,:,lmin-m)= -phi_el(:,:,lmin)+2._pr*wval
-        phi_el(:,:,lmax+m)= -phi_el(:,:,lmax)+2._pr*wval
+        myvar(:,:,lmin-m)= -myvar(:,:,lmin)+2._pr*wval
+        myvar(:,:,lmax+m)= -myvar(:,:,lmax)+2._pr*wval
 5       enddo
       elseif (bcz.eq.'p') then
         do 6 m=1,gc
-        phi_el(:,:,lmin-m)= phi_el(:,:,lmax+1-m)
-        phi_el(:,:,lmax+m)= phi_el(:,:,lmin-1+m)
+        myvar(:,:,lmin-m)= myvar(:,:,lmax+1-m)
+        myvar(:,:,lmax+m)= myvar(:,:,lmin-1+m)
 6       enddo
       endif
 
-
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief boundary condition for rho_el
-      subroutine bcRho_el
+!> @brief a particle located on myid=0, i=imax imposes a source on 
+!>        myid=0, i=imax+1 which needs to be transferred to myid=1, i=imin
+!>        required for rho_el,Fsx,Fsy,Fsz
+!> @todo  if 2 dimensions periodic, the corners between diagonal 
+!>        procs not transferred yet
+      subroutine bcLEsource(myvar)
       use var
-      real(kind=pr) :: wval
+      use parallel
+      real(kind=pr) :: myvar(ii,jj,ll)
       integer :: m
 
-      wval= 0._pr  !no charge on surface
-
-      if (bcx.eq.'w') then
-        if (myid.eq.0) then
-          do 1 m=1,gc
-          rho_el(imin-m,:,:)= -rho_el(imin,:,:)+2._pr*wval
-1         enddo
-        endif
-        if (myid.eq.nrprocs-1) then
-          do 2 m=1,gc
-          rho_el(imax+m,:,:)= -rho_el(imax,:,:)+2._pr*wval
-2         enddo
-        endif
-      elseif (bcx.eq.'p') then
-        ! done through the sync routines
-      elseif (bcx.eq.'i') then
-        if (myid.eq.0) then
-          do 7 m=1,gc
-          rho_el(imin-m,:,:)= rho_el(imin,:,:)
-7         enddo
-        endif
-        if (myid.eq.nrprocs-1) then
-          do 8 m=1,gc
-          rho_el(imax+m,:,:)= rho_el(imax,:,:)
-8         enddo
-        endif
+      if (bcx.eq.'p') then
+        call syncLEsource(myvar)  ! done through the sync routines
       endif
 
-      if (bcy.eq.'w') then
-        do 3 m=1,gc
-        rho_el(:,jmin-m,:)= -rho_el(:,jmin,:)+2._pr*wval
-        rho_el(:,jmax+m,:)= -rho_el(:,jmax,:)+2._pr*wval
-3       enddo
-      elseif (bcy.eq.'p') then
+      if (bcy.eq.'p') then
         do 4 m=1,gc
-        rho_el(:,jmin-m,:)= rho_el(:,jmax+1-m,:)
-        rho_el(:,jmax+m,:)= rho_el(:,jmin-1+m,:)
+        myvar(:,jmax+1-m,:)= myvar(:,jmin-m,:) + myvar(:,jmax+1-m,:)
+        myvar(:,jmin-1+m,:)= myvar(:,jmax+m,:) + myvar(:,jmin-1+m,:)
 4       enddo
       endif
 
-      if (bcz.eq.'w') then
-        do 5 m=1,gc
-        rho_el(:,:,lmin-m)= -rho_el(:,:,lmin)+2._pr*wval
-        rho_el(:,:,lmax+m)= -rho_el(:,:,lmax)+2._pr*wval
-5       enddo
-      elseif (bcz.eq.'p') then
+      if (bcz.eq.'p') then
         do 6 m=1,gc
-        rho_el(:,:,lmin-m)= rho_el(:,:,lmax+1-m)
-        rho_el(:,:,lmax+m)= rho_el(:,:,lmin-1+m)
+        myvar(:,:,lmax+1-m)= myvar(:,:,lmin-m) + myvar(:,:,lmax+1-m)
+        myvar(:,:,lmin-1+m)= myvar(:,:,lmax+m) + myvar(:,:,lmin-1+m)
 6       enddo
       endif
 
-
-      return
       end
diff --git a/src/electrostatics.f90 b/src/electrostatics.f90
index 142a19f5d5be6bf879758148c9ad9facb1c61a9b..7ed97e19fb7243161e3bb80a4c60dc00a8278104 100644
--- a/src/electrostatics.f90
+++ b/src/electrostatics.f90
@@ -3,200 +3,125 @@
 !> @brief solve E field
       subroutine solveElectrostatics
       use var
-      real(kind=pr) err,err00,err2,syncMax
+      use parallel
+      real(kind=pr) :: err,err00
       integer it
 
-
-      if (pnd.ne.0._pr.and.syncMax(maxval(abs(q_el))).ne.0._pr) then
+      if (pnd.eq.0._pr.or.syncMax(maxval(abs(q_el))).eq.0._pr) return
+        
+      call chargeDensity
 
       do it=1,itmax
         call calcPhi_el(err)
-
-        if (it.eq.1) err00=max(err,1e-19_pr)
+        if (it.eq.1) err00=max(err,1.e-19_pr)
         if (err/err00.lt.tol) exit
       enddo
 
-      call calcE_el(err2)
+      call calcE_el
 
-      if (myid.eq.0) &
-      write(*,'(a,es8.1e2,a,i3,a,es8.1e2)') &
-      'E-pot.   |L2/L2_0 = ',err/err00,' |L2 #',it-1,' = ',err
+      if (myid.eq.0) write(*,'(a,i3,a,es8.2e2,a)') 'E-pot.    |L2 #',it-1,' = ',err/err00,' |'
        
-      endif
-
-      return
       end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief one sweep to relax phi_el field using Jacobi method
-!> @param err        L2 error norm
-      subroutine calcPhi_el(err)
+!> @brief compute volumetric charge density
+      subroutine chargeDensity
       use var
-      real(kind=pr),dimension(ii,jj,ll) :: phi_el1
-      real(kind=pr) :: diag,dex,dey,dez,err,dphi_el,syncSum
-      integer :: i,j,l
-
-! phi_el:   electrostatic potential (V)
-! rho_el:   charge density (C/m**3)
-! eps_el:   permittivity vacuum/air (F/m)
-
-      err=0._pr
-      phi_el1=0._pr
-
-      do i=imin,imax; do j=jmin,jmax; do l=lmin,lmax
+      real(kind=pr),dimension(2,2,2) :: weight
+      real(kind=pr) :: volE
+      integer       :: n,ibeg,iend,jbeg,jend,lbeg,lend
 
-        if (celltype(i,j,l).ne.active) cycle
+      rho_el=0._pr
 
-! solve the poisson equation:
-        diag= (2._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
-              +2._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
-              +2._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))))
+      do 1 n=1,np
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,0)
+        rho_el(ibeg:iend,jbeg:jend,lbeg:lend)= rho_el(ibeg:iend,jbeg:jend,lbeg:lend) + q_el(n)*partn(n)*weight/volE
+1     enddo
 
-        dex= &
-        (phi_el(i+1,j,l)*(xc(i)-xc(i-1))+phi_el(i-1,j,l)*(xc(i+1)-xc(i))) &
-        /(0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
-        dey= &
-        (phi_el(i,j+1,l)*(yc(j)-yc(j-1))+phi_el(i,j-1,l)*(yc(j+1)-yc(j))) &
-        /(0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
-        dez= &
-        (phi_el(i,j,l+1)*(zc(l)-zc(l-1))+phi_el(i,j,l-1)*(zc(l+1)-zc(l))) &
-        /(0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
+      call bcDirichlet(rho_el,0._pr)
+      call bcLEsource(rho_el)
 
-        phi_el1(i,j,l) = (rho_el(i,j,l)/eps_el + dex + dey + dez)/diag
-        dphi_el=phi_el1(i,j,l)-phi_el(i,j,l)
-        err=err+dphi_el*dphi_el
+      end
 
+!####################################################################
+!> @author Holger Grosshans
+!> @brief one sweep to relax phi_el poisson equation using Jacobi method
+!> @param err: L2 error norm
+!> @todo Jacobi converges too slow
+      subroutine calcPhi_el(err)
+      use var
+      use parallel
+      real(kind=pr),dimension(ii,jj,ll) :: dphi_el
+      real(kind=pr)                     :: diag,dex,dey,dez,err
+      integer                           :: i,j,l
+
+      dphi_el=0._pr
+
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        diag= ( 2._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
+               +2._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
+               +2._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))) )
+
+        dex= (phi_el(i+1,j,l)*(xc(i)-xc(i-1))+phi_el(i-1,j,l)*(xc(i+1)-xc(i))) &
+             /(0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
+        dey= (phi_el(i,j+1,l)*(yc(j)-yc(j-1))+phi_el(i,j-1,l)*(yc(j+1)-yc(j))) &
+             /(0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
+        dez= (phi_el(i,j,l+1)*(zc(l)-zc(l-1))+phi_el(i,j,l-1)*(zc(l+1)-zc(l))) &
+             /(0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
+
+        dphi_el(i,j,l) = (rho_el(i,j,l)/eps_el + dex + dey + dez)/diag - phi_el(i,j,l)
       enddo; enddo; enddo
 
+      phi_el=phi_el + dphi_el
+
+      call bcDirichlet(phi_el,0._pr)
 
-      phi_el=phi_el1
-      call sync(phi_el)
-      call bcPhi_el
-      err=(syncSum(err)/dimgptot)**(0.5_pr)
+      err=sqrt(sum((vol*dphi_el)**2))/volTot
+      err=syncSum(err)
       
-      return
       end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief one sweep to relax E field using Jacobi method
-!> @param err        L2 error norm
-      subroutine calcE_el(err)
+!> @brief calculate E from phi_el, not an iterative process
+      subroutine calcE_el
       use var
-      real(kind=pr) :: dexel,deyel,dezel,temp,err,syncSum
       integer :: i,j,l
 
-! phi_el:   electrostatic potential (V)
-! rho_el:   charge density (C/m**3)
-! E_el:     electrostatic field (V/m)
-! eps_el:   permittivity vacuum/air (F/m)
-
-      err=0._pr
-
-      do i=imin,imax; do j=jmin,jmax; do l=lmin,lmax
-
-        if (celltype(i,j,l).ne.active) cycle
-
-! calculate electrostatic field
-        temp= Ex_el(i,j,l)
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
         Ex_el(i,j,l)= - (phi_el(i+1,j,l)-phi_el(i-1,j,l))/(xc(i+1)-xc(i-1))
-        dexel=temp-Ex_el(i,j,l)
-
-        temp= Ey_el(i,j,l)
         Ey_el(i,j,l)= - (phi_el(i,j+1,l)-phi_el(i,j-1,l))/(yc(j+1)-yc(j-1))
-        deyel=temp-Ey_el(i,j,l)
-
-        temp= Ez_el(i,j,l)
         Ez_el(i,j,l)= - (phi_el(i,j,l+1)-phi_el(i,j,l-1))/(zc(l+1)-zc(l-1))
-        dezel=temp-Ez_el(i,j,l)
-      
-        err=err+dexel*dexel+deyel*deyel+dezel*dezel
-                
       enddo; enddo; enddo
 
-      call sync(Ex_el); call sync(Ey_el); call sync(Ez_el)
-      call bcE_el
-      err=(syncSum(err)/dimgptot/3._pr)**(0.5_pr)
-!      write(*,'(x,a,es9.2e2,a,3(es9.2e2))') &
-!      'res. E =',err
+      call bcNeumann(Ex_el); call bcNeumann(Ey_el); call bcNeumann(Ez_el)
 
-      return
       end
 
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief compute volumetric charge density
-      subroutine chargeDensity
-      use var
-      real(kind=pr),dimension(3,3,3) :: weight
-      real(kind=pr) :: volE
-      integer       :: n,ibeg,iend,jbeg,jend,lbeg,lend,i,j,l, &
-                       iw,jw,lw,ip,jp,lp
-
-!      rho_el(imin:imax,jmin:jmax,lmin:lmax)=0._pr
-      rho_el(:,jmin:jmax,lmin:lmax)=0._pr
-
-
-      do 1 n=1,np
-        if (celltype(ip(n),jp(n),lp(n)).ne.active) cycle
-
-        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,0)
-
-        do i=ibeg,iend; do j=jbeg,jend; do l=lbeg,lend
-          iw=i+1-ibeg
-          jw=j+1-jbeg
-          lw=l+1-lbeg
-          rho_el(i,j,l) = rho_el(i,j,l) + q_el(n)*partn(n)*weight(iw,jw,lw)/volE
-        enddo; enddo; enddo
-
-1     enddo
-
-      call bcRho_el
-
-      return
-      end
-
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief compute electric forces on particles from E-field
+!>        at seeding time-step E is not available, only Coulomb forces
       subroutine forcesGauss
       use var
-      real(kind=pr),dimension(3,3,3) :: weight
+      real(kind=pr),dimension(2,2,2) :: weight
       real(kind=pr) :: Extot,Eytot,Eztot,partmass,volE
-      integer       :: n,ibeg,iend,jbeg,jend,lbeg,lend,i,j,l, &
-                       iw,jw,lw,ip,jp,lp
-
+      integer       :: n,ibeg,iend,jbeg,jend,lbeg,lend
 
       do 1 n=1,np
-        if (celltype(ip(n),jp(n),lp(n)).ne.active) cycle
-
-        Extot=0._pr   
-        Eytot=0._pr   
-        Eztot=0._pr   
-
         call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,0)
 
-        do i=ibeg,iend; do j=jbeg,jend; do l=lbeg,lend
-          iw=i+1-ibeg
-          jw=j+1-jbeg
-          lw=l+1-lbeg
-          Extot=Extot+Ex_el(i,j,l)*weight(iw,jw,lw)
-          Eytot=Eytot+Ey_el(i,j,l)*weight(iw,jw,lw)
-          Eztot=Eztot+Ez_el(i,j,l)*weight(iw,jw,lw)
-        enddo; enddo; enddo
+        Extot= sum(Ex_el(ibeg:iend,jbeg:jend,lbeg:lend)*weight)
+        Eytot= sum(Ey_el(ibeg:iend,jbeg:jend,lbeg:lend)*weight)
+        Eztot= sum(Ez_el(ibeg:iend,jbeg:jend,lbeg:lend)*weight)
 
         partmass=4._pr/3._pr*pi*rhop*partn(n)*radp(n)**3
         fx_el(n)= q_el(n)*Extot/partmass
         fy_el(n)= q_el(n)*Eytot/partmass
         fz_el(n)= q_el(n)*Eztot/partmass
-
 1     enddo
 
-
-      return
       end
 
 !####################################################################
@@ -204,17 +129,15 @@
 !> @brief compute electric forces on particles from Coulomb's law
       subroutine forcesCoulomb
       use var
-      real(kind=pr) :: dis,dis3,disx,disy,disz, &
-          Extot,Eytot,Eztot,partmass
-      integer :: n1,n2,ip,jp,lp,m1,m2,i,j,l
+      use parallel
+      integer :: n1,n2,m1,m2,i,j,l
 
+      rtau_el_max=0._pr
 
       select case (elforceScheme)
-      case (2)
-        fx_el=0._pr
-        fy_el=0._pr
-        fz_el=0._pr
 
+      case (2)  ! only Coulomb law
+        fx_el=0._pr; fy_el=0._pr; fz_el=0._pr
         do 1 n1=2,np
         do 2 n2=1,(n1-1)
           if (n1.eq.n2) cycle
@@ -222,69 +145,59 @@
 2       enddo
 1       enddo
 
-      case (3)
-        do i=1,ii; do j=1,jj; do l=1,ll
-
-        do 4 m1=2,npic(i,j,l)
-        do 5 m2=1,(m1-1)
-          n1=nic(i,j,l,m1)
-          n2=nic(i,j,l,m2)
-          call forcesCoulombN1N2(n1,n2)
-5       enddo
-4       enddo
+      case (3)  ! hybrid scheme, only particles in same cell
+        do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+          do 4 m1=2,npic(i,j,l)
+          do 5 m2=1,(m1-1)
+            n1=nic(i,j,l,m1)
+            n2=nic(i,j,l,m2)
+            call forcesCoulombN1N2(n1,n2)
+5         enddo
+4         enddo
         enddo; enddo; enddo
 
       end select
 
-      return
-      end
+      rtau_el_max=syncMax(rtau_el_max)
 
+      contains
 
-!####################################################################
-!> @author Holger Grosshans
 !> @brief compute Coulomb force of n2 acting on n1
-      subroutine forcesCoulombN1N2(n1,n2)
-      use var
-      real(kind=pr) :: dis,dis3,disx,disy,disz,partmass
-      integer :: n1,n2,ip,jp,lp
-
-
-      disx=xp(n1)-xp(n2)
-      disy=yp(n1)-yp(n2)
-      disz=zp(n1)-zp(n2)
-      dis=(disx**2+disy**2+disz**2)**0.5
-      dis3=dis**3
+        subroutine forcesCoulombN1N2(n1,n2)
+        use var
+        real(kind=pr) :: dis,dis3,disx,disy,disz,partmass1,partmass2,rtau_el
+        integer :: n1,n2
   
-      partmass=4._pr/3._pr*pi*rhop*partn(n1)*radp(n1)**3
-
-      fx_el(n1)= fx_el(n1) &
-               + q_el(n1)*q_el(n2)*disx/4._pr/pi/eps_el/dis3/partmass
-      fy_el(n1)= fy_el(n1) &
-               + q_el(n1)*q_el(n2)*disy/4._pr/pi/eps_el/dis3/partmass
-      fz_el(n1)= fz_el(n1) &
-               + q_el(n1)*q_el(n2)*disz/4._pr/pi/eps_el/dis3/partmass
-
-      partmass=4._pr/3._pr*pi*rhop*partn(n2)*radp(n2)**3
-
-      fx_el(n2)= fx_el(n2) &
-               - q_el(n1)*q_el(n2)*disx/4._pr/pi/eps_el/dis3/partmass
-      fy_el(n2)= fy_el(n2) &
-               - q_el(n1)*q_el(n2)*disy/4._pr/pi/eps_el/dis3/partmass
-      fz_el(n2)= fz_el(n2) &
-               - q_el(n1)*q_el(n2)*disz/4._pr/pi/eps_el/dis3/partmass
+        disx=xp(n1)-xp(n2)
+        disy=yp(n1)-yp(n2)
+        disz=zp(n1)-zp(n2)
+        dis=sqrt(disx**2+disy**2+disz**2) 
+        dis3=dis**3
+        partmass1=4._pr/3._pr*pi*rhop*partn(n1)*radp(n1)**3
+        partmass2=4._pr/3._pr*pi*rhop*partn(n2)*radp(n2)**3
+        rtau_el= sqrt(abs(q_el(n1)*q_el(n2))/4._pr/pi/eps_el/dis**2/min(partmass1,partmass2)/2._pr/dis) ! =sqrt(2*dis/acceleration)
+        rtau_el_max=max(rtau_el_max,rtau_el)
+        if (rtau_el.gt.(1._pr/dtNext)) dis3=dis3*(dtNext*rtau_el)**2 ! scale dis for stability
+        
+        fx_el(n1)= fx_el(n1) + q_el(n1)*q_el(n2)*disx/4._pr/pi/eps_el/dis3/partmass1
+        fy_el(n1)= fy_el(n1) + q_el(n1)*q_el(n2)*disy/4._pr/pi/eps_el/dis3/partmass1
+        fz_el(n1)= fz_el(n1) + q_el(n1)*q_el(n2)*disz/4._pr/pi/eps_el/dis3/partmass1
+  
+        fx_el(n2)= fx_el(n2) - q_el(n1)*q_el(n2)*disx/4._pr/pi/eps_el/dis3/partmass2
+        fy_el(n2)= fy_el(n2) - q_el(n1)*q_el(n2)*disy/4._pr/pi/eps_el/dis3/partmass2
+        fz_el(n2)= fz_el(n2) - q_el(n1)*q_el(n2)*disz/4._pr/pi/eps_el/dis3/partmass2
 
+        end
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief compute particle-wall charging
       subroutine chargeParticleWall(n,direction)
       use var
       real(kind=pr) :: ut2,un2,alpha1,AoAtot,dqp,random(2),random_normal
-      integer :: n,i,direction
+      integer :: n,direction
       character(70) :: filename
 
 
@@ -311,20 +224,18 @@
 
       call random_number(random)
       random_normal=cos(2._pr*pi*random(1))*sqrt(-2._pr*log(random(2)+1.e-12_pr))    ! Box-Muller method
-      dqp=Qaccfactor*(qpmax-q_el(n))*(random_normal+1._pr)  ! ...(mu*random_normal+sigma)
-      q_el(n)=max(min(q_el(n)+dqp,qpmax),qp0)
+      dqp=Qaccfactor*(qpmax-q_elNext(n))*(random_normal+1._pr)  ! ...(mu*random_normal+sigma)
+      q_elNext(n)=max(min(q_elNext(n)+dqp,qpmax),qp0)
       
 
       write(filename,'(a,i3.3,a)') 'results/particlesWall_p',myid,'.dat'
       open(access='append',unit=10,file=filename)
-      write(10,77) nt,t,sqrt(ut2),sqrt(un2),dqp,q_el(n)
+      write(10,77) nt,t,sqrt(ut2),sqrt(un2),dqp,q_elNext(n)
 77    format(i7,5(x,es11.3e2))
       close(10)
  
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief compute particle-particle charging
@@ -349,17 +260,15 @@
 
       call random_number(random)
       random_normal=cos(2._pr*pi*random(1))*sqrt(-2._pr*log(random(2)+1.e-12_pr))    ! Box-Muller method
-      dqp=Qaccfactor*(q_el(n2)-q_el(n1))*(random_normal+1._pr)
-      q_el(n1)=max(min(q_el(n1)+dqp,qpmax),qp0)
-      q_el(n2)=max(min(q_el(n2)-dqp,qpmax),qp0)
+      dqp=Qaccfactor*(q_elNext(n2)-q_elNext(n1))*(random_normal+1._pr)
+      q_elNext(n1)=max(min(q_elNext(n1)+dqp,qpmax),qp0)
+      q_elNext(n2)=max(min(q_elNext(n2)-dqp,qpmax),qp0)
 
 
       write(filename,'(a,i3.3,a)') 'results/particlesPart_p',myid,'.dat'
       open(access='append',unit=10,file=filename)
-      write(10,77) nt,t,q_el(n1),q_el(n2),dqp
+      write(10,77) nt,t,q_elNext(n1),q_elNext(n2),dqp
 77    format(i7,4(x,es11.3e2))
       close(10)
-
      
-      return
       end
diff --git a/src/fluid.f90 b/src/fluid.f90
index b96194da4ec6bb371ce7436e417f2dcec4f4f04b..30cab7f97af1550f3f282afd98d8c098826c9afd 100644
--- a/src/fluid.f90
+++ b/src/fluid.f90
@@ -1,70 +1,305 @@
 !####################################################################
 !> @author Holger Grosshans
 !> @brief solves coupled pressure-velocity and calculates L2 norms
+!> @param err: L2 error norm
       subroutine solveFluid
       use var
-      real(kind=pr) err,err1,err2,err0,err10,err20, &
-      err00,err100,err200,lambda11,lambda12
-      integer it
+      use parallel
+      real(kind=pr),dimension(ii,jj,ll) :: du,dv,dw,dp,ddp,massRes
+      real(kind=pr) :: err(4),err0(4),errL2
+      integer itout,it,itmommax,itpCorr1max,itpCorr2max,velCorr1,velCorr2
+
+!> itmax: outer iterations
+      itmommax=1; itpCorr1max=1; itpCorr2max=0  ! sequential SIMPLE
+     !itmommax=4; itpCorr1max=4; itpCorr2max=0  ! SIMPLE
+     !itmommax=4; itpCorr1max=4; itpCorr2max=4  ! PISO
+      velCorr1=0; velCorr2=0                    ! velocity correction yes/no (1/0)
 
-      call ddt
-      call deferredCorrection
       if ((bcx.eq.'i').and.(myid.eq.0)) call inflow
 
-      do 1 it=1,itmax
-        call momentum(err1)
-        call pressure(err2)
-        err=(3._pr*err1+err2)/4._pr
-        if (it.eq.1) then
-          err00=err; err10=err1; err20=err2
-          if (err.eq.0._pr) err00=1._pr
-          if (err1.eq.0._pr) err10=1._pr
-          if (err2.eq.0._pr) err20=1._pr
+      do 1 itout=1,itmax
+
+        if ((mod(it,10).eq.0).and.(npTot.ne.0)) call momentumCoupling
+
+        do 2 it=1,itmommax              ! solve momentum eq
+          call momx(du); call momy(dv); call momz(dw)
+          call bcUVW(du,dv,dw)
+          u=u+du*urfu;   v=v+dv*urfv;   w=w+dw*urfw
+2       enddo
+
+        call mass(massRes,u,v,w)        ! first pressure correction
+        dp=0._pr
+        do 3 it=1,itpCorr1max
+          call pressureCorrection(dp,massRes)
+          call bcNeumann(dp)
+3       enddo
+        p= p+dp*urfp
+
+        if (velCorr2.eq.1) then         ! first velocity correction
+          call velocityCorrection(du,dv,dw,dp)
+          call bcUVW(du,dv,dw)
+          u=u+du*urfu;   v=v+dv*urfv;   w=w+dw*urfw
         endif
-        if (err/err00.lt.tol) exit
+
+        if (itpCorr2max.ge.1) then
+          call mass(massRes,du,dv,dw)   ! second pressure correction
+          dp=0._pr
+          do 4 it=1,itpCorr2max
+            call pressureCorrection(dp,massRes)
+            call bcNeumann(dp)
+4         enddo
+          p= p+dp*urfp
+
+          if (velCorr2.eq.1) then       ! second velocity correction
+            call velocityCorrection(du,dv,dw,dp)
+            call bcUVW(du,dv,dw)
+            u=u+du*urfu;   v=v+dv*urfv;   w=w+dw*urfw
+          endif
+        endif
+
+        err=sqrt([sum(volu*du),sum(volv*dv),sum(volw*dw),sum(vol*dp)]**2)/volTot
+        err(1)=syncSum(err(1)); err(2)=syncSum(err(2)); err(3)=syncSum(err(3)); err(4)=syncSum(err(4))
+        !if (myid.eq.0) write(*,'(x,a,4(es9.2e2))') 'res. inner it. u,v,w,p =',err
+        if (itout.eq.1) err0=max(err,1.e-20_pr)
+        errL2=sum(err/err0)/4._pr
+        if (errL2.lt.tol) exit ! converged
+
 1     enddo
 
+      if (myid.eq.0) write(*,'(a,i3,3(a,es8.2e2))') 'fluid     |L2 #',itout-1,' = ',errL2, &
+                     ' |mom.    = ',sum(err(1:3)/err0(1:3))/3._pr,' |pc.     = ',err(4)/err0(4)
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief pressure corrrection step
+      subroutine pressureCorrection(dp,massRes)
+      use var
+      real(kind=pr),dimension(ii,jj,ll) :: dp,ddp,massRes
+      integer :: i,j,l
+
+      ddp=0._pr
+
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        ddp(i,j,l)= (   Cb1(i,j,l)*dp(i+1,j,l) + Cb2(i,j,l)*dp(i-1,j,l) &
+                      + Cc1(i,j,l)*dp(i,j+1,l) + Cc2(i,j,l)*dp(i,j-1,l) &
+                      + Cd1(i,j,l)*dp(i,j,l+1) + Cd2(i,j,l)*dp(i,j,l-1) &
+                      + massRes(i,j,l)*rhof/dt ) / Ca(i,j,l) - dp(i,j,l)
+      enddo; enddo; enddo
+      dp=dp+ddp
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+      subroutine velocityCorrection(mydu,mydv,mydw,mydp)
+      use var
+      real(kind=pr),dimension(ii,jj,ll) :: mydu,mydv,mydw,mydp
+      real(kind=pr) :: ux,vy,wz
+      integer :: i,j,l
+
+      mydu=0._pr; mydv=0._pr; mydw=0._pr
+
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        if (celltype(i+1,j,l).ne.wall) mydu(i,j,l)= dt/(xc(i+1)-xc(i))/rhof*(mydp(i+1,j,l)-mydp(i,j,l))
+        if (celltype(i,j+1,l).ne.wall) mydv(i,j,l)= dt/(yc(j+1)-yc(j))/rhof*(mydp(i,j+1,l)-mydp(i,j,l))
+        if (celltype(i,j,l+1).ne.wall) mydw(i,j,l)= dt/(zc(l+1)-zc(l))/rhof*(mydp(i,j,l+1)-mydp(i,j,l))
+      enddo; enddo; enddo
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief compute mass residual
+      subroutine mass(massRes,myu,myv,myw)
+      use var
+      real(kind=pr),dimension(ii,jj,ll) :: massRes,myu,myv,myw
+      real(kind=pr) :: ux,vy,wz
+      integer :: i,j,l
+
+      massRes= 0._pr
+
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        if (celltype(i,j,l).ne.active) cycle
+        ux= (myu(i,j,l)-myu(i-1,j,l))/(xf(i)-xf(i-1)) ! 2nd order central
+        vy= (myv(i,j,l)-myv(i,j-1,l))/(yf(j)-yf(j-1))
+        wz= (myw(i,j,l)-myw(i,j,l-1))/(zf(l)-zf(l-1))
+        massRes(i,j,l)=-(ux+vy+wz)
+      enddo; enddo; enddo
 
-      if (myid.eq.0) &
-      write(*,'(3(a,es8.1e2))') &
-      'fluid    |L2/L2_0 = ' &
-      ,err/err00,' |mom.    = ',err1/err10,' |pc.     = ',err2/err20
-      if (myid.eq.0) &
-      write(*,'(a,i3,3(a,es8.1e2))') &
-      'fluid    |L2 #',it-1,' = ',err,' |mom.    = ',err1,' |pc.     = ',err2
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief momentum eq in x-direction, one sweep using Jacobi method
+      subroutine momx(du)
+      use var
+      real(kind=pr),dimension(ii,jj,ll) :: tu,qu,du
+      real(kind=pr) :: ua,va,wa,px,uux,vuy,wuz, &
+                       uxx,uyy,uzz,dudt,Cdudt,Cviscx,erru
+      integer :: i,j,l
+
+      tu=0._pr; qu=0._pr; du=0._pr
+
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        if (celltype(i+1,j,l).eq.wall) cycle
+
+! bilinear interpolation 
+        ua= u(i,j,l)
+        va= 0.25_pr*(v(i,j,l)+v(i,j-1,l)+v(i+1,j,l)+v(i+1,j-1,l))
+        wa= 0.25_pr*(w(i,j,l)+w(i,j,l-1)+w(i+1,j,l)+w(i+1,j,l-1))
+
+! convective terns (2nd order central)
+        uux= ua*(u(i+1,j,l)-u(i-1,j,l))/(xf(i+1)-xf(i-1))
+        vuy= va*(u(i,j+1,l)-u(i,j-1,l))/(yc(j+1)-yc(j-1))
+        wuz= wa*(u(i,j,l+1)-u(i,j,l-1))/(zc(l+1)-zc(l-1))
+
+! pressure gradient (2nd order central)
+        px= (p(i+1,j,l)-p(i,j,l))/(xc(i+1)-xc(i))
+
+! viscous terms (2nd order central)
+        uxx= (u(i+1,j,l)*(xf(i)-xf(i-1))+u(i-1,j,l)*(xf(i+1)-xf(i))-u(i,j,l)*(xf(i+1)-xf(i-1)))/ &
+             (0.5_pr*(xf(i+1)-xf(i-1))*(xf(i+1)-xf(i))*(xf(i)-xf(i-1)))
+        uyy= (u(i,j+1,l)*(yc(j)-yc(j-1))+u(i,j-1,l)*(yc(j+1)-yc(j))-u(i,j,l)*(yc(j+1)-yc(j-1)))/ &
+             (0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
+        uzz= (u(i,j,l+1)*(zc(l)-zc(l-1))+u(i,j,l-1)*(zc(l+1)-zc(l))-u(i,j,l)*(zc(l+1)-zc(l-1)))/ &
+             (0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
+
+! time integration (2nd order)
+        dudt= ((1._pr+tau01)*u(i,j,l)-(1._pr+tau01+tau02)*u01(i,j,l)+tau02*u02(i,j,l))/ &
+               (2._pr*tau01*dt)
+   
+! momentum eq -lhs+rhs (m/s**2)
+        tu(i,j,l)= - dudt -(uux+vuy+wuz) -(px+dpdx)/rhof + nuf*(uxx+uyy+uzz) + Fsx(i,j,l)
+
+! coefficients of u(i,j,l) of momentum eq
+        Cdudt=  (1._pr+tau01)/(2._pr*tau01*dt)
+        Cviscx= -2._pr*nuf * (  1._pr/((xf(i+1)-xf(i))*(xf(i)-xf(i-1))) &
+                              + 1._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
+                              + 1._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))) )
+
+! coefficients lhs-rhs
+        qu(i,j,l)= Cdudt - Cviscx
+   
+        du(i,j,l)=tu(i,j,l)/qu(i,j,l)
+
+      enddo; enddo; enddo
 
-      return
       end
 
+!####################################################################
+!> @author Holger Grosshans
+!> @brief momentum eq in y-direction, one sweep using Jacobi method
+      subroutine momy(dv)
+      use var
+      real(kind=pr),dimension(ii,jj,ll) :: tv,qv,dv
+      real(kind=pr) :: ua,va,wa,py,uvx,vvy,wvz, &
+                       vxx,vyy,vzz,dvdt,Cdvdt,Cviscy
+      integer :: i,j,l
+
+      tv=0._pr; qv=0._pr; dv=0._pr
+      
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        if (celltype(i,j+1,l).eq.wall) cycle
+
+! bilinear interpolation 
+        ua= 0.25_pr*(u(i,j,l)+u(i-1,j,l)+u(i,j+1,l)+u(i-1,j+1,l))
+        va= v(i,j,l)
+        wa= 0.25_pr*(w(i,j,l)+w(i,j,l-1)+w(i,j+1,l)+w(i,j+1,l-1))
+
+! convective terns (2nd order central)
+        uvx= ua*(v(i+1,j,l)-v(i-1,j,l))/(xc(i+1)-xc(i-1))
+        vvy= va*(v(i,j+1,l)-v(i,j-1,l))/(yf(j+1)-yf(j-1))
+        wvz= wa*(v(i,j,l+1)-v(i,j,l-1))/(zc(l+1)-zc(l-1))
+
+! pressure gradient (2nd order)
+        py=(p(i,j+1,l)-p(i,j,l))/(yc(j+1)-yc(j))
+
+! viscous terms (2nd order)
+        vxx= (v(i+1,j,l)*(xc(i)-xc(i-1))+v(i-1,j,l)*(xc(i+1)-xc(i))-v(i,j,l)*(xc(i+1)-xc(i-1)))/ &
+             (0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
+        vyy= (v(i,j+1,l)*(yf(j)-yf(j-1))+v(i,j-1,l)*(yf(j+1)-yf(j))-v(i,j,l)*(yf(j+1)-yf(j-1)))/ &
+             (0.5_pr*(yf(j+1)-yf(j-1))*(yf(j+1)-yf(j))*(yf(j)-yf(j-1)))
+        vzz= (v(i,j,l+1)*(zc(l)-zc(l-1))+v(i,j,l-1)*(zc(l+1)-zc(l))-v(i,j,l)*(zc(l+1)-zc(l-1)))/ &
+             (0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
+
+! time integration (2nd order)
+        dvdt = ((1._pr+tau01)*v(i,j,l)-(1._pr+tau01+tau02)*v01(i,j,l)+tau02*v02(i,j,l))/ &
+                (2._pr*tau01*dt)
+    
+! momentum eq. -lhs+rhs
+        tv(i,j,l)= - dvdt - (uvx+vvy+wvz) - py/rhof + nuf*(vxx+vyy+vzz) + Fsy(i,j,l)
+
+! coefficients of v(i,j,l) of momentum eq
+        Cdvdt=  (1._pr+tau01)/(2._pr*tau01*dt)
+        Cviscy= -2._pr*nuf * (  1._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
+                              + 1._pr/((yf(j+1)-yf(j))*(yf(j)-yf(j-1))) &
+                              + 1._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))) )
+
+! coefficients lhs-rhs
+        qv(i,j,l)= Cdvdt - Cviscy
+      
+        dv(i,j,l)=tv(i,j,l)/qv(i,j,l)
+
+      enddo; enddo; enddo
+
+      end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief calculate the adaptive time-step size
-      subroutine timestep
+!> @brief momentum eq in z-direction, one sweep using Jacobi method
+      subroutine momz(dw)
       use var
-      real(kind=pr) syncMax,umax
+      real(kind=pr),dimension(ii,jj,ll) :: tw,qw,dw
+      real(kind=pr) :: ua,va,wa,pz,uwx,vwy,wwz, &
+                       wxx,wyy,wzz,dwdt,Cdwdt,Cviscz
+      integer :: i,j,l
+
+      tw=0._pr; qw=0._pr; dw=0._pr
+
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        if (celltype(i,j,l+1).eq.wall) cycle
+
+! bilinear interpolation 
+        ua= 0.25_pr*(u(i,j,l)+u(i-1,j,l)+u(i,j,l+1)+u(i-1,j,l+1))
+        va= 0.25_pr*(v(i,j,l)+v(i,j-1,l)+v(i,j,l+1)+v(i,j-1,l+1))
+        wa= w(i,j,l)
+
+! convective terns (2nd order central)
+        uwx= ua*(w(i+1,j,l)-w(i-1,j,l))/(xc(i+1)-xc(i-1))
+        vwy= va*(w(i,j+1,l)-w(i,j-1,l))/(yc(j+1)-yc(j-1))
+        wwz= wa*(w(i,j,l+1)-w(i,j,l-1))/(zf(l+1)-zf(l-1))
+
+! pressure gradient (2nd order)
+        pz=(p(i,j,l+1)-p(i,j,l))/(zc(l+1)-zc(l))
 
-      umax= syncMax(maxval(abs(u)))
+! viscous terms (2nd order)
+        wxx= (w(i+1,j,l)*(xc(i)-xc(i-1))+w(i-1,j,l)*(xc(i+1)-xc(i))-w(i,j,l)*(xc(i+1)-xc(i-1)))/ &
+             (0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
+        wyy= (w(i,j+1,l)*(yc(j)-yc(j-1))+w(i,j-1,l)*(yc(j+1)-yc(j))-w(i,j,l)*(yc(j+1)-yc(j-1)))/ &
+             (0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
+        wzz= (w(i,j,l+1)*(zf(l)-zf(l-1))+w(i,j,l-1)*(zf(l+1)-zf(l))-w(i,j,l)*(zf(l+1)-zf(l-1)))/ &
+             (0.5_pr*(zf(l+1)-zf(l-1))*(zf(l+1)-zf(l))*(zf(l)-zf(l-1)))
 
-      if ((nt.eq.1).or.(umax.eq.0._pr)) then
-        dt=  cfl*dimx/dimi/10._pr
-        dt01=dt
-        dt02=dt01
-      else
-        dt02=dt01
-        dt01=dt
-        dt=  cfl*dimx/dimi/umax
-      endif
+! second-order time integration
+        dwdt= ((1._pr+tau01)*w(i,j,l)-(1._pr+tau01+tau02)*w01(i,j,l)+tau02*w02(i,j,l))/ &
+               (2._pr*tau01*dt)
+        
+! momentum eq. -lhs+rhs
+        tw(i,j,l)= - dwdt - (uwx+vwy+wwz) - pz/rhof + nuf*(wxx+wyy+wzz) + Fsz(i,j,l)
 
-! fixed time-step:
-!      dt=cfl*minval(hx)/ubulk
-!      dt01=dt
-!      dt02=dt
+! coefficients of u(i,j,l) of momentum eq
+        Cdwdt=  (1._pr+tau01)/(2._pr*tau01*dt)
+        Cviscz= -2._pr*nuf * (  1._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
+                              + 1._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
+                              + 1._pr/((zf(l+1)-zf(l))*(zf(l)-zf(l-1))) )
 
-      tau01=dt/(dt+dt01)
-      tau02=dt01/(dt01+dt02)
-      t=t+dt
+! coefficients lhs-rhs
+        qw(i,j,l)= Cdwdt - Cviscz
+    
+        dw(i,j,l)=tw(i,j,l)/qw(i,j,l)
 
+      enddo; enddo; enddo
 
-      return
       end
diff --git a/src/main.f90 b/src/main.f90
index 91feab50c39d2725fe4808f8a67d6f2f93c9fa28..d042447ec3febd5faeda405fe74ac8abe47389c8 100644
--- a/src/main.f90
+++ b/src/main.f90
@@ -1,35 +1,49 @@
+! Copyright 2015-2021 Holger Grosshans
+!
+! This program is free software: you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation, either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+!####################################################################
 !> @author Holger Grosshans
 !> @brief pafiX - particle flow simulation in eXplosion protection
       program pafiX
       use var
+      use parallel
       use mpi
-      real(kind=pr) :: syncAv
-
+      implicit none 
 
       call initParallel
       if (myid.eq.0) write(*,'(/a/a)') repeat('#',72),version
-      if (myid.eq.0) write(*,'(a/a)') repeat('#',72),'Pre-processing'
+      if (myid.eq.0) write(*,'(a/a)')  repeat('#',72),'Pre-processing'
       call preProcessing
 
-      if (myid.eq.0) write(*,'(a/a)') repeat('#',72),'Start computation'
+      if (myid.eq.0) write(*,'(a/a)')  repeat('#',72),'Start computation'
       do 10 nt=ntstart,ntend
-      if (myid.eq.0) write(*,'(a/a,i7,x,a,i7,x,a)') &
-        repeat('#',72),'nt=',nt,'of',ntend,'time-steps'
+      if (myid.eq.0) write(*,'(a/a,i7,x,a,i7,x,a)') repeat('#',72),'nt=',nt,'of',ntend,'time-steps'
 
         call syncCheck
-        call timestep
-
-        call solveFluid
-        call solveElectrostatics
-        call solveParticles
-
-        call postProcessing
-
-        timecom(1)=syncAv(timecom)
+        call prepareTimestep          ! nt-1 to nt
+        call solveFluid               ! nt-1 to nt
+        call solveElectrostatics      ! nt
+        call nextTimestepSize         ! nt to nt+1
+        call solveParticles           ! nt to nt+1
+        call postProcessing           ! nt
+
+        timecom(1)=syncSum(timecom(1))/nrprocs
+        timecom(9)=real(mpi_wtime(),kind=pr)-timebeg+timecom(10)
         if (myid.eq.0) write(*,'(3(a,es8.2e2))') &
-        'time (s) |physical= ',t, &
-        ' |comput. = ',(mpi_wtime()-timebeg), &
-        ' |MPI com = ',timecom(1)
+          'time (s)  |physical= ',t,' |comput. = ',timecom(9),' |MPI com = ',timecom(1)
+        call flush
 
 10    enddo
 
diff --git a/src/makefile b/src/makefile
index 6ed0367b799943482043167ac24eec15e7df1821..fd7dbe26bbb7b9888cf814e02676ed8697e2477c 100644
--- a/src/makefile
+++ b/src/makefile
@@ -1,24 +1,18 @@
 #%.o : %.mod
 
-OBJ =	var.o main.o pre.o bc.o restart.o fluid.o \
-      momentum.o post.o schemes.o \
-      pressure.o writevtk_fluid_xz.o \
-      parallel.o writevtk_grid.o particles.o \
-      mom1.o mom5.o particlesTransport.o \
-      mass.o electrostatics.o \
-      writevtk_particles.o writedat_particles.o \
- 	    writevtk_fluid_xy.o writevtk_fluid_xyz.o \
-      writevtk_fluid_yz.o writedat_fluid_xz.o \
-      writedat_fluid_xy.o
+OBJ =	var.o parallel.o main.o pre.o bc.o restart.o fluid.o \
+      timestep.o post.o particles.o particlesTransport.o \
+       electrostatics.o writedat_particles.o write_vtk.o
 INC =
 
 
 # gcc:
 CMP = mpifort
 #O3: optimization
-FLAGS   = -O3 -mcmodel=medium
+#FLAGS   = -O3 -mcmodel=medium
 #debugging:
-#FLAGS   = -g3 -O0 -fbounds-check -mcmodel=medium -fimplicit-none -fcheck=all -fbacktrace -floop-nest-optimize -ffpe-trap=invalid,zero,overflow -Wconversion -fno-tree-vectorize
+FLAGS   = -g3 -O0 -fbounds-check -mcmodel=medium -fimplicit-none -fcheck=all -fbacktrace -floop-nest-optimize -ffpe-trap=invalid,zero,overflow -Wconversion -fno-tree-vectorize 
+#-Wall
 FFLAGS  = -c $(FLAGS)
 
 
@@ -26,6 +20,8 @@ newfu: $(OBJ)
 	$(CMP) $(FLAGS) -o pafiX $(OBJ)
 var.o: var.f90 $(INC)
 	$(CMP) $(FFLAGS) var.f90
+parallel.o: parallel.f90 $(INC)
+	$(CMP) $(FFLAGS) parallel.f90
 main.o: main.f90 $(INC)
 	$(CMP) $(FFLAGS) main.f90
 pre.o: pre.f90 $(INC)
@@ -38,44 +34,18 @@ restart.o: restart.f90 $(INC)
 	$(CMP) $(FFLAGS) restart.f90
 fluid.o: fluid.f90 $(INC)
 	$(CMP) $(FFLAGS) fluid.f90
-momentum.o: momentum.f90 $(INC)
-	$(CMP) $(FFLAGS) momentum.f90
-pressure.o: pressure.f90 $(INC)
-	$(CMP) $(FFLAGS) pressure.f90
-mass.o: mass.f90 $(INC)
-	$(CMP) $(FFLAGS) mass.f90
-writevtk_fluid_xy.o: writevtk_fluid_xy.f90 $(INC)
-	$(CMP) $(FFLAGS) writevtk_fluid_xy.f90
-writevtk_fluid_xz.o: writevtk_fluid_xz.f90 $(INC)
-	$(CMP) $(FFLAGS) writevtk_fluid_xz.f90
-writevtk_fluid_yz.o: writevtk_fluid_yz.f90 $(INC)
-	$(CMP) $(FFLAGS) writevtk_fluid_yz.f90
-writevtk_fluid_xyz.o: writevtk_fluid_xyz.f90 $(INC)
-	$(CMP) $(FFLAGS) writevtk_fluid_xyz.f90
-writedat_fluid_xy.o: writedat_fluid_xy.f90 $(INC)
-	$(CMP) $(FFLAGS) writedat_fluid_xy.f90
-writedat_fluid_xz.o: writedat_fluid_xz.f90 $(INC)
-	$(CMP) $(FFLAGS) writedat_fluid_xz.f90
-writevtk_particles.o: writevtk_particles.f90 $(INC)
-	$(CMP) $(FFLAGS) writevtk_particles.f90
-writedat_particles.o: writedat_particles.f90 $(INC)
-	$(CMP) $(FFLAGS) writedat_particles.f90
-parallel.o: parallel.f90 $(INC)
-	$(CMP) $(FFLAGS) parallel.f90
-writevtk_grid.o: writevtk_grid.f90 $(INC)
-	$(CMP) $(FFLAGS) writevtk_grid.f90
+timestep.o: timestep.f90 $(INC)
+	$(CMP) $(FFLAGS) timestep.f90
 particles.o: particles.f90 $(INC)
 	$(CMP) $(FFLAGS) particles.f90
 particlesTransport.o: particlesTransport.f90 $(INC)
 	$(CMP) $(FFLAGS) particlesTransport.f90
-mom1.o: mom1.f90 $(INC)
-	$(CMP) $(FFLAGS) mom1.f90
-mom5.o: mom5.f90 $(INC)
-	$(CMP) $(FFLAGS) mom5.f90
 electrostatics.o: electrostatics.f90 $(INC)
 	$(CMP) $(FFLAGS) electrostatics.f90
-schemes.o: schemes.f90 $(INC)
-	$(CMP) $(FFLAGS) schemes.f90
+write_vtk.o: write_vtk.f90 $(INC)
+	$(CMP) $(FFLAGS) write_vtk.f90
+writedat_particles.o: writedat_particles.f90 $(INC)
+	$(CMP) $(FFLAGS) writedat_particles.f90
 
 clean:
 	rm *.o *.mod
diff --git a/src/mass.f90 b/src/mass.f90
deleted file mode 100644
index 7220ac14872fcabf223699c76c54bcdea48734f6..0000000000000000000000000000000000000000
--- a/src/mass.f90
+++ /dev/null
@@ -1,36 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-!> @brief 2nd order discretization of mass conservation
-      subroutine mass2(rmc,i,j,l)
-      use var
-      real(kind=pr) rmc,ux,vy,wz
-      integer i,j,l
-
-      ux= (u(i,j,l)-u(i-1,j,l))/(xf(i)-xf(i-1))
-      vy= (v(i,j,l)-v(i,j-1,l))/(yf(j)-yf(j-1))
-      wz= (w(i,j,l)-w(i,j,l-1))/(zf(l)-zf(l-1))
-
-      rmc=-(ux+vy+wz)
-
-      
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief 4th order discretization of mass conservation
-      subroutine mass4(rmc,i,j,l)
-      use var
-      real(kind=pr) :: rmc,ux,vy,wz,d1o4
-      integer :: i,j,l
-
-      ux=d1o4(xc(i),u(i-2,j,l),u(i-1,j,l),u(i,j,l),u(i+1,j,l),xf(i-2),xf(i-1),xf(i),xf(i+1))
-      vy=d1o4(yc(j),v(i,j-2,l),v(i,j-1,l),v(i,j,l),v(i,j+1,l),yf(j-2),yf(j-1),yf(j),yf(j+1))
-      wz=d1o4(zc(l),w(i,j,l-2),w(i,j,l-1),w(i,j,l),w(i,j,l+1),zf(l-2),zf(l-1),zf(l),zf(l+1))
-
-      rmc=-(ux+vy+wz)
-
-
-      return
-      end
diff --git a/src/mom1.f90 b/src/mom1.f90
deleted file mode 100644
index e99b4c289026a800405578b52f8cb75d396d8878..0000000000000000000000000000000000000000
--- a/src/mom1.f90
+++ /dev/null
@@ -1,228 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-!> @brief first order discretization of momentum eq in x-direction
-      subroutine momx1(tu,qu,i,j,l)
-      use var
-      real(kind=pr) :: ua,va,wa,tu,qu,px,uux,vuy,wuz, &
-                       uxx,uyy,uzz,temporal,conx,pressx,viscx, &
-                       Ctemporal,Cconx,Cpressx,Cviscx,Cuux,Cvuy,Cwuz
-      integer :: i,j,l
-
-! bilinear interpolation 
-      ua= u(i,j,l)
-      va= 0.25_pr*(v(i,j,l)+v(i,j-1,l)+v(i+1,j,l)+v(i+1,j-1,l))
-      wa= 0.25_pr*(w(i,j,l)+w(i,j,l-1)+w(i+1,j,l)+w(i+1,j,l-1))
-
-! upwind (1st order)
-      if (ua.ge.0._pr) then
-        uux= ua*(u(i,j,l)-u(i-1,j,l))/(xf(i)-xf(i-1))
-        Cuux= ua/(xf(i)-xf(i-1))
-      else
-        uux= ua*(u(i+1,j,l)-u(i,j,l))/(xf(i+1)-xf(i))
-        Cuux= -ua/(xf(i+1)-xf(i))
-      endif
-
-      if (va.ge.0._pr) then
-        vuy= va*(u(i,j,l)-u(i,j-1,l))/(yc(j)-yc(j-1))
-        Cvuy= va/(yc(j)-yc(j-1))
-      else
-        vuy= va*(u(i,j+1,l)-u(i,j,l))/(yc(j+1)-yc(j))
-        Cvuy= -va/(yc(j+1)-yc(j))
-      endif
-
-      if (wa.ge.0._pr) then
-        wuz= wa*(u(i,j,l)-u(i,j,l-1))/(zc(l)-zc(l-1))
-        Cwuz= wa/(zc(l)-zc(l-1))
-      else
-        wuz= wa*(u(i,j,l+1)-u(i,j,l))/(zc(l+1)-zc(l))
-        Cwuz= -wa/(zc(l+1)-zc(l))
-      endif
-
-! pressure gradient (2nd order)
-      px= (p(i+1,j,l)-p(i,j,l))/(xc(i+1)-xc(i))
-
-! viscous terms (2nd order)
-      uxx= (u(i+1,j,l)*(xf(i)-xf(i-1))+u(i-1,j,l)*(xf(i+1)-xf(i))-u(i,j,l)*(xf(i+1)-xf(i-1)))/ &
-           (0.5_pr*(xf(i+1)-xf(i-1))*(xf(i+1)-xf(i))*(xf(i)-xf(i-1)))
-      uyy= (u(i,j+1,l)*(yc(j)-yc(j-1))+u(i,j-1,l)*(yc(j+1)-yc(j))-u(i,j,l)*(yc(j+1)-yc(j-1)))/ &
-           (0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
-      uzz= (u(i,j,l+1)*(zc(l)-zc(l-1))+u(i,j,l-1)*(zc(l+1)-zc(l))-u(i,j,l)*(zc(l+1)-zc(l-1)))/ &
-           (0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
-
-! terms of momentum eq
-      temporal = ((1._pr+tau01)*u(i,j,l)+dudt(i,j,l))/(2._pr*tau01*dt)
-      conx     = uux+vuy+wuz
-      pressx   = (px+dpdx)/rhof
-      viscx    = nuf*(uxx+uyy+uzz)
-
-! rhs-lhs (m/s**2)
-      tu = -temporal -conx -pressx + viscx + fsx(i,j,l)
-
-! coefficients of u(i,j,l) of momentum eq
-      Ctemporal= (1._pr+tau01)/(2._pr*tau01*dt)
-      Cconx    = Cuux+Cvuy+Cwuz
-      Cviscx   = -2._pr*nuf  &
-                 *(1._pr/((xf(i+1)-xf(i))*(xf(i)-xf(i-1))) &
-                 + 1._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
-                 + 1._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))))
-
-! coefficients lhs-rhs
-      qu= Ctemporal +Cconx -Cviscx
-
-
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief first order discretization of momentum eq in y-direction
-      subroutine momy1(tv,qv,i,j,l)
-      use var
-      real(kind=pr) :: ua,va,wa,tv,qv,py,uvx,vvy,wvz, &
-                       vxx,vyy,vzz,temporal,cony,pressy,viscy, &
-                       Ctemporal,Ccony,Cpressy,Cviscy,Cuvx,Cvvy,Cwvz
-      integer :: i,j,l
-
-! bilinear interpolation 
-      ua= 0.25_pr*(u(i,j,l)+u(i-1,j,l)+u(i,j+1,l)+u(i-1,j+1,l))
-      va= v(i,j,l)
-      wa= 0.25_pr*(w(i,j,l)+w(i,j,l-1)+w(i,j+1,l)+w(i,j+1,l-1))
-
-! upwind (1st order)
-      if (ua.ge.0._pr) then
-        uvx= ua*(v(i,j,l)-v(i-1,j,l))/(xc(i)-xc(i-1))
-        Cuvx= ua/(xc(i)-xc(i-1))
-      else
-        uvx= ua*(v(i+1,j,l)-v(i,j,l))/(xc(i+1)-xc(i))
-        Cuvx= -ua/(xc(i+1)-xc(i))
-      endif
-
-      if (va.ge.0._pr) then
-        vvy= va*(v(i,j,l)-v(i,j-1,l))/(yf(j)-yf(j-1))
-        Cvvy= va/(yf(j)-yf(j-1))
-      else
-        vvy= va*(v(i,j+1,l)-v(i,j,l))/(yf(j+1)-yf(j))
-        Cvvy= -va/(yf(j+1)-yf(j))
-      endif
-
-      if (wa.ge.0._pr) then
-        wvz= wa*(v(i,j,l)-v(i,j,l-1))/(zc(l)-zc(l-1))
-        Cwvz= wa/(zc(l)-zc(l-1))
-      else
-        wvz= wa*(v(i,j,l+1)-v(i,j,l))/(zc(l+1)-zc(l))
-        Cwvz= -wa/(zc(l+1)-zc(l))
-      endif
-
-! pressure gradient (2nd order)
-      py=(p(i,j+1,l)-p(i,j,l))/(yc(j+1)-yc(j))
-
-! viscous terms (2nd order)
-      vxx= (v(i+1,j,l)*(xc(i)-xc(i-1))+v(i-1,j,l)*(xc(i+1)-xc(i))-v(i,j,l)*(xc(i+1)-xc(i-1)))/ &
-           (0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
-      vyy= (v(i,j+1,l)*(yf(j)-yf(j-1))+v(i,j-1,l)*(yf(j+1)-yf(j))-v(i,j,l)*(yf(j+1)-yf(j-1)))/ &
-           (0.5_pr*(yf(j+1)-yf(j-1))*(yf(j+1)-yf(j))*(yf(j)-yf(j-1)))
-      vzz= (v(i,j,l+1)*(zc(l)-zc(l-1))+v(i,j,l-1)*(zc(l+1)-zc(l))-v(i,j,l)*(zc(l+1)-zc(l-1)))/ &
-           (0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
-
-! terms of momentum eq
-      temporal = ((1._pr+tau01)*v(i,j,l)+dvdt(i,j,l))/(2._pr*tau01*dt)
-      cony     = uvx+vvy+wvz
-      pressy   = py/rhof
-      viscy    = nuf*(vxx+vyy+vzz)
-
-! rhs - lhs
-      tv = -temporal - cony - pressy + viscy + fsy(i,j,l)
-
-! coefficients of v(i,j,l) of momentum eq
-      Ctemporal= (1._pr+tau01)/(2._pr*tau01*dt)
-      Ccony    = Cuvx+Cvvy+Cwvz
-      Cviscy   = -2._pr*nuf &
-                 *(1._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
-                 + 1._pr/((yf(j+1)-yf(j))*(yf(j)-yf(j-1))) &
-                 + 1._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))))
-
-! coefficients lhs-rhs
-      qv= Ctemporal +Ccony -Cviscy
-
-
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief first order discretization of momentum eq in z-direction
-      subroutine momz1(tw,qw,i,j,l)
-      use var
-      real(kind=pr) :: ua,va,wa,tw,qw,pz,uwx,vwy,wwz, &
-                       wxx,wyy,wzz,temporal,conz,pressz,viscz, &
-                       Ctemporal,Cconz,Cpressz,Cviscz,Cuwx,Cvwy,Cwwz
-      integer :: i,j,l
-
-
-! bilinear interpolation 
-      ua= 0.25_pr*(u(i,j,l)+u(i-1,j,l)+u(i,j,l+1)+u(i-1,j,l+1))
-      va= 0.25_pr*(v(i,j,l)+v(i,j-1,l)+v(i,j,l+1)+v(i,j-1,l+1))
-      wa= w(i,j,l)
-
-
-! upwind (1st order)
-      if (ua.ge.0._pr) then
-        uwx= ua*(w(i,j,l)-w(i-1,j,l))/(xc(i)-xc(i-1))
-        Cuwx= ua/(xc(i)-xc(i-1))
-      else
-        uwx= ua*(w(i+1,j,l)-w(i,j,l))/(xc(i+1)-xc(i))
-        Cuwx= -ua/(xc(i+1)-xc(i))
-      endif
-
-      if (va.ge.0._pr) then
-        vwy= va*(w(i,j,l)-w(i,j-1,l))/(yc(j)-yc(j-1))
-        Cvwy= va/(yc(j)-yc(j-1))
-      else
-        vwy= va*(w(i,j+1,l)-w(i,j,l))/(yc(j+1)-yc(j))
-        Cvwy= -va/(yc(j+1)-yc(j))
-      endif
-
-      if (wa.ge.0._pr) then
-        wwz= wa*(w(i,j,l)-w(i,j,l-1))/(zf(l)-zf(l-1))
-        Cwwz= wa/(zf(l)-zf(l-1))
-      else
-        wwz= wa*(w(i,j,l+1)-w(i,j,l))/(zf(l+1)-zf(l))
-        Cwwz= -wa/(zf(l+1)-zf(l))
-      endif
-
-! pressure gradient (2nd order)
-      pz=(p(i,j,l+1)-p(i,j,l))/(zc(l+1)-zc(l))
-
-! viscous terms (2nd order)
-      wxx= (w(i+1,j,l)*(xc(i)-xc(i-1))+w(i-1,j,l)*(xc(i+1)-xc(i))-w(i,j,l)*(xc(i+1)-xc(i-1)))/ &
-           (0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
-      wyy= (w(i,j+1,l)*(yc(j)-yc(j-1))+w(i,j-1,l)*(yc(j+1)-yc(j))-w(i,j,l)*(yc(j+1)-yc(j-1)))/ &
-           (0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
-      wzz= (w(i,j,l+1)*(zf(l)-zf(l-1))+w(i,j,l-1)*(zf(l+1)-zf(l))-w(i,j,l)*(zf(l+1)-zf(l-1)))/ &
-           (0.5_pr*(zf(l+1)-zf(l-1))*(zf(l+1)-zf(l))*(zf(l)-zf(l-1)))
-
-! terms of momentum eq
-      temporal = ((1._pr+tau01)*w(i,j,l)+dwdt(i,j,l))/(2._pr*tau01*dt)
-      conz     = uwx+vwy+wwz
-      pressz   = pz/rhof
-      viscz    = nuf*(wxx+wyy+wzz)
-
-! rhs - lhs
-      tw = -temporal - conz - pressz + viscz + fsz(i,j,l)
-
-! coefficients of u(i,j,l) of momentum eq
-      Ctemporal= (1._pr+tau01)/(2._pr*tau01*dt)
-      Cconz    =  Cuwx+Cvwy+Cwwz
-      Cviscz   = -2._pr*nuf &
-                 *(1._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
-                 + 1._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
-                 + 1._pr/((zf(l+1)-zf(l))*(zf(l)-zf(l-1))))
-
-! coefficients lhs-rhs
-      qw= Ctemporal +Cconz -Cviscz
-
-
-      return
-      end
diff --git a/src/mom5.f90 b/src/mom5.f90
deleted file mode 100644
index d7ea08e94e343a6598aa9cf4123ebacba8373bde..0000000000000000000000000000000000000000
--- a/src/mom5.f90
+++ /dev/null
@@ -1,246 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-!> @brief fifth order discretization of momentum eq in x-direction
-      subroutine momx5(tu,qu,i,j,l)
-      use var
-      real(kind=pr) :: ua,va,wa,tu,qu,px,uux,vuy,wuz, &
-                       uxx,uyy,uzz,temporal,conx,pressx,viscx, &
-                       f1,f2,f3,f4,fluxplu,fluxmin, &
-                       Ctemporal,Cconx,Cpressx,Cviscx, &
-                       d1o4
-      integer :: i,j,l
-
-
-! bilinear interpolation
-      ua= u(i,j,l)
-      va= 0.25_pr*(v(i,j,l)+v(i,j-1,l)+v(i+1,j,l)+v(i+1,j-1,l))
-      wa= 0.25_pr*(w(i,j,l)+w(i,j,l-1)+w(i+1,j,l)+w(i+1,j,l-1))
-
-! upwind (5th order WENO)
-      if (ua.gt.0._pr) then
-        call weno(fluxplu,u(i-2,j,l),u(i-1,j,l),u(i,j,l),u(i+1,j,l),u(i+2,j,l))
-        call weno(fluxmin,u(i-3,j,l),u(i-2,j,l),u(i-1,j,l),u(i,j,l),u(i+1,j,l))
-      else
-        call weno(fluxplu,u(i+3,j,l),u(i+2,j,l),u(i+1,j,l),u(i,j,l),u(i-1,j,l))
-        call weno(fluxmin,u(i+2,j,l),u(i+1,j,l),u(i,j,l),u(i-1,j,l),u(i-2,j,l))
-      endif
-      uux= ua*(fluxplu-fluxmin)/dxfdi(i)
-
-      if (va.gt.0._pr) then
-        call weno(fluxplu,u(i,j-2,l),u(i,j-1,l),u(i,j,l),u(i,j+1,l),u(i,j+2,l))
-        call weno(fluxmin,u(i,j-3,l),u(i,j-2,l),u(i,j-1,l),u(i,j,l),u(i,j+1,l))
-      else
-        call weno(fluxplu,u(i,j+3,l),u(i,j+2,l),u(i,j+1,l),u(i,j,l),u(i,j-1,l))
-        call weno(fluxmin,u(i,j+2,l),u(i,j+1,l),u(i,j,l),u(i,j-1,l),u(i,j-2,l))
-      endif
-      vuy= va*(fluxplu-fluxmin)/dycdj(j)
-
-      if (wa.gt.0._pr) then
-        call weno(fluxplu,u(i,j,l-2),u(i,j,l-1),u(i,j,l),u(i,j,l+1),u(i,j,l+2))
-        call weno(fluxmin,u(i,j,l-3),u(i,j,l-2),u(i,j,l-1),u(i,j,l),u(i,j,l+1))
-      else
-        call weno(fluxplu,u(i,j,l+3),u(i,j,l+2),u(i,j,l+1),u(i,j,l),u(i,j,l-1))
-        call weno(fluxmin,u(i,j,l+2),u(i,j,l+1),u(i,j,l),u(i,j,l-1),u(i,j,l-2))
-      endif
-      wuz= wa*(fluxplu-fluxmin)/dzcdl(l)
-
-! pressure gradient (4th order)
-      px=d1o4(xf(i),p(i-1,j,l),p(i,j,l),p(i+1,j,l),p(i+2,j,l),xc(i-1),xc(i),xc(i+1),xc(i+2))
-
-! viscous terms (2nd order)
-      uxx= (u(i+1,j,l)*(xf(i)-xf(i-1))+u(i-1,j,l)*(xf(i+1)-xf(i))-u(i,j,l)*(xf(i+1)-xf(i-1)))/ &
-           (0.5_pr*(xf(i+1)-xf(i-1))*(xf(i+1)-xf(i))*(xf(i)-xf(i-1)))
-      uyy= (u(i,j+1,l)*(yc(j)-yc(j-1)) + u(i,j-1,l)*(yc(j+1)-yc(j)) - u(i,j,l)*(yc(j+1)-yc(j-1)))/ &
-           (0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
-      uzz= (u(i,j,l+1)*(zc(l)-zc(l-1))+u(i,j,l-1)*(zc(l+1)-zc(l))-u(i,j,l)*(zc(l+1)-zc(l-1)))/ &
-           (0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
-
-! terms of momentum eq
-      temporal = ((1._pr+tau01)*u(i,j,l)+dudt(i,j,l))/(2._pr*tau01*dt)
-      conx     = uux+vuy+wuz
-      pressx   = (px+dpdx)/rhof
-      viscx    = nuf*(uxx+uyy+uzz)
-
-! rhs - lhs
-      tu = -temporal -conx -pressx + viscx + fsx(i,j,l)
-
-!quHO not needed!
-!! coefficients of du(i,j,l) of momentum eq
-!      Ctemporal= (1._pr+tau01)/(2._pr*tau01*dt)
-!      Cconx=     abs(ua)/dxfdi(i)+abs(va)/dycdj(j)+abs(wa)/dzcdl(l)
-!      Cviscx   = -2._pr*nuf  &
-!                 *(1._pr/((xf(i+1)-xf(i))*(xf(i)-xf(i-1))) &
-!                 + 1._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
-!                 + 1._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))))
-!
-!! coefficients lhs-rhs
-!      qu= Ctemporal +Cconx -Cviscx
-      qu=0._pr
-
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief fifth order discretization of momentum eq in y-direction
-      subroutine momy5(tv,qv,i,j,l)
-
-      use var
-      real(kind=pr) :: ua,va,wa,tv,qv,py,uvx,vvy,wvz, &
-                       vxx,vyy,vzz,temporal,cony,pressy,viscy, &
-                       f1,f2,f3,f4,fluxplu,fluxmin, &
-                       Ctemporal,Ccony,Cpressy,Cviscy, &
-                       d1o4
-      integer :: i,j,l
-
-
-! bilinear interpolation 
-      ua=0.25_pr*(u(i,j,l)+u(i-1,j,l)+u(i,j+1,l)+u(i-1,j+1,l))
-      va=v(i,j,l)
-      wa=0.25_pr*(w(i,j,l)+w(i,j,l-1)+w(i,j+1,l)+w(i,j+1,l-1))
-
-! upwind (5th order WENO)
-      if (ua.gt.0._pr) then
-        call weno(fluxplu,v(i-2,j,l),v(i-1,j,l),v(i,j,l),v(i+1,j,l),v(i+2,j,l))
-        call weno(fluxmin,v(i-3,j,l),v(i-2,j,l),v(i-1,j,l),v(i,j,l),v(i+1,j,l))
-      else
-        call weno(fluxplu,v(i+3,j,l),v(i+2,j,l),v(i+1,j,l),v(i,j,l),v(i-1,j,l))
-        call weno(fluxmin,v(i+2,j,l),v(i+1,j,l),v(i,j,l),v(i-1,j,l),v(i-2,j,l))
-      endif
-      uvx= ua*(fluxplu-fluxmin)/dxcdi(i)
-
-      if (va.gt.0._pr) then
-        call weno(fluxplu,v(i,j-2,l),v(i,j-1,l),v(i,j,l),v(i,j+1,l),v(i,j+2,l))
-        call weno(fluxmin,v(i,j-3,l),v(i,j-2,l),v(i,j-1,l),v(i,j,l),v(i,j+1,l))
-      else
-        call weno(fluxplu,v(i,j+3,l),v(i,j+2,l),v(i,j+1,l),v(i,j,l),v(i,j-1,l))
-        call weno(fluxmin,v(i,j+2,l),v(i,j+1,l),v(i,j,l),v(i,j-1,l),v(i,j-2,l))
-      endif
-      vvy= va*(fluxplu-fluxmin)/dyfdj(j)
-
-      if (wa.gt.0._pr) then
-        call weno(fluxplu,v(i,j,l-2),v(i,j,l-1),v(i,j,l),v(i,j,l+1),v(i,j,l+2))
-        call weno(fluxmin,v(i,j,l-3),v(i,j,l-2),v(i,j,l-1),v(i,j,l),v(i,j,l+1))
-      else
-        call weno(fluxplu,v(i,j,l+3),v(i,j,l+2),v(i,j,l+1),v(i,j,l),v(i,j,l-1))
-        call weno(fluxmin,v(i,j,l+2),v(i,j,l+1),v(i,j,l),v(i,j,l-1),v(i,j,l-2))
-      endif
-      wvz= wa*(fluxplu-fluxmin)/dzcdl(l)
-
-! pressure gradient (4th order)
-      py=d1o4(yf(j),p(i,j-1,l),p(i,j,l),p(i,j+1,l),p(i,j+2,l),yc(j-1),yc(j),yc(j+1),yc(j+2))
-
-! viscous terms (2nd order)
-      vxx= (v(i+1,j,l)*(xc(i)-xc(i-1))+v(i-1,j,l)*(xc(i+1)-xc(i))-v(i,j,l)*(xc(i+1)-xc(i-1)))/ &
-           (0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
-      vyy= (v(i,j+1,l)*(yf(j)-yf(j-1))+v(i,j-1,l)*(yf(j+1)-yf(j))-v(i,j,l)*(yf(j+1)-yf(j-1)))/ &
-           (0.5_pr*(yf(j+1)-yf(j-1))*(yf(j+1)-yf(j))*(yf(j)-yf(j-1)))
-      vzz= (v(i,j,l+1)*(zc(l)-zc(l-1))+v(i,j,l-1)*(zc(l+1)-zc(l))-v(i,j,l)*(zc(l+1)-zc(l-1)))/ &
-           (0.5_pr*(zc(l+1)-zc(l-1))*(zc(l+1)-zc(l))*(zc(l)-zc(l-1)))
-
-! terms of momentum eq
-      temporal = ((1._pr+tau01)*v(i,j,l)+dvdt(i,j,l))/(2._pr*tau01*dt)
-      cony     = uvx+vvy+wvz
-      pressy   = py/rhof
-      viscy    = nuf*(vxx+vyy+vzz)
-
-! rhs - lhs
-      tv = -temporal - cony - pressy + viscy + fsy(i,j,l)
-
-!! coefficients of dv(i,j,l) of momentum eq
-!      Ctemporal= (1._pr+tau01)/(2._pr*tau01*dt)
-!      Ccony=     abs(ua)/dxcdi(i)+abs(va)/dyfdj(j)+abs(wa)/dzcdl(l)
-!      Cviscy   = -2._pr*nuf &
-!                 *(1._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
-!                 + 1._pr/((yf(j+1)-yf(j))*(yf(j)-yf(j-1))) &
-!                 + 1._pr/((zc(l+1)-zc(l))*(zc(l)-zc(l-1))))
-!
-!! coefficients lhs-rhs
-!      qv= Ctemporal +Ccony -Cviscy
-      qv=0._pr
-
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief fifth order discretization of momentum eq in z-direction
-      subroutine momz5(tw,qw,i,j,l)
-      use var
-      real(kind=pr) :: ua,va,wa,tw,qw,pz,uwx,vwy,wwz, &
-                       wxx,wyy,wzz,temporal,conz,pressz,viscz, &
-                       f1,f2,f3,f4,fluxplu,fluxmin, &
-                       Ctemporal,Cconz,Cpressz,Cviscz, &
-                       d1o4
-      integer :: i,j,l
-
-
-! bilinear interpolation 
-      ua=0.25_pr*(u(i,j,l)+u(i-1,j,l)+u(i,j,l+1)+u(i-1,j,l+1))
-      va=0.25_pr*(v(i,j,l)+v(i,j-1,l)+v(i,j,l+1)+v(i,j-1,l+1))
-      wa=w(i,j,l)
-
-! upwind (5th order WENO)
-      if (ua.gt.0._pr) then
-        call weno(fluxplu,w(i-2,j,l),w(i-1,j,l),w(i,j,l),w(i+1,j,l),w(i+2,j,l))
-        call weno(fluxmin,w(i-3,j,l),w(i-2,j,l),w(i-1,j,l),w(i,j,l),w(i+1,j,l))
-      else
-        call weno(fluxplu,w(i+3,j,l),w(i+2,j,l),w(i+1,j,l),w(i,j,l),w(i-1,j,l))
-        call weno(fluxmin,w(i+2,j,l),w(i+1,j,l),w(i,j,l),w(i-1,j,l),w(i-2,j,l))
-      endif
-      uwx= ua*(fluxplu-fluxmin)/dxcdi(i)
-
-      if (va.gt.0._pr) then
-        call weno(fluxplu,w(i,j-2,l),w(i,j-1,l),w(i,j,l),w(i,j+1,l),w(i,j+2,l))
-        call weno(fluxmin,w(i,j-3,l),w(i,j-2,l),w(i,j-1,l),w(i,j,l),w(i,j+1,l))
-      else
-        call weno(fluxplu,w(i,j+3,l),w(i,j+2,l),w(i,j+1,l),w(i,j,l),w(i,j-1,l))
-        call weno(fluxmin,w(i,j+2,l),w(i,j+1,l),w(i,j,l),w(i,j-1,l),w(i,j-2,l))
-      endif
-      vwy= va*(fluxplu-fluxmin)/dycdj(j)
-
-      if (wa.gt.0._pr) then
-        call weno(fluxplu,w(i,j,l-2),w(i,j,l-1),w(i,j,l),w(i,j,l+1),w(i,j,l+2))
-        call weno(fluxmin,w(i,j,l-3),w(i,j,l-2),w(i,j,l-1),w(i,j,l),w(i,j,l+1))
-      else
-        call weno(fluxplu,w(i,j,l+3),w(i,j,l+2),w(i,j,l+1),w(i,j,l),w(i,j,l-1))
-        call weno(fluxmin,w(i,j,l+2),w(i,j,l+1),w(i,j,l),w(i,j,l-1),w(i,j,l-2))
-      endif
-      wwz= wa*(fluxplu-fluxmin)/dzfdl(l)
-
-! pressure gradient (4th order)
-      pz=d1o4(zf(l),p(i,j,l-1),p(i,j,l),p(i,j,l+1),p(i,j,l+2),zc(l-1),zc(l),zc(l+1),zc(l+2))
-
-! viscous terms (2nd order)
-      wxx= (w(i+1,j,l)*(xc(i)-xc(i-1))+w(i-1,j,l)*(xc(i+1)-xc(i))-w(i,j,l)*(xc(i+1)-xc(i-1)))/ &
-           (0.5_pr*(xc(i+1)-xc(i-1))*(xc(i+1)-xc(i))*(xc(i)-xc(i-1)))
-      wyy= (w(i,j+1,l)*(yc(j)-yc(j-1))+w(i,j-1,l)*(yc(j+1)-yc(j))-w(i,j,l)*(yc(j+1)-yc(j-1)))/ &
-           (0.5_pr*(yc(j+1)-yc(j-1))*(yc(j+1)-yc(j))*(yc(j)-yc(j-1)))
-      wzz= (w(i,j,l+1)*(zf(l)-zf(l-1))+w(i,j,l-1)*(zf(l+1)-zf(l))-w(i,j,l)*(zf(l+1)-zf(l-1)))/ &
-           (0.5_pr*(zf(l+1)-zf(l-1))*(zf(l+1)-zf(l))*(zf(l)-zf(l-1)))
-
-! terms of momentum eq
-      temporal = ((1._pr+tau01)*w(i,j,l)+dwdt(i,j,l))/(2._pr*tau01*dt)
-      conz     = uwx+vwy+wwz
-      pressz   = pz/rhof
-      viscz    = nuf*(wxx+wyy+wzz)
-
-! rhs - lhs
-      tw = -temporal - conz - pressz + viscz + fsz(i,j,l)
-
-!! coefficients of dw(i,j,l) of momentum eq
-!      Ctemporal= (1._pr+tau01)/(2._pr*tau01*dt)
-!      Cconz=     abs(ua)/dxcdi(i)+abs(va)/dycdj(j)+abs(wa)/dzfdl(l)
-!      Cviscz   = -2._pr*nuf &
-!                 *(1._pr/((xc(i+1)-xc(i))*(xc(i)-xc(i-1))) &
-!                 + 1._pr/((yc(j+1)-yc(j))*(yc(j)-yc(j-1))) &
-!                 + 1._pr/((zf(l+1)-zf(l))*(zf(l)-zf(l-1))))
-!
-!! coefficients lhs-rhs
-!      qw= Ctemporal +Cconz -Cviscz
-      qw=0._pr
-
-      return
-      end
diff --git a/src/momentum.f90 b/src/momentum.f90
deleted file mode 100644
index b1e95c167ea07ca90f369ab586d0d4fbacb54c6d..0000000000000000000000000000000000000000
--- a/src/momentum.f90
+++ /dev/null
@@ -1,144 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-!> @brief one sweep to relax momentum eq. using Jacobi method
-!> @param err: L2 error norm
-      subroutine  momentum(err)
-      use var
-
-      real(kind=pr),dimension(ii,jj,ll) :: u1,v1,w1
-      real(kind=pr) :: err,syncSum
-      real(kind=pr) :: dum,dvm,dwm
-      real(kind=pr) :: du,dv,dw,dua,dva,dwa
-      real(kind=pr) :: tu,tv,tw,qu,qv,qw
-      integer :: i,j,l
-
-      err=0._pr
-      u1=u; v1=v; w1=w
-      dum=0._pr; dvm=0._pr; dwm=0._pr
-
-
-      do i=imin,imax; do j=jmin,jmax; do l=lmin,lmax
-
-        if (celltype(i,j,l).ne.active) cycle
-
-        dua=0._pr; dva=0._pr; dwa=0._pr
-  
-        if (celltype(i+1,j,l).ne.wall) then
-         call momx1(tu,qu,i,j,l)
-         du=(defect_u(i,j,l)+tu)/qu*urfu
-         u1(i,j,l)=u(i,j,l)+du
-         dua=abs(du)
-         if (dum.lt.dua) dum=dua
-        endif
-  
-        if (celltype(i,j+1,l).ne.wall) then
-         call momy1(tv,qv,i,j,l)
-         dv=(defect_v(i,j,l)+tv)/qv*urfv
-         v1(i,j,l)=v(i,j,l)+dv
-         dva=abs(dv)
-         if (dvm.lt.dva) dvm=dva
-        endif
-  
-        if (celltype(i,j,l+1).ne.wall) then
-         call momz1(tw,qw,i,j,l)
-         dw=(defect_w(i,j,l)+tw)/qw*urfw
-         w1(i,j,l)=w(i,j,l)+dw
-         dwa=abs(dw)
-         if (dwm.lt.dwa) dwm=dwa
-        endif
-        
-        err=err+dua*dua+dva*dva+dwa*dwa
-
-      enddo; enddo; enddo
-
-      u=u1; v=v1; w=w1
-
-      call sync(u); call sync(v); call sync(w)
-      call bcUVWP
-
-      err=(syncSum(err)/dimgptot/3._pr)**(0.5_pr)
-!      write(*,'(x,a,es9.2e2,a,3(es9.2e2))') &
-!      'res. inner it. mom =',err,', max du,dv,dw =',dum,dvm,dwm
-
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief second-order time integration
-      subroutine ddt
-      use var
-      integer :: i,j,l
-
-      dudt=-(1._pr+tau01+tau02)*u+tau02*u01
-      dvdt=-(1._pr+tau01+tau02)*v+tau02*v01
-      dwdt=-(1._pr+tau01+tau02)*w+tau02*w01
-      u01=u
-      v01=v
-      w01=w
-      
-
-      return
-      end
-
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief HO-LO terms for deferred correction method
-      subroutine  deferredCorrection
-      use var
-      real(kind=pr) :: &
-      tu,tv,tw,qu,qv,qw,ra,raHO,tuHO,tvHO,twHO,quHO,qvHO,qwHO
-      integer :: i,j,l
-
-
-      do i=imin,imax+1; do j=jmin,jmax+1; do l=lmin,lmax+1
-
-        if ((celltype(i+1,j,l).ne.wall).and.(celltype(i-1,j,l).ne.wall).and. &
-            (celltype(i,j+1,l).ne.wall).and.(celltype(i,j-1,l).ne.wall).and. &
-            (celltype(i,j,l+1).ne.wall).and.(celltype(i,j,l-1).ne.wall)) then
-          call mass2(ra,i,j,l)
-          call mass4(raHO,i,j,l)
-          defect_c(i,j,l)=raHO-ra
-        else
-          defect_c(i,j,l)=0._pr
-        endif
-    
-        if (celltype(i,j,l).ne.active) cycle ! xmax+1 cells are only needed for defect_c
-
-        if ((celltype(i+3,j,l).ne.wall).and.(celltype(i-2,j,l).ne.wall).and. &
-            (celltype(i,j+2,l).ne.wall).and.(celltype(i,j-2,l).ne.wall).and. &
-            (celltype(i,j,l+2).ne.wall).and.(celltype(i,j,l-2).ne.wall)) then
-          call momx1(tu,qu,i,j,l)
-          call momx5(tuHO,quHO,i,j,l)
-          defect_u(i,j,l)=tuHO-tu
-        else
-          defect_u(i,j,l)=0._pr
-        endif
-
-        if ((celltype(i+2,j,l).ne.wall).and.(celltype(i-2,j,l).ne.wall).and. &
-            (celltype(i,j+3,l).ne.wall).and.(celltype(i,j-2,l).ne.wall).and. &
-            (celltype(i,j,l+2).ne.wall).and.(celltype(i,j,l-2).ne.wall)) then
-          call momy1(tv,qv,i,j,l)
-          call momy5(tvHO,qvHO,i,j,l)    
-          defect_v(i,j,l)=tvHO-tv
-        else
-          defect_v(i,j,l)=0._pr
-        endif
-
-        if ((celltype(i+2,j,l).ne.wall).and.(celltype(i-2,j,l).ne.wall).and. &
-            (celltype(i,j+2,l).ne.wall).and.(celltype(i,j-2,l).ne.wall).and. &
-            (celltype(i,j,l+3).ne.wall).and.(celltype(i,j,l-2).ne.wall)) then
-          call momz1(tw,qw,i,j,l)
-          call momz5(twHO,qwHO,i,j,l)
-          defect_w(i,j,l)=twHO-tw
-        else
-          defect_w(i,j,l)=0._pr
-        endif
-
-      enddo; enddo; enddo
-
-
-      return
-      end
diff --git a/src/parallel.f90 b/src/parallel.f90
index 89947601574ea71f66fd3182662ad81e084e8d12..404e4bf85371c4280eec00ba8c08cd45ca9f8887 100644
--- a/src/parallel.f90
+++ b/src/parallel.f90
@@ -1,3 +1,8 @@
+module parallel
+implicit none 
+
+contains
+
 !####################################################################
 !> @author Holger Grosshans
 !> @brief initialize MPI
@@ -10,52 +15,36 @@
       call mpi_comm_rank(mpi_comm_world,myid,mpierr)
       call mpi_type_create_f90_real(precision,mpi_undefined,mpi_pr,mpierr)
 
-      timecom=0._pr
       timenow=real(mpi_wtime(),kind=pr)
       timebeg=real(mpi_wtime(),kind=pr)
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief synchronize particles between processors
       subroutine syncPart(np_sendl,np_sendr,np_recvl,np_recvr,myvar)
       use var
       use mpi
-      real(kind=pr), dimension (maxnp) :: &
-      myvar,p_sendl,p_sendr,p_recvl,p_recvr
-      integer, dimension (maxnp) :: np_sendl,np_sendr,np_recvl,np_recvr
-      integer rsleft,rsright,rrleft,rrright,n_sendl,n_sendr, &
-              n_recvl,n_recvr,n
+      real(kind=pr),allocatable,dimension(:) :: p_sendl,p_sendr
+      real(kind=pr),dimension(maxnp) :: myvar,p_recvl,p_recvr
+      integer,dimension(maxnp) :: np_sendl,np_sendr,np_recvl,np_recvr
+      integer rsleft,rsright,rrleft,rrright,n_sendl,n_sendr,n_recvl,n_recvr,n
 
       timenow=real(mpi_wtime(),kind=pr)
 
-      n_sendl=0
-      n_sendr=0
-      do 1 n=1,np
-        if (np_sendl(n).eq.1) then
-          n_sendl=n_sendl+1
-          p_sendl(n_sendl)=myvar(n)
-        endif
-        if (np_sendr(n).eq.1) then
-          n_sendr=n_sendr+1
-          p_sendr(n_sendr)=myvar(n)
-        endif
-1     enddo
+      n_sendl=sum(np_sendl(1:np))
+      p_sendl=pack(myvar(1:np),np_sendl(1:np).eq.1)
+      n_sendr=sum(np_sendr(1:np))
+      p_sendr=pack(myvar(1:np),np_sendr(1:np).eq.1)
 
 ! send/receive number of particles
-      call mpi_isend(n_sendl,1,mpi_integer,prev, &
-           2,mpi_comm_world,rsleft,mpierr)
-      call mpi_irecv(n_recvl,1,mpi_integer,prev, &
-           1,mpi_comm_world,rrleft,mpierr)
-      call mpi_isend(n_sendr,1,mpi_integer,next, &
-           1,mpi_comm_world,rsright,mpierr)
-      call mpi_irecv(n_recvr,1,mpi_integer,next, &
-           2,mpi_comm_world,rrright,mpierr)
+      call mpi_isend(n_sendl,1,mpi_integer,prev,2,mpi_comm_world,rsleft,mpierr)
+      call mpi_irecv(n_recvl,1,mpi_integer,prev,1,mpi_comm_world,rrleft,mpierr)
+      call mpi_isend(n_sendr,1,mpi_integer,next,1,mpi_comm_world,rsright,mpierr)
+      call mpi_irecv(n_recvr,1,mpi_integer,next,2,mpi_comm_world,rrright,mpierr)
       call mpi_wait(rsleft,mpistatus,mpierr)
       call mpi_wait(rrleft,mpistatus,mpierr)
       call mpi_wait(rsright,mpistatus,mpierr)
@@ -63,35 +52,30 @@
       if (next.eq.mpi_proc_null) n_recvr=0
       if (prev.eq.mpi_proc_null) n_recvl=0
 
-      if (n_sendl.gt.0) call mpi_isend&
-      (p_sendl,n_sendl,mpi_pr,prev,2,mpi_comm_world,rsleft,mpierr)
-      if (n_recvl.gt.0) call mpi_irecv&
-      (p_recvl,n_recvl,mpi_pr,prev,1,mpi_comm_world,rrleft,mpierr)
-      if (n_sendr.gt.0) call mpi_isend&
-      (p_sendr,n_sendr,mpi_pr,next,1,mpi_comm_world,rsright,mpierr)
-      if (n_recvr.gt.0) call mpi_irecv&
-      (p_recvr,n_recvr,mpi_pr,next,2,mpi_comm_world,rrright,mpierr)
+      if (n_sendl.gt.0) call mpi_isend(p_sendl,n_sendl,mpi_pr,prev,2,mpi_comm_world,rsleft,mpierr)
+      if (n_recvl.gt.0) call mpi_irecv(p_recvl,n_recvl,mpi_pr,prev,1,mpi_comm_world,rrleft,mpierr)
+      if (n_sendr.gt.0) call mpi_isend(p_sendr,n_sendr,mpi_pr,next,1,mpi_comm_world,rsright,mpierr)
+      if (n_recvr.gt.0) call mpi_irecv(p_recvr,n_recvr,mpi_pr,next,2,mpi_comm_world,rrright,mpierr)
       if (n_sendl.gt.0) call mpi_wait(rsleft,mpistatus,mpierr)
       if (n_recvl.gt.0) call mpi_wait(rrleft,mpistatus,mpierr)
       if (n_sendr.gt.0) call mpi_wait(rsright,mpistatus,mpierr)
       if (n_recvr.gt.0) call mpi_wait(rrright,mpistatus,mpierr)
 
       np=npp
-      do 2 n=1,n_recvl
-        np=np+1
-        np_recvl(np)=1
-        myvar(np)=p_recvl(n)
-2     enddo
-      do 3 n=1,n_recvr
-        np=np+1
-        np_recvr(np)=1
-        myvar(np)=p_recvr(n)
-3     enddo
+      np_recvl=0
+      np_recvr=0
+
+      np_recvl( np+1 : np+n_recvl ) = 1
+         myvar( np+1 : np+n_recvl ) = p_recvl( 1 : n_recvl )
+      
+      np_recvr( np+n_recvl+1 : np+n_recvl+n_recvr ) = 1
+         myvar( np+n_recvl+1 : np+n_recvl+n_recvr ) = p_recvr( 1 : n_recvr )
       
+      np=np+n_recvl+n_recvr
+
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
 !####################################################################
@@ -100,36 +84,23 @@
       subroutine syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,myvar)
       use var
       use mpi
-      integer, dimension (maxnp) :: &
-      myvar,p_sendl,p_sendr,p_recvl,p_recvr
-      integer, dimension (maxnp) :: np_sendl,np_sendr,np_recvl,np_recvr
-      integer rsleft,rsright,rrleft,rrright,n_sendl,n_sendr, &
-              n_recvl,n_recvr,n
+      integer, allocatable, dimension(:) :: p_sendl,p_sendr
+      integer, dimension(maxnp) :: myvar,p_recvl,p_recvr
+      integer, dimension(maxnp) :: np_sendl,np_sendr,np_recvl,np_recvr
+      integer rsleft,rsright,rrleft,rrright,n_sendl,n_sendr,n_recvl,n_recvr,n
 
       timenow=real(mpi_wtime(),kind=pr)
 
-      n_sendl=0
-      n_sendr=0
-      do 1 n=1,np
-        if (np_sendl(n).eq.1) then
-          n_sendl=n_sendl+1
-          p_sendl(n_sendl)=myvar(n)
-        endif
-        if (np_sendr(n).eq.1) then
-          n_sendr=n_sendr+1
-          p_sendr(n_sendr)=myvar(n)
-        endif
-1     enddo
+      n_sendl=sum(np_sendl(1:np))
+      p_sendl=pack(myvar(1:np),np_sendl(1:np).eq.1)
+      n_sendr=sum(np_sendr(1:np))
+      p_sendr=pack(myvar(1:np),np_sendr(1:np).eq.1)
 
 ! send/receive number of particles
-      call mpi_isend(n_sendl,1,mpi_integer,prev, &
-           2,mpi_comm_world,rsleft,mpierr)
-      call mpi_irecv(n_recvl,1,mpi_integer,prev, &
-           1,mpi_comm_world,rrleft,mpierr)
-      call mpi_isend(n_sendr,1,mpi_integer,next, &
-           1,mpi_comm_world,rsright,mpierr)
-      call mpi_irecv(n_recvr,1,mpi_integer,next, &
-           2,mpi_comm_world,rrright,mpierr)
+      call mpi_isend(n_sendl,1,mpi_integer,prev,2,mpi_comm_world,rsleft,mpierr)
+      call mpi_irecv(n_recvl,1,mpi_integer,prev,1,mpi_comm_world,rrleft,mpierr)
+      call mpi_isend(n_sendr,1,mpi_integer,next,1,mpi_comm_world,rsright,mpierr)
+      call mpi_irecv(n_recvr,1,mpi_integer,next,2,mpi_comm_world,rrright,mpierr)
       call mpi_wait(rsleft,mpistatus,mpierr)
       call mpi_wait(rrleft,mpistatus,mpierr)
       call mpi_wait(rsright,mpistatus,mpierr)
@@ -137,191 +108,152 @@
       if (next.eq.mpi_proc_null) n_recvr=0
       if (prev.eq.mpi_proc_null) n_recvl=0
 
-
-      if (n_sendl.gt.0) call mpi_isend&
-      (p_sendl,n_sendl,mpi_integer,prev,2,mpi_comm_world,rsleft,mpierr)
-      if (n_recvl.gt.0) call mpi_irecv&
-      (p_recvl,n_recvl,mpi_integer,prev,1,mpi_comm_world,rrleft,mpierr)
-      if (n_sendr.gt.0) call mpi_isend&
-      (p_sendr,n_sendr,mpi_integer,next,1,mpi_comm_world,rsright,mpierr)
-      if (n_recvr.gt.0) call mpi_irecv&
-      (p_recvr,n_recvr,mpi_integer,next,2,mpi_comm_world,rrright,mpierr)
+      if (n_sendl.gt.0) call mpi_isend(p_sendl,n_sendl,mpi_integer,prev,2,mpi_comm_world,rsleft,mpierr)
+      if (n_recvl.gt.0) call mpi_irecv(p_recvl,n_recvl,mpi_integer,prev,1,mpi_comm_world,rrleft,mpierr)
+      if (n_sendr.gt.0) call mpi_isend(p_sendr,n_sendr,mpi_integer,next,1,mpi_comm_world,rsright,mpierr)
+      if (n_recvr.gt.0) call mpi_irecv(p_recvr,n_recvr,mpi_integer,next,2,mpi_comm_world,rrright,mpierr)
       if (n_sendl.gt.0) call mpi_wait(rsleft,mpistatus,mpierr)
       if (n_recvl.gt.0) call mpi_wait(rrleft,mpistatus,mpierr)
       if (n_sendr.gt.0) call mpi_wait(rsright,mpistatus,mpierr)
       if (n_recvr.gt.0) call mpi_wait(rrright,mpistatus,mpierr)
 
       np=npp
-      do 2 n=1,n_recvl
-        np=np+1
-        np_recvl(np)=1
-        myvar(np)=p_recvl(n)
-2     enddo
-      do 3 n=1,n_recvr
-        np=np+1
-        np_recvr(np)=1
-        myvar(np)=p_recvr(n)
-3     enddo
+      np_recvl=0
+      np_recvr=0
+
+      np_recvl( np+1 : np+n_recvl ) = 1
+         myvar( np+1 : np+n_recvl ) = p_recvl( 1 : n_recvl )
+      
+      np_recvr( np+n_recvl+1 : np+n_recvl+n_recvr ) = 1
+         myvar( np+n_recvl+1 : np+n_recvl+n_recvr ) = p_recvr( 1 : n_recvr )
+
+      np=np+n_recvl+n_recvr
       
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief synchronize fluid between processors
       subroutine sync(myvar)
       use var
       use mpi
-      real(kind=pr) :: myvar(ii,jj,ll)
-      real(kind=pr), dimension(gc*jj*ll) :: &
-      sendleft,sendright,recvleft,recvright
-      integer :: rsleft,rsright,rrleft,rrright,n
-      integer :: i,j,l
+      real(kind=pr), dimension(ii,jj,ll) :: myvar
+      real(kind=pr), dimension(gc*jj*ll) :: sendleft,sendright,recvleft,recvright
+      integer :: rsleft,rsright,rrleft,rrright
+      integer :: n
 
       timenow=real(mpi_wtime(),kind=pr)
 
-      n=0
-      do i= imin,imin+gc-1
-      do l= 1,ll; do j= 1,jj
-        n=n+1
-        sendleft(n)= myvar(i,j,l)
-      enddo; enddo; enddo
-
-      n=0
-      do i= imax,imax-gc+1,-1
-      do l= 1,ll; do j= 1,jj
-         n=n+1
-         sendright(n)= myvar(i,j,l)
-      enddo; enddo; enddo
-
-      call mpi_isend(sendleft,gc*jj*ll,mpi_pr,prev,1,mpi_comm_world,rsleft,mpierr)
-      call mpi_isend(sendright,gc*jj*ll,mpi_pr,next,2,mpi_comm_world,rsright,mpierr)
-      call mpi_irecv(recvright,gc*jj*ll,mpi_pr,next,1,mpi_comm_world,rrright,mpierr)
-      call mpi_irecv(recvleft,gc*jj*ll,mpi_pr,prev,2,mpi_comm_world,rrleft,mpierr)
+      n=gc*jj*ll
+      sendleft= reshape(myvar(imin:imin+gc-1,1:jj,1:ll),(/n/))
+      sendright=reshape(myvar(imax-gc+1:imax,1:jj,1:ll),(/n/))
+
+      call mpi_isend(sendleft,n,mpi_pr,prev,1,mpi_comm_world,rsleft,mpierr)
+      call mpi_isend(sendright,n,mpi_pr,next,2,mpi_comm_world,rsright,mpierr)
+      call mpi_irecv(recvright,n,mpi_pr,next,1,mpi_comm_world,rrright,mpierr)
+      call mpi_irecv(recvleft,n,mpi_pr,prev,2,mpi_comm_world,rrleft,mpierr)
       call mpi_wait(rsleft,mpistatus,mpierr)
       call mpi_wait(rsright,mpistatus,mpierr)
       call mpi_wait(rrright,mpistatus,mpierr)
       call mpi_wait(rrleft,mpistatus,mpierr)
 
-      if (next.ne.mpi_proc_null) then
-        n=0
-        do i= imax+1,ii
-        do l= 1,ll; do j= 1,jj
-          n=n+1
-          myvar(i,j,l)= recvright(n)
-        enddo; enddo; enddo
-      endif
-
-      if (prev.ne.mpi_proc_null) then
-        n=0
-        do i= gc,1,-1
-        do l= 1,ll; do j= 1,jj
-          n=n+1
-          myvar(i,j,l)= recvleft(n)
-      enddo; enddo; enddo
-      endif
+      if (next.ne.mpi_proc_null) myvar(imax+1:ii,1:jj,1:ll)=reshape(recvright,(/gc,jj,ll/))
+      if (prev.ne.mpi_proc_null) myvar(1:gc,1:jj,1:ll)=     reshape(recvleft,(/gc,jj,ll/))
 
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief compute the max of a scalar over all processors
-!> @param myvar scalar
-      real(kind=pr) function syncMax(myvar)
+!> @brief synchronize LE sources between processors, see 'bcELsource'
+      subroutine syncLEsource(myvar)
       use var
       use mpi
-      real(kind=pr) :: myvar,myvar2
-      integer :: proc,rs,rr
+      real(kind=pr), dimension(ii,jj,ll) :: myvar
+      real(kind=pr), dimension(gc*jj*ll) :: sendleft,sendright,recvleft,recvright
+      integer :: rsleft,rsright,rrleft,rrright
+      integer :: i,j,l,n
 
       timenow=real(mpi_wtime(),kind=pr)
 
-! mpi_allreduce does not work with intel compiler
-      call mpi_allreduce&
-      (myvar,syncMax,1,mpi_pr,mpi_max,mpi_comm_world,mpierr)
-      
+      n=gc*jj*ll
+      sendleft= reshape(myvar(1:gc,1:jj,1:ll),(/n/))
+      sendright=reshape(myvar(imax+1:ii,1:jj,1:ll),(/n/))
+
+      call mpi_isend(sendleft,n,mpi_pr,prev,1,mpi_comm_world,rsleft,mpierr)
+      call mpi_isend(sendright,n,mpi_pr,next,2,mpi_comm_world,rsright,mpierr)
+      call mpi_irecv(recvright,n,mpi_pr,next,1,mpi_comm_world,rrright,mpierr)
+      call mpi_irecv(recvleft,n,mpi_pr,prev,2,mpi_comm_world,rrleft,mpierr)
+      call mpi_wait(rsleft,mpistatus,mpierr)
+      call mpi_wait(rsright,mpistatus,mpierr)
+      call mpi_wait(rrright,mpistatus,mpierr)
+      call mpi_wait(rrleft,mpistatus,mpierr)
+
+      if (next.ne.mpi_proc_null) myvar(imax-gc+1:imax,1:jj,1:ll)=reshape(recvright,(/gc,jj,ll/))
+      if (prev.ne.mpi_proc_null) myvar(imin:imin+gc-1,1:jj,1:ll)=reshape(recvleft,(/gc,jj,ll/))
+
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief compute the sum of a scalar over all processors
-!> @param myvar real scalar
-      real(kind=pr) function syncSum(myvar) 
+!> @brief compute the max of a scalar over all processors
+      real(kind=pr) function syncMax(myvar)
       use var
       use mpi
-      real(kind=pr),intent(in) :: myvar
-      real(kind=pr) :: myvar2,sumvar
-      integer :: proc,rs,rr
+      real(kind=pr) :: myvar
 
       timenow=real(mpi_wtime(),kind=pr)
 
 ! mpi_allreduce does not work with intel compiler
-      call mpi_allreduce&
-      (myvar,syncSum,1,mpi_pr,mpi_sum,mpi_comm_world,mpierr)
-
+      call mpi_allreduce(myvar,syncMax,1,mpi_pr,mpi_max,mpi_comm_world,mpierr)
+      
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
-      end function
-
+      end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief compute the sum of a scalar over all processors
-!> @param myvar integer scalar
-      integer function syncSumI(myvar)
+!> @brief compute the sum of a real scalar over all processors
+      real(kind=pr) function syncSum(myvar)
       use var
       use mpi
-      integer :: myvar,myvar2
-      integer :: proc,rs,rr
+      real(kind=pr),intent(in) :: myvar
 
       timenow=real(mpi_wtime(),kind=pr)
 
 ! mpi_allreduce does not work with intel compiler
-      call mpi_allreduce&
-      (myvar,syncSumI,1,mpi_integer,mpi_sum,mpi_comm_world,mpierr)
+      call mpi_allreduce(myvar,syncSum,1,mpi_pr,mpi_sum,mpi_comm_world,mpierr)
 
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
-      end
+      end function
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief compute the average of a scalar over all processors
-!> @param myvar scalar
-      real(kind=pr) function syncAv(myvar)
+!> @brief compute the sum of a integer scalar over all processors
+      integer function syncSumI(myvar)
       use var
       use mpi
-      real(kind=pr) :: myvar,myvar2
-      integer :: proc,rs,rr
+      integer :: myvar
 
       timenow=real(mpi_wtime(),kind=pr)
 
 ! mpi_allreduce does not work with intel compiler
-      call mpi_allreduce&
-      (myvar,myvar,1,mpi_pr,mpi_sum,mpi_comm_world,mpierr)
-      
-      syncAv=myvar/nrprocs
+      call mpi_allreduce(myvar,syncSumI,1,mpi_integer,mpi_sum,mpi_comm_world,mpierr)
 
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
 !####################################################################
@@ -330,7 +262,7 @@
       subroutine syncCheck
       use var
       use mpi
-      integer :: m,proc,rs,rr,ntproc
+      integer :: proc,rs,rr,ntproc
 
       timenow=real(mpi_wtime(),kind=pr)
 
@@ -346,14 +278,13 @@
       endif
 
       if (myid.ne.0) then
-          call mpi_isend(nt,1,mpi_integer,0,0,mpi_comm_world,rs,mpierr)
-          call mpi_wait(rs,mpistatus,mpierr)
+        call mpi_isend(nt,1,mpi_integer,0,0,mpi_comm_world,rs,mpierr)
+        call mpi_wait(rs,mpistatus,mpierr)
       endif
 
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
 
 !####################################################################
@@ -386,5 +317,6 @@
       timeend=real(mpi_wtime(),kind=pr)
       timecom(1)=timecom(1)+timeend-timenow
 
-      return
       end
+
+end module parallel
diff --git a/src/particles.f90 b/src/particles.f90
index 94637091ae48a66fd70195326cc111d4a58c433d..2808a91ac7eb1596be6563f6222e9786fd01516a 100644
--- a/src/particles.f90
+++ b/src/particles.f90
@@ -3,111 +3,22 @@
 !> @brief solve particulate phase
       subroutine solveParticles
       use var
-      integer ip,jp,lp
 
       if (pnd.ne.0.or.npTot.ne.0) then
-        if (myid.eq.0) write(*,'(a)',advance='no') 'particle'
         if (((bcx.eq.'i').and.(nt.ge.ntseed)).or.(nt.eq.ntseed)) call particlesSeed
-        call fluidVelocity     
-        if (elForceScheme.ne.2) call forcesGauss
-        if (elForceScheme.ne.1) call forcesCoulomb
-        call particlesVelocity
-        call particlesCollide
-        call particlesTransport    !particles from neighbour gc added
-        call chargeDensity
-        call momentumCoupling      !particles from neighbour gc removed
-        if (myid.eq.0) write(*,*)
+        call particlesDrag
+        call particlesLift
+        if ((elForceScheme.eq.1).or.(elForceScheme.eq.3)) call forcesGauss
+        if ((elForceScheme.eq.2).or.(elForceScheme.eq.3)) call forcesCoulomb
+        call particlesVelocityNext
+        call particlesCollideNext
+        call particlesTransportNext
+        if (myid.eq.0) write(*,'(a,i8,2(a,es8.2e2))') &          
+          'particles |transp. = ',npTot,' |dt/t_el = ',dtNext*rtau_el_max,' |dt/t_p  = ',dtNext*rtau_p_max
       endif
 
-      return
       end
 
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief move particle from storage position n to m
-      subroutine partN2M(n,m)
-      use var
-      integer :: n,m
-
-      xp(m)=xp(n)
-      yp(m)=yp(n)
-      zp(m)=zp(n)
-      radp(m)=radp(n)
-      partn(m)=partn(n)
-      up(m)=up(n)
-      vp(m)=vp(n)
-      wp(m)=wp(n)
-      uf(m)=uf(n)
-      vf(m)=vf(n)
-      wf(m)=wf(n)
-      uf01(m)=uf01(n)
-      vf01(m)=vf01(n)
-      wf01(m)=wf01(n)
-      q_el(m)=q_el(n)
-      partn(m)=partn(n)
-      wcollnum(m)=wcollnum(n)
-      ppcollnum(m)=ppcollnum(n)
-      nGlob(m)=nGlob(n)
- 
-      return
-      end 
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief compute Eulerian indices of particles
-      integer function ip(n)
-      use var
-      integer n
-      
-      ip=minloc(xf, dim=1, mask=(xp(n).lt.xf))
-
-      if (ip.lt.1.or.ip.gt.ii) goto 9000
-
-      return
-
-9000  write(*,*) 'particle lost, proc=',myid,', xp=',xp(n)
-      stop
-
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief compute Eulerian indices of particles
-      integer function jp(n)
-      use var
-      integer n
-
-      jp=minloc(yf, dim=1, mask=(yp(n).lt.yf))
-
-      if (jp.lt.jmin.or.jp.gt.jmax) goto 9000
-
-      return
-
-9000  write(*,*) 'particle lost, proc=',myid,', yp=',yp(n)
-      stop
-
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief compute Eulerian indices of particles
-      integer function lp(n)
-      use var
-      integer n
-
-      lp=minloc(zf, dim=1, mask=(zp(n).lt.zf))
-
-      if (lp.lt.lmin.or.lp.gt.lmax) goto 9000
-
-      return
-
-9000  write(*,*) 'particle lost, proc=',myid,', zp=',zp(n)
-      stop
-
-      end
-
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief compute weigths for interpolation from Lagrangian to
@@ -120,144 +31,72 @@
       subroutine weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,direction)
       use var
       integer,intent(in)  :: n,direction
-      real(kind=pr),dimension(3,3,3),intent(out) :: weight
+      real(kind=pr),dimension(2,2,2),intent(out) :: weight
       integer,intent(out) :: ibeg,iend,jbeg,jend,lbeg,lend
-      real(kind=pr)       :: deltaf2,deltaf,dis2, &
-                             disx,disy,disz,sumweights,volE
-      integer             :: i,j,l,ipa,jpa,lpa,ip,jp,lp
-
-      ipa=ip(n)
-      jpa=jp(n)
-      lpa=lp(n)
+      real(kind=pr)       :: deltaf2,deltaf,dis2,volE
+      integer             :: i,j,l
 
-      weight=0._pr
-
-
-! define distribution block       
-      if (xp(n).lt.xc(ipa)) then
-        ibeg=ipa-1
-        iend=ipa
-      else
-        ibeg=ipa
-        iend=ipa+1
-      endif
-      if (yp(n).lt.yc(jpa)) then
-        jbeg=max(jpa-1,jmin)
-        jend=jpa
+! define distribution block and correct for staggered variables
+      if ((direction.eq.1).or.(xp(n).lt.xc(ip(n)))) then
+        ibeg=ip(n)-1
       else
-        jbeg=jpa
-        jend=min(jpa+1,jmax)
+        ibeg=ip(n)
       endif
-      if (zp(n).lt.zc(lpa)) then
-        lbeg=max(lpa-1,lmin)
-        lend=lpa
+      iend=ibeg+1
+
+      if ((direction.eq.2).or.(yp(n).lt.yc(jp(n)))) then
+        jbeg=jp(n)-1
       else
-        lbeg=lpa
-        lend=min(lpa+1,lmax)
+        jbeg=jp(n)
       endif
+      jend=jbeg+1
 
-! correct for variables on faces
-      if (direction.eq.1) then
-        ibeg=ipa-1
-        iend=ipa
-      elseif (direction.eq.2) then
-        jbeg=jpa-1
-        jend=jpa
-      elseif (direction.eq.3) then
-        lbeg=lpa-1
-        lend=lpa
+      if ((direction.eq.3).or.(zp(n).lt.zc(lp(n)))) then
+        lbeg=lp(n)-1
+      else
+        lbeg=lp(n)
       endif
+      lend=lbeg+1
 
 ! volume on the Eulerian grid
-      if (direction.eq.0) volE=(xf(iend)-xf(ibeg-1))*(yf(jend)-yf(jbeg-1))*(zf(lend)-zf(lbeg-1))
-      if (direction.eq.1) volE=(xc(iend+1)-xc(ibeg))*(yf(jend)-yf(jbeg-1))*(zf(lend)-zf(lbeg-1))
-      if (direction.eq.2) volE=(xf(iend)-xf(ibeg-1))*(yc(jend+1)-yc(jbeg))*(zf(lend)-zf(lbeg-1))
-      if (direction.eq.3) volE=(xf(iend)-xf(ibeg-1))*(yf(jend)-yf(jbeg-1))*(zc(lend+1)-zc(lbeg))
-
-! deltaf2=2*variance=3*sigma**2      
-!      if (direction.eq.1) then
-!        deltaf=2._pr*(xc(iend)-xc(ibeg)+yf(jbeg)-yf(jend)+zf(lbeg)-zf(lend))/3._pr
-!      elseif (direction.eq.2) then
-!        deltaf=2._pr*(xf(iend)-xf(ibeg)+yc(jbeg)-yc(jend)+zf(lbeg)-zf(lend))/3._pr
-!      elseif (direction.eq.3) then
-!        deltaf=2._pr*(xf(iend)-xf(ibeg)+yf(jbeg)-yf(jend)+zc(lbeg)-zc(lend))/3._pr
-!      endif
-!      deltaf2=(deltaf**2)/6._pr
+      if (direction.eq.0) then
+        volE=(xf(iend)-xf(ibeg-1))*(yf(jend)-yf(jbeg-1))*(zf(lend)-zf(lbeg-1))
+      else if (direction.eq.1) then
+        volE=(xc(iend+1)-xc(ibeg))*(yf(jend)-yf(jbeg-1))*(zf(lend)-zf(lbeg-1))
+      else if (direction.eq.2) then
+        volE=(xf(iend)-xf(ibeg-1))*(yc(jend+1)-yc(jbeg))*(zf(lend)-zf(lbeg-1))
+      else if (direction.eq.3) then
+        volE=(xf(iend)-xf(ibeg-1))*(yf(jend)-yf(jbeg-1))*(zc(lend+1)-zc(lbeg))
+      endif
 
       deltaf=xc(iend)-xc(ibeg)
       deltaf2=(deltaf**2)/6._pr
 
 !compute weights
-      do i=ibeg,iend; do j=jbeg,jend; do l=lbeg,lend
-        disx=xp(n)-xc(i)
-        if (direction.eq.1) disx=xp(n)-xf(i)
-        disy=yp(n)-yc(j)
-        if (direction.eq.2) disy=yp(n)-yf(j)
-        disz=zp(n)-zc(l)
-        if (direction.eq.3) disz=zp(n)-zf(l)
-        dis2=disx*disx+disy*disy+disz*disz
-
+      do l=lbeg,lend; do j=jbeg,jend; do i=ibeg,iend
+        if (direction.eq.0) then
+          dis2= (xp(n)-xc(i))**2 + (yp(n)-yc(j))**2 + (zp(n)-zc(l))**2
+        elseif (direction.eq.1) then
+          dis2= (xp(n)-xf(i))**2 + (yp(n)-yc(j))**2 + (zp(n)-zc(l))**2
+        elseif (direction.eq.2) then
+          dis2= (xp(n)-xc(i))**2 + (yp(n)-yf(j))**2 + (zp(n)-zc(l))**2
+        elseif (direction.eq.3) then
+          dis2= (xp(n)-xc(i))**2 + (yp(n)-yc(j))**2 + (zp(n)-zf(l))**2
+        endif
         weight(i+1-ibeg,j+1-jbeg,l+1-lbeg)=exp(-dis2/deltaf2)
-      enddo; enddo; enddo     
-      
-      weight=weight/sum(weight) ! sum normalized
-
- 
-      return
-      end
-
-      
-!####################################################################
-!> @author Holger Grosshans
-!> @brief couple Lagrangian to closest Eulerian point
-!> param weight    weights of involved cells
-!> param volE      volume of the involved cells
-!> param n         particle number
-!> param direction 0 if Eulerian variable is stored in the cell 
-!>                 center, 1-3 if on the x,y or z-face
-      subroutine weightLE1(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,direction)
-      use var
-      integer,intent(in)  :: n,direction
-      real(kind=pr),dimension(3,3,3),intent(out) :: weight
-      integer,intent(out) :: ibeg,iend,jbeg,jend,lbeg,lend
-      real(kind=pr)       :: volE
-      integer             :: i,j,l,ipa,jpa,lpa,ip,jp,lp
-
-      ipa=ip(n)
-      jpa=jp(n)
-      lpa=lp(n)
-
-! define distribution block       
-      if ((direction.eq.1).and.(xp(n).lt.xc(ipa))) ipa=ipa-1
-      if ((direction.eq.2).and.(yp(n).lt.yc(jpa))) jpa=jpa-1
-      if ((direction.eq.3).and.(zp(n).lt.zc(lpa))) lpa=lpa-1
-
-      ibeg=ipa; iend=ipa
-      jbeg=jpa; jend=jpa
-      lbeg=lpa; lend=lpa
-
-! volume on the Eulerian grid
-      if (direction.eq.0) volE=(xf(ipa)-xf(ipa-1))*(yf(jpa)-yf(jpa-1))*(zf(lpa)-zf(lpa-1))
-      if (direction.eq.1) volE=(xc(ipa+1)-xc(ipa))*(yf(jpa)-yf(jpa-1))*(zf(lpa)-zf(lpa-1))
-      if (direction.eq.2) volE=(xf(ipa)-xf(ipa-1))*(yc(jpa+1)-yc(jpa))*(zf(lpa)-zf(lpa-1))
-      if (direction.eq.3) volE=(xf(ipa)-xf(ipa-1))*(yf(jpa)-yf(jpa-1))*(zc(lpa+1)-zc(lpa))
+      enddo; enddo; enddo
 
-      weight=1._pr
+      weight=weight/sum(weight) ! normalized
  
-      return
       end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief allocate particle arrays
+!> @brief allocate all public particle arrays
       subroutine allocateParticleArrays
       use var
-      real(kind=pr), allocatable, dimension(:) :: &
-      tup,tvp,twp,tuf,tvf,twf,tuf01,tvf01,twf01,txp,typ,tzp,tradp, &
-      tq_el,tfx_el,tfy_el,tfz_el,tpartn,tnGlob
-      integer, allocatable, dimension(:) :: &
-      twcollnum,tppcollnum
-      integer :: syncSumI,nppTot
+      use parallel
+      integer :: nppTot
 
       npTot=syncSumI(np)
       nppTot=syncSumI(npp)
@@ -266,22 +105,37 @@
       call allocateParticleArray(nppTot,up)
       call allocateParticleArray(nppTot,vp)
       call allocateParticleArray(nppTot,wp)
+      call allocateParticleArray(nppTot,upNext)
+      call allocateParticleArray(nppTot,vpNext)
+      call allocateParticleArray(nppTot,wpNext)
       call allocateParticleArray(nppTot,uf)
       call allocateParticleArray(nppTot,vf)
       call allocateParticleArray(nppTot,wf)
-      call allocateParticleArray(nppTot,uf01)
-      call allocateParticleArray(nppTot,vf01)
-      call allocateParticleArray(nppTot,wf01)
+      call allocateParticleArray(nppTot,dufdy)
+      call allocateParticleArray(nppTot,dufdz)
       call allocateParticleArray(nppTot,xp)
       call allocateParticleArray(nppTot,yp)
       call allocateParticleArray(nppTot,zp)
+      call allocateParticleArray(nppTot,xpNext)
+      call allocateParticleArray(nppTot,ypNext)
+      call allocateParticleArray(nppTot,zpNext)
       call allocateParticleArray(nppTot,radp)
       call allocateParticleArray(nppTot,q_el)
+      call allocateParticleArray(nppTot,q_elNext)
       call allocateParticleArray(nppTot,fx_el)
       call allocateParticleArray(nppTot,fy_el)
       call allocateParticleArray(nppTot,fz_el)
+      call allocateParticleArray(nppTot,fx_d)
+      call allocateParticleArray(nppTot,fy_d)
+      call allocateParticleArray(nppTot,fz_d)
+      call allocateParticleArray(nppTot,fx_l)
+      call allocateParticleArray(nppTot,fy_l)
+      call allocateParticleArray(nppTot,fz_l)
       call allocateParticleArray(nppTot,partn)
 
+      call allocateParticleArrayI(nppTot,ip)
+      call allocateParticleArrayI(nppTot,jp)
+      call allocateParticleArrayI(nppTot,lp)
       call allocateParticleArrayI(nppTot,wcollnum)
       call allocateParticleArrayI(nppTot,ppcollnum)
       call allocateParticleArrayI(nppTot,nGlob)
@@ -290,8 +144,7 @@
 
         subroutine allocateParticleArray(nppTot,myvar)
         use var
-        real(kind=pr), allocatable, dimension(:) :: &
-        myvar,tmyvar
+        real(kind=pr), allocatable, dimension(:) :: myvar,tmyvar
         integer :: nppTot
 
         if (nppTot.ge.1) then
@@ -309,8 +162,7 @@
 
         subroutine allocateParticleArrayI(nppTot,myvar)
         use var
-        integer, allocatable, dimension(:) :: &
-        myvar,tmyvar
+        integer, allocatable, dimension(:) :: myvar,tmyvar
         integer :: nppTot
 
         if (nppTot.ge.1) then
@@ -328,31 +180,142 @@
 
       end
 
+!####################################################################
+!> @author Holger Grosshans
+!> @brief send particles to next processor, all required variables for further transport
+      subroutine particlesNextProc
+      use var
+      use parallel
+      use mpi
+      integer, dimension (maxnp) :: np_sendr,np_sendl,np_recvl,np_recvr
+      integer :: n,m
+
+      np_sendl=0
+      np_sendr=0
+      
+      do 1 n=1,np
+
+      if (prev.ne.mpi_proc_null) then
+        if (xp(n).le.xmin) then
+          np_sendl(n)=1
+        else
+          np_sendl(n)=0
+        endif
+      endif
+      if (next.ne.mpi_proc_null) then
+        if (xp(n).ge.xmax) then
+          np_sendr(n)=1
+        else
+          np_sendr(n)=0
+        endif
+      endif
+
+1     enddo
+
+      npp=np
+      np_recvl=0 
+      np_recvr=0 
+
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,xp)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,yp)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,zp)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,xpNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,ypNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,zpNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,radp)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,up)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,vp)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,wp)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,upNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,vpNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,wpNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,q_el)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,q_elNext)
+      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,partn)
+      call syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,wcollnum)
+      call syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,ppcollnum)
+      call syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,nGlob)
+
+      if ((bcx.eq.'p').and.(myid.eq.nrprocs-1)) then
+        do 2 n=npp+1,np
+          if (np_recvr(n).eq.1) xp(n)= xp(n) + dimxtot
+2       enddo
+      endif
+      if ((bcx.eq.'p').and.(myid.eq.0)) then
+        do 3 n=npp+1,np
+          if (np_recvl(n).eq.1) xp(n)= xp(n) - dimxtot
+3       enddo
+      endif
+
+      m=0           ! remove sent particles
+      do 4 n=1,np
+        if ((xp(n).ge.xmin).and.(xp(n).le.xmax)) then
+          m=m+1
+          call partN2M(n,m)
+        endif
+4     enddo
+      np=m
+
+      end 
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief locate particles on Eulerian grid
-      subroutine particlesToCells
+!> @brief move particle from storage position n to m, all required variables for further transport
+      subroutine partN2M(n,m)
       use var
-      integer :: i,j,l,n,ip,jp,lp
+      integer :: n,m
 
-      npic(:,:,:)=0
+      xp(m)=xp(n)
+      yp(m)=yp(n)
+      zp(m)=zp(n)
+      xpNext(m)=xpNext(n)
+      ypNext(m)=ypNext(n)
+      zpNext(m)=zpNext(n)
+      radp(m)=radp(n)
+      up(m)=up(n)
+      vp(m)=vp(n)
+      wp(m)=wp(n)
+      upNext(m)=upNext(n)
+      vpNext(m)=vpNext(n)
+      wpNext(m)=wpNext(n)
+      q_el(m)=q_el(n)
+      q_elNext(m)=q_elNext(n)
+      partn(m)=partn(n)
 
+      wcollnum(m)=wcollnum(n)
+      ppcollnum(m)=ppcollnum(n)
+      nGlob(m)=nGlob(n)
+ 
+      end 
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief locate particles on Eulerian grid, required after moving 
+!>        particles: nextTimestep, particlesNextProc, particlesSeed
+      subroutine particlesToCells
+      use var
+      integer :: n
+      
+      npic=0
       do 1 n=1,np
-        i=ip(n); j=jp(n); l=lp(n)
-        npic(i,j,l)=npic(i,j,l)+1
+        ip(n)=minloc(xf, dim=1, mask=(xp(n).lt.xf))
+        jp(n)=minloc(yf, dim=1, mask=(yp(n).lt.yf))
+        lp(n)=minloc(zf, dim=1, mask=(zp(n).lt.zf))
+
+        if (celltype(ip(n),jp(n),lp(n)).ne.active) then
+          write(*,*) 'particle lost, proc=',myid,', xp=',xp(n),', yp=',yp(n),', zp=',zp(n)
+          stop
+        endif
+
+        npic(ip(n),jp(n),lp(n))=npic(ip(n),jp(n),lp(n))+1
 1     enddo
 
       if (allocated(nic)) deallocate(nic)
       allocate(nic(ii,jj,ll,maxval(npic)))
 
       nic=0
-
       do 2 n=1,np
-        i=ip(n); j=jp(n); l=lp(n)
-        nic(i,j,l,count(nic(i,j,l,:).ne.0)+1)=n
+        nic(ip(n),jp(n),lp(n),count(nic(ip(n),jp(n),lp(n),:).ne.0)+1)=n
 2     enddo
 
-
-      return
       end
diff --git a/src/particlesTransport.f90 b/src/particlesTransport.f90
index ee4045f745c57ea0a1177b6e30eef1b14a728764..b24d4064f79452f15c4dac62faaff89d736a9552 100644
--- a/src/particlesTransport.f90
+++ b/src/particlesTransport.f90
@@ -1,135 +1,180 @@
 !####################################################################
 !> @author Holger Grosshans
-!> @brief calculate the fluid velocity around each particle
-      subroutine fluidVelocity
-      use var
-      real(kind=pr),dimension(3,3,3) :: weight
-      real(kind=pr) volE
-      integer :: n,ibeg,iend,jbeg,jend,lbeg,lend,i,j,l,iw,jw,lw
-      integer :: direction,ip,jp,lp
+!> @brief explicit first-order Euler forward integration of particle
+!>        velocities to next time-step
+      subroutine particlesVelocityNext
+      use var      
+      use parallel
+      real(kind=pr),dimension(maxnp) :: dup,dvp,dwp
+      real(kind=pr) :: f_g(3)
+
+      f_g= (1-rhof/rhop)*g
+
+      dup(1:np)= (fx_d(1:np) + fx_l(1:np) + fx_el(1:np) + f_g(1)) * dtNext
+      dvp(1:np)= (fy_d(1:np) + fy_l(1:np) + fy_el(1:np) + f_g(2)) * dtNext
+      dwp(1:np)= (fz_d(1:np) + fz_l(1:np) + fz_el(1:np) + f_g(3)) * dtNext
+
+      upNext(1:np)= up(1:np) + dup(1:np)
+      vpNext(1:np)= vp(1:np) + dvp(1:np)
+      wpNext(1:np)= wp(1:np) + dwp(1:np)
+
+      dup_max=max(maxval(abs(dup(1:np))),maxval(abs(dvp(1:np))),maxval(abs(dwp(1:np))))
+      dup_max=syncMax(dup_max)
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief particle drag force
+      subroutine particlesDrag
+      use var      
+      use parallel 
+      real(kind=pr) :: rtau_p
+      integer       :: n
+
+      call fluidVelocity
+
+      rtau_p_max=0._pr
 
-      uf01=uf; vf01=vf; wf01=wf
-      uf=0._pr; vf=0._pr; wf=0._pr
-      
       do 1 n=1,np
-        if (celltype(ip(n),jp(n),lp(n)).ne.active) cycle
-        do 4 direction=1,3
-          call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,direction)
-          do i=ibeg,iend; do j=jbeg,jend; do l=lbeg,lend
-            iw=i+1-ibeg
-            jw=j+1-jbeg
-            lw=l+1-lbeg   
-            if (direction.eq.1) uf(n)=uf(n)+weight(iw,jw,lw)*u(i,j,l)
-            if (direction.eq.2) vf(n)=vf(n)+weight(iw,jw,lw)*v(i,j,l)
-            if (direction.eq.3) wf(n)=wf(n)+weight(iw,jw,lw)*w(i,j,l)     
-          enddo; enddo; enddo
-4       enddo
+        call calcRtau_p(rtau_p,n)
+        fx_d(n)= (uf(n)-up(n))*rtau_p
+        fy_d(n)= (vf(n)-vp(n))*rtau_p
+        fz_d(n)= (wf(n)-wp(n))*rtau_p
 1     enddo
 
-      return
+      rtau_p_max=syncMax(rtau_p_max)
+      
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief calculate drag coefficient and steady state drag
-      real(kind=pr) function drag(n)
+!> @brief particle lift force (Saffman, 1965, 1968, correction by Mei, 1992)
+      subroutine particlesLift
       use var      
-      real(kind=pr) :: urel,Reyp,cd
+      real(kind=pr) :: urel,Reyp,Reyf,beta,Cls
       integer       :: n
 
+      call fluidVelocityGradient
 
-      urel= sqrt(( uf01(n)-up(n))*(uf01(n)-up(n)) &
-                 +(vf01(n)-vp(n))*(vf01(n)-vp(n)) &
-                 +(wf01(n)-wp(n))*(wf01(n)-wp(n)))
+      do 1 n=1,np
+        urel= sqrt((uf(n)-up(n))**2+(vf(n)-vp(n))**2+(wf(n)-wp(n))**2)
+        Reyp= max(1.e-10_pr,2._pr*radp(n)*urel/nuf)
+        Reyf= radp(n)**2/nuf*sqrt(dufdy(n)**2+dufdz(n)**2)
+        beta= Reyf/Reyp/2._pr
+  
+        if (Reyp.le.40._pr) then
+          Cls= (1._pr-0.3314_pr*sqrt(beta))*exp(-Reyp/10._pr)+0.3314_pr*sqrt(beta)
+        else
+          Cls= 0.0524_pr*sqrt(beta*Reyp)
+        endif
+  
+        fx_l(n)= 0._pr      
+        fy_l(n)= 1.54_pr*sqrt(nuf)*rhof/rhop/radp(n)*(uf(n)-up(n))*sign(sqrt(abs(dufdy(n))),dufdy(n))*Cls
+        fz_l(n)= 1.54_pr*sqrt(nuf)*rhof/rhop/radp(n)*(uf(n)-up(n))*sign(sqrt(abs(dufdz(n))),dufdz(n))*Cls
+1     enddo
       
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief reciprocal (to avoid NaN) particle response time (Putnam, 1961)
+      subroutine calcRtau_p(rtau_p,n)
+      use var      
+      real(kind=pr) :: urel,Reyp,Cd,rtau_p
+      integer       :: n
+
+      urel= sqrt((uf(n)-up(n))**2+(vf(n)-vp(n))**2+(wf(n)-wp(n))**2)
       Reyp= max(1.e-10_pr,2._pr*radp(n)*urel/nuf)
-      if (Reyp.gt.1000._pr) then
-        cd= 0.424_pr
+
+      if (Reyp.lt.1000._pr) then
+        Cd= 24._pr/Reyp * (1._pr + 1._pr/6._pr*Reyp**(2._pr/3._pr))
       else
-        cd= 24._pr/Reyp * (1._pr + 1._pr/6._pr*Reyp**(2._pr/3._pr))
+        Cd= 0.424_pr
       endif
-      drag= 0.375_pr*rhof*urel*cd/(rhop*radp(n))
-      !drag=0._pr
+      
+      rtau_p= 3._pr*rhof*urel*Cd/(8._pr*rhop*radp(n))
 
+      rtau_p_max=max(rtau_p_max,rtau_p)
+      if (rtau_p.gt.(1._pr/dtNext)) rtau_p= 1._pr/dtNext ! stability criteria Euler forward
 
-      return
       end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief explicit first order integration of particle velocities
-      subroutine particlesVelocity
-      use var      
-      real(kind=pr),dimension(3) :: f_fl,f_g
-      real(kind=pr) :: fact,dragdt,drag
-      integer       :: n,ip,jp,lp
+!> @brief calculate the fluid velocity around each particle
+      subroutine fluidVelocity
+      use var
+      real(kind=pr),dimension(2,2,2) :: weight
+      real(kind=pr) volE
+      integer :: n,ibeg,iend,jbeg,jend,lbeg,lend
+      integer :: direction
 
       do 1 n=1,np
-        if (celltype(ip(n),jp(n),lp(n)).ne.active) cycle
-
-        f_fl(1)= drag(n)*(uf01(n)-up(n))
-        f_fl(2)= drag(n)*(vf01(n)-vp(n))
-        f_fl(3)= drag(n)*(wf01(n)-wp(n))
-
-        f_g(1)= (1-rhof/rhop)*g(1)
-        f_g(2)= (1-rhof/rhop)*g(2)
-        f_g(3)= (1-rhof/rhop)*g(3)
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,1)
+        uf(n)=sum(weight*u(ibeg:iend,jbeg:jend,lbeg:lend))
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,2)
+        vf(n)=sum(weight*v(ibeg:iend,jbeg:jend,lbeg:lend))
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,3)
+        wf(n)=sum(weight*w(ibeg:iend,jbeg:jend,lbeg:lend))
+1     enddo
 
-        up(n)= up(n) + (f_fl(1) + fx_el(n) + f_g(1))*dt
-        up(n)= max(up(n),-2._pr*ubulk)
-        up(n)= min(up(n),2._pr*ubulk)
+      end
 
-        vp(n)= vp(n) + (f_fl(2) + fy_el(n) + f_g(2))*dt
-        vp(n)= max(vp(n),-ubulk)
-        vp(n)= min(vp(n),ubulk)
+!####################################################################
+!> @author Holger Grosshans
+!> @brief calculate the fluid velocity gradient around each particle
+      subroutine fluidVelocityGradient
+      use var
+      real(kind=pr),dimension(2,2,2) :: weight
+      real(kind=pr) volE
+      integer :: n,ibeg,iend,jbeg,jend,lbeg,lend,i,j,l,iw,jw,lw
 
-        wp(n)= wp(n) + (f_fl(3) + fz_el(n) + f_g(3))*dt
-        wp(n)= max(wp(n),-ubulk)
-        wp(n)= min(wp(n),ubulk)
+      dufdy=0._pr; dufdz=0._pr
+      
+      do 1 n=1,np
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,1) ! could be extended for 2 and 3
+        do l=lbeg,lend; do j=jbeg,jend; do i=ibeg,iend
+          iw=i+1-ibeg; jw=j+1-jbeg; lw=l+1-lbeg   
+          dufdy(n)=dufdy(n)+weight(iw,jw,lw)*(u(i,j+1,l)-u(i,j-1,l))/(yc(j+1)-yc(j-1))
+          dufdz(n)=dufdz(n)+weight(iw,jw,lw)*(u(i,j,l+1)-u(i,j,l-1))/(zc(l+1)-zc(l-1))
+        enddo; enddo; enddo
 1     enddo
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief move particles
-      subroutine particlesTransport
+!> @brief second-order Crank-Nicolson integration of particle positions to next time-step
+      subroutine particlesTransportNext
       use var
-      use mpi
-      real(kind=pr) :: xpold,ypold,zpold
-      integer, dimension (maxnp) :: &
-      np_sendr,np_sendl,np_recvl,np_recvr
-      integer :: n,m,i,j,l
-      integer :: syncSumI
+      use parallel
+      integer :: n,m
       character(70) :: filename
       logical :: remove(maxnp)
 
       remove=.false.
 
       npTot=syncSumI(np)
-      if (myid.eq.0) write(*,'(a,i9)',advance='no') ' |transp. =',npTot
-
-      np_sendl=0
-      np_sendr=0
-      
-      do 1 n=1,np
 
-        xpold=xp(n)
-        ypold=yp(n)
-        zpold=zp(n)
-        xp(n)=xpold+up(n)*dt
-        yp(n)=ypold+vp(n)*dt
-        zp(n)=zpold+wp(n)*dt 
-
-! boundary conditions
-        if (bcx.eq.'w') then
-          if (((myid.eq.0.).and.(xp(n).lt.xmin+radp(n))).or. &
-              ((myid.eq.nrprocs-1).and.(xp(n).gt.xmax-radp(n)))) then
-            up(n)=-up(n)*restRatio      
-            xp(n)=xpold+up(n)*dt
+      xpNext(1:np)= xp(1:np)+(up(1:np)*dt+upNext(1:np)*dtNext)*dtNext/(dt+dtNext)
+      ypNext(1:np)= yp(1:np)+(vp(1:np)*dt+vpNext(1:np)*dtNext)*dtNext/(dt+dtNext)
+      zpNext(1:np)= zp(1:np)+(wp(1:np)*dt+wpNext(1:np)*dtNext)*dtNext/(dt+dtNext)
+
+      do 1 n=1,np ! boundary conditions
+
+        if (bcx.eq.'p') then ! x-direction
+          ! done in particlesNextProc
+        elseif (bcx.eq.'w') then
+          if (((myid.eq.0.).and.(xpNext(n).lt.xmin+radp(n))).or. &
+              ((myid.eq.nrprocs-1).and.(xpNext(n).gt.xmax-radp(n)))) then
+            upNext(n)=-upNext(n)*restRatio
+            if (xpNext(n).gt.xmax-radp(n)) then
+              xpNext(n)=(xmax-radp(n)) - (xpNext(n)-(xmax-radp(n)))
+            elseif (xpNext(n).lt.xmin+radp(n)) then
+              xpNext(n)=(xmin+radp(n)) - (xpNext(n)-(xmin+radp(n)))
+            endif
+            wcollnum(n)=wcollnum(n)+1
             if (qpmax.ne.qp0) call chargeParticleWall(n,1)
           endif
         elseif (bcx.eq.'i') then
@@ -142,89 +187,42 @@
           endif
         endif
 
-        if (bcy.eq.'p') then
-          if (yp(n).lt.ymin) yp(n)=yp(n)+dimy
-          if (yp(n).gt.ymax) yp(n)=yp(n)-dimy
+        if (bcy.eq.'p') then ! y-direction
+          if (ypNext(n).lt.ymin) ypNext(n)=ypNext(n)+dimy
+          if (ypNext(n).gt.ymax) ypNext(n)=ypNext(n)-dimy
         elseif (bcy.eq.'w') then
-          if ((yp(n).lt.ymin+radp(n)).or.(yp(n).gt.ymax-radp(n))) then
-            vp(n)=-vp(n)*restRatio      
-            yp(n)=ypold+vp(n)*dt
+          if ((ypNext(n).lt.ymin+radp(n)).or.(ypNext(n).gt.ymax-radp(n))) then
+            vpNext(n)=-vpNext(n)*restRatio 
+            if (ypNext(n).gt.ymax-radp(n)) then
+              ypNext(n)=(ymax-radp(n)) - (ypNext(n)-(ymax-radp(n)))
+            elseif (ypNext(n).lt.ymin+radp(n)) then
+              ypNext(n)=(ymin+radp(n)) - (ypNext(n)-(ymin+radp(n)))
+            endif
             wcollnum(n)=wcollnum(n)+1
             if (qpmax.ne.qp0) call chargeParticleWall(n,2)
           endif
         endif
 
-        if (bcz.eq.'p') then
-          if (zp(n).lt.zmin) zp(n)=zp(n)+dimz
-          if (zp(n).gt.zmax) zp(n)=zp(n)-dimz
+        if (bcz.eq.'p') then ! z-direction
+          if (zpNext(n).lt.zmin) zpNext(n)=zpNext(n)+dimz
+          if (zpNext(n).gt.zmax) zpNext(n)=zpNext(n)-dimz
         elseif (bcz.eq.'w') then
-          if ((zp(n).lt.zmin+radp(n)).or.(zp(n).gt.zmax-radp(n))) then
-            wp(n)=-wp(n)*restRatio      
-            zp(n)=zpold+wp(n)*dt
+          if ((zpNext(n).lt.zmin+radp(n)).or.(zpNext(n).gt.zmax-radp(n))) then
+            wpNext(n)=-wpNext(n)*restRatio      
+            if (zpNext(n).gt.zmax-radp(n)) then
+              zpNext(n)=(zmax-radp(n)) - (zpNext(n)-(zmax-radp(n)))
+            elseif (zpNext(n).lt.zmin+radp(n)) then
+              zpNext(n)=(zmin+radp(n)) - (zpNext(n)-(zmin+radp(n)))
+            endif
             wcollnum(n)=wcollnum(n)+1
             if (qpmax.ne.qp0) call chargeParticleWall(n,3)
           endif
         endif
 
-
-! particles are send (=1) if they are either on the active ghost
-! cells or crossed the border to the next processor
-      if (prev.ne.mpi_proc_null) then
-          if ((xp(n).gt.xmin).and.(xp(n).lt.xf(gc+gc)).or. &
-              (xpold.gt.xmin).and.(xp(n).le.xmin)) then
-             np_sendl(n)=1
-          else
-             np_sendl(n)=0
-          endif
-      endif
-      if (next.ne.mpi_proc_null) then
-          if ((xp(n).gt.xf(imax-gc)).and.(xp(n).lt.xmax).or. &
-              (xpold.lt.xmax).and.(xp(n).ge.xmax)) then
-             np_sendr(n)=1
-          else
-             np_sendr(n)=0
-          endif
-      endif
-
 1     enddo
 
 
-      npp=np
-      np_recvl=0 
-      np_recvr=0 
-
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,xp)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,yp)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,zp)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,radp)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,up)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,vp)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,wp)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,q_el)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,uf)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,vf)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,wf)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,uf01)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,vf01)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,wf01)
-      call syncPart(np_sendl,np_sendr,np_recvl,np_recvr,partn)
-      call syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,wcollnum)
-      call syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,ppcollnum)
-      call syncPartI(np_sendl,np_sendr,np_recvl,np_recvr,nGlob)
-
-
-      if ((bcx.eq.'p').and.(myid.eq.nrprocs-1)) then
-        do 2 n=npp+1,np
-          if (np_recvr(n).eq.1) xp(n)= xp(n) + dimxtot
-2       enddo
-      endif
-      if ((bcx.eq.'p').and.(myid.eq.0)) then
-        do 3 n=npp+1,np
-          if (np_recvl(n).eq.1) xp(n)= xp(n) - dimxtot
-3       enddo
-      endif
-
-      if ((bcx.eq.'i').and.(myid.eq.nrprocs-1)) then
+      if ((bcx.eq.'i').and.(myid.eq.nrprocs-1)) then ! remove particles from outlet
         m=0
         do 4 n=1,np
           if (remove(n)) then
@@ -241,9 +239,6 @@
         np=m
       endif
 
-      call particlesToCells
-
-      return
       end 
 
 !####################################################################
@@ -251,235 +246,143 @@
 !> @brief compute momentum source term for fluid phase (habil eq 2.12)
       subroutine momentumCoupling
       use var
-      real(kind=pr), dimension(ii,jj,ll) :: &
-          rui,rvi,rwi,source_u,source_v,source_w
-      real(kind=pr) :: f_d(3),volp,source,drag,sp_r,volE
-      real(kind=pr),dimension(3,3,3) :: weight
-      integer       :: n,ibeg,iend,jbeg,jend,lbeg,lend,i,j,l,iw,jw,lw
-      integer       :: direction,m,ip,jp,lp
-
-
-      rui=0._pr
-      rvi=0._pr
-      rwi=0._pr
-      source_u=0._pr
-      source_v=0._pr
-      source_w=0._pr
-      
-      do 1 n=1,np
-
-        if ((ip(n).lt.(imin-1)).or.(ip(n).gt.(imax+1)).or. &
-            (jp(n).lt.(jmin-1)).or.(jp(n).gt.(jmax+1)).or. &
-            (lp(n).lt.(lmin-1)).or.(lp(n).gt.(lmax+1))) cycle
-
+      real(kind=pr) :: volE,partmass
+      real(kind=pr),dimension(2,2,2) :: weight
+      integer       :: n,ibeg,iend,jbeg,jend,lbeg,lend
 
-! only drag forces
-        f_d(1)= drag(n)*(uf(n)-up(n))
-        f_d(2)= drag(n)*(vf(n)-vp(n))
-        f_d(3)= drag(n)*(wf(n)-wp(n))
-
-        volp= 4._pr/3._pr*pi*partn(n)*radp(n)**3
-      
-        do 2 direction=1,3
-          call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,direction)
-
-! compute source terms for the parcel 
-          do l=lbeg,lend; do i=ibeg,iend; do j=jbeg,jend
-            iw=i+1-ibeg
-            jw=j+1-jbeg
-            lw=l+1-lbeg
-            if (direction.eq.1) then
-              source= rhop/rhof * volp/volE * f_d(1)
-              rui(i,j,l)= rui(i,j,l) + source*weight(iw,jw,lw)
-            elseif (direction.eq.2) then
-              source= rhop/rhof * volp/volE * f_d(2)
-              rvi(i,j,l)= rvi(i,j,l) + source*weight(iw,jw,lw)
-            elseif (direction.eq.3) then
-              source= rhop/rhof * volp/volE * f_d(3)
-              rwi(i,j,l)= rwi(i,j,l) + source*weight(iw,jw,lw)
-            endif
-          enddo; enddo; enddo
+      Fsx=0._pr; Fsy=0._pr; Fsz=0._pr
+     
+      call particlesDrag  ! only aerodynamic forces
+      call particlesLift
 
-2       enddo
+      do 1 n=1,np
+        partmass= rhop*4._pr/3._pr*pi*partn(n)*radp(n)**3
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,1)
+        Fsx(ibeg:iend,jbeg:jend,lbeg:lend)=   Fsx(ibeg:iend,jbeg:jend,lbeg:lend) &
+                                            - partmass/rhof/volE*(fx_d(n)+fx_l(n))*weight
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,2)
+        Fsy(ibeg:iend,jbeg:jend,lbeg:lend)=   Fsy(ibeg:iend,jbeg:jend,lbeg:lend) &
+                                            - partmass/rhof/volE*(fy_d(n)+fy_l(n))*weight
+        call weightLE8(weight,ibeg,iend,jbeg,jend,lbeg,lend,volE,n,3)
+        Fsz(ibeg:iend,jbeg:jend,lbeg:lend)=   Fsz(ibeg:iend,jbeg:jend,lbeg:lend) &
+                                            - partmass/rhof/volE*(fz_d(n)+fz_l(n))*weight
 1     enddo
 
-! hg not sure if I want this
-!      sp_r=0.70    ! relax the contribution to the momentum equation
-!
-!      do 6 i=imin,imax; do 6 j=jmin,jmax; do 6 l=lmin,lmax
-!        rup(i,j,l) = -((1.-sp_r)*rui(i,j,l)+rui_o(i,j,l)*sp_r)
-!        rvp(i,j,l) = -((1.-sp_r)*rvi(i,j,l)+rvi_o(i,j,l)*sp_r)
-!        rwp(i,j,l) = -((1.-sp_r)*rwi(i,j,l)+rwi_o(i,j,l)*sp_r)
-!      
-!        rui_o(i,j,l)=rui(io)
-!        rvi_o(i,j,l)=rvi(io)
-!        rwi_o(i,j,l)=rwi(io)
-!6     enddo
-
-      do i=imin,imax; do j=jmin,jmax; do l=lmin,lmax
-        fsx(i,j,l)= -rui(i,j,l)
-        fsy(i,j,l)= -rvi(i,j,l)
-        fsz(i,j,l)= -rwi(i,j,l)
-!        fsx(i,j,l)= 0._pr
-!        fsy(i,j,l)= 0._pr
-!        fsz(i,j,l)= 0._pr
-      enddo; enddo; enddo
-
-! remove particles of another processor, they were only needed for source term
-      m=0
-      do 3 n=1,np
-        if ((xp(n).ge.xmin).and.(xp(n).le.xmax)) then
-          m=m+1
-          call partN2M(n,m)
-        endif
-3     enddo
-      np=m
+      call bcLEsource(Fsx); call bcLEsource(Fsy); call bcLEsource(Fsz)
 
-
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief compute particles collisions using ray casting
-      subroutine particlesCollide
+!> @brief particles collisions in next time-step using ray casting
+      subroutine particlesCollideNext
       use var     
       real(kind=pr),dimension(maxnp) :: xpc,ypc,zpc
-      real(kind=pr),dimension(3) :: relvelo,midlink,ncontact
+      real(kind=pr),dimension(3) :: relvelo,midlink,ncontact,vn,ve
       real(kind=pr) :: sumrad,upp1,vpp1,wpp1,upp2,vpp2,wpp2, &
-                       partn1,partn2,partdist, &
-                       r3n1,r3n2,rxx,projvtox,srel,projvton, &
-                       closestrelvelo,fracdt, &
-                       vex,vey,vez,vnx,vny,vnz
-      integer :: n1,n2,numcol,ip,jp,lp,m1,m2,i,j,l,syncSumI
+                       partdist,r3n1,r3n2,projvtox,srel,projvton, &
+                       closestrelvelo,fracdt
+      integer :: n1,n2,m1,m2,i,j,l,syncSumI
       
-
-      numcol=0
-
-      do i=1,ii; do j=1,jj; do l=1,ll
+      do l=1,ll; do j=1,jj; do i=1,ii
 ! condition I only particles in same cell:
       do 1 m1=2,npic(i,j,l)
       do 2 m2=1,(m1-1)
 
-      n1=nic(i,j,l,m1)
-      n2=nic(i,j,l,m2)
+        n1=nic(i,j,l,m1)
+        n2=nic(i,j,l,m2)
 
 ! setting the 2 particles in the rest frame of particle n2
-      relvelo(1)=up(n1)-up(n2)
-      relvelo(2)=vp(n1)-vp(n2)
-      relvelo(3)=wp(n1)-wp(n2)
-      midlink(1)=xp(n2)-xp(n1)
-      midlink(2)=yp(n2)-yp(n1)
-      midlink(3)=zp(n2)-zp(n1)
-      projvtox=dot_product(midlink,(relvelo*dt))
+        relvelo= (/ up(n1)-up(n2) , vp(n1)-vp(n2) , wp(n1)-wp(n2) /)
+        midlink= (/ xp(n2)-xp(n1) , yp(n2)-yp(n1) , zp(n2)-zp(n1) /)
+        projvtox=dot_product(midlink,(relvelo*dtNext))
 
 ! condition IIa to check collision (propagation direction):
-      if (projvtox.lt.0._pr) cycle
+        if (projvtox.lt.0._pr) cycle
 
-      srel=sqrt(dot_product((relvelo*dt),(relvelo*dt)))
+        srel= sqrt(dot_product((relvelo*dtNext),(relvelo*dtNext)))
 
 ! condition IIb to check collision (no rel velocity, no collision):
-      if (abs(srel).lt.1.e-19_pr) cycle
+        if (abs(srel).lt.1.e-19_pr) cycle
 
-      partdist=sqrt(dot_product(midlink,midlink))
-      sumrad=radp(n1)+radp(n2)
+        partdist= sqrt(dot_product(midlink,midlink))
+        sumrad= radp(n1)+radp(n2)
       
 ! condition III to check collision (contact expected):
-      if ((partdist**2-(projvtox/srel)**2).gt.sumrad**2) then
-        cycle
-      elseif (partdist.le.sumrad) then ! if overlapping after seeding
-        cycle
-      endif
+        if ((partdist**2-(projvtox/srel)**2).gt.sumrad**2) then
+          cycle
+        elseif (partdist.le.sumrad) then ! if overlapping after seeding
+          cycle
+        endif
 
-      closestrelvelo=sqrt(sumrad**2-(partdist**2-(projvtox/srel)**2))
-      fracdt=(projvtox/srel-closestrelvelo)/srel
+        closestrelvelo= sqrt(sumrad**2-(partdist**2-(projvtox/srel)**2))
+        fracdt= (projvtox/srel-closestrelvelo)/srel
 
 ! condition IV to check collision (contact during next timestep):
-      if ((fracdt.gt.1._pr).or.(fracdt.lt.0._pr)) cycle
+        if ((fracdt.gt.1._pr).or.(fracdt.lt.0._pr)) cycle
       
 ! all conditions fullfilled -> collision happens
-      ppcollnum(n1)=ppcollnum(n1)+1
-      ppcollnum(n2)=ppcollnum(n2)+1
-      numcol=numcol+1  
-      if (q_el(n1).ne.q_el(n2)) call chargeParticleParticle(n1,n2)
+        ppcollnum(n1)= ppcollnum(n1)+1
+        ppcollnum(n2)= ppcollnum(n2)+1
+        if (q_el(n1).ne.q_el(n2)) call chargeParticleParticle(n1,n2)
 
 ! fictitious contact point
-      xpc(n1)=xp(n1)+fracdt*up(n1)*dt
-      ypc(n1)=yp(n1)+fracdt*vp(n1)*dt
-      zpc(n1)=zp(n1)+fracdt*wp(n1)*dt
-      xpc(n2)=xp(n2)+fracdt*up(n2)*dt
-      ypc(n2)=yp(n2)+fracdt*vp(n2)*dt
-      zpc(n2)=zp(n2)+fracdt*wp(n2)*dt
+        xpc(n1)= xp(n1)+fracdt*up(n1)*dtNext
+        ypc(n1)= yp(n1)+fracdt*vp(n1)*dtNext
+        zpc(n1)= zp(n1)+fracdt*wp(n1)*dtNext
+        xpc(n2)= xp(n2)+fracdt*up(n2)*dtNext
+        ypc(n2)= yp(n2)+fracdt*vp(n2)*dtNext
+        zpc(n2)= zp(n2)+fracdt*wp(n2)*dtNext
 
-      r3n1=radp(n1)**3
-      r3n2=radp(n2)**3
+        r3n1= radp(n1)**3
+        r3n2= radp(n2)**3
 
 ! normal vector to the contact point ('Stossnormale')
-      ncontact(1)=xpc(n1)-xpc(n2)
-      ncontact(2)=ypc(n1)-ypc(n2)
-      ncontact(3)=zpc(n1)-zpc(n2)
+        ncontact= (/ xpc(n1)-xpc(n2) , ypc(n1)-ypc(n2) , zpc(n1)-zpc(n2) /)
 
 ! project the contact velocity on the contact normal
 ! these components are zero for n2 bc it is in rest
-      projvton=dot_product(ncontact,relvelo)/(sumrad**2)
-      vnx=projvton*ncontact(1)
-      vny=projvton*ncontact(2)
-      vnz=projvton*ncontact(3)
+        projvton= dot_product(ncontact,relvelo)/(sumrad**2)
+        vn= projvton*ncontact
 
 ! velocity components in the contact plane which do not change during contact
 ! these components are zero for n2 bc it is in rest
-      vex=relvelo(1)-vnx
-      vey=relvelo(2)-vny
-      vez=relvelo(3)-vnz
+        ve= relvelo-vn
 
 ! new v = rest frame + unchanged components in contact plane + central collision
-      upp1=up(n2) + vex + (r3n1-restRatio*r3n2)*vnx/(r3n1+r3n2)
-      vpp1=vp(n2) + vey + (r3n1-restRatio*r3n2)*vny/(r3n1+r3n2)
-      wpp1=wp(n2) + vez + (r3n1-restRatio*r3n2)*vnz/(r3n1+r3n2)
-
-      upp2=up(n2) + (1._pr+restRatio)*r3n1*vnx/(r3n1+r3n2)
-      vpp2=vp(n2) + (1._pr+restRatio)*r3n1*vny/(r3n1+r3n2)
-      wpp2=wp(n2) + (1._pr+restRatio)*r3n1*vnz/(r3n1+r3n2)
-
-      if (max(vpp1,wpp1,vpp2,wpp2,.5_pr*upp1,.5_pr*upp2).gt.2._pr*ubulk) then
-      print*
-      print*,up(n1),vp(n1),wp(n1)
-      print*,upp1,vpp1,wpp1
-      print*,up(n2),vp(n2),wp(n2)
-      print*,upp2,vpp2,wpp2
-      print*,projvtox,midlink,vnx,vny,vnz,vex,vey,vez
-      print*,up(n1)+up(n2)-upp1-upp2,vp(n1)+vp(n2)-vpp1-vpp2,wp(n1)+wp(n2)-wpp1-wpp2
-      endif
+        upp1= up(n2) + ve(1) + (r3n1-restRatio*r3n2)*vn(1)/(r3n1+r3n2)
+        vpp1= vp(n2) + ve(2) + (r3n1-restRatio*r3n2)*vn(2)/(r3n1+r3n2)
+        wpp1= wp(n2) + ve(3) + (r3n1-restRatio*r3n2)*vn(3)/(r3n1+r3n2)
 
-      partn1=partn(n1)
-      partn2=partn(n2)
-      if(partn1.gt.partn2) then
-        up(n2)=upp2
-        vp(n2)=vpp2
-        wp(n2)=wpp2
-        up(n1)=(partn2*upp1+(partn1-partn2)*up(n1))/partn1
-        vp(n1)=(partn2*vpp1+(partn1-partn2)*vp(n1))/partn1
-        wp(n1)=(partn2*wpp1+(partn1-partn2)*wp(n1))/partn1
-      else
-        up(n1)=upp1
-        vp(n1)=vpp1
-        wp(n1)=wpp1
-        up(n2)=(partn1*upp2+(partn2-partn1)*up(n2))/partn2
-        vp(n2)=(partn1*vpp2+(partn2-partn1)*vp(n2))/partn2
-        wp(n2)=(partn1*wpp2+(partn2-partn1)*wp(n2))/partn2
-      endif
+        upp2= up(n2) + (1._pr+restRatio)*r3n1*vn(1)/(r3n1+r3n2)
+        vpp2= vp(n2) + (1._pr+restRatio)*r3n1*vn(2)/(r3n1+r3n2)
+        wpp2= wp(n2) + (1._pr+restRatio)*r3n1*vn(3)/(r3n1+r3n2)
 
+        if (max(vpp1,wpp1,vpp2,wpp2,.5_pr*upp1,.5_pr*upp2).gt.2._pr*ubulk) then
+          write(*,*) 'Warning: post-collision velocity too high'
+          write(*,*) up(n1),vp(n1),wp(n1),upp1,vpp1,wpp1,up(n2),vp(n2),wp(n2),upp2,vpp2,wpp2
+        endif
+
+        if(partn(n1).gt.partn(n2)) then
+          upNext(n2)= upp2
+          vpNext(n2)= vpp2
+          wpNext(n2)= wpp2
+          upNext(n1)= (partn(n2)*upp1+(partn(n1)-partn(n2))*up(n1))/partn(n1)
+          vpNext(n1)= (partn(n2)*vpp1+(partn(n1)-partn(n2))*vp(n1))/partn(n1)
+          wpNext(n1)= (partn(n2)*wpp1+(partn(n1)-partn(n2))*wp(n1))/partn(n1)
+        else
+          upNext(n1)= upp1
+          vpNext(n1)= vpp1
+          wpNext(n1)= wpp1
+          upNext(n2)= (partn(n1)*upp2+(partn(n2)-partn(n1))*up(n2))/partn(n2)
+          vpNext(n2)= (partn(n1)*vpp2+(partn(n2)-partn(n1))*vp(n2))/partn(n2)
+          wpNext(n2)= (partn(n1)*wpp2+(partn(n2)-partn(n1))*wp(n2))/partn(n2)
+        endif
 
 2     enddo
 1     enddo
       enddo; enddo; enddo
 
-      numcol=syncSumI(numcol)
-      if (myid.eq.0) write(*,'(a,i9)',advance='no') &
-        ' |collide =',numcol
-
-      return
       end
 
 !####################################################################
@@ -487,9 +390,9 @@
 !> @brief seed particles
       subroutine particlesSeed
       use var
+      use parallel
       real(kind=pr),allocatable,dimension(:) :: randomx,randomy,randomz
-      integer :: n,i,j,l,ip,jp,lp,npseed,npseedTot, &
-                 syncSumI
+      integer :: n,npseed,npseedTot
       character(70) :: filename
 
 !> number of particles to be seeded
@@ -508,9 +411,6 @@
       np=npp+npseed
       call allocateParticleArrays
 
-      if (myid.eq.0) write(*,'(a,i9)',advance='no') &
-        ' |seed    =',npseedTot
-
       if (npseed.eq.0) return
 
       write(filename,'(a,i3.3,a)') 'results/particlesSeed_p',myid,'.dat'
@@ -531,11 +431,11 @@
 
       do 1 n=npp+1,np
 !> seed not directly on wall or an active gc:
-      if (bcx.eq.'i') then
-        xp(n)=randomx(n-npp)*ubulk*dt+xf(imin-1)
-      else
-        xp(n)=randomx(n-npp)*(dimx-2._pr*prad)+xf(imin-1)+prad
-      endif
+        if (bcx.eq.'i') then
+          xp(n)=randomx(n-npp)*ubulk*dt+xf(imin-1)
+        else
+          xp(n)=randomx(n-npp)*(dimx-2._pr*prad)+xf(imin-1)+prad
+        endif
         yp(n)=randomy(n-npp)*(dimy-2._pr*prad)+yf(jmin-1)+prad
         zp(n)=randomz(n-npp)*(dimz-2._pr*prad)+zf(lmin-1)+prad
 
@@ -545,34 +445,26 @@
         wcollnum(n)=0
         ppcollnum(n)=0
 
-        i=ip(n)
-        j=jp(n)
-        l=lp(n)
-
-        up(n)=u(i,j,l)
-        if (xp(n).lt.xc(i)) up(n)=u(i-1,j,l)
-        vp(n)=v(i,j,l)
-        if (yp(n).lt.yc(j)) vp(n)=v(i,j-1,l)
-        wp(n)=w(i,j,l)
-        if (zp(n).lt.zc(l)) wp(n)=w(i,j,l-1)
-      
+        radp(n)=prad
+        partn(n)=1._pr
+        q_el(n)=qp0
+        q_elNext(n)=q_el(n)
 
 !      xp(1)=0.02;yp(1)=0.;zp(1)=0.
 !      xp(2)=0.03;yp(2)=0.;zp(2)=0.
 !      up(1)=1.;up(2)=-1;vp(1)=0.;vp(2)=0.;wp(1)=0.;wp(2)=0.
 
-        uf(n)=up(n); vf(n)=vp(n); wf(n)=wp(n);
-        radp(n)=prad
-        partn(n)=1._pr
-        q_el(n)=qp0
-
         write(10,'(3(es10.2e2,x))') radp(n),q_el(n),partn(n)
 
 1     enddo
 
       call particlesToCells
-      
+      call fluidVelocity
+
+      up(npp+1:np)= uf(npp+1:np)
+      vp(npp+1:np)= vf(npp+1:np)
+      wp(npp+1:np)= wf(npp+1:np)
+
       close(10)
 
-      return
       end
diff --git a/src/post.f90 b/src/post.f90
index 515f085ff35d92529f748bf77858cc3941d8c478..9caaa17d0f2df7fe783e4f48e9a78627d145b938 100644
--- a/src/post.f90
+++ b/src/post.f90
@@ -3,79 +3,57 @@
       subroutine postProcessing
       use var
 
-      if (mod(nt,int_results).eq.0.or.(nt).eq.1) then
-
-      call monitor
-      call writevtk_fluid_xy
-      call writevtk_fluid_xz
-      call writevtk_fluid_yz
-      call writedat_ufluid_xy
-      call writedat_vfluid_xy
-      call writedat_wfluid_xy
-!      call writedat_ufluid_xz
-!      call writedat_vfluid_xz
-!      call writedat_wfluid_xz
-!      call writedat_coulomb
-!      call writevtk_fluid_xyz
-      call writevtk_particles
-      call writedat_particles
-!      call writevtk_fluid_av
-!      call writedat_ufluid_3d
-!      call writedat_vfluid_3d
-!      call writedat_wfluid_3d
-
+      if ((mod(nt,int_results).eq.0).or.(nt.eq.1).or.(nt.eq.ntend)) then
+       call monitor
+       call writevtk_fluid_xy
+       call writevtk_fluid_xz
+       call writevtk_fluid_yz
+       call writevtk_fluid_xyz
+       call writevtk_particles
+       call writedat_particles
       endif
 
-      if (mod(nt,int_restart).eq.0) call saveField
+      if ((mod(nt,int_restart).eq.0).or.(nt.eq.ntend)) call saveField
 
-      return 
       end
 
 !####################################################################
 !> @author Holger Grosshans
       subroutine monitor
       use var
+      use parallel
       real(kind=pr) :: ucl,avu,avv,avw,tke,gradu,graduy,graduz, &
                        Rec,Reb,avvp,avwp,avyp,avzp,avvf,avwf,avxp,avqp, &
-                       syncAv,syncSum,C01,A01
-      integer :: i,j,l,m,N01,syncSumI
+                       rmsv,rmsw,C05,A05
+      integer :: i,j,l,m,N05
       logical :: file_ex
       character(70) :: filename2
 
+      if (bcy.eq.'w'.and.bcz.eq.'w') then
+        ucl= sum(u(imin:imax,int(jj/2),int(ll/2)))/(imax-imin+1)
+      elseif (bcy.eq.'w'.and.bcz.eq.'p') then 
+        ucl= sum(u(imin:imax,int(jj/2),lmin:lmax))/(imax-imin+1)/(lmax-lmin+1)
+      elseif (bcy.eq.'p'.and.bcz.eq.'w') then
+        ucl= sum(u(imin:imax,jmin:jmax,int(ll/2)))/(imax-imin+1)/(jmax-jmin+1)
+      endif
 
+      avu= sum(u(imin:imax,jmin:jmax,lmin:lmax)*volu(imin:imax,jmin:jmax,lmin:lmax)) / volTot
+      avv= sum(v(imin:imax,jmin:jmax,lmin:lmax)*volv(imin:imax,jmin:jmax,lmin:lmax)) / volTot
+      avw= sum(w(imin:imax,jmin:jmax,lmin:lmax)*volw(imin:imax,jmin:jmax,lmin:lmax)) / volTot
 
-      j=int(jj/2); l=int(ll/2)
-
-      ucl= sum(u(imin:imax,j,l))/(imax-imin+1)
-
-      avu= sum(u(imin:imax,jmin:jmax,lmin:lmax) &
-      *vol(imin:imax,jmin:jmax,lmin:lmax)) / volTot
-      avv= sum(v(imin:imax,jmin:jmax,lmin:lmax) &
-      *vol(imin:imax,jmin:jmax,lmin:lmax)) / volTot
-      avw= sum(w(imin:imax,jmin:jmax,lmin:lmax) &
-      *vol(imin:imax,jmin:jmax,lmin:lmax)) / volTot
-
-      rmsv = sum((v(imin:imax,jmin:jmax,lmin:lmax))**2 &
-      *vol(imin:imax,jmin:jmax,lmin:lmax)) / volTot
+      rmsv=sum((v(imin:imax,jmin:jmax,lmin:lmax))**2 *volv(imin:imax,jmin:jmax,lmin:lmax)) / volTot
       rmsv=sqrt(rmsv)
-      rmsw = sum((w(imin:imax,jmin:jmax,lmin:lmax))**2 &
-      *vol(imin:imax,jmin:jmax,lmin:lmax)) / volTot   
+      rmsw=sum((w(imin:imax,jmin:jmax,lmin:lmax))**2 *volw(imin:imax,jmin:jmax,lmin:lmax)) / volTot   
       rmsw=sqrt(rmsw)
 
-      graduy= &
-      (sum(u(imin:imax,jmin,lmin:lmax)*vol(imin:imax,jmin,lmin:lmax)) &
-      +sum(u(imin:imax,jmax,lmin:lmax)*vol(imin:imax,jmax,lmin:lmax)))&
-      / &
-      (sum(vol(imin:imax,jmin,lmin:lmax)) &
-      +sum(vol(imin:imax,jmax,lmin:lmax)))&
-      / (ymax-yc(jmax))
-      graduz= &
-      (sum(u(imin:imax,jmin:jmax,lmin)*vol(imin:imax,jmin:jmax,lmin)) &
-      +sum(u(imin:imax,jmin:jmax,lmax)*vol(imin:imax,jmin:jmax,lmax))) &
-      / &
-      (sum(vol(imin:imax,jmin:jmax,lmin)) &
-      +sum(vol(imin:imax,jmin:jmax,lmax))) &
-      / (zmax-zc(lmax))
+      graduy= ( sum(u(imin:imax,jmin,lmin:lmax)*volu(imin:imax,jmin,lmin:lmax)) &
+               +sum(u(imin:imax,jmax,lmin:lmax)*volu(imin:imax,jmax,lmin:lmax))) &
+              / (sum(volu(imin:imax,jmin,lmin:lmax))+sum(volu(imin:imax,jmax,lmin:lmax))) &
+              / (ymax-yc(jmax))
+      graduz= ( sum(u(imin:imax,jmin:jmax,lmin)*volu(imin:imax,jmin:jmax,lmin)) &
+               +sum(u(imin:imax,jmin:jmax,lmax)*volu(imin:imax,jmin:jmax,lmax))) &
+              / (sum(volu(imin:imax,jmin:jmax,lmin))+sum(volu(imin:imax,jmin:jmax,lmax))) &
+              / (zmax-zc(lmax))
 
       if (bcy.eq.'w'.and.bcz.eq.'w') gradu=(graduy+graduz)/2._pr
       if (bcy.eq.'w'.and.bcz.eq.'p') gradu=graduy
@@ -86,45 +64,43 @@
        avzp=syncSum(sum(zp(1:np)))/npTot 
        avqp=syncSum(sum(q_el(1:np)))/npTot
        if (bcy.eq.'w'.and.bcz.eq.'w') then
-        N01=count((min((yp(1:np)-ymin),(ymax-yp(1:np))).le.(dimy*0.01_pr)).or. &
-                  (min((zp(1:np)-zmin),(zmax-zp(1:np))).le.(dimz*0.01_pr)))
-        A01=(dimy*dimz)-(dimy*0.98_pr)*(dimz*0.98_pr)
+        N05=count((min((yp(1:np)-ymin),(ymax-yp(1:np))).le.(dimy*0.05_pr)).or. &
+                  (min((zp(1:np)-zmin),(zmax-zp(1:np))).le.(dimz*0.05_pr)))
+        A05=(dimy*dimz)-(dimy*0.90_pr)*(dimz*0.90_pr)
        elseif (bcy.eq.'w'.and.bcz.eq.'p') then
-        N01=count(min((yp(1:np)-ymin),(ymax-yp(1:np))).le.(dimy*0.01_pr))
-        A01=(dimy*dimz)-(dimy*0.98_pr)*dimz
+        N05=count(min((yp(1:np)-ymin),(ymax-yp(1:np))).le.(dimy*0.05_pr))
+        A05=(dimy*dimz)-(dimy*0.90_pr)*dimz
        elseif (bcy.eq.'p'.and.bcz.eq.'w') then
-        N01=count(min((zp(1:np)-zmin),(zmax-zp(1:np))).le.(dimz*0.01_pr))
-        A01=(dimy*dimz)-dimy*(dimz*0.98_pr)
+        N05=count(min((zp(1:np)-zmin),(zmax-zp(1:np))).le.(dimz*0.05_pr))
+        A05=(dimy*dimz)-dimy*(dimz*0.90_pr)
        endif
-       C01=syncSumI(N01)/(A01*dimxTot)/pnd
+       C05=real(syncSumI(N05),kind=pr)/(A05*dimxTot)/pnd
       else
        npTot=0
-       avyp=0._pr
-       avzp=0._pr
-       avqp=0._pr
-       C01=0._pr
+       avyp= 0._pr
+       avzp= 0._pr
+       avqp= 0._pr
+       C05=  0._pr
       endif
 
-
-      ucl=syncAv(ucl) 
-      avu=syncAv(avu) 
-      avv=syncAv(avv) 
-      avw=syncAv(avw) 
+      ucl=  syncSum(ucl)/nrprocs
       ubulk=avu
-      rmsv=syncAv(rmsv)
-      rmsw=syncAv(rmsw)
-      gradu=syncAv(gradu)
+      avu=  syncSum(avu)/nrprocs
+      avv=  syncSum(avv)/nrprocs
+      avw=  syncSum(avw)/nrprocs
+      rmsv= syncSum(rmsv)/nrprocs
+      rmsw= syncSum(rmsw)/nrprocs
+      gradu=syncSum(gradu)/nrprocs
       
-      if (myid.eq.0) then
+      if (myid.ne.0) return
 
-      Rec    = ucl*delta/nuf
-      Reb    = avu*delta/nuf
-      tau_w  = muf*abs(gradu)
-      u_tau  = sqrt(tau_w/rhof)
-      Re_tau = u_tau*delta/nuf
+      Rec=    ucl*delta/nuf
+      Reb=    avu*delta/nuf
+      tau_w=  muf*abs(gradu)
+      u_tau=  sqrt(tau_w/rhof)
+      Re_tau= u_tau*delta/nuf
       if (Re_tau.gt.0._pr) delta_v= delta/Re_tau
 
-
       filename2='output/monitor.dat'
       inquire(file=filename2,exist=file_ex)
       if (file_ex.and.nt.ne.1) then
@@ -135,18 +111,12 @@
         write(10,'(a,i10,i14,15(i10))') '#',(m,m=1,16)
         write(10,'(a,a10,a14,14(a10))') &
         '#','nt','t','dt','ucl','av(u)','av(v)','av(w)','rms(v)','rms(w)', &
-        'Rec','Reb','tau_w','u_{tau}','Re_{tau}', &
-        'C_{01}','av(qp)'
+        'Rec','Reb','tau_w','u_{tau}','Re_{tau}','C_{05}','av(qp)'
       endif
 
       write(10,'(x,i10,es14.6e2,20(es10.2e2))') &
-      nt,t,dt,ucl,avu,avv,avw,rmsv,rmsw,Rec,Reb, &
-      tau_w,u_tau,Re_tau,C01,avqp
-
+      nt,t,dt,ucl,avu,avv,avw,rmsv,rmsw,Rec,Reb,tau_w,u_tau,Re_tau,C05,avqp
 
       close(10)
 
-      endif
-
-      return
       end
diff --git a/src/pre.f90 b/src/pre.f90
index 99c0b01c333ab965266224376ec35f7f5f7302e5..d656408f1b6d6b62128e67b03816c9085b3145cf 100644
--- a/src/pre.f90
+++ b/src/pre.f90
@@ -3,25 +3,19 @@
 !> @brief pre processing
       subroutine preProcessing
       use var
-      integer n
 
       nt=0
       call flowConditions
       call initVariables
       call gridGeneration
+      call computeCoefficients
       call writevtk_grid
-      if (ntstart.gt.1) then
-        call readField
-!        do n=1,np
-!          q_el(n)=qelp !> possible variation of particle charge
-!        enddo
-!        q_el(:)=qelp !> possible variation of particle charge
-      elseif (ntstart.eq.1) then
+      if (ntstart.eq.1) then
         call initFlow
-        call writevtk_fluid_xz
+      elseif (ntstart.gt.1) then
+        call readField
       endif
 
-      return 
       end
 
 !####################################################################
@@ -31,9 +25,7 @@
       use var
       use mpi
       integer :: dimitotTemp
-      character(8) :: comp_date
-      character(10) :: comp_time
-
+      character :: filename*70,comp_date*8,comp_time*10
 
 ! read input file
       open(unit=10,file='input/input.dat',status='old')
@@ -53,7 +45,7 @@
       read(10,*)
       read(10,*) int_results,int_restart
       read(10,*)
-      read(10,*) cfl
+      read(10,*) cfl,itmax,tol
       read(10,*)
       read(10,*) ubulk0,dpdx
       read(10,*)
@@ -61,7 +53,7 @@
       read(10,*)
       read(10,*) pnd,ntseed
       read(10,*)
-      read(10,*) prad,rhop
+      read(10,*) prad,rhop,restRatio
       read(10,*)
       read(10,*) qp0,qpmax
       read(10,*)
@@ -88,8 +80,7 @@
       dimx=dimxtot/nrprocs
       dimi=int(dimitotTemp/nrprocs)
       dimitot=dimi*nrprocs
-      if (myid.eq.0.and.dimitot.ne.dimitotTemp) &
-        write(*,'(a,i8)') 'dimi set to ',dimitot
+      if (myid.eq.0.and.dimitot.ne.dimitotTemp) write(*,'(a,i8)') 'dimi set to ',dimitot
 
       npTot=int(pnd*dimxtot*dimy*dimz)
       muf=nuf*rhof
@@ -102,63 +93,50 @@
       Re   = ubulk*delta/nuf
       ftt  = dimxtot/ubulk
 
-
 ! write output file
-      if (myid.eq.0) then
-      open(unit=20,file='output/output.dat',status='replace')
-
+      if (myid.ne.0) return
       call date_and_time(date=comp_date,time=comp_time)
-      write(20,'(a,x,a8,a,x,a6)') &
-            'Simulation start date:',comp_date,', time',comp_time
+
+      write(filename,'(3a,a6,a)') 'output/output_',comp_date,'_',comp_time,'.dat'
+      open(unit=20,file=filename,status='replace')
+
+      write(20,'(a,x,a8,a,x,a6)') 'Simulation start date:',comp_date,', time',comp_time
       write(20,*)
       write(20,'(a)') 'Conditions:'
       write(20,'(a,i4)') &
             'Nr. of processors                                     = ',nrprocs
-      write(20,'(a,3(es11.2e2,x))') &
-            'dimensions in x,y,z-direction (m,m,m)                 = ', &
-            dimxtot,dimy,dimz
+      write(20,'(a,3(es11.2e2))') &
+            'dimensions in x,y,z-direction (m,m,m)                 = ',dimxtot,dimy,dimz
       write(20,'(a,3x,3(a,x))') &
             'BCs in x,y,z-direction [(w)all/(p)eriodic]            = ',bcx,bcy,bcz
       write(20,'(a,3(i5),a,x,i8)') &
-            'Nr. of cells in x,y,z-direction (-,-,-)               = ', &
-            dimitot,dimj,diml,', total =',dimitot*dimj*diml
+            'Nr. of cells in x,y,z-direction (-,-,-)               = ',dimitot,dimj,diml,', total =',dimitot*dimj*diml
       write(20,'(a,3(i5),a,x,i8)') &
-            'Nr. of cells in x,y,z-direction per proc. (-,-,-)     = ', &
-            dimi,dimj,diml,', total =',dimi*dimj*diml
+            'Nr. of cells in x,y,z-direction per proc. (-,-,-)     = ',dimi,dimj,diml,', total =',dimi*dimj*diml
       write(20,'(a,3x,3(a,x))') &
             'Grid in x,y,z-direction [(u)niform/(s)tretch]         = ',gridx,gridy,gridz
       write(20,'(a,4(i8))') &
-            'nt: start, compute, results, restart (-,-,-,-)        = ', &
-            ntstart,ntime,int_results,int_restart
-      write(20,'(a,es11.2e2)') &
-            'CFL number (-)                                        = ', cfl
+            'nt: start, compute, results, restart (-,-,-,-)        = ',ntstart,ntime,int_results,int_restart
+      write(20,'(a,es11.2e2,i11,es11.2e2)') &
+            'CFL number (-), max number iterations (-), rel. tol.  = ',cfl,itmax,tol
       write(20,'(a,2(es11.2e2))') &
-            'in/initial flow (m/s), pressure gradient (N/m**3)     = ', ubulk,dpdx
+            'in/initial flow (m/s), pressure gradient (N/m**3)     = ',ubulk,dpdx
       write(20,'(a,2(es11.2e2))') &
-            'fluid density (kg/m**3), kinematic visc. (m**2/s)     = ', &
-            rhof,nuf
-      write(20,'(a,i8,es11.2,i8)') &
-            'particle number (-), (-/m**3) or (-/s), seed nt (-)   = ', npTot,pnd,ntseed
+            'fluid density (kg/m**3), kinematic visc. (m**2/s)     = ',rhof,nuf
+      write(20,'(a,i11,es11.2,i11)') &
+            'particle number (-), (-/m**3) or (-/s), seed nt (-)   = ',npTot,pnd,ntseed
       write(20,'(a,3(es11.2e2))') &
-            'particle rad. (m), mat. density (kg/m**3)             = ', &
-            prad,rhop
+            'particle rad (m),mat density (kg/m**3),rest coeff (-) = ',prad,rhop,restRatio
       write(20,'(a,3(es11.2e2))') &
-            'particle charge initial, maximum (C,C)                = ', &
-            qp0,qpmax
+            'particle charge initial, maximum (C,C)                = ',qp0,qpmax
       write(20,'(a,3(es11.2e2))') &
-            'gravity vector in x,y,z-dir. (m/s**2,m/s**2,m/s**2)   = ', &
-            g(1),g(2),g(3)
+            'gravity vector in x,y,z-dir. (m/s**2,m/s**2,m/s**2)   = ',g(1),g(2),g(3)
       write(20,'(a,8(es11.2e2))') &
-            'delta (m), Re (-), flow through time (s)              = ', &
-            delta,Re,ftt
+            'delta (m), Re (-), flow through time (s)              = ',delta,Re,ftt
             
-      endif
-
       close(20)
 
-      return
       end
-      
 
 !####################################################################
 !> @brief allocate and initialize all variables
@@ -166,7 +144,6 @@
       use var
       use mpi
 
-
       ii=dimi+2*gc; jj=dimj+2*gc; ll=diml+2*gc
       maxnp=0
 
@@ -174,22 +151,19 @@
       allocate(mpistatus(mpi_status_size))
 
 ! grid
-      allocate( &
-      celltype(ii,jj,ll), &
-      xc(ii),yc(jj),zc(ll),xf(ii),yf(jj),zf(ll), &
-      dxcdi(ii),dycdj(jj),dzcdl(ll),dxfdi(ii),dyfdj(jj),dzfdl(ll), &
-      vol(ii,jj,ll))
+      allocate(celltype(ii,jj,ll))
+      allocate(xc(ii),yc(jj),zc(ll),xf(ii),yf(jj),zf(ll), &
+      vol(ii,jj,ll),volu(ii,jj,ll),volv(ii,jj,ll),volw(ii,jj,ll), &
+      Ca(ii,jj,ll),Cb1(ii,jj,ll),Cb2(ii,jj,ll),Cc1(ii,jj,ll),Cc2(ii,jj,ll), &
+      Cd1(ii,jj,ll),Cd2(ii,jj,ll))
 
 ! fluid
-      allocate( &
-      u(ii,jj,ll),v(ii,jj,ll),w(ii,jj,ll),p(ii,jj,ll), &
+      allocate(u(ii,jj,ll),v(ii,jj,ll),w(ii,jj,ll),p(ii,jj,ll), &
       rho_el(ii,jj,ll),phi_el(ii,jj,ll), &
       Ex_el(ii,jj,ll),Ey_el(ii,jj,ll),Ez_el(ii,jj,ll), &
-      defect_c(ii,jj,ll),defect_u(ii,jj,ll), &
-      defect_v(ii,jj,ll),defect_w(ii,jj,ll), &
       u01(ii,jj,ll),v01(ii,jj,ll),w01(ii,jj,ll), &
-      fsx(ii,jj,ll),fsy(ii,jj,ll),fsz(ii,jj,ll), &
-      dudt(ii,jj,ll),dvdt(ii,jj,ll),dwdt(ii,jj,ll))
+      u02(ii,jj,ll),v02(ii,jj,ll),w02(ii,jj,ll), &
+      Fsx(ii,jj,ll),Fsy(ii,jj,ll),Fsz(ii,jj,ll))
 
 ! particles
       allocate(npic(ii,jj,ll))
@@ -198,49 +172,58 @@
 
 ! init
       u=0._pr; v=0._pr; w=0._pr; p=0._pr
-      dudt=0._pr; dvdt=0._pr; dwdt=0._pr
       u01=u; v01=v; w01= w
-      fsx=0._pr; fsy=0._pr; fsz=0._pr
-      defect_c=0._pr; defect_u=0._pr; defect_v=0._pr; defect_w=0._pr
+      u02=u; v02=v; w02= w
+      Fsx=0._pr; Fsy=0._pr; Fsz=0._pr
       celltype=active
-      dxcdi=0._pr; dycdj=0._pr; dzcdl=0._pr; dxfdi=0._pr; dyfdj=0._pr; dzfdl=0._pr
-      t=0._pr
+      t=0._pr; timecom=0._pr
+      rtau_p_max=0._pr; Dup_max=0._pr
+      vol=0._pr; volu=0._pr; volv=0._pr; volw=0._pr;
+      Ca=0._pr; Cb1=0._pr; Cb2=0._pr; Cc1=0._pr; Cc2=0._pr; Cd1=0._pr; Cd2=0._pr;
 
 ! electrostatics
       rho_el=0._pr
       phi_el=0._pr
-      Ex_el=0._pr; Ey_el=0._pr; Ez_el=0._pr
-      fx_el=0._pr; fy_el=0._pr; fz_el=0._pr
-      q_el=0._pr
+      Ex_el= 0._pr; Ey_el=0._pr; Ez_el=0._pr
+      fx_el= 0._pr; fy_el=0._pr; fz_el=0._pr
+      fx_d=  0._pr; fy_d= 0._pr; fz_d= 0._pr
+      fx_l=  0._pr; fy_l= 0._pr; fz_l= 0._pr
+      q_el=  0._pr; q_elNext=0._pr;
 
       call init_random_seed()
 
-      return
       end
 
+!####################################################################
+!> @author Holger Grosshans
+!> @brief initialize random number generator
+      subroutine init_random_seed()
+      use var
+      integer :: i,n,clock
+      integer, dimension(:), allocatable :: seed
+
+      call random_seed(size=n)
+      allocate(seed(n))
+      call system_clock(count=clock)
+      seed = clock + 37 * (/ (i - 1, i = 1, n) /)
+      call random_seed(put=seed)
+      deallocate(seed)
+      
+      end
 
 !####################################################################
 !> @author Holger Grosshans
 !> @brief generate grid for gaseous phase
       subroutine gridGeneration
       use var
-      real(kind=pr) :: hy_temp,hz_temp,fluxplu,fluxmin, &
-                       dimi_pr,dimj_pr,diml_pr,gc_pr,jj_pr,ll_pr
+      real(kind=pr) :: hy_temp,hz_temp
       integer :: i,j,l,m
 
-      
       imin=1+gc; imax=ii-gc
       jmin=1+gc; jmax=jj-gc
       lmin=1+gc; lmax=ll-gc
       gp=ii*jj*ll; dimgp=dimi*dimj*diml; dimgptot=(dimi*nrprocs)*dimj*diml
 
-      dimi_pr=real(dimi,kind=pr)
-      dimj_pr=real(dimj,kind=pr)
-      diml_pr=real(diml,kind=pr)
-      gc_pr=real(gc,kind=pr)
-      jj_pr=real(jj,kind=pr)
-      ll_pr=real(ll,kind=pr)
-
 !> celltypes, default=active
       do 1 i=1,ii
         select case (bcx)
@@ -278,13 +261,13 @@
 !> grid
       do 4 i=1,ii
         if (gridx.eq.'u') then
-          xf(i)=real(i-gc,kind=pr)*dimx/dimi_pr
+          xf(i)=real(i-gc,kind=pr)*dimx/real(dimi,kind=pr)
         elseif (gridx.eq.'s') then
           !not implemented yet
         endif
 
         if (i.eq.1) then
-          xc(i)= xf(1)-(dimx/dimi_pr)/2._pr
+          xc(i)= xf(1)-(dimx/real(dimi,kind=pr))/2._pr
         else
           xc(i)= (xf(i)+xf(i-1))/2._pr
         endif
@@ -292,16 +275,16 @@
 
       do 5 j=1,jj
         if (gridy.eq.'u') then
-          hy_temp=dimy/dimj_pr
-          yf(j)=(real(j,kind=pr)-real(jj_pr)/2._pr)*hy_temp
+          hy_temp=dimy/real(dimj,kind=pr)
+          yf(j)=(real(j,kind=pr)-real(jj,kind=pr)/2._pr)*hy_temp
         elseif (gridy.eq.'s') then
-          hy_temp= (1._pr-cos(pi/dimj_pr))*dimy/2._pr !width of first active cell
+          hy_temp= (1._pr-cos(pi/real(dimj,kind=pr)))*dimy/2._pr !width of first active cell
           if (j.lt.jmin) then
             yf(j)= real(j+1-jmin,kind=pr)*hy_temp-dimy/2._pr
           elseif (j.gt.jmax) then
             yf(j)= real(j-jmax,kind=pr)*hy_temp+dimy/2._pr
           else
-            yf(j)=-(cos(real(j-gc,kind=pr)*pi/dimj_pr))*dimy/2._pr
+            yf(j)=-(cos(real(j-gc,kind=pr)*pi/real(dimj,kind=pr)))*dimy/2._pr
           endif
         endif
 
@@ -314,16 +297,16 @@
 
       do 6 l=1,ll
         if (gridz.eq.'u') then
-          hz_temp=dimz/diml_pr
-          zf(l)=(real(l,kind=pr)-real(ll_pr)/2._pr)*hz_temp
+          hz_temp=dimz/real(diml,kind=pr)
+          zf(l)=(real(l,kind=pr)-real(ll,kind=pr)/2._pr)*hz_temp
         elseif (gridz.eq.'s') then
-          hz_temp= (1._pr-cos(pi/diml_pr))*dimz/2._pr !width of first active cell
+          hz_temp= (1._pr-cos(pi/real(diml,kind=pr)))*dimz/2._pr !width of first active cell
           if (l.lt.lmin) then
             zf(l)= real(l+1-lmin,kind=pr)*hz_temp-dimz/2._pr
           elseif (l.gt.lmax) then
             zf(l)= real(l-lmax,kind=pr)*hz_temp+dimz/2._pr
           else
-            zf(l)=-(cos(real(l-gc,kind=pr)*pi/diml_pr))*dimz/2._pr
+            zf(l)=-(cos(real(l-gc,kind=pr)*pi/real(diml,kind=pr)))*dimz/2._pr
           endif
         endif
 
@@ -343,127 +326,73 @@
       ymin=yf(gc); ymax=yf(jj-gc)
       zmin=zf(gc); zmax=zf(ll-gc)
 
+      end
 
-      do i=2,ii;  do j=2,jj; do l=2,ll
-        vol(i,j,l)=(xf(i)-xf(i-1))*(yf(j)-yf(j-1))*(zf(l)-zf(l-1))
+!####################################################################
+!> @author Holger Grosshans
+!> @brief pre-compute coefficients to speed of the solution loops
+      subroutine computeCoefficients
+      use var
+      integer :: i,j,l
+
+      do i=imin,imax;  do j=jmin,jmax; do l=lmin,lmax
+        vol(i,j,l)= (xf(i)-xf(i-1))*(yf(j)-yf(j-1))*(zf(l)-zf(l-1))
+        volu(i,j,l)=(xc(i+1)-xc(i))*(yf(j)-yf(j-1))*(zf(l)-zf(l-1))
+        volv(i,j,l)=(xf(i)-xf(i-1))*(yc(j+1)-yc(j))*(zf(l)-zf(l-1))
+        volw(i,j,l)=(xf(i)-xf(i-1))*(yf(j)-yf(j-1))*(zc(l+1)-zc(l))
       enddo; enddo; enddo
       volTot= sum(vol(imin:imax,jmin:jmax,lmin:lmax))
 
-! compute derivatives of grid spacing for mapping
-      do 8 i=imin,imax
-        if ((celltype(i+2,jmin,lmin).ne.wall).and.(celltype(i-2,jmin,lmin).ne.wall)) then
-          if (xc(i).gt.0._pr) then
-            call weno(fluxplu,xc(i-2),xc(i-1),xc(i),xc(i+1),xc(i+2))
-            call weno(fluxmin,xc(i-3),xc(i-2),xc(i-1),xc(i),xc(i+1))
-          else
-            call weno(fluxplu,xc(i+3),xc(i+2),xc(i+1),xc(i),xc(i-1))
-            call weno(fluxmin,xc(i+2),xc(i+1),xc(i),xc(i-1),xc(i-2))
-          endif
-          dxcdi(i)=fluxplu-fluxmin
-          if (xf(i).gt.0._pr) then
-            call weno(fluxplu,xf(i-2),xf(i-1),xf(i),xf(i+1),xf(i+2))
-            call weno(fluxmin,xf(i-3),xf(i-2),xf(i-1),xf(i),xf(i+1))
-          else
-            call weno(fluxplu,xf(i+3),xf(i+2),xf(i+1),xf(i),xf(i-1))
-            call weno(fluxmin,xf(i+2),xf(i+1),xf(i),xf(i-1),xf(i-2))
-          endif
-          dxfdi(i)=fluxplu-fluxmin
-        endif
-8     enddo
-      do 9 j=jmin,jmax
-        if ((celltype(imin,j+2,lmin).ne.wall).and.(celltype(imin,j-2,lmin).ne.wall)) then
-          if (yc(j).gt.0._pr) then
-            call weno(fluxplu,yc(j-2),yc(j-1),yc(j),yc(j+1),yc(j+2))
-            call weno(fluxmin,yc(j-3),yc(j-2),yc(j-1),yc(j),yc(j+1))
-          else
-            call weno(fluxplu,yc(j+3),yc(j+2),yc(j+1),yc(j),yc(j-1))
-            call weno(fluxmin,yc(j+2),yc(j+1),yc(j),yc(j-1),yc(j-2))
-          endif
-          dycdj(j)=fluxplu-fluxmin
-          if (yf(j).gt.0._pr) then
-            call weno(fluxplu,yf(j-2),yf(j-1),yf(j),yf(j+1),yf(j+2))
-            call weno(fluxmin,yf(j-3),yf(j-2),yf(j-1),yf(j),yf(j+1))
-          else
-            call weno(fluxplu,yf(j+3),yf(j+2),yf(j+1),yf(j),yf(j-1))
-            call weno(fluxmin,yf(j+2),yf(j+1),yf(j),yf(j-1),yf(j-2))
-          endif
-          dyfdj(j)=fluxplu-fluxmin
-        endif
-9     enddo
-      do 10 l=lmin,lmax
-        if ((celltype(imin,jmin,l+2).ne.wall).and.(celltype(imin,jmin,l-2).ne.wall)) then
-          if (zc(l).gt.0._pr) then
-            call weno(fluxplu,zc(l-2),zc(l-1),zc(l),zc(l+1),zc(l+2))
-            call weno(fluxmin,zc(l-3),zc(l-2),zc(l-1),zc(l),zc(l+1))
-          else
-            call weno(fluxplu,zc(l+3),zc(l+2),zc(l+1),zc(l),zc(l-1))
-            call weno(fluxmin,zc(l+2),zc(l+1),zc(l),zc(l-1),zc(l-2))
-          endif
-          dzcdl(l)=fluxplu-fluxmin
-          if (zf(l).gt.0._pr) then
-            call weno(fluxplu,zf(l-2),zf(l-1),zf(l),zf(l+1),zf(l+2))
-            call weno(fluxmin,zf(l-3),zf(l-2),zf(l-1),zf(l),zf(l+1))
-          else
-            call weno(fluxplu,zf(l+3),zf(l+2),zf(l+1),zf(l),zf(l-1))
-            call weno(fluxmin,zf(l+2),zf(l+1),zf(l),zf(l-1),zf(l-2))
-          endif
-          dzfdl(l)=fluxplu-fluxmin
-        endif
-10    enddo
-
+! coefficients for PISO algorithm, not sure which version is better
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+        Cb1(i,j,l)=0._pr; Cb2(i,j,l)=0._pr; Cc1(i,j,l)=0._pr
+        Cc2(i,j,l)=0._pr; Cd1(i,j,l)=0._pr; Cd2(i,j,l)=0._pr
+        if (celltype(i+1,j,l).ne.wall) Cb1(i,j,l)= 1._pr/((xc(i+1)-xc(i))*(xf(i)-xf(i-1)))
+        if (celltype(i-1,j,l).ne.wall) Cb2(i,j,l)= 1._pr/((xc(i)-xc(i-1))*(xf(i)-xf(i-1)))
+        if (celltype(i,j+1,l).ne.wall) Cc1(i,j,l)= 1._pr/((yc(j+1)-yc(j))*(yf(j)-yf(j-1)))
+        if (celltype(i,j-1,l).ne.wall) Cc2(i,j,l)= 1._pr/((yc(j)-yc(j-1))*(yf(j)-yf(j-1)))
+        if (celltype(i,j,l+1).ne.wall) Cd1(i,j,l)= 1._pr/((zc(l+1)-zc(l))*(zf(l)-zf(l-1)))
+        if (celltype(i,j,l-1).ne.wall) Cd2(i,j,l)= 1._pr/((zc(l)-zc(l-1))*(zf(l)-zf(l-1)))
+        Ca(i,j,l)= Cb1(i,j,l)+Cb2(i,j,l)+Cc1(i,j,l)+Cc2(i,j,l)+Cd1(i,j,l)+Cd2(i,j,l)
+      enddo; enddo; enddo
+      !do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
+      !  Cb1(i,j,l)= 1._pr/((xc(i+1)-xc(i))*(xf(i)-xf(i-1)))
+      !  Cb2(i,j,l)= 1._pr/((xc(i)-xc(i-1))*(xf(i)-xf(i-1)))
+      !  Cc1(i,j,l)= 1._pr/((yc(j+1)-yc(j))*(yf(j)-yf(j-1)))
+      !  Cc2(i,j,l)= 1._pr/((yc(j)-yc(j-1))*(yf(j)-yf(j-1)))
+      !  Cd1(i,j,l)= 1._pr/((zc(l+1)-zc(l))*(zf(l)-zf(l-1)))
+      !  Cd2(i,j,l)= 1._pr/((zc(l)-zc(l-1))*(zf(l)-zf(l-1)))
+      !  Ca(i,j,l)= Cb1(i,j,l)+Cb2(i,j,l)+Cc1(i,j,l)+Cc2(i,j,l)+Cd1(i,j,l)+Cd2(i,j,l)
+      !enddo; enddo; enddo
 
-      return
       end
 
 !####################################################################
 !> @author Holger Grosshans
-!> @brief Initialize the flow according to Nelson & Fringer (2017)
-!> turbulence spin-up time to reduce 
+!> @brief Initialize the flow to reduce spin-up time (Nelson & Fringer, 2017)
       subroutine initFlow
       use var
+      use parallel
       real(kind=pr) yplus,random(gp),uplus,vplus,wplus,dist,alpha,utau
       integer :: i,j,l,m
 
-
       call syncRandom(gp,random)
 
-      alpha=0.5_pr
-
-!     delta_v=delta/150._pr
-!     utau=0.05_pr
+      alpha=0.25_pr
 
       m=0
-      do i=imin,imax; do j=jmin,jmax; do l=lmin,lmax
+      do l=lmin,lmax; do j=jmin,jmax; do i=imin,imax
         m=m+1
-
-! law of the wall/log law:
-!        yplus=min(dimy/2.-abs(yc(j)),dimy/2-abs(zc(l)))/delta_v
-!        if (yplus.lt.10)then
-!          uplus = yplus                ! u+ = y+
-!        else
-!          uplus = 2.5*log(yplus) + 5.  ! u+ = 2.5ln(y+) + 5.
-!        end if
-! Setting perturbation on velocity
-!        uplus = 1.5*uplus + uplus*(random(m)-.5)
-!        vplus = uplus*(random(m)-.5)
-!        wplus = uplus*(random(m)-.5)
-!        u(i,j,l)=uplus*utau
-!        v(i,j,l)=vplus*utau
-!        w(i,j,l)=wplus*utau
-
-! linear:
         if (bcy.eq.'w'.and.bcz.eq.'w') dist=delta-max(abs(yc(j)),abs(zc(l)))
         if (bcy.eq.'w'.and.bcz.eq.'p') dist=delta-abs(yc(j))
         if (bcy.eq.'p'.and.bcz.eq.'w') dist=delta-abs(zc(l))
-        u(i,j,l)=ubulk*dist/delta + (random(m)-.5_pr)*alpha*ubulk
+        u(i,j,l)= (1._pr + (2._pr*random(m)-1._pr)*alpha) * ubulk*dist/delta
       enddo; enddo; enddo
 
       v=0._pr
       w=0._pr
+      call bcUVW(u,v,w)
       u01=u; v01=v; w01=w
-      call bcUVWP
-      call sync(u); call sync(v); call sync(w)
+      u02=u01; v02=v01; w02=w01
       
-      return
       end
-
diff --git a/src/pressure.f90 b/src/pressure.f90
deleted file mode 100644
index 3224269d319321cbe2a3bc42407fddfa700afa40..0000000000000000000000000000000000000000
--- a/src/pressure.f90
+++ /dev/null
@@ -1,65 +0,0 @@
-!> @author Holger Grosshans
-!> @brief one sweep to relax mass conservation using distributive
-!> Jacobi method based on distributive Gauss-Seidel by Brandt (1972)
-!> @param err        L2 error norm
-      subroutine pressure(err)
-      use var
-      real(kind=pr),dimension(ii,jj,ll) :: u1,v1,w1
-      real(kind=pr) :: err,h2sum,de,dex,dey,dez,ra,dpa,dpm, &
-                       erru,errv,errw,syncSum
-      integer :: i,j,l
-
-
-      err=0._pr
-      erru=0._pr
-      errv=0._pr
-      errw=0._pr
-
-
-      u1=u; v1=v; w1=w
-
-      do i=imin,imax+1; do j=jmin,jmax+1; do l=lmin,lmax+1
-
-        if (celltype(i,j,l).eq.wall) cycle
-  
-        h2sum=0._pr
-        if (celltype(i+1,j,l).ne.wall) h2sum=h2sum+1._pr/(xf(i)-xf(i-1))**2 
-        if (celltype(i-1,j,l).ne.wall) h2sum=h2sum+1._pr/(xf(i)-xf(i-1))**2
-        if (celltype(i,j+1,l).ne.wall) h2sum=h2sum+1._pr/(yf(j)-yf(j-1))**2
-        if (celltype(i,j-1,l).ne.wall) h2sum=h2sum+1._pr/(yf(j)-yf(j-1))**2
-        if (celltype(i,j,l+1).ne.wall) h2sum=h2sum+1._pr/(zf(l)-zf(l-1))**2
-        if (celltype(i,j,l-1).ne.wall) h2sum=h2sum+1._pr/(zf(l)-zf(l-1))**2
-
-        call mass2(ra,i,j,l)
-        de=  (defect_c(i,j,l)+ra)/h2sum*urfp
-        dpa= de*rhof*(1._pr/dt+2._pr*nuf/((xf(i)-xf(i-1))**2+(yf(j)-yf(j-1))**2+(zf(l)-zf(l-1))**2))
-        dex= de/(xf(i)-xf(i-1))
-        dey= de/(yf(j)-yf(j-1))
-        dez= de/(zf(l)-zf(l-1))
-        
-        if (celltype(i,j,l).eq.active)                               p(i,j,l)=    p(i,j,l)+dpa
-        if (celltype(i,j,l).eq.active.and.celltype(i+1,j,l).ne.wall) u1(i,j,l)=   u1(i,j,l)+dex
-        if (celltype(i-1,j,l).eq.active.and.celltype(i,j,l).ne.wall) u1(i-1,j,l)= u1(i-1,j,l)-dex
-        if (celltype(i,j,l).eq.active.and.celltype(i,j+1,l).ne.wall) v1(i,j,l)=   v1(i,j,l)+dey
-        if (celltype(i,j-1,l).eq.active.and.celltype(i,j,l).ne.wall) v1(i,j-1,l)= v1(i,j-1,l)-dey
-        if (celltype(i,j,l).eq.active.and.celltype(i,j,l+1).ne.wall) w1(i,j,l)=   w1(i,j,l)+dez
-        if (celltype(i,j,l-1).eq.active.and.celltype(i,j,l).ne.wall) w1(i,j,l-1)= w1(i,j,l-1)-dez
-  
-        if(dpm.lt.dpa) dpm=dpa
-        erru=erru+dex*dex
-        errv=errv+dey*dey
-        errw=errw+dez*dez
-        err=err+dpa*dpa
-
-      enddo; enddo; enddo
-
-      u=u1; v=v1; w=w1
-
-      call sync(u); call sync(v); call sync(w); call sync(p)
-      call bcUVWP
-
-      err=(syncSum(err)/dimgptot)**(0.5_pr)
-!      write(*,'(x,a,4(es9.2e2))') 'res. inner it. pressure corr. =',err
-
-      return
-      end
diff --git a/src/restart.f90 b/src/restart.f90
index e6a8cbfe6a56e638692bf07eedf7515dbd2cf1a3..e2778c0883dbeb6c43436ccb1605c872c63e2484 100644
--- a/src/restart.f90
+++ b/src/restart.f90
@@ -1,85 +1,103 @@
-!####################################################################
-!> @author Holger Grosshans
-!> @brief initialize random number generator
-      subroutine init_random_seed()
-      use var
-      integer :: i,n,clock
-      integer, dimension(:), allocatable :: seed
-
-      call random_seed(size=n)
-      allocate(seed(n))
-      call system_clock(count=clock)
-      seed = clock + 37 * (/ (i - 1, i = 1, n) /)
-      call random_seed(put=seed)
-      deallocate(seed)
-      
-      return
-      end
-
 !####################################################################
 !> @author Holger Grosshans
 !> @brief save fluid and particle field for restart
       subroutine saveField
       use var
-      integer :: i,j,l,n
+      integer :: n
       character(70) :: filename
+      integer :: fileformat=-9999003 ! current format identifier
 
       write(filename,'(a,i3.3,a,i3.3,a,i3.3,a,i3.3,a,i6.6)') &
       'restart/fluidField_p',myid,'_',dimi,'_',dimj,'_',diml,'_',nt
       open(unit=11,file=filename,form='unformatted')
-      write(11) u,u01,v,v01,w,w01,p,fsx,fsy,fsz,rho_el,t,dt,dt01
+      write(11) fileformat
+      write(11) u(imin:imax,jmin:jmax,lmin:lmax),u01(imin:imax,jmin:jmax,lmin:lmax), &
+                v(imin:imax,jmin:jmax,lmin:lmax),v01(imin:imax,jmin:jmax,lmin:lmax), &
+                w(imin:imax,jmin:jmax,lmin:lmax),w01(imin:imax,jmin:jmax,lmin:lmax), &
+                p(imin:imax,jmin:jmax,lmin:lmax),t,dtNext,dt,dt01,timecom
       close(11)
 
-      write(filename,'("restart/particleField_p",i3.3,"_",i6.6)') myid,nt
-      open(unit=12,file=filename,form='unformatted')
-      write(12) np
-      write(12) (up(n),vp(n),wp(n),xp(n),yp(n),zp(n),uf(n),vf(n),wf(n), &
-      radp(n),partn(n),q_el(n),wcollnum(n),ppcollnum(n),n=1,np)
-      close(12)
+      if (npTot.gt.0) then
+        write(filename,'("restart/particleField_p",i3.3,"_",i6.6)') myid,nt
+        open(unit=12,file=filename,form='unformatted')
+        write(12) fileformat
+        write(12) np
+        write(12) (upNext(n),vpNext(n),wpNext(n),xpNext(n),ypNext(n),zpNext(n), &
+        radp(n),partn(n),q_elNext(n),wcollnum(n),ppcollnum(n),nGlob(n),n=1,np)
+        close(12)
+      endif
 
-      return
       end
 
-
 !####################################################################
 !> @author Holger Grosshans
-!> @brief read fluid and particle field for restart
+!> @brief read fluid and particle field for restart, old or new format
       subroutine readField
       use var
-      integer :: i,j,l,n
+      integer :: n,stat
       character(70) :: filename
+      integer :: fileformat
 
       if (myid.eq.0) write(*,'(a)') 'read old data'
 
       write(filename,'(a,i3.3,a,i3.3,a,i3.3,a,i3.3,a,i6.6)') &
       'restart/fluidField_p',myid,'_',dimi,'_',dimj,'_',diml,'_',ntstart
-      open(unit=11,file=filename,form='unformatted',status='old',err=9000)
-      rewind 11
-      read(11) u,u01,v,v01,w,w01,p,fsx,fsy,fsz,rho_el,t,dt,dt01
+      open(unit=11,file=filename,form='unformatted',status='old',iostat=stat)
+      if (stat.ne.0) then
+        write(*,'(a)') 'old field not existing ',filename
+        stop
+      endif
+      rewind(11)
+      read(11) fileformat
+      if (fileformat.eq.-9999003) then
+        read(11) u(imin:imax,jmin:jmax,lmin:lmax),u01(imin:imax,jmin:jmax,lmin:lmax), &
+                 v(imin:imax,jmin:jmax,lmin:lmax),v01(imin:imax,jmin:jmax,lmin:lmax), &
+                 w(imin:imax,jmin:jmax,lmin:lmax),w01(imin:imax,jmin:jmax,lmin:lmax), &
+                 p(imin:imax,jmin:jmax,lmin:lmax),t,dtNext,dt,dt01,timecom
+        call bcUVW(u,v,w)
+        call bcUVW(u01,v01,w01)
+        call bcNeumann(p)
+        timecom(10)=timecom(9)
+      elseif (fileformat.eq.-9999002) then ! works with gc=3
+        read(11) u,u01,v,v01,w,w01,p,t,dtNext,dt,dt01,timecom
+      else ! oldest format, works with gc=3
+        rewind(11)
+        read(11) u,u01,v,v01,w,w01,p,Fsx,Fsy,Fsz,rho_el,t,dt,dt01
+        call nextTimestepSize 
+      endif
       close(11)
 
       write(filename,'("restart/particleField_p",i3.3,"_",i6.6)') myid,ntstart
-      open(unit=12,file=filename,form='unformatted',status='old',err=9000)
-      rewind(12)
-      read(12) np
-      call allocateParticleArrays
-      read(12) (up(n),vp(n),wp(n),xp(n),yp(n),zp(n),uf(n),vf(n),wf(n), &
-      radp(n),partn(n),q_el(n),wcollnum(n),ppcollnum(n),n=1,np)
+      open(unit=12,file=filename,form='unformatted',status='old',iostat=stat)
+      if (stat.ne.0) then
+        np=0
+        call allocateParticleArrays
+      else
+        rewind(12)
+        read(12) fileformat
+        if (fileformat.eq.-9999002.or.fileformat.eq.-9999003) then ! newest format
+          read(12) np
+          call allocateParticleArrays
+          read(12) (upNext(n),vpNext(n),wpNext(n),xpNext(n),ypNext(n),zpNext(n), &
+          radp(n),partn(n),q_elNext(n),wcollnum(n),ppcollnum(n),nGlob(n),n=1,np)
+        else ! oldest format
+          rewind(12)
+          read(12) np
+          call allocateParticleArrays
+          read(12) (up(n),vp(n),wp(n),xp(n),yp(n),zp(n),uf(n),vf(n),wf(n), &
+          radp(n),partn(n),q_el(n),wcollnum(n),ppcollnum(n),n=1,np)
+          xpNext=xp; ypNext=yp; zpNext=zp;
+          upNext=up; vpNext=vp; wpNext=wp;
+          q_elNext=q_el
+          do n=1,np
+            nseedLoc=nseedLoc+1
+            nGlob(n)=nseedLoc*1000+myid 
+          enddo
+        endif
+        endif
       close(12)
 
       ntstart=ntstart+1
       ntend=ntend+1
       
-      do n=1,np
-        nseedLoc=nseedLoc+1
-        nGlob(n)=nseedLoc*1000+myid 
-      enddo
-      call particlesToCells
-
-      return
-     
-9000  write(*,'(a)') 'old field not existing ',filename
-      stop
-     
       end
-
diff --git a/src/schemes.f90 b/src/schemes.f90
deleted file mode 100644
index a5efc79fecf622e94b2abbe2e72fff95f65a9fca..0000000000000000000000000000000000000000
--- a/src/schemes.f90
+++ /dev/null
@@ -1,98 +0,0 @@
-!!####################################################################
-!> @author Holger Grosshans
-!!> @brief spatial first order discretization of first derivative
-!      real(kind=pr) function d1o2(phi,node,i,j,l)
-!      use var
-!      real(kind=pr) phi,node
-!      integer :: i,j,l,im1,jm1,lm1,ip1,jp1,lp1
-!
-!!      uux= ua*d1o2(u,xf,i,j,l) -abs(ua)*d2o2(u,xf,i,j,l)
-!      if (node.eq.xc.or.node.eq.xf) then
-!        im1=i-1; ip1=i+1
-!        jm1=j;   jp1=j
-!        lm1=l;   lp1=l
-!      endif
-!      if (node.eq.yc.or.node.eq.yf) then
-!        im1=i;   ip1=i
-!        jm1=j-1; jp1=j+1
-!        lm1=l;   lp1=l
-!      endif
-!      if (node.eq.zc.or.node.eq.zf) then
-!        im1=i;   ip1=i
-!        jm1=j;   jp1=j
-!        lm1=l-1; lp1=l+1
-!      endif
-!      
-!      d1o2= (u(ip1,jp1,lp1)-u(im1,jm1,lm1))/(xf(i+1)-xf(i-1))
-!
-!      return
-!      end
-!
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief 5th order WENO on a uniform grid
-      subroutine weno(flux,phi1,phi2,phi3,phi4,phi5)
-      use var
-      real(kind=pr) :: flux,phi1,phi2,phi3,phi4,phi5, &
-          beta11,beta12,beta21,beta22,beta31,beta32, &
-          beta1,beta2,beta3,omega1,omega2,omega3, &
-          omega,weight1,weight2,weight3,flux1,flux2,flux3
-
- 
-! compute brackets beta11, beta12, ...
-      beta11=phi1-2._pr*phi2+phi3
-      beta12=phi1-4._pr*phi2+3._pr*phi3
-      beta21=phi2-2._pr*phi3+phi4
-      beta22=phi2-phi4
-      beta31=phi3-2._pr*phi4+phi5
-      beta32=3._pr*phi3-4._pr*phi4+phi5
- 
-! compute the smoothness indicators for flux
-! epsilon=1.e-6, avoids that the denominiator (next operation) becomes zero
-      beta1=13._pr/12._pr*beta11**2 + 0.25_pr*beta12**2 + 1.e-6_pr
-      beta2=13._pr/12._pr*beta21**2 + 0.25_pr*beta22**2 + 1.e-6_pr
-      beta3=13._pr/12._pr*beta31**2 + 0.25_pr*beta32**2 + 1.e-6_pr
-  
-! the linear weights are gamma1=0.1, gamma2=0.6, gamme3=0.3
-! compute the nonlinear weights
-      omega1=0.1_pr/(beta1**2)
-      omega2=0.6_pr/(beta2**2)
-      omega3=0.3_pr/(beta3**2)
-      omega=omega1+omega2+omega3
-      weight1=omega1/omega
-      weight2=omega2/omega
-      weight3=omega3/omega
- 
-! compute 3 3rd order downwind fluxes on 3 stencils
-      flux1=(2._pr*phi1-7._pr*phi2+11._pr*phi3)/6._pr
-      flux2=(-phi2+5._pr*phi3+2._pr*phi4)/6._pr
-      flux3=(2._pr*phi3+5._pr*phi4-phi5)/6._pr
- 
-! compute the numerical flux
-      flux=weight1*flux1+weight2*flux2+weight3*flux3
- 
-      return
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-!> @brief 1st derivative 4th order discretization of phi at loc (Castillo et al., 1995)
-      real(kind=pr) function  d1o4(loc,phi0,phi1,phi2,phi3,loc0,loc1,loc2,loc3)
-      use var
-      real(kind=pr) :: d01,d12,d23,d012,d123,d0123,loc,phi0,phi1,phi2,phi3,loc0,loc1,loc2,loc3
-
-! Eq. (2.9)
-      d01=  (phi1-phi0)/(loc1-loc0)
-      d12=  (phi2-phi1)/(loc2-loc1)
-      d23=  (phi3-phi2)/(loc3-loc2)
-      d012= (d12-d01)/(loc2-loc0)
-      d123= (d23-d12)/(loc3-loc1)
-      d0123=(d123-d012)/(loc3-loc0)
-
-! Eq. (2.10)
-      d1o4=  d01 + ((loc-loc0)+(loc-loc1))*d012 &
-            + ((loc-loc0)*(loc-loc1)+(loc-loc2)*((loc-loc0)+(loc-loc1)))*d0123
-
-      return
-      end
diff --git a/src/timestep.f90 b/src/timestep.f90
new file mode 100644
index 0000000000000000000000000000000000000000..13f2bc3c63761370b44db5122f2c146a4cf86923
--- /dev/null
+++ b/src/timestep.f90
@@ -0,0 +1,52 @@
+!####################################################################
+!> @author Holger Grosshans
+!> @brief copy variables between time-steps
+      subroutine prepareTimestep
+      use var
+
+      if (nt.eq.1) then
+        dt=cfl*dimx/dimi/10._pr
+        dt01=dt
+        dt02=dt01
+      else
+        dt02=dt01
+        dt01=dt
+        dt=dtNext
+      endif
+
+! fixed time-step:
+!      dt=cfl*minval(hx)/ubulk
+!      dt01=dt
+!      dt02=dt
+
+      tau01=dt/(dt+dt01)
+      tau02=dt01/(dt01+dt02)
+      t=t+dt
+
+      u02=u01; v02=v01; w02=w01
+      u01=u; v01=v; w01=w
+      xp=xpNext; yp=ypNext; zp=zpNext;
+      up=upNext; vp=vpNext; wp=wpNext;
+      q_el=q_elNext
+
+      call particlesNextProc
+      call particlesToCells
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief next time-step size, needed AFTER flow field and BEFORE particle calculation
+      subroutine nextTimestepSize
+      use var
+      use parallel
+      real(kind=pr) umax
+
+      umax= syncMax(maxval(abs(u)))
+      if (umax.eq.0._pr) then
+        dtNext=dt
+      else
+        dtNext=cfl*dimx/dimi/umax
+      endif
+
+      end
diff --git a/src/var.f90 b/src/var.f90
index 20090b91f7654e62ea741b2c32822a873134c33f..33a4ac8d64bb439fe1b0a030bad6b9cddb99528e 100644
--- a/src/var.f90
+++ b/src/var.f90
@@ -1,26 +1,29 @@
 !> @author Holger Grosshans
-!> @brief  definition of public variables, global denotes
-!!         the complete domain, local only one processor
+!> @brief  definition of public variables, global denotes the complete domain, local only one processor
+!>
+!> how to add a new public variable:
+!> fluid: var,initVariables(allocate+init) 
+!> particles: var,allocateParticleArrays,initVariables,particlesNextProc(?),partN2M(?)
+
       module var
       implicit none 
 
 ! hardcoded parameters which the user cannot change
+      character(70) :: version='pafiX v1.1.0 (Copyright 2015-21 by H. Grosshans)'
+
       integer, parameter :: &
       precision=8, &                !< number precision
       pr=selected_real_kind(precision), &
       elforceScheme=3, &            !< 1=Gauss, 2=Coulomb, 3=Hybrid (Grosshans&Papalexandris, 2017)
-      itmax=100, &                  !< max number of iterations for 1 equation
-      gc= 3                         !< number of ghost cells, for consistence always 3, also at walls
+      gc= 2                         !< number of ghost cells, depends on stencils, but >= 2
 
       real(kind=pr), parameter :: &
-      eps_el= 8.85e-12_pr, &        !< permittivity vacuum/air
+      eps_el= 8.85e-12_pr, &        !< permittivity vacuum/air (F/m)
       pi= 4._pr*atan(1._pr), &
-      tol= 1.e-2_pr, &              !< factor by which L2 shall decrease
-      urfu= .25_pr, &               !< under relaxation factor variable u
+      urfu= 0.25_pr, &              !< under relaxation factor variable u
       urfv= urfu, &
       urfw= urfv, &
-      urfp= .5_pr, &
-      restRatio= 1._pr              !< particle material restitution ratio
+      urfp= 4._pr
 
       real(kind=pr), parameter :: &
       Ew=1.e11_pr, &                !< duct Young's modulus (kg/s**2/m)
@@ -29,8 +32,6 @@
       nyw=0.28_pr, &                !< duct Poisson ratio
       Qaccfactor= 0.1_pr            !< artificially accelerate the charging rate
       
-      character(70) :: version='pafiX v1.1.0 (Copyright 2019 by H. Grosshans)'
-
 ! input
       real(kind=pr) :: &
       cfl, &                        !< CFL number (-)
@@ -42,7 +43,9 @@
       nuf, &                        !< fluid kinematic viscosity (m**2/s)
       pnd, &                        !< particle number density (-/m**3)
       rhop, &                       !< particle material density (kg/m**3)
+      restRatio, &                  !< particle material restitution ratio
       g(3), &                       !< gravity vector (m/s**2,m/s**2,m/s**2)
+      tol, &                        !< factor by which L2 shall decrease
       dimxtot, &                    !< dimension of domain (m)
       delta, &                      !< duct half width
       tau_w, &                      !< wall shear stress
@@ -51,25 +54,28 @@
       Re_tau, &                     !< friction Reynolds number
       delta_v, &                    !< viscous length scale (m) 
       t_tau, &                      !< viscous time scale (s)
-      ftt, &                        !< flow through time (s)
-      rmsv,rmsw
+      ftt                           !< flow through time (s)
+
       integer :: &
       ntstart, &                    !< start time step
       ntime, &                      !< end time step
       dimi,dimj,diml, &             !< local number of cells in x-direction
       int_results, &                !< interval write out results
       int_restart, &                !< interval write out restart files
+      itmax, &                      !< max number of iterations for 1 equation
       dimitot, &                    !< global number of cells in x-direction
       ntseed                        !< time step particle seeding
 
 ! run
       real(kind=pr) :: &
-      dt, &                         !< size of time step nt (s)
       dpdx, &                       !< streamwise pressure gradient (N/m**3)
-      dt01, &                       !< time step size nt-1
-      dt02, &                       !< time step size nt-2
+      dtNext, &                     !< time-step size from (nt) to (nt+1) (s)
+      dt, &                         !< time-step size from (nt-1) to (nt) (s)
+      dt01, &                       !< time step size from (nt-2) to (nt-1) (s)
+      dt02, &                       !< time step size from (nt-3) to (nt-2) (s)
       tau01,tau02, &
       t                             !< physical time (s)
+
       integer :: nt, &              !< time step
       ntend                         !< last time step of computation
 
@@ -77,13 +83,14 @@
       character(1) :: &
       bcx,bcy,bcz, &                !< type of boundary condition [(w)all/(p)eriodic]
       gridx,gridy,gridz             !< grid [(u)niform/(s)tretch]
+
       real(kind=pr), allocatable, dimension(:,:,:) :: &
-      vol                           !< volume per cell (m**3)
+      vol,volu,volv,volw            !< volume per cell (m**3), centered and staggered variables
+
       real(kind=pr), allocatable, dimension(:) :: &
       xc,yc,zc, &                   !< center point of a cell (m)
-      xf,yf,zf, &                   !< face of a cell in pos. direction from xc (m)
-      dxcdi,dycdj,dzcdl, &          !< derivative of grid mapping at cell center (m/m)
-      dxfdi,dyfdj,dzfdl             !< derivative of grid mapping at cell face (m/m)
+      xf,yf,zf                      !< face of a cell in pos. direction from xc (m)
+
       real(kind=pr) :: &
       xmin,ymin,zmin, &             !< lower local boundary in global coordinates (m)
       xmax,ymax,zmax, &             !< upper local boundary in global coordinates (m)
@@ -92,6 +99,7 @@
 
       integer, allocatable, dimension(:,:,:) :: &
       celltype                      !< celltype
+
       integer, parameter :: active=1, passive=2, wall=3
 
       integer :: &
@@ -102,51 +110,71 @@
       imin,jmin,lmin, &             !< local min index of cell containing fluid
       imax,jmax,lmax                !< local max index of cell containing fluid
 
+! pre-computed coefficients
+      real(kind=pr), allocatable, dimension(:,:,:) :: &
+      Ca,Cb1,Cb2,Cc1,Cc2,Cd1,Cd2    !< coefficients for SIMPLE algorithm
+
 ! fluid
       real(kind=pr) :: muf          !< fluid dynamic viscosity (kg/s/m)
+
       real(kind=pr), allocatable, dimension(:,:,:) :: &
       u,v,w, &                      !< fluid velocity (m/s)
       p, &                          !< fluid pressure (N/m**2)
-      dudt,dvdt,dwdt, &             !< term for time integration (m/s)
       u01,v01,w01, &                !< fluid velocity previous time-step
-      fsx,fsy,fsz, &                !< source term particles -> fluid (m/s**2)
-      defect_c, &                   !< defect correction terms
-      defect_u,defect_v,defect_w
+      u02,v02,w02, &                !< fluid velocity previous time-step
+      Fsx,Fsy,Fsz                   !< source term particles -> fluid (m/s**2)
 
 ! particles
+      real(kind=pr) :: &
+      rtau_p_max, &                 !< max reciprocal particle time-scale in a time-step
+      rtau_el_max, &                !< max reciprocal Coulomb force time-scale in a time-step
+      dup_max                       !< max particle velocity change in a time-step
+
       integer :: &
       np, &                         !< local number of particles
       npTot, &                      !< total number of particles
       npp, &                        !< local number of particles before some operation
       maxnp, &                      !< maximum possible local number of particles
       nseedLoc                      !< local counter for seeded particles      
+
       real(kind=pr), allocatable, dimension(:) :: &
-      up,vp,wp, &                   !< particle velocity (m/s)
-      uf,vf,wf, &                   !< average fluid velocity around a particle (m/s)
-      uf01,vf01,wf01, &             !< fluid vel. around particle prev. time-step (m/s)
-      xp,yp,zp, &                   !< particle position (m)
+      up,vp,wp, &                   !< particle velocity at t (m/s)
+      upNext,vpNext,wpNext, &       !< particle velocity at t+dt (m/s)
+      uf,vf,wf, &                   !< fluid velocity around a particle (m/s)
+      dufdy,dufdz, &                !< fluid velocity gradient around a particle (m/s)
+      xp,yp,zp, &                   !< particle position at t (m)
+      xpNext,ypNext,zpNext, &       !< particle position at t+dt (m)
       radp, &                       !< particle radius (m)
-      q_el, &                       !< particle charge (C)
+      q_el, &                       !< particle charge at t (C)
+      q_elNext, &                   !< particle charge at t+dt (C)
       fx_el,fy_el,fz_el, &          !< electrostatic force on particle (m/s**2)
+      fx_d,fy_d,fz_d, &             !< drag force on particle (m/s**2)
+      fx_l,fy_l,fz_l, &             !< lift force on particle (m/s**2)
       partn                         !< number of particles represented by parcel
+
       integer, allocatable, dimension(:) :: &
+      ip,jp,lp, &                   !< Eulerian indice of particle position
       wcollnum, &                   !< number of particle-wall collisions
       ppcollnum, &                  !< number of particle-particle collisions
       nGlob                         !< global particle id
+
       integer, allocatable, dimension(:,:,:) :: &
       npic                          !< number of particles in a Eulerian cell
+
       integer, allocatable, dimension(:,:,:,:) :: &
       nic                           !< indices of particles in a Eulerian cell
 
-
 ! parallel
-      real(kind=pr) :: timebeg,timecom(10),timenow,timeend
+      real(kind=pr) :: timebeg,timenow,timeend, &
+      timecom(10)                   !< 1-8: sync operations, 9: physical time, 10: restart
+
       integer :: &
       mpi_pr, &
       myid, &                       !< id of current processor
       nrprocs, &                    !< total number of processors
       mpierr, &
       next,prev                     !< id of next and previous processor
+
       integer, allocatable, dimension(:) :: &
       mpistatus
 
diff --git a/src/write_vtk.f90 b/src/write_vtk.f90
new file mode 100644
index 0000000000000000000000000000000000000000..57c3f64d349453c4c2c4d53a501f0d30e7af487c
--- /dev/null
+++ b/src/write_vtk.f90
@@ -0,0 +1,449 @@
+!####################################################################
+!> @author Holger Grosshans
+!> @brief write out particle field in vtk format
+      subroutine writevtk_particles
+      use var
+      integer :: n
+      character(80) :: filename,rowfmt,rowfm2
+
+100   format(es13.4e2)
+101   format(3(es13.4e2))
+102   format(3(es14.5e2))
+      rowfmt='(10(1x,es11.4e2))'
+      rowfm2='(10(1x,i9))'
+
+      if(myid.eq.0) call write_visit_container('particles')
+        
+      write(filename,'("results/particles_p",i3.3,"_",i6.6,".vtk")') myid,nt
+      open(10,file=filename)
+
+      write(10,'(a)') '# vtk DataFile Version 3.0'
+      write(10,'(a,es14.6e2,a,x,a)') 'particle data: t=',t,' s --',version
+      write(10,'(a)') 'ASCII'
+      write(10,'(a)') 'DATASET UNSTRUCTURED_GRID'
+      write(10,'(a6,i9,a6)') 'POINTS ',np,' FLOAT'
+      write(10,102) (xp(n),yp(n),zp(n),n=1,np)
+      write(10,'(a5,i9,i9)') 'CELLS ',np,2*np
+      write(10,*) ('1 ',n-1,n=1,np)
+      write(10,'(a10,i9)') 'CELL_TYPES ',np
+      write(10,*) ('1 ', n=1,np)
+      write(10,'(a,i9)') 'POINT_DATA ',np
+
+      call writeVar('radp',radp)
+      call writeVar('up',up)
+      call writeVar('vp',vp)
+      call writeVar('wp',wp)
+      call writeVar('uf',uf)
+      call writeVar('vf',vf)
+      call writeVar('wf',wf)
+      call writeVar('partn',partn)
+      call writeVar('q_el',q_el)
+      call writeVar('fx_d',fx_d)
+      call writeVar('fy_d',fy_d)
+      call writeVar('fz_d',fz_d)
+      call writeVar('fx_l',fx_l)
+      call writeVar('fy_l',fy_l)
+      call writeVar('fz_l',fz_l)
+      call writeVar('fx_el',fx_el)
+      call writeVar('fy_el',fy_el)
+      call writeVar('fz_el',fz_el)
+      call writeVarI('wcollnum',wcollnum)
+      call writeVarI('ppcollnum',ppcollnum)
+
+      write(10,'(a)') 'VECTORS UPVPWP FLOAT'
+      write(10,101) (up(n),vp(n),wp(n),n=1,np)
+      write(10,'(a)') 
+
+      close(10)
+
+      contains
+
+        subroutine writeVar(name,myvar)
+        use var
+        real(kind=pr) :: myvar(:)
+        character(*)  :: name
+
+        write(10,'(3a)') 'SCALARS ',name,' float 1'
+        write(10,'(a)') 'LOOKUP_TABLE default '
+        write(10,fmt=rowfmt) (myvar(n),n=1,np)
+        write(10,'(a)') 
+
+        end
+
+        subroutine writeVarI(name,myvar)
+        use var
+        integer :: myvar(:)
+        character(*)  :: name
+
+        write(10,'(3a)') 'SCALARS ',name,' float 1'
+        write(10,'(a)') 'LOOKUP_TABLE default '
+        write(10,fmt=rowfm2) (myvar(n),n=1,np)
+        write(10,'(a)') 
+
+        end
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+      subroutine writevtk_fluid_xyz
+      use var
+      real(kind=pr) :: temp(ii,jj,ll)
+      integer :: i,j,l
+      character(70) :: filename,rowfmt,vecfmt
+
+100   format(es11.4e2)
+      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
+      write(vecfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,3(es11.4e2)))'
+
+      if(myid.eq.0) call write_visit_container('fluid_xyz')
+
+      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_xyz_p',myid,'_',nt,'.vtk'
+      open(10,file=filename)
+
+      write(10,'(a)') '# vtk DataFile Version 3.0'
+      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
+      write(10,'(a)') 'ASCII'
+      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
+      write(10,'(a10,3(i4))') 'DIMENSIONS',(imax-imin+2),(jmax-jmin+3),(lmax-lmin+3)
+      write(10,*) 'X_COORDINATES',(imax-imin+2),'float'
+      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
+      write(10,*) 'Y_COORDINATES',(jmax-jmin+3),'float'
+      write(10,fmt=rowfmt) (yc(j),j=jmin-1,jmax+1)
+      write(10,*) 'Z_COORDINATES',(lmax-lmin+3),'float'
+      write(10,fmt=rowfmt) (zc(l),l=lmin-1,lmax+1)
+      write(10,*) 'POINT_DATA ',(imax-imin+2)*(jmax-jmin+3)*(lmax-lmin+3)
+
+      temp=0._pr
+      temp(2:ii,:,:)=(u(2:ii,:,:)+u(1:ii-1,:,:))/2._pr
+      call writeVar('u',temp)
+      temp(:,2:jj,:)=(v(:,2:jj,:)+v(:,1:jj-1,:))/2._pr
+      call writeVar('v',temp)
+      temp(:,:,2:ll)=(w(:,:,2:ll)+w(:,:,1:ll-1))/2._pr
+      call writeVar('w',temp)
+      call writeVar('p',p)
+      call writeVar('rho_el',rho_el)
+      call writeVar('phi_el',phi_el)
+      call writeVar('Ex_el',Ex_el)
+      call writeVar('Ey_el',Ey_el)
+      call writeVar('Ez_el',Ez_el)
+
+      !temp=sqrt(Ex_el**2+Ey_el**2+Ez_el**2)
+      !call writeVar('Emag',temp)
+
+!      write(10,'(a)') 'VECTORS uvw float'
+!      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
+!        write(10,fmt='(3(es12.2e2))') (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)), &
+!                              0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)), &
+!                              0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
+!      enddo; enddo
+
+!      write(10,'(a)') 'VECTORS coordinates float 1'
+!      write(10,'(a)') 'LOOKUP_TABLE default '
+!      do l=lmin-1,lmax+1
+!      do i=imin,imax+1
+!        write(10,'(3(i8))') i,j,l
+!      enddo
+!      enddo
+
+      close(10)
+
+      contains
+
+        subroutine writeVar(name,myvar)
+        use var
+        real(kind=pr) :: myvar(ii,jj,ll)
+        character(*)  :: name
+
+        write(10,'(3a)') 'SCALARS ',name,' float 1'
+        do l=lmin-1,lmax+1; do j=jmin-1,jmax+1
+          write(10,fmt=rowfmt) (myvar(i,j,l),i=imin,imax+1)
+        enddo; enddo
+
+        end
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+      subroutine writevtk_fluid_xy
+      use var
+      real(kind=pr) :: temp(ii,jj,ll)
+      integer :: i,j,l
+      character(70) :: filename,rowfmt,vecfmt
+
+100   format(es11.4e2)
+      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
+      write(vecfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,3(es11.4e2)))'
+
+      l=int(ll/2.)+1
+
+      if(myid.eq.0) call write_visit_container('fluid_xy')
+
+      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_xy_p',myid,'_',nt,'.vtk'
+      open(10,file=filename)
+
+      write(10,'(a)') '# vtk DataFile Version 3.0'
+      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
+      write(10,'(a)') 'ASCII'
+      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
+      write(10,'(a10,i4,i4,a4)') 'DIMENSIONS',(imax-imin+2),(jmax-jmin+3),'1'
+      write(10,*) 'X_COORDINATES',(imax-imin+2),'float'
+      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
+      write(10,*) 'Y_COORDINATES',(jmax-jmin+3),'float'
+      write(10,fmt=rowfmt) (yc(j),j=jmin-1,jmax+1)
+      write(10,*) 'Z_COORDINATES 1 float'
+      write(10,100) zc(l)
+      write(10,*) 'POINT_DATA ',(imax-imin+2)*(jmax-jmin+3)
+
+      temp=0._pr
+      temp(2:ii,:,:)=(u(2:ii,:,:)+u(1:ii-1,:,:))/2._pr
+      call writeVar('u',temp)
+      temp(:,2:jj,:)=(v(:,2:jj,:)+v(:,1:jj-1,:))/2._pr
+      call writeVar('v',temp)
+      temp(:,:,2:ll)=(w(:,:,2:ll)+w(:,:,1:ll-1))/2._pr
+      call writeVar('w',temp)
+      !call writeVar('uraw',u)
+      !call writeVar('vraw',v)
+      !call writeVar('wraw',w)
+      call writeVar('p',p)
+      call writeVar('rho_el',rho_el)
+      call writeVar('phi_el',phi_el)
+      call writeVar('Ex_el',Ex_el)
+      call writeVar('Ey_el',Ey_el)
+      call writeVar('Ez_el',Ez_el)
+      !temp=sqrt(Ex_el**2+Ey_el**2+Ez_el**2)
+      !call writeVar('Emag',temp)
+
+!      write(10,'(a)') 'VECTORS uvw float'
+!      do j=jmin-1,jmax+1
+!        write(10,fmt='(3(es12.2e2))') (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)), &
+!                              0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)), &
+!                              0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
+!      enddo
+
+      close(10)
+
+      contains
+
+        subroutine writeVar(name,myvar)
+        use var
+        real(kind=pr) :: myvar(ii,jj,ll)
+        character(*)  :: name
+
+        write(10,'(3a)') 'SCALARS ',name,' float 1'
+        write(10,'(a)') 'LOOKUP_TABLE default '
+        do j=jmin-1,jmax+1
+          write(10,fmt=rowfmt) (myvar(i,j,l),i=imin,imax+1)
+        enddo
+
+        end
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+      subroutine writevtk_fluid_xz
+      use var
+      real(kind=pr) :: temp(ii,jj,ll)
+      integer :: i,j,l
+      character(70) :: filename,rowfmt,vecfmt
+
+100   format(es11.4e2)
+      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
+      write(vecfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,3(es11.4e2)))'
+
+      j=int(jj/2.)+1
+
+      if(myid.eq.0) call write_visit_container('fluid_xz')
+
+      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_xz_p',myid,'_',nt,'.vtk'
+      open(10,file=filename)
+
+      write(10,'(a)') '# vtk DataFile Version 3.0'
+      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
+      write(10,'(a)') 'ASCII'
+      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
+      write(10,'(a10,i4,a4,i4)') 'DIMENSIONS',(imax-imin+2),'1',(lmax-lmin+3)
+      write(10,*) 'X_COORDINATES',(imax-imin+2),'float'
+      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
+      write(10,*) 'Y_COORDINATES 1 float'
+      write(10,100) yc(j)
+      write(10,*) 'Z_COORDINATES',(lmax-lmin+3),'float'
+      write(10,fmt=rowfmt) (zc(l),l=lmin-1,lmax+1)
+      write(10,*) 'POINT_DATA ',(imax-imin+2)*(lmax-lmin+3)
+
+      temp=0._pr
+      temp(2:ii,:,:)=(u(2:ii,:,:)+u(1:ii-1,:,:))/2._pr
+      call writeVar('u',temp)
+      temp(:,2:jj,:)=(v(:,2:jj,:)+v(:,1:jj-1,:))/2._pr
+      call writeVar('v',temp)
+      temp(:,:,2:ll)=(w(:,:,2:ll)+w(:,:,1:ll-1))/2._pr
+      call writeVar('w',temp)
+      !call writeVar('uraw',u)
+      !call writeVar('vraw',v)
+      !call writeVar('wraw',w)
+      call writeVar('p',p)
+      call writeVar('rho_el',rho_el)
+      call writeVar('phi_el',phi_el)
+      call writeVar('Ex_el',Ex_el)
+      call writeVar('Ey_el',Ey_el)
+      call writeVar('Ez_el',Ez_el)
+      !temp=sqrt(Ex_el**2+Ey_el**2+Ez_el**2)
+      !call writeVar('Emag',temp)
+
+!      write(10,'(a)') 'VECTORS uvw float'
+!      do l=lmin-1,lmax+1
+!        write(10,fmt='(3(es12.2e2))') (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)), &
+!                              0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)), &
+!                              0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
+!      enddo
+
+      close(10)
+
+      contains
+
+        subroutine writeVar(name,myvar)
+        use var
+        real(kind=pr) :: myvar(ii,jj,ll)
+        character(*)  :: name
+
+        write(10,'(3a)') 'SCALARS ',name,' float 1'
+        write(10,'(a)') 'LOOKUP_TABLE default '
+        do l=lmin-1,lmax+1
+          write(10,fmt=rowfmt) (myvar(i,j,l),i=imin,imax+1)
+        enddo
+
+        end
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+      subroutine writevtk_fluid_yz
+      use var
+      real(kind=pr) :: temp(ii,jj,ll)
+      integer :: i,j,l
+      character(70) :: filename,rowfmt
+
+100   format(es11.4e2)
+      write(rowfmt,'(a,i4,a)') '(',(jmax-jmin+3),'(1x,es11.4e2))'
+
+      i=int(ii/2.)+1
+
+      if(myid.eq.0) call write_visit_container('fluid_yz')
+
+      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_yz_p',myid,'_',nt,'.vtk'
+      open(10,file=filename)
+
+      write(10,'(a)') '# vtk DataFile Version 3.0'
+      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
+      write(10,'(a)') 'ASCII'
+      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
+      write(10,'(a12,i8,i8)') 'DIMENSIONS 1',(jmax-jmin+3),(lmax-lmin+3)
+      write(10,*) 'X_COORDINATES 1 float'
+      write(10,100) xc(i)
+      write(10,*) 'Y_COORDINATES',(jmax-jmin+3),'float'
+      write(10,fmt=rowfmt) (yc(j),j=jmin-1,jmax+1)
+      write(10,*) 'Z_COORDINATES',(lmax-lmin+3),'float'
+      write(10,fmt=rowfmt) (zc(l),l=lmin-1,lmax+1)
+      write(10,*) 'POINT_DATA ',(jmax-jmin+3)*(lmax-lmin+3)
+
+      temp=0._pr
+      temp(2:ii,:,:)=(u(2:ii,:,:)+u(1:ii-1,:,:))/2._pr
+      call writeVar('u',temp)
+      temp(:,2:jj,:)=(v(:,2:jj,:)+v(:,1:jj-1,:))/2._pr
+      call writeVar('v',temp)
+      temp(:,:,2:ll)=(w(:,:,2:ll)+w(:,:,1:ll-1))/2._pr
+      call writeVar('w',temp)
+      !call writeVar('uraw',u)
+      !call writeVar('vraw',v)
+      !call writeVar('wraw',w)
+      call writeVar('p',p)
+      call writeVar('rho_el',rho_el)
+      call writeVar('phi_el',phi_el)
+      call writeVar('Ex_el',Ex_el)
+      call writeVar('Ey_el',Ey_el)
+      call writeVar('Ez_el',Ez_el)
+      !temp=sqrt(Ex_el**2+Ey_el**2+Ez_el**2)
+      !call writeVar('Emag',temp)
+
+      close(10)
+
+      contains
+
+        subroutine writeVar(name,myvar)
+        use var
+        real(kind=pr) :: myvar(ii,jj,ll)
+        character(*)  :: name
+
+        write(10,'(3a)') 'SCALARS ',name,' float 1'
+        write(10,'(a)') 'LOOKUP_TABLE default '
+        do l=lmin-1,lmax+1
+          write(10,fmt=rowfmt) (myvar(i,j,l),j=jmin-1,jmax+1)
+        enddo
+
+        end
+
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+      subroutine writevtk_grid
+      use var
+      integer :: i,j,l
+      character(70) :: filename,rowfmt
+
+100   format(es11.4e2)
+      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
+
+      write(filename,'("output/grid_p",i3.3,".vtk")') myid
+      open(10,file=filename)
+
+      write(10,'(a)') '# vtk DataFile Version 2.0'
+      write(10,'(a,x,a)') 'grid --',version
+      write(10,'(a)') 'ASCII'
+      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
+      write(10,*) 'DIMENSIONS',ii,jj,ll
+      write(10,*) 'X_COORDINATES',ii,'float'
+      write(10,fmt=rowfmt) (xc(i),i=1,ii)
+      write(10,*) 'Y_COORDINATES',jj,'float'
+      write(10,fmt=rowfmt) (yc(j),j=1,jj)
+      write(10,*) 'Z_COORDINATES',ll,'float'
+      write(10,fmt=rowfmt) (zc(l),l=1,ll)
+      write(10,*) 'POINT_DATA ',ii*jj*ll
+
+      write(10,*) 'SCALARS celltype int 1'
+      write(10,*) 'LOOKUP_TABLE default '
+      do l=1,ll; do j=1,jj; do i=1,ii
+        write(10,'(i2)') celltype(i,j,l)
+      enddo; enddo; enddo
+
+      close(10)
+      
+      end
+
+!####################################################################
+!> @author Holger Grosshans
+!> @brief write visit container file
+      subroutine write_visit_container(filename)
+      use var
+      integer :: m
+      character(*)  :: filename
+      character(80) :: filename2
+      logical :: file_ex
+
+      write(filename2,'(3a)') 'results/',filename,'.visit'
+      inquire(file=filename2,exist=file_ex)
+      if (file_ex.and.nt.ne.1) then
+        open(11,file=filename2,access='append')
+      else
+        open(11,file=filename2)
+        write(11,'(a8,x,i3)') '!NBLOCKS',nrprocs
+      endif
+      do m=1,nrprocs
+       write(11,'(2a,i3.3,a,i6.6,a)') filename,'_p',(m-1),'_',nt,'.vtk'
+      enddo
+      close(11)
+        
+      end
diff --git a/src/writedat_fluid_xy.f90 b/src/writedat_fluid_xy.f90
deleted file mode 100644
index a3c0e89fbc509af679ccb1756eec5beac996be5c..0000000000000000000000000000000000000000
--- a/src/writedat_fluid_xy.f90
+++ /dev/null
@@ -1,93 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-      subroutine writedat_ufluid_xy
-      use var
-      character(70) :: filename,rowfmt
-      integer :: i,j,l
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      l=int(ll/2)
-
-      write(filename,'(a,i3.3,a,i6.6,a)') &
-        'results/fluid_u_xy_p',myid,'_',nt,'.dat'
-      open(10,file=filename)
-
-      write(10,'(a,es14.6e2,a,x,a)') '# u: t=',t,' s --',version
-
-      write(10,'(a11)',advance='no') '#       y/x'
-      write(10,fmt=rowfmt) (xf(i),i=imin,imax+1)
-      do j=jmin-1,jmax+1
-        write(10,fmt=100,advance='no') yc(j) 
-        write(10,fmt=rowfmt) (u(i,j,l),i=imin,imax+1)
-      enddo
- 
-      close(10)
-
-      return
-
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-      subroutine writedat_vfluid_xy
-      use var
-      character(70) :: filename,rowfmt
-      integer :: i,j,l
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      l=int(ll/2)
-
-      write(filename,'(a,i3.3,a,i6.6,a)') &
-        'results/fluid_v_xy_p',myid,'_',nt,'.dat'
-      open(10,file=filename)
-
-      write(10,'(a,es14.6e2,a,x,a)') '# v: t=',t,' s --',version
-
-      write(10,'(a11)',advance='no') '#       y/x'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-      do j=jmin-1,jmax+1
-        write(10,fmt=100,advance='no') yf(j) 
-        write(10,fmt=rowfmt) (v(i,j,l),i=imin,imax+1)
-      enddo
- 
-      close(10)
-
-      return
-
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-      subroutine writedat_wfluid_xy
-      use var
-      character(70) :: filename,rowfmt
-      integer :: i,j,l
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      l=int(ll/2)
-
-      write(filename,'(a,i3.3,a,i6.6,a)') &
-        'results/fluid_w_xy_p',myid,'_',nt,'.dat'
-      open(10,file=filename)
-
-      write(10,'(a,es14.6e2,a,x,a)') '# w: t=',t,' s --',version
-
-      write(10,'(a11)',advance='no') '#       y/x'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-      do j=jmin-1,jmax+1
-        write(10,fmt=100,advance='no') yc(j) 
-        write(10,fmt=rowfmt) (w(i,j,l),i=imin,imax+1)
-      enddo
- 
-      close(10)
-
-      return
-
-      end
-
diff --git a/src/writedat_fluid_xz.f90 b/src/writedat_fluid_xz.f90
deleted file mode 100644
index 77989532278fb60fbf9f696ca40e8f5d23804038..0000000000000000000000000000000000000000
--- a/src/writedat_fluid_xz.f90
+++ /dev/null
@@ -1,93 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-      subroutine writedat_ufluid_xz
-      use var
-      character(70) :: filename,rowfmt
-      integer :: i,j,l
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      j=int(jj/2)
-
-      write(filename,'(a,i3.3,a,i6.6,a)') &
-        'results/fluid_u_xz_p',myid,'_',nt,'.dat'
-      open(10,file=filename)
-
-      write(10,'(a,es14.6e2,a,x,a)') '# u: t=',t,' s --',version
-
-      write(10,'(a11)',advance='no') '#       z/x'
-      write(10,fmt=rowfmt) (xf(i),i=imin,imax+1)
-      do l=lmin-1,lmax+1
-        write(10,fmt=100,advance='no') zc(l) 
-        write(10,fmt=rowfmt) (u(i,j,l),i=imin,imax+1)
-      enddo
- 
-      close(10)
-
-      return
-
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-      subroutine writedat_vfluid_xz
-      use var
-      character(70) :: filename,rowfmt
-      integer :: i,j,l
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      j=int(jj/2)
-
-      write(filename,'(a,i3.3,a,i6.6,a)') &
-        'results/fluid_v_xz_p',myid,'_',nt,'.dat'
-      open(10,file=filename)
-
-      write(10,'(a,es14.6e2,a,x,a)') '# v: t=',t,' s --',version
-
-      write(10,'(a11)',advance='no') '#       z/x'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-      do l=lmin-1,lmax+1
-        write(10,fmt=100,advance='no') zc(l) 
-        write(10,fmt=rowfmt) (v(i,j,l),i=imin,imax+1)
-      enddo
- 
-      close(10)
-
-      return
-
-      end
-
-!####################################################################
-!> @author Holger Grosshans
-      subroutine writedat_wfluid_xz
-      use var
-      character(70) :: filename,rowfmt
-      integer :: i,j,l
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      j=int(jj/2)
-
-      write(filename,'(a,i3.3,a,i6.6,a)') &
-        'results/fluid_w_xz_p',myid,'_',nt,'.dat'
-      open(10,file=filename)
-
-      write(10,'(a,es14.6e2,a,x,a)') '# w: t=',t,' s --',version
-
-      write(10,'(a11)',advance='no') '#       z/x'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-      do l=lmin-1,lmax+1
-        write(10,fmt=100,advance='no') zf(l) 
-        write(10,fmt=rowfmt) (w(i,j,l),i=imin,imax+1)
-      enddo
- 
-      close(10)
-
-      return
-
-      end
-
diff --git a/src/writedat_particles.f90 b/src/writedat_particles.f90
index 187b225928fc3a0a85eb0e75c05445693723b5dd..5374c5a36c0ea116f23007e39b62b955af4abf7d 100644
--- a/src/writedat_particles.f90
+++ b/src/writedat_particles.f90
@@ -7,23 +7,26 @@
       integer n
       character(80) :: filename
 
-100   format(10(es13.4e2,x),2(i6,x))
-
-      write(filename, &
-      '("results/particles_p",i3.3,"_",i6.6,".dat")') myid,nt
+100   format(22(es13.4e2,x),2(i6,x))
 
+      write(filename,'("results/particles_p",i3.3,"_",i6.6,".dat")') myid,nt
       open(10,file=filename)
         
       write(10,'(a,es14.6e2,a,x,a)') '# t=',t,' s --',version
 
       do n=1,np
         partmass=4._pr/3._pr*pi*rhop*partn(n)*radp(n)**3
-        write(10,100) xp(n),yp(n),zp(n),radp(n),up(n),vp(n),wp(n), &
+        write(10,100) xp(n),yp(n),zp(n), &
+                      radp(n), &
+                      up(n),vp(n),wp(n), &
+                      uf(n),vf(n),wf(n), &
                       partn(n),q_el(n),q_el(n)/partmass, &
+                      fx_el(n),fy_el(n),fz_el(n), &
+                      fx_d(n),fy_d(n),fz_d(n), &
+                      fx_l(n),fy_l(n),fz_l(n), &
                       wcollnum(n),ppcollnum(n)
       enddo
 
       close(10)
 
-      return
       end
diff --git a/src/writevtk_fluid_xy.f90 b/src/writevtk_fluid_xy.f90
deleted file mode 100644
index 3ef111e191837c54e130d8b3eddff940733cf2f7..0000000000000000000000000000000000000000
--- a/src/writevtk_fluid_xy.f90
+++ /dev/null
@@ -1,144 +0,0 @@
-!> @author Holger Grosshans
-      subroutine writevtk_fluid_xy
-      use var
-      integer :: i,j,l,m
-      character(70) :: filename,filename2,rowfmt,vecfmt
-      logical :: file_ex
-
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-      write(vecfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,3(es11.4e2)))'
-
-      l=int(ll/2.)+1
-
-      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_xy_p',myid,'_',nt,'.vtk'
-      open(10,file=filename)
-
-! write visit container file
-      filename2='results/fluid_xy.visit'
-      if(myid.eq.0) then
-        inquire(file=filename2,exist=file_ex)
-        if (file_ex.and.nt.gt.1) then
-          open(11,file=filename2,access='append')
-        else
-          open(11,file=filename2)
-          write(11,'(a8,x,i3)') '!NBLOCKS',nrprocs
-        endif
-        do m=1,nrprocs
-          write(11,'(a,i3.3,a,i6.6,a)') 'fluid_xy_p',(m-1),'_',nt,'.vtk'
-        enddo
-        close(11)
-      endif
-
-
-      write(10,'(a)') '# vtk DataFile Version 3.0'
-      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
-      write(10,'(a)') 'ASCII'
-      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
-      write(10,'(a10,i4,i4,a4)') &
-            'DIMENSIONS',(imax-imin+2),(jmax-jmin+3),'1'
-
-      write(10,*) 'X_COORDINATES',(imax-imin+2),'float'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-
-      write(10,*) 'Y_COORDINATES',(jmax-jmin+3),'float'
-      write(10,fmt=rowfmt) (yc(j),j=jmin-1,jmax+1)
-
-      write(10,*) 'Z_COORDINATES 1 float'
-      write(10,100) zc(l)
-
-      write(10,*) 'POINT_DATA ',(imax-imin+2)*(jmax-jmin+3)
-
-      write(10,'(a)') 'SCALARS u float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS v float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS w float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
-      enddo
-
-!      write(10,'(a)') 'SCALARS uraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do j=jmin-1,jmax+1
-!        write(10,fmt=rowfmt) (u(i,j,l),i=imin,imax+1)
-!      enddo
-!
-!      write(10,'(a)') 'SCALARS vraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do j=jmin-1,jmax+1
-!        write(10,fmt=rowfmt) (v(i,j,l),i=imin,imax+1)
-!      enddo
-!
-!      write(10,'(a)') 'SCALARS wraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do j=jmin-1,jmax+1
-!        write(10,fmt=rowfmt) (w(i,j,l),i=imin,imax+1)
-!      enddo
-
-      write(10,'(a)') 'SCALARS p float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (p(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS rho_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (rho_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS phi_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (phi_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ex_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (Ex_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ey_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (Ey_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ez_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1
-        write(10,fmt=rowfmt) (Ez_el(i,j,l),i=imin,imax+1)
-      enddo
-
-!      write(10,'(a)') 'SCALARS Emag_el float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do j=jmin-1,jmax+1
-!        write(10,fmt=rowfmt) &
-!        (sqrt(Ex_el(i,j,l)**2+Ey_el(i,j,l)**2+Ez_el(i,j,l)**2)**(0.5),i=imin,imax+1)
-!      enddo
-!
-!
-!      write(10,'(a)') 'VECTORS uvw float'
-!      do j=jmin-1,jmax+1
-!        write(10,fmt='(3(es12.2e2))') (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)), &
-!                              0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)), &
-!                              0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
-!      enddo
-
-
-      close(10)
-
-      return
-      end
diff --git a/src/writevtk_fluid_xyz.f90 b/src/writevtk_fluid_xyz.f90
deleted file mode 100644
index 22a942959b9325705c337bed4589024a3706244a..0000000000000000000000000000000000000000
--- a/src/writevtk_fluid_xyz.f90
+++ /dev/null
@@ -1,138 +0,0 @@
-!> @author Holger Grosshans
-      subroutine writevtk_fluid_xyz
-      use var
-      real(kind=pr) :: pp
-      integer :: i,j,l,m
-      character(70) :: filename,filename2,rowfmt,vecfmt
-      logical :: file_ex
-
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-      write(vecfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,3(es11.4e2)))'
-
-      pp=0._pr
-
-      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_xyz_p',myid,'_',nt,'.vtk'
-      open(10,file=filename)
-
-! write visit container file
-      filename2='results/fluid_xyz.visit'
-      if(myid.eq.0) then
-        inquire(file=filename2,exist=file_ex)
-        if (file_ex.and.nt.gt.1) then
-          open(11,file=filename2,access='append')
-        else
-          open(11,file=filename2)
-          write(11,'(a8,x,i3)') '!NBLOCKS',nrprocs
-        endif
-        do m=1,nrprocs
-          write(11,'(a,i3.3,a,i6.6,a)') 'fluid_xyz_p',(m-1),'_',nt,'.vtk'
-        enddo
-        close(11)
-      endif
-
-
-      write(10,'(a)') '# vtk DataFile Version 3.0'
-      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
-      write(10,'(a)') 'ASCII'
-      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
-      write(10,'(a10,3(i4))') &
-            'DIMENSIONS',(imax-imin+2),(jmax-jmin+3),(lmax-lmin+3)
-
-      write(10,*) 'X_COORDINATES',(imax-imin+2),'float'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-
-      write(10,*) 'Y_COORDINATES',(jmax-jmin+3),'float'
-      write(10,fmt=rowfmt) (yc(j),j=jmin-1,jmax+1)
-
-      write(10,*) 'Z_COORDINATES',(lmax-lmin+3),'float'
-      write(10,fmt=rowfmt) (zc(l),l=lmin-1,lmax+1)
-
-      write(10,*) 'POINT_DATA ',(imax-imin+2)*(jmax-jmin+3)*(lmax-lmin+3)
-
-      write(10,'(a)') 'SCALARS u float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS v float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS w float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS p float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (p(i,j,l),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS rho_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (rho_el(i,j,l),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS phi_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (phi_el(i,j,l),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS Ex_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ex_el(i,j,l),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS Ey_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ey_el(i,j,l),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS Ez_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ez_el(i,j,l),i=imin,imax+1)
-      enddo; enddo
-
-      write(10,'(a)') 'SCALARS Emag_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) &
-        (sqrt(Ex_el(i,j,l)**2+Ey_el(i,j,l)**2+Ez_el(i,j,l)**2)**(0.5),i=imin,imax+1)
-      enddo; enddo
-
-!      write(10,'(a)') 'VECTORS uvw float'
-!      do j=jmin-1,jmax+1; do l=lmin-1,lmax+1
-!        write(10,fmt='(3(es12.2e2))') (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)), &
-!                              0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)), &
-!                              0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
-!      enddo; enddo
-
-
-!      write(10,'(a)') 'VECTORS coordinates float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!      do i=imin,imax+1
-!        write(10,'(3(i8))') i,j,l
-!      enddo
-!      enddo
-
-
-      close(10)
-
-
-
-      return
-
-      end
diff --git a/src/writevtk_fluid_xz.f90 b/src/writevtk_fluid_xz.f90
deleted file mode 100644
index 832508e46c8367f4b3fb8f6beeafa5f079ae6d4f..0000000000000000000000000000000000000000
--- a/src/writevtk_fluid_xz.f90
+++ /dev/null
@@ -1,150 +0,0 @@
-!> @author Holger Grosshans
-      subroutine writevtk_fluid_xz
-      use var
-      real(kind=pr) :: pp
-      integer :: i,j,l,m
-      character(70) :: filename,filename2,rowfmt,vecfmt
-      logical :: file_ex
-
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-      write(vecfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,3(es11.4e2)))'
-
-      j=int(jj/2.)+1
-      pp=0._pr
-
-      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_xz_p',myid,'_',nt,'.vtk'
-      open(10,file=filename)
-
-! write visit container file
-      filename2='results/fluid_xz.visit'
-      if(myid.eq.0) then
-        inquire(file=filename2,exist=file_ex)
-        if (file_ex.and.nt.gt.1) then
-          open(11,file=filename2,access='append')
-        else
-          open(11,file=filename2)
-          write(11,'(a8,x,i3)') '!NBLOCKS',nrprocs
-        endif
-        do m=1,nrprocs
-          write(11,'(a,i3.3,a,i6.6,a)') 'fluid_xz_p',(m-1),'_',nt,'.vtk'
-        enddo
-        close(11)
-      endif
-
-
-      write(10,'(a)') '# vtk DataFile Version 3.0'
-      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
-      write(10,'(a)') 'ASCII'
-      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
-      write(10,'(a10,i4,a4,i4)') &
-            'DIMENSIONS',(imax-imin+2),'1',(lmax-lmin+3)
-
-      write(10,*) 'X_COORDINATES',(imax-imin+2),'float'
-      write(10,fmt=rowfmt) (xc(i),i=imin,imax+1)
-
-      write(10,*) 'Y_COORDINATES 1 float'
-      write(10,100) yc(j)
-
-      write(10,*) 'Z_COORDINATES',(lmax-lmin+3),'float'
-      write(10,fmt=rowfmt) (zc(l),l=lmin-1,lmax+1)
-
-      write(10,*) 'POINT_DATA ',(imax-imin+2)*(lmax-lmin+3)
-
-      write(10,'(a)') 'SCALARS u float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS v float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS w float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
-      enddo
-
-!      write(10,'(a)') 'SCALARS uraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) (u(i,j,l),i=imin,imax+1)
-!      enddo
-!
-!      write(10,'(a)') 'SCALARS vraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) (v(i,j,l),i=imin,imax+1)
-!      enddo
-!
-!      write(10,'(a)') 'SCALARS wraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) (w(i,j,l),i=imin,imax+1)
-!      enddo
-
-      write(10,'(a)') 'SCALARS p float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (p(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS rho_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (rho_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS phi_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (phi_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ex_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ex_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ey_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ey_el(i,j,l),i=imin,imax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ez_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ez_el(i,j,l),i=imin,imax+1)
-      enddo
-
-!      write(10,'(a)') 'SCALARS Emag_el float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) &
-!        (sqrt(Ex_el(i,j,l)**2+Ey_el(i,j,l)**2+Ez_el(i,j,l)**2)**(0.5),i=imin,imax+1)
-!      enddo
-!
-!
-!      write(10,'(a)') 'VECTORS uvw float'
-!      do l=lmin-1,lmax+1
-!        write(10,fmt='(3(es12.2e2))') (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)), &
-!                              0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)), &
-!                              0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),i=imin,imax+1)
-!      enddo
-
-
-
-      close(10)
-
-
-
-      return
-
-      end
diff --git a/src/writevtk_fluid_yz.f90 b/src/writevtk_fluid_yz.f90
deleted file mode 100644
index 59f40d580f4a128435ca9cf0142d611211c78885..0000000000000000000000000000000000000000
--- a/src/writevtk_fluid_yz.f90
+++ /dev/null
@@ -1,138 +0,0 @@
-!> @author Holger Grosshans
-      subroutine writevtk_fluid_yz
-      use var
-      real(kind=pr), dimension(jj) :: temp4
-      real(kind=pr) :: temp,temp1,temp2,temp3
-      integer :: i,j,l,m
-      character(70) :: filename,filename2,rowfmt
-      logical :: file_ex
-
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(jmax-jmin+3),'(1x,es11.4e2))'
-
-      i=int(ii/2.)+1
-
-      write(filename,'(a,i3.3,a,i6.6,a)') 'results/fluid_yz_p',myid,'_',nt,'.vtk'
-      open(10,file=filename)
-
-! write visit container file
-      filename2='results/fluid_yz.visit'
-      if(myid.eq.0) then
-        inquire(file=filename2,exist=file_ex)
-        if (file_ex.and.nt.gt.1) then
-          open(11,file=filename2,access='append')
-        else
-          open(11,file=filename2)
-          write(11,'(a8,x,i3)') '!NBLOCKS',nrprocs
-        endif
-        do m=1,nrprocs
-          write(11,'(a,i3.3,a,i6.6,a)') 'fluid_yz_p',(m-1),'_',nt,'.vtk'
-        enddo
-        close(11)
-      endif
-
-
-      write(10,'(a)') '# vtk DataFile Version 3.0'
-      write(10,'(a,es14.6e2,a,x,a)') 'fluid data: t=',t,' s --',version
-      write(10,'(a)') 'ASCII'
-      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
-      write(10,'(a12,i8,i8)') &
-            'DIMENSIONS 1',(jmax-jmin+3),(lmax-lmin+3)
-
-      write(10,*) 'X_COORDINATES 1 float'
-      write(10,100) xc(i)
-
-      write(10,*) 'Y_COORDINATES',(jmax-jmin+3),'float'
-      write(10,fmt=rowfmt) (yc(j),j=jmin-1,jmax+1)
-
-      write(10,*) 'Z_COORDINATES',(lmax-lmin+3),'float'
-      write(10,fmt=rowfmt) (zc(l),l=lmin-1,lmax+1)
-
-      write(10,*) 'POINT_DATA ',(jmax-jmin+3)*(lmax-lmin+3)
-
-      write(10,'(a)') 'SCALARS u float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(u(i,j,l)+u(max(i-1,1),j,l)),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS v float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(v(i,j,l)+v(i,max(j-1,1),l)),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS w float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (0.5_pr*(w(i,j,l)+w(i,j,max(l-1,1))),j=jmin-1,jmax+1)
-      enddo
-
-!      write(10,'(a)') 'SCALARS uraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) (u(i,j,l),i=imin,imax+1)
-!      enddo
-!
-!      write(10,'(a)') 'SCALARS vraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) (v(i,j,l),i=imin,imax+1)
-!      enddo
-!
-!      write(10,'(a)') 'SCALARS wraw float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) (w(i,j,l),i=imin,imax+1)
-!      enddo
-
-      write(10,'(a)') 'SCALARS p float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (p(i,j,l),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS rho_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (rho_el(i,j,l),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS phi_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (phi_el(i,j,l),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ex_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ex_el(i,j,l),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ey_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ey_el(i,j,l),j=jmin-1,jmax+1)
-      enddo
-
-      write(10,'(a)') 'SCALARS Ez_el float 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      do l=lmin-1,lmax+1
-        write(10,fmt=rowfmt) (Ez_el(i,j,l),j=jmin-1,jmax+1)
-      enddo
-
-!      write(10,'(a)') 'SCALARS Emag_el float 1'
-!      write(10,'(a)') 'LOOKUP_TABLE default '
-!      do l=lmin-1,lmax+1
-!        write(10,fmt=rowfmt) &
-!        (sqrt(Ex_el(i,j,l)**2+Ey_el(i,j,l)**2+Ez_el(i,j,l)**2)**(0.5),j=jmin-1,jmax+1)
-!      enddo
-
- 
-      close(10)
-
-
-      return
-      end
diff --git a/src/writevtk_grid.f90 b/src/writevtk_grid.f90
deleted file mode 100644
index 346d0e66ad9df4ee1b9ff654a0647eb175825946..0000000000000000000000000000000000000000
--- a/src/writevtk_grid.f90
+++ /dev/null
@@ -1,41 +0,0 @@
-!> @author Holger Grosshans
-      subroutine writevtk_grid
-      use var
-      integer :: i,j,l
-      character(70) :: filename,rowfmt
-
-100   format(es11.4e2)
-      write(rowfmt,'(a,i4,a)') '(',(imax-imin+2),'(1x,es11.4e2))'
-
-      write(filename,'("output/grid_p",i3.3,".vtk")') myid
-      open(10,file=filename)
-
-      write(10,'(a)') '# vtk DataFile Version 2.0'
-      write(10,'(a,x,a)') 'grid --',version
-      write(10,'(a)') 'ASCII'
-      write(10,'(a)') 'DATASET RECTILINEAR_GRID'
-      write(10,*) 'DIMENSIONS',ii,jj,ll
-
-      write(10,*) 'X_COORDINATES',ii,'float'
-      write(10,fmt=rowfmt) (xc(i),i=1,ii)
-
-      write(10,*) 'Y_COORDINATES',jj,'float'
-      write(10,fmt=rowfmt) (yc(j),j=1,jj)
-
-      write(10,*) 'Z_COORDINATES',ll,'float'
-      write(10,fmt=rowfmt) (zc(l),l=1,ll)
-
-      write(10,*) 'POINT_DATA ',ii*jj*ll
-
-      write(10,*) 'SCALARS celltype int 1'
-      write(10,*) 'LOOKUP_TABLE default '
-      do l=1,ll; do j=1,jj; do i=1,ii
-        write(10,'(i2)') celltype(i,j,l)
-      enddo
-      enddo
-      enddo
-
-      close(10)
-      
-      return
-      end
diff --git a/src/writevtk_particles.f90 b/src/writevtk_particles.f90
deleted file mode 100644
index b519f0691331ef0f9ec5b81bbf77a85b8febc4b9..0000000000000000000000000000000000000000
--- a/src/writevtk_particles.f90
+++ /dev/null
@@ -1,124 +0,0 @@
-!####################################################################
-!> @author Holger Grosshans
-!> @brief write out particle field in vtk format
-      subroutine writevtk_particles
-      use var
-      integer :: i,j,l,n,m
-      character(80) :: filename,filename2,rowfmt,rowfm2
-      logical :: file_ex
-
-
-100   format(es13.4e2)
-101   format(3(es13.4e2))
-102   format(3(es14.5e2))
-      rowfmt='(10(1x,es11.4e2))'
-      rowfm2='(10(1x,i9))'
-
-      write(filename, &
-      '("results/particles_p",i3.3,"_",i6.6,".vtk")') myid,nt
-
-      open(10,file=filename)
-
-! write visit container file
-      filename2='results/particles.visit'
-      if(myid.eq.0) then
-        inquire(file=filename2,exist=file_ex)
-        if (file_ex.and.nt.ne.1) then
-          open(11,file=filename2,access='append')
-        else
-          open(11,file=filename2)
-          write(11,'(a8,x,i3)') '!NBLOCKS',nrprocs
-        endif
-        do m=1,nrprocs
-         write(11,'(a,i3.3,a,i6.6,a)') 'particles_p',(m-1),'_',nt,'.vtk'
-        enddo
-        close(11)
-      endif
-
-        
-      write(10,'(a)') '# vtk DataFile Version 3.0'
-      write(10,'(a,es14.6e2,a,x,a)') 'particle data: t=',t,' s --',version
-      write(10,'(a)') 'ASCII'
-      write(10,'(a)') 'DATASET UNSTRUCTURED_GRID'
-      write(10,*) 
-
-      write(10,'(a6,i9,a6)') 'POINTS ',np,' FLOAT'
-      do n=1,np
-        write(10,102) (xp(n)),yp(n),zp(n)
-      end do
-      write(10,*) 
-      
-      write(10,'(a5,i9,i9)') 'CELLS ',np,2*np
-      write(10,*) ('1',n-1,n=1,np)
-      write(10,*) 
-
-      write(10,'(a10,i9)') 'CELL_TYPES ',np
-      write(10,*) ('1 ', n=1,np)
-      write(10,*) 
-
-      write(10,'(a,i9)') 'POINT_DATA ',np
-      write(10,'(a)') 'SCALARS RadP FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (radp(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS UP FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (up(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS VP FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (vp(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS WP FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (wp(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS partn FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (partn(n),n=1,np)
-      write(10,'(a)')
-
-      write(10,'(a)') 'SCALARS q_el FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (q_el(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS fx_el FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (fx_el(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS fy_el FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (fy_el(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS fz_el FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfmt) (fz_el(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS wcollnum FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfm2) (wcollnum(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'SCALARS np FLOAT 1'
-      write(10,'(a)') 'LOOKUP_TABLE default '
-      write(10,fmt=rowfm2) (nGlob(n),n=1,np)
-      write(10,'(a)') 
-
-      write(10,'(a)') 'VECTORS UPVPWP FLOAT'
-      write(10,101) (up(n),vp(n),wp(n),n=1,np)
-      write(10,'(a)') 
-
-      close(10)
-
-
-      return
-        
-      end