Browse Source

Initial revision

master
gotm 21 years ago
commit
5fb5805d28
  1. 6
      BUGS
  2. 351
      COPYING
  3. 60
      CodingStyle
  4. 1
      FAQ
  5. 14
      HISTORY
  6. 1
      INSTALL
  7. 58
      Makefile
  8. 2
      README
  9. 3
      README.compile
  10. 1
      TODO
  11. 1
      VERSION
  12. 19
      doc/.log
  13. 1
      include/.cvsignore
  14. 118
      include/cppdefs.h
  15. 1
      include/version.h
  16. 59
      src/2d/Makefile
  17. 189
      src/2d/bottom_friction.F90
  18. 114
      src/2d/cfl_check.F90
  19. 72
      src/2d/coriolis.F90
  20. 137
      src/2d/depth_update.F90
  21. 72
      src/2d/divergence.F90
  22. 138
      src/2d/dynamic_allocations.h
  23. 26
      src/2d/dynamic_declarations.h
  24. 133
      src/2d/have_bdy.F90
  25. 88
      src/2d/init_2d_bdy.F90
  26. 342
      src/2d/m2d.F90
  27. 307
      src/2d/momentum.F90
  28. 69
      src/2d/residual.F90
  29. 124
      src/2d/sealevel.F90
  30. 48
      src/2d/static.h
  31. 258
      src/2d/update_2d_bdy.F90
  32. 185
      src/2d/uv_advect.F90
  33. 84
      src/2d/uv_depths.F90
  34. 132
      src/2d/uv_diffusion.F90
  35. 146
      src/2d/variables_2d.F90
  36. 76
      src/3d/Makefile
  37. 1029
      src/3d/advection_3d.F90
  38. 226
      src/3d/bdy_3d.F90
  39. 154
      src/3d/bottom_friction_3d.F90
  40. 81
      src/3d/bottomstress_3d.F90
  41. 361
      src/3d/coordinates.F90
  42. 150
      src/3d/dynamic_allocations.h
  43. 41
      src/3d/dynamic_declarations.h
  44. 315
      src/3d/eqstate.F90
  45. 179
      src/3d/gotm.F90
  46. 342
      src/3d/internal_pressure.F90
  47. 314
      src/3d/internal_pressure.F90.SONG
  48. 290
      src/3d/internal_pressure.F90.new
  49. 431
      src/3d/m3d.F90
  50. 321
      src/3d/rivers.F90
  51. 399
      src/3d/salinity.F90
  52. 193
      src/3d/slow_advection.F90
  53. 143
      src/3d/slow_bottom_friction.F90
  54. 155
      src/3d/slow_diffusion.F90
  55. 186
      src/3d/slow_terms.F90
  56. 341
      src/3d/spm.F90
  57. 170
      src/3d/ss_nn.F90
  58. 118
      src/3d/start_macro.F90
  59. 70
      src/3d/static.h
  60. 63
      src/3d/stop_macro.F90
  61. 90
      src/3d/stresses_3d.F90
  62. 342
      src/3d/temperature.F90
  63. 238
      src/3d/uu_momentum_3d.F90
  64. 364
      src/3d/uv_advect_3d.F90
  65. 100
      src/3d/uv_bounds_3d.F90
  66. 163
      src/3d/uv_diffusion_3d.F90
  67. 164
      src/3d/variables_3d.F90
  68. 237
      src/3d/vv_momentum_3d.F90
  69. 98
      src/3d/ww_momentum_3d.F90
  70. 1228
      src/ChangeLog
  71. 83
      src/Makefile
  72. 25
      src/README
  73. 33
      src/README.halo
  74. 272
      src/Rules.make
  75. 55
      src/TODO
  76. 29
      src/cutils/Makefile
  77. 26
      src/cutils/caldat.c
  78. 25
      src/cutils/julday.c
  79. 20
      src/cutils/kurt.c
  80. 42
      src/domain/Makefile
  81. 136
      src/domain/bdy_spec.F90
  82. 871
      src/domain/domain.F90
  83. 121
      src/domain/dynamic_allocations.h
  84. 22
      src/domain/dynamic_declarations.h
  85. 86
      src/domain/print_bdy.F90
  86. 67
      src/domain/static.h
  87. 54
      src/futils/Makefile
  88. 60
      src/futils/cnv_2d.F90
  89. 62
      src/futils/cnv_3d.F90
  90. 68
      src/futils/eta_mask.F90
  91. 573
      src/futils/grid_interpol.F90
  92. 124
      src/futils/kbk_interpol.F90
  93. 67
      src/futils/parameters.F90
  94. 49
      src/futils/pos.F90
  95. 601
      src/futils/time.F90
  96. 62
      src/futils/to_2d_vel.F90
  97. 63
      src/futils/to_3d_vel.F90
  98. 62
      src/futils/tow.F90
  99. 63
      src/futils/tridiagonal.F90
  100. 102
      src/futils/ver_interpol.F90
  101. Some files were not shown because too many files have changed in this diff Show More

6
BUGS

@ -0,0 +1,6 @@
None so far - but missing features.
But if you find any please e-mail to:
karsten@bolding-burchard.com
or
hans@bolding-burchard.com

351
COPYING

@ -0,0 +1,351 @@
NOTE! This copyright does *not* cover user programs that use kernel
services by normal system calls - this is merely considered normal use
of the kernel, and does *not* fall under the heading of "derived work".
Also note that the GPL below is copyrighted by the Free Software
Foundation, but the instance of code that it refers to (the Linux
kernel) is copyrighted by me and others who actually wrote it.
Linus Torvalds
----------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) 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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
END OF TERMS AND CONDITIONS
Appendix: 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
convey 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) 19yy <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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This 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 Library General
Public License instead of this License.

60
CodingStyle

@ -0,0 +1,60 @@
$Id: CodingStyle,v 1.1 2002-05-02 14:00:27 gotm Exp $
In this file a few general rules for coding 'getm' are given.
0: Use of module, subroutine and function templates.
In the template directory example files of modules, subroutines and functions
are available. Please use those if you need to create a new file and please fill
in all relevant information - especially author and description.
1: Indentation
Since Fortran90 allows for free-format we don't have to stick to the column 7
rule. After a bit of testing we have chosen that each new level should be
indented 3 blanks e.g..
subroutine egon
logical is_it_true
integer i,j
kaj = 1
if (is_it_true) then
do i=1,100
j=i
end do
end if
return
end
And please don't put any blanks at the end of lines.
2: Upper and lower case.
We keep everything in lower case.
3: Variable naming conventions.
Highest priority is - readability - therefore we have chosen the C-style
convention - where we use _ instead of mixed upper/lower case variable names.
Variables - especially public variables - should have a meaningful name
like in 'have_boundaries'.
4: Writing diagnostics.
A few pre-processing definitions have been defined in cppdefs.h to ease writing
diagnostics and also to give diagnostics a consistent look. Have a look in
cppdefs.h for the actual definitions. Here is just one example:
Instead of coding:
write(0,*) 'Some diagnostic ouput'
use
STDERR 'Some diagnostic ouput'
This makes it very easy to change the entire diagnostic system in the program
by simply changing the definition of STDERR in cppdefs.h.
To allow for different identations the following set of definitions have been
implemented:
LEVEL0 to LEVEL4 they are to be used as STDERR.
5: Import explicitely variables from modules.
When other modules are used always use the 'ONLY' keyword and do only import
the variables actually needed. This give a much clearerpicture of the data
flow in the programme.

1
FAQ

@ -0,0 +1 @@
$Id: FAQ,v 1.1 2002-05-02 14:00:27 gotm Exp $

14
HISTORY

@ -0,0 +1,14 @@
Initial version developed by Hans Burchard in the Matar MAST project.
The original code was not very generel and in order to apply it for
a different area quite a lot should be changed.
Shortly after Karsten Bolding started at JRC we decided to join forces
and turn the original code into a generel purpuse 3D model. The first
step was to remove all non-generel code from the original code. Second
step was to implement generel input-output routines. We decided to use
NETCDF as file format. Third step was to implement baroclinic effects.
In late July 1998 the first beta was ready - still with some missing
features - and was run for different simple test cases.
980724:

1
INSTALL

@ -0,0 +1 @@
$Id: INSTALL,v 1.1 2002-05-02 14:00:28 gotm Exp $

58
Makefile

@ -0,0 +1,58 @@
#
# Master Makefile for the getm project.
#
VERSION = 1
PATCHLEVEL = 1
SUBLEVEL = 0
VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
EXEC = model$(libtype)
base = BUGS INSTALL README TODO HISTORY
all: VERSION $(EXEC) doc
$(EXEC): include/version.h
$(MAKE) -C src $(EXEC) install
include/version.h: ./Makefile
@echo \#define RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
@mv -f .ver $@
VERSION: ./Makefile
@echo $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@
doc:
$(MAKE) -C src/ doc
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i doc; done
clean:
rm -f VERSION
distclean:
$(MAKE) -C src distclean
$(MAKE) -C utils distclean
dist: distclean
(cd ../ ; tar cf - v$(VER)/ | gzip -9 > v$(VER).tar.gz)
sync
diff:
cvs diff > cvs.diff
vi cvs.diff
$(RM) cvs.diff
update:
cvs update > cvs.update
vi cvs.update
$(RM) cvs.update
cvs2cl
vi ChangeLog
commit:
cvs commit > cvs.commit
vi cvs.commit
dummy:

2
README

@ -0,0 +1,2 @@
$Id: README,v 1.1 2002-05-02 14:00:28 gotm Exp $

3
README.compile

@ -0,0 +1,3 @@
$Id: README.compile,v 1.1 2002-05-02 14:00:29 gotm Exp $
To be written

1
TODO

@ -0,0 +1 @@
$Id: TODO,v 1.1 2002-05-02 14:00:29 gotm Exp $

1
VERSION

@ -0,0 +1 @@
1.1.0

19
doc/.log

@ -0,0 +1,19 @@
This is TeX, Version 3.14159 (Web2C 7.3.7) (format=latex 2001.12.11) 5 JAN 2002 18:08
**code_letter
(/usr/share/texmf/tex/latex/tools/.tex
! Interruption.
<to be read again>
\begingroup
l.1
%%
? X
Here is how much of TeX's memory you used:
5 strings out of 10847
122 string characters out of 70945
44507 words of memory out of 263001
3034 multiletter control sequences out of 10000+0
3640 words of font info for 14 fonts, out of 400000 for 1000
14 hyphenation exceptions out of 1000
3i,0n,1p,18b,6s stack positions out of 300i,100n,500p,50000b,4000s
No pages of output.

1
include/.cvsignore

@ -0,0 +1 @@
dimensions.h

118
include/cppdefs.h

@ -0,0 +1,118 @@
! This file is include in all .F90 files and contains very important
! difinitions. Infact the model will not compile when this file is not
! in a correct format.
! KBK 990615
#include "version.h"
#if defined(SPHERICAL) || defined(CURVILINEAR)
#define DXC dxc(i,j)
#define DXCJP1 dxc(i,j+1)
#define DXU dxu(i,j)
#define DXV dxv(i,j)
#define DXVJM1 dxv(i,j-1)
#define DXX dxx(i,j)
#define DXXJM1 dxx(i,j-1)
#define DYC dyc(i,j)
#define DYCIP1 dyc(i+1,j)
#define DYU dyu(i,j)
#define DYUIM1 dyu(i-1,j)
#define DYV dyv(i,j)
#define DYX dyx(i,j)
#define DYXIM1 dyx(i-1,j)
#define ARCD1 arcd1(i,j)
#define ARUD1 arud1(i,j)
#define ARVD1 arvd1(i,j)
#else
#define DXC dx
#define DXCJP1 dx
#define DXU dx
#define DXV dx
#define DXVJM1 dx
#define DXX dx
#define DXXJM1 dx
#define DYC dy
#define DYCIP1 dy
#define DYU dy
#define DYUIM1 dy
#define DYV dy
#define DYX dy
#define DYXIM1 dy
#define ARCD1 ard1
#define ARUD1 ard1
#define ARVD1 ard1
#endif
! Reserved Fortran units
#define stdin 5
#define stdout 6
#define stderr 0
#define debug 0
#define NAMLST 10
#define RESTART 15
#define PARSETUP 20
#define BDYINFO 21
#define BDYDATA 22
! Data/file formats
#define ANALYTICAL 0
#define ASCII 1
#define NETCDF 2
#define RAWBINARY 3
#define OPENDX 4
#define GRADS 5
#define PATH_MAX 255
! Handy for writing
#define STDOUT write(stdout,*)
#define STDERR write(stderr,*)
#define LEVEL0 STDERR
#define LEVEL1 STDERR ' ',
#define LEVEL2 STDERR ' ',
#define LEVEL3 STDERR ' ',
#define LEVEL4 STDERR ' ',
#define FATAL STDERR 'FATAL ERROR: ',
!KBK#define STDERR IF(myid.le.0) write(stderr,*)
#define LINE "------------------------------------------------------------------------"
! For easier reading
#define READING 0
#define WRITING 1
! To avoid dividing by zero
#define SMALL 1e-8
! What precision will we use in this compilation
#define SINGLE
#undef SINGLE
#ifdef SINGLE
#define REALTYPE REAL
#define REAL_SIZE 4
#define _ZERO_ 0.0
#define _ONE_ 1.0
#else
#define REALTYPE DOUBLE PRECISION
#define MPI_REALTYPE MPI_DOUBLE_PRECISION
#define REAL_SIZE 8
#define _ZERO_ 0.0d0
#define _ONE_ 1.0d0
#endif
! The width of the HALO zones
#define HALO 1
! Here the memory-allocation is defined
#define E2DFIELD imin-HALO:imax+HALO,jmin-HALO:jmax+HALO
#define I2DFIELD iimin-HALO:iimax+HALO,jjmin-HALO:jjmax+HALO
#define I3DFIELD iimin-HALO:iimax+HALO,jjmin-HALO:jjmax+HALO,0:kmax
! These defines the do loops for the real inner points..
! that is the points that are independent of neighbours.
#define DO_EILOOP DO i=imin,imax
#define DO_EJLOOP DO j=jmin,jmax
#define DO_IILOOP DO i=iimin,iimax
#define DO_IJLOOP DO j=jjmin,jjmax

1
include/version.h

@ -0,0 +1 @@
#define RELEASE "1.1.0"

59
src/2d/Makefile

@ -0,0 +1,59 @@
#$Id: Makefile,v 1.1 2002-05-02 14:00:41 gotm Exp $
#
# Makefile to build the 2D specific library - libm2d.a
#
include ../Rules.make
INCS = static.h dynamic_declarations.h dynamic_allocations.h
LIB = $(LIBDIR)/lib2d${buildtype}.a
MODSRC = m2d.F90 variables_2d.F90
LIBSRC = cfl_check.F90 have_bdy.F90 bottom_friction.F90 depth_update.F90 momentum.F90 uv_advect.F90 uv_diffusion.F90 coriolis.F90 sealevel.F90 uv_depths.F90 init_2d_bdy.F90 update_2d_bdy.F90 divergence.F90 residual.F90
SRC = $(MODSRC) $(LIBSRC)
MOD = \
${LIB}(variables_2d.o) \
${LIB}(m2d.o)
OBJ = \
${LIB}(cfl_check.o) \
${LIB}(bottom_friction.o) \
${LIB}(coriolis.o) \
${LIB}(depth_update.o) \
${LIB}(momentum.o) \
${LIB}(sealevel.o) \
${LIB}(uv_advect.o) \
${LIB}(uv_diffusion.o) \
${LIB}(uv_depths.o) \
${LIB}(have_bdy.o) \
${LIB}(divergence.o) \
${LIB}(residual.o) \
${LIB}(update_2d_bdy.o)
all: modules objects
modules: $(MOD)
objects: $(OBJ)
$(MOD): $(INCS)
$(OBJ): $(INCS)
doc:
$(PROTEX) $(SRC) > $(DOCDIR)/2d.tex
clean:
$(RM) $(LIB) $(MODDIR)/m2d.{m,mod}
realclean: clean
$(RM) *.o
distclean: realclean
#-----------------------------------------------------------------------
# Copyright (C) 2001 - Hans Burchard and Karsten Bolding (BBH) !
#-----------------------------------------------------------------------

189
src/2d/bottom_friction.F90

@ -0,0 +1,189 @@
!$Id: bottom_friction.F90,v 1.1 2002-05-02 14:00:41 gotm Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: bottom_friction() - calculates the 2D bottom friction.
!
! !INTERFACE:
subroutine bottom_friction(runtype)
!
! !DESCRIPTION:
!
! !USES:
use parameters, only: kappa,avmmol
use domain, only: imin,imax,jmin,jmax,au,av,min_depth
use variables_2d
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: bottom_friction.F90,v $
! Revision 1.1 2002-05-02 14:00:41 gotm
! Initial revision
!
! Revision 1.6 2001/06/22 08:19:10 bbh
! Compiler options such as USE_MASK and OLD_DRY deleted.
! Open and passive boundary for z created.
! Various inconsistencies removed.
! wait_halo added.
! Checked loop boundaries
!
! Revision 1.5 2001/05/20 07:46:38 bbh
! Fixed masks
!
! Revision 1.4 2001/05/18 13:03:34 bbh
! Optimize for speed + masks for update_2d_halo() - CHECK
!
! Revision 1.3 2001/05/03 19:35:01 bbh
! Use of variables_2d
!
! Revision 1.2 2001/04/24 08:24:58 bbh
! Use runtype instead of macro
!
! Revision 1.1.1.1 2001/04/17 08:43:08 bbh
! initial import into CVS
!
! !LOCAL VARIABLES:
integer :: i,j
REALTYPE :: uloc(E2DFIELD),vloc(E2DFIELD)
REALTYPE :: HH(E2DFIELD),fricvel(E2DFIELD)
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'bottom_friction() # ',Ncall
#endif
where (au .gt. 0)
uloc=U/DU
end where
do j=jmin,jmax
do i=imin,imax
if (au(i,j) .gt. 0) then
vloc(i,j)=0.25* ( V(i ,j )/DV(i ,j ) &
+V(i+1,j )/DV(i+1,j ) &
+V(i ,j-1)/DV(i ,j-1) &
+V(i+1,j-1)/DV(i+1,j-1) )
end if
end do
end do
! The x-direction
#ifndef DEBUG
where (au .gt. 0)
HH=max(min_depth,DU)
ruu=(kappa/log((zub+0.5*HH)/zub))**2
end where
#else
HH=max(min_depth,DU)
ruu=(zub+0.5*HH)/zub
do j=jmin,jmax
do i=imin,imax
if (ruu(i,j) .le. _ONE_) then
STDERR 'bottom_friction friction coefficient infinite.'
STDERR 'i = ',i,' j = ',j
STDERR 'min_depth = ',min_depth,' DU = ',DU(i,j)
stop
end if
end do
end do
where (au .gt. 0)
ruu=(kappa/log(ruu))**2
end where
#endif
if (runtype .eq. 1) then
where (au .gt. 0)
fricvel=sqrt(ruu*(uloc**2+vloc**2))
zub=min(HH,zub0+0.1*avmmol/max(avmmol,fricvel))
ruu=(zub+0.5*HH)/zub
ruu=(kappa/log(ruu))**2
end where
end if
where (au .gt. 0)
ru=ruu*sqrt(uloc**2+vloc**2)
end where
! The y-direction
do j=jmin,jmax
do i=imin,imax
if (av(i,j) .gt. 0) then
uloc(i,j)=0.25* ( U(i ,j )/DU(i ,j ) &
+U(i-1,j )/DU(i-1,j ) &
+U(i ,j+1)/DU(i ,j+1) &
+U(i-1,j+1)/DU(i-1,j+1) )
end if
end do
end do
where (av .gt. 0)
vloc=V/DV
end where
#ifndef DEBUG
where (av .gt. 0)
HH=max(min_depth,DV)
rvv=(kappa/log((zvb+0.5*HH)/zvb))**2
end where
#else
HH=max(min_depth,DV)
rvv=(zvb+0.5*HH)/zvb
do j=jmin,jmax
do i=imin,imax
if (rvv(i,j) .le. _ONE_) then
STDERR 'bottom_friction friction coefficient infinite.'
STDERR 'i = ',i,' j = ',j
STDERR 'min_depth = ',min_depth,' DV = ',DU(i,j)
stop
end if
end do
end do
where (av .gt. 0)
rvv=(kappa/log(rvv))**2
end where
#endif
where (av .gt. 0)
HH=max(min_depth,DV)
rvv=(kappa/log((zvb+0.5*HH)/zvb))**2
end where
! if (runtype .eq. 1) then
where (av .gt. 0)
fricvel=sqrt(rvv*(uloc**2+vloc**2))
! zvb=min(HH,zvb0+0.1*avmmol/max(avmmol,fricvel))
rvv=(zvb+0.5*HH)/zvb
rvv=(kappa/log(rvv))**2
end where
! end if
where (av .gt. 0)
rv=rvv*sqrt(uloc**2+vloc**2)
end where
#ifdef DEBUG
write(debug,*) 'Leaving bottom_friction()'
write(debug,*)
#endif
return
end subroutine bottom_friction
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2001 - Hans Burchard and Karsten Bolding !
!-----------------------------------------------------------------------

114
src/2d/cfl_check.F90

@ -0,0 +1,114 @@
!$Id: cfl_check.F90,v 1.1 2002-05-02 14:00:41 gotm Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: cfl_check() - barotropic residual currents.
!
! !INTERFACE:
subroutine cfl_check()
!
! !DESCRIPTION:
!
! !USES:
use parameters, only: g
use domain, only: imin,imax,jmin,jmax,H,az
#if defined(SPHERICAL) || defined(CURVILINEAR)
use domain, only: dyc,dxc
#else
use domain, only: dy,dx
#endif
use m2d, only: dtm
IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: cfl_check.F90,v $
! Revision 1.1 2002-05-02 14:00:41 gotm
! Initial revision
!
! Revision 1.7 2001/09/19 11:25:14 gotm
! Removed E2DFIELD when de-allocating lmask
!
! Revision 1.6 2001/09/19 11:20:32 bbh
! Explicit de-allocates memory when -DFORTRAN90
!
! Revision 1.5 2001/09/01 17:07:58 bbh
! Removed some print statements
!
! Revision 1.4 2001/08/01 08:25:52 bbh
! CURVILINEAR now implemented
!
! Revision 1.3 2001/04/20 14:03:39 bbh
! should not have deleted imin,imax,jmin,jmax :-)
!
! Revision 1.2 2001/04/20 13:47:33 bbh
! Fixed bug concerning optional argument
!
! Revision 1.1.1.1 2001/04/17 08:43:08 bbh
! initial import into CVS
!
!
! !LOCAL VARIABLES:
integer :: pos(2),max_pos(2),rc,i,j
REALTYPE :: h_max=-99.,c,max_dt,dtt
logical, dimension(:,:), allocatable :: lmask
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'CFL check'
allocate(lmask(E2DFIELD),stat=rc)
if (rc /= 0) stop 'cfl_check: Error allocating memory (lmask)'
lmask = .false.
lmask = (az .gt. 0)
h_max = maxval(H,mask = lmask)
pos = maxloc(H,mask = lmask)
#if defined(SPHERICAL) || defined(CURVILINEAR)
max_dt=1000000000.
do i=imin,imax
do j=jmin,jmax
if (H(i,j).gt.0) then
dtt=min(dxc(i,j),dyc(i,j))/sqrt(2.*g*H(i,j))
if (dtt.lt.max_dt) then
max_dt=dtt
max_pos(1)=i
max_pos(2)=j
end if
end if
end do
end do
LEVEL3 'max CFL number at depth=',H(max_pos(1),max_pos(2)),' at ',max_pos
LEVEL3 'at this position, dx = ',dxc(max_pos(1),max_pos(2)),' and dy = ',dyc(max_pos(1),max_pos(2))
#else
c = sqrt(g*h_max)
max_dt = min(dx,dy)/(c*sqrt(2.))
LEVEL3 'max depth=',h_max,' at ',pos
#endif
if (dtm .gt. max_dt) then
FATAL 'reduce time-step (',dtm,') below ',max_dt
stop 'cfl_check()'
else
LEVEL3 'used dt (',dtm,') is less than ',max_dt
end if
#ifdef FORTRAN90
deallocate(lmask,stat=rc)
if (rc /= 0) stop 'cfl_check: Error allocating memory (lmask)'
#endif
return
end subroutine cfl_check
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2001 - Hans Burchard and Karsten Bolding (BBH) !
!-----------------------------------------------------------------------

72
src/2d/coriolis.F90

@ -0,0 +1,72 @@
!$Id: coriolis.F90,v 1.1 2002-05-02 14:00:42 gotm Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: coriolis - 2D coriolis terms.
!
! !INTERFACE:
subroutine coriolis(D1,vel,avgvel,D,cor)
!
! !DESCRIPTION:
! This routine calculates the Corilis term - in both x and y direction
! on a Arakawa C-grid.
!
! !USES:
use domain, only: imin,imax,jmin,jmax,CORI
IMPLICIT NONE
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: D1(E2DFIELD)
REALTYPE, intent(in) :: vel(E2DFIELD)
REALTYPE, intent(in) :: D(E2DFIELD)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
REALTYPE, intent(out):: avgvel(E2DFIELD)
REALTYPE, intent(out):: cor(E2DFIELD)
!
! !REVISION HISTORY:
! Original author(s): Hans Burchard & Karsten Bolding
!
! $Log: coriolis.F90,v $
! Revision 1.1 2002-05-02 14:00:42 gotm
! Initial revision
!
! Revision 1.1.1.1 2001/04/17 08:43:07 bbh
! initial import into CVS
!
!
! !LOCAL VARIABLES:
integer :: i,j
!
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'Coriolis() # ',Ncall
#endif
do j=jmin,jmax
do i=imin,imax
avgvel(i,j)=0.25*( vel(i ,j )/D1(i ,j ) &
+vel(i+1,j )/D1(i+1,j ) &
+vel(i ,j-1)/D1(i ,j-1) &
+vel(i+1,j-1)/D1(i+1,j-1) )
cor(i,j)=Cori*D(i,j)*avgvel(i,j)
end do
end do
#ifdef DEBUG
write(debug,*) 'Leaving coriolis()'
write(debug,*)
#endif
return
end subroutine coriolis
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2001 - Hans Burchard and Karsten Bolding !
!-----------------------------------------------------------------------

137
src/2d/depth_update.F90

@ -0,0 +1,137 @@
!$Id: depth_update.F90,v 1.1 2002-05-02 14:00:42 gotm Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: depth_update - adjust the depth to new elevations.
!
! !INTERFACE:
subroutine depth_update
!
! !DESCRIPTION:
!
! !USES:
use commhalo, only: update_2d_halo,wait_halo,D_TAG,DV_TAG,DU_TAG
use domain, only: imin,imax,jmin,jmax,H,HU,HV,min_depth,crit_depth
use domain, only: az,au,av,dry_z,dry_u,dry_v
use variables_2d, only: D,z,zo,DU,zuo,zu,DV,zvo,zv
IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !REVISION HISTORY:
! Original author(s): Hans Burchard & Karsten Bolding
!
! $Log: depth_update.F90,v $
! Revision 1.1 2002-05-02 14:00:42 gotm
! Initial revision
!
! Revision 1.5 2001/08/27 11:53:13 bbh
! TVD-advection for momentum added, some bugs removed
!
! Revision 1.4 2001/06/22 08:19:10 bbh
! Compiler options such as USE_MASK and OLD_DRY deleted.
! Open and passive boundary for z created.
! Various inconsistencies removed.
! wait_halo added.
! Checked loop boundaries
!
! Revision 1.3 2001/05/18 13:03:34 bbh
! Optimize for speed + masks for update_2d_halo() - CHECK
!
! Revision 1.2 2001/05/03 19:35:01 bbh
! Use of variables_2d
!
! Revision 1.1.1.1 2001/04/17 08:43:07 bbh
! initial import into CVS
!
! !LOCAL VARIABLES:
integer :: i,j
REALTYPE :: d1,d2,x
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'depth_update() # ',Ncall
#endif
! Depth in elevation points
D = z+H
call update_2d_halo(D,D,az,imin,jmin,imax,jmax,D_TAG)
call wait_halo(D_TAG)
! U-points
do j=jmin,jmax
do i=imin,imax
zuo(i,j) = zu(i,j)
x=max(0.25*(zo(i,j)+zo(i+1,j)+z(i,j)+z(i+1,j)),-HU(i,j)+min_depth)
zu(i,j) = x
DU(i,j) = x+HU(i,j)
end do
end do
call update_2d_halo(DU,DU,au,imin,jmin,imax,jmax,DU_TAG)
call wait_halo(DU_TAG)
! V-points
do j=jmin,jmax
do i=imin,imax
zvo(i,j)=zv(i,j)
x = max(0.25*(zo(i,j)+zo(i,j+1)+z(i,j)+z(i,j+1)),-HV(i,j)+min_depth)
zv(i,j) = x
DV(i,j) = x+HV(i,j)
end do
end do
call update_2d_halo(DV,DV,av,imin,jmin,imax,jmax,DV_TAG)
call wait_halo(DV_TAG)
!kbk#ifdef DEBUG
do j=jmin,jmax
do i=imin,imax
if(D(i,j) .le. _ZERO_ .and. az(i,j) .gt. 0) then
STDERR 'D ',i,j,H(i,j),D(i,j)
end if
if(DU(i,j) .le. _ZERO_ .and. au(i,j) .gt. 0) then
STDERR 'DU ',i,j,HU(i,j),DU(i,j)
end if
if(DV(i,j) .le. _ZERO_ .and. av(i,j) .gt. 0) then
STDERR 'DV ',i,j,HV(i,j),DV(i,j)
end if
end do
end do
!kbk#endif
d1 = 2*min_depth
d2 = crit_depth-2*min_depth
dry_z = max(_ZERO_,min(_ONE_,(D-d1/2.)/d2))
dry_u = max(_ZERO_,min(_ONE_,(DU-d1)/d2))
dry_v = max(_ZERO_,min(_ONE_,(DV-d1)/d2))
#ifdef DEBUG
write(debug,*) 'Leaving depth_update()'
write(debug,*)
#endif
return
end subroutine depth_update
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2001 - Hans Burchard and Karsten Bolding !
!-----------------------------------------------------------------------

72
src/2d/divergence.F90

@ -0,0 +1,72 @@
!$Id: divergence.F90,v 1.1 2002-05-02 14:00:43 gotm Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: divergence
!
! !INTERFACE:
subroutine divergence()
!
! !DESCRIPTION:
!
! !USES:
use domain, only: imin,imax,jmin,jmax
use variables_2d, only: U,DU,V,DV,surfdiv
#if defined(SPHERICAL) || defined(CURVILINEAR)
use domain, only: arcd1,dxv,dyu
#else
use domain, only: ard1,dx,dy
#endif
IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !REVISION HISTORY:
! Original author(s): Hans Burchard & Karsten Bolding
!
! $Log: divergence.F90,v $
! Revision 1.1 2002-05-02 14:00:43 gotm
! Initial revision
!
! Revision 1.4 2001/08/01 08:25:52 bbh
! CURVILINEAR now implemented
!
! Revision 1.3 2001/05/25 18:48:12 bbh
! Needs fixing - use mask
!
! Revision 1.2 2001/05/06 18:51:55 bbh
! Towards proper implementation of specified 2D bdy.
!
! Revision 1.1.1.1 2001/04/17 08:43:08 bbh
! initial import into CVS
!
!
! !LOCAL VARIABLES:
integer :: i,j
!HB REALTYPE :: dxm1,dym1
!
!EOP
!-----------------------------------------------------------------------
!BOC
!HB dxm1 = _ONE_/dx
!HB dym1 = _ONE_/dy
return
do i=imin,imax
do j=jmin,jmax
STDERR i,j,DU(i,j),DU(i-1,j),DV(i,j),DV(i,j-1)
surfdiv(i,j) = ((U(i,j)/DU(i,j)*DYU-U(i-1,j)/DU(i-1,j)*DYUIM1) &
- (V(i,j)/DV(i,j)*DXV-V(i,j-1)/DV(i,j-1)*DXVJM1))*ARCD1
end do
end do
return
end subroutine divergence
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2001 - Hans Burchard and Karsten Bolding !
!-----------------------------------------------------------------------

138
src/2d/dynamic_allocations.h

@ -0,0 +1,138 @@
allocate(D(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (D)'
allocate(DU(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (DU)'
allocate(DV(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (DV)'
allocate(z(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (z)'
allocate(zo(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zo)'
allocate(zrold(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zrold)'
allocate(zrnew(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zrnew)'
allocate(zu(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zu)'
allocate(zuo(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zuo)'
allocate(zv(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zv)'
allocate(zvo(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (zvo)'
allocate(U(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (U)'
allocate(V(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_2d: Error allocating memory (V)'