Showing preview only (1,367K chars total). Download the full file or copy to clipboard to get everything.
Repository: geodynamics/seismic_cpml
Branch: master
Commit: 0d89aa3132f2
Files: 29
Total size: 1.3 MB
Directory structure:
gitextract_pzg7djl1/
├── .gitignore
├── AUTHORS
├── LICENSE
├── Makefile
├── README
├── README_seismic_cpml.html
├── analytical_solution_viscoacoustic_Carcione_version1.f90
├── analytical_solution_viscoelastic_2D_plane_strain_Carcione_correct_with_1_over_L.f90
├── attenuation_model_with_SolvOpt.f90
├── conversion_between_Qp_Qs_and_Qkappa_Qmu_from_Dahlen_Tromp_959_960_in_3D_and_in_2D_plane_strain.f90
├── email_from_Youshan_Liu_about_bug_in_the_original_fourth_order_Runge_Kutta_scheme.txt
├── explanation_from_Youshan_Liu_about_bug_in_the_original_fourth_order_Runge_Kutta_scheme.docx
├── plotall_fit_is_perfect_for_viscoelastic_fourth_order.gnu
├── seismic_ADEPML_2D_elastic_RK4_eighth_order.f90
├── seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.f90
├── seismic_CPML_2D_anisotropic.f90
├── seismic_CPML_2D_isotropic_fourth_order.f90
├── seismic_CPML_2D_isotropic_second_order.f90
├── seismic_CPML_2D_poroelastic_fourth_order.f90
├── seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic.f90
├── seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic.f90
├── seismic_CPML_2D_pressure_second_order.f90
├── seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic.f90
├── seismic_CPML_2D_velocity_and_stress_second_order_viscoelastic.f90
├── seismic_CPML_3D_isotropic_MPI_OpenMP.f90
├── seismic_CPML_3D_viscoelastic_MPI.f90
├── seismic_PML_Collino_2D_anisotropic_fourth.f90
├── seismic_PML_Collino_2D_isotropic.f90
└── seismic_PML_Collino_3D_isotropic_OpenMP.f90
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# 2D
xseismic_CPML_2D_isotropic_second_order
xseismic_CPML_2D_isotropic_fourth_order
xseismic_CPML_2D_anisotropic
xseismic_PML_Collino_2D_isotropic
xseismic_PML_Collino_2D_anisotropic_fourth
xseismic_ADEPML_2D_elastic_RK4_eighth_order
xseismic_ADEPML_2D_viscoelastic_RK4_eighth_order
# 3D
xseismic_CPML_3D_isotropic_MPI_OpenMP
xseismic_CPML_2D_poroelastic_fourth_order
xseismic_CPML_3D_viscoelastic_MPI
xseismic_PML_Collino_3D_isotropic_OpenMP
================================================
FILE: AUTHORS
================================================
Main historical authors: Dimitri Komatitsch, CNRS / University of Marseille, France
and Roland Martin, CNRS / University of Toulouse, France,
but several other people have contributed since then, see the comments at the beginning of each of the Fortran source files.
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
<http://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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
================================================
FILE: Makefile
================================================
#
# Makefile for SEISMIC_CPML Version 1.2, April 2015.
# Dimitri Komatitsch, CNRS, France
#
SHELL=/bin/sh
O = obj
# the MEDIUM_MEMORY flag is for large 3D runs, which need more than 2 GB of memory
# Portland
#F90 = pgf90
#MPIF90 = mpif90
#FLAGS = -fast -Mnobounds -Minline -Mneginfo -Mdclchk -Knoieee -Minform=warn -fastsse -tp amd64e -Msmart
#MEDIUM_MEMORY = -mcmodel=medium
#OPEN_MP = -mp
# Intel (leave option -ftz, which can be *critical* for performance)
#F90 = ifort
#MPIF90 = mpif90
#FLAGS = -O3 -xHost -vec-report0 -implicitnone -warn truncated_source -warn argument_checking -warn unused -warn declarations -warn alignments -warn ignore_loc -warn usage -check nobounds -ftz -stand f03
#FLAGS = -check all -debug -g -O0 -fp-stack-check -traceback -ftrapuv -vec-report0 -implicitnone -warn truncated_source -warn argument_checking -warn unused -warn declarations -warn alignments -warn ignore_loc -warn usage -check nobounds -ftz -stand f03
#MEDIUM_MEMORY = -mcmodel=medium
#OPEN_MP = -openmp -openmp-report1
# IBM xlf
#F90 = xlf_r
#MPIF90 = mpxlf_r
#FLAGS = -O3 -qfree=f90 -qhalt=w -qsave
#MEDIUM_MEMORY = -q64
#OPEN_MP = -qsmp=omp
# GNU gfortran
F90 = gfortran
MPIF90 = mpif90
FLAGS = -std=gnu -fimplicit-none -frange-check -O3 -fmax-errors=10 -pedantic -pedantic-errors -Waliasing -Wampersand -Wcharacter-truncation -Wline-truncation -Wsurprising -Wno-tabs -Wunderflow
MEDIUM_MEMORY = -mcmodel=medium
#OPEN_MP = -fopenmp
default: clean seismic_CPML_2D_pressure_second_order seismic_CPML_2D_isotropic_second_order seismic_CPML_2D_isotropic_fourth_order seismic_CPML_2D_anisotropic seismic_PML_Collino_2D_isotropic seismic_PML_Collino_3D_isotropic_OpenMP seismic_CPML_3D_isotropic_MPI_OpenMP seismic_CPML_2D_poroelastic_fourth_order seismic_CPML_3D_viscoelastic_MPI seismic_PML_Collino_2D_anisotropic_fourth seismic_ADEPML_2D_elastic_RK4_eighth_order seismic_ADEPML_2D_viscoelastic_RK4_eighth_order seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic seismic_CPML_2D_velocity_and_stress_second_order_viscoelastic
all: default
clean:
/bin/rm -f *.o xseismic_CPML_2D_pressure_second_order xseismic_CPML_2D_isotropic_second_order xseismic_CPML_2D_isotropic_fourth_order xseismic_CPML_2D_anisotropic xseismic_PML_Collino_2D_isotropic xseismic_CPML_3D_isotropic_MPI_OpenMP xseismic_PML_Collino_3D_isotropic_OpenMP xseismic_CPML_2D_poroelastic_fourth_order xseismic_CPML_3D_viscoelastic_MPI xseismic_PML_Collino_2D_anisotropic_fourth xseismic_ADEPML_2D_elastic_RK4_eighth_order xseismic_ADEPML_2D_viscoelastic_RK4_eighth_order xseismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic xseismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic xseismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic xseismic_CPML_2D_velocity_and_stress_second_order_viscoelastic
seismic_CPML_2D_velocity_and_stress_second_order_viscoelastic:
$(F90) $(FLAGS) -o xseismic_CPML_2D_velocity_and_stress_second_order_viscoelastic seismic_CPML_2D_velocity_and_stress_second_order_viscoelastic.f90
seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic:
$(F90) $(FLAGS) -o xseismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic.f90
seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic:
$(F90) $(FLAGS) -o xseismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic.f90
seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic:
$(F90) $(FLAGS) -o xseismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic.f90
seismic_ADEPML_2D_elastic_RK4_eighth_order:
$(F90) $(FLAGS) -o xseismic_ADEPML_2D_elastic_RK4_eighth_order seismic_ADEPML_2D_elastic_RK4_eighth_order.f90
seismic_ADEPML_2D_viscoelastic_RK4_eighth_order:
$(F90) $(FLAGS) -o xseismic_ADEPML_2D_viscoelastic_RK4_eighth_order seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.f90
seismic_CPML_2D_poroelastic_fourth_order:
$(F90) $(FLAGS) -o xseismic_CPML_2D_poroelastic_fourth_order seismic_CPML_2D_poroelastic_fourth_order.f90
seismic_CPML_2D_pressure_second_order:
$(F90) $(FLAGS) -o xseismic_CPML_2D_pressure_second_order seismic_CPML_2D_pressure_second_order.f90
seismic_CPML_2D_isotropic_second_order:
$(F90) $(FLAGS) -o xseismic_CPML_2D_isotropic_second_order seismic_CPML_2D_isotropic_second_order.f90
seismic_CPML_2D_isotropic_fourth_order:
$(F90) $(FLAGS) -o xseismic_CPML_2D_isotropic_fourth_order seismic_CPML_2D_isotropic_fourth_order.f90
seismic_CPML_2D_anisotropic:
$(F90) $(FLAGS) -o xseismic_CPML_2D_anisotropic seismic_CPML_2D_anisotropic.f90
seismic_PML_Collino_2D_isotropic:
$(F90) $(FLAGS) -o xseismic_PML_Collino_2D_isotropic seismic_PML_Collino_2D_isotropic.f90
seismic_PML_Collino_2D_anisotropic_fourth:
$(F90) $(FLAGS) -o xseismic_PML_Collino_2D_anisotropic_fourth seismic_PML_Collino_2D_anisotropic_fourth.f90
seismic_PML_Collino_3D_isotropic_OpenMP:
$(F90) $(FLAGS) $(MEDIUM_MEMORY) $(OPEN_MP) -o xseismic_PML_Collino_3D_isotropic_OpenMP seismic_PML_Collino_3D_isotropic_OpenMP.f90
seismic_CPML_3D_isotropic_MPI_OpenMP:
$(MPIF90) $(FLAGS) $(MEDIUM_MEMORY) $(OPEN_MP) -o xseismic_CPML_3D_isotropic_MPI_OpenMP seismic_CPML_3D_isotropic_MPI_OpenMP.f90
seismic_CPML_3D_viscoelastic_MPI:
$(MPIF90) $(FLAGS) $(MEDIUM_MEMORY) $(OPEN_MP) -o xseismic_CPML_3D_viscoelastic_MPI seismic_CPML_3D_viscoelastic_MPI.f90
================================================
FILE: README
================================================
seismic_cpml
============
SEISMIC_CPML is a set of twelve open-source Fortran90 programs to solve the two-dimensional or three-dimensional isotropic or anisotropic elastic, viscoelastic or poroelastic wave equation using a finite-difference method with Convolutional or Auxiliary Perfectly Matched Layer (C-PML or ADE-PML) conditions, developed by Dimitri Komatitsch and Roland Martin from CNRS, France.
See README_seismic_cpml.html in this directory for more details.
================================================
FILE: README_seismic_cpml.html
================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>The SEISMIC_CPML software package</title>
<meta name="generator" content="LibreOffice 5.1.6.2 (Linux)"/>
<meta name="created" content="00:00:00"/>
<meta name="changedby" content="Dimitri Komatitsch"/>
<meta name="changed" content="2018-07-12T23:19:48.535278496"/>
</head>
<body lang="en-US" background="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEJ7AnsAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wAALCACAAIABAREA/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEBAAA/APaI3Z1AY5IOM5/z/n9XiTY2CTwew4A4OD7U87JUPGT2x0P+f60+ADgAnaeobt+PrUci7gVwDg4IIIP19hUQQ5JPJHQ4z+Y71M+BCgYAEnJI6f55owRHkYIPHHSmqoIAYAnP1I7U+RVPBXCk8c/UZBNQ/KVYYBfbkEnkH09fw/nTQFyASQcbQDjnjpnpT40YEMoIBOADjkH/APXR5jk87hxgjPX1p+WZfnO4dcHkDr2qNyNhKqFIHPb/AD+lJBwzLjI9QadMqb8ggEnketIjckkYPtnnpUjqS5ZPlPoO/wBP8afuE6kDIlAzkd/YilRCSAcZxnjuPWmyqGPTcijJz/hQoxkZyOgI/wA8U0jLhWAXd0JyQe1SNwABzxnJ6H3H+NQNGSA6k5xyMcn8B7ClRFKKwHDevbseaczbRtUrxzzmoRjpjIHTnpUyLvCg5BBx1wRTJRlmjPXuQcce/wCdRxt8wOMAdcdqnmGRuxkdOn6n3qLayfOCM56Adf8AE0by45JJHQ55/P8AKpY0/j3KvPfoaladWlKdQOCQOvvTSmGGxgcDPcH8KFk4IBGenPc+4oSQScAck8r/AFBqUoyoQfmz0GOn0FVlBMwZcj156H39ee9TlQFyAM5yQe3GPw6f5zVaZeCVJB/nUagsuWPK8g44pwZkKgA4AyM9KJwxw4OeNpAPT6e3WpxGGjDDp9OneoS2w89vX06daUu2OC2OuM5B/ClKlwSCMdwSePb6UFcLjHPXAOaFTLEA456Z5zjtT84AAIAPH1NQJLiQFuQOM56dqawKMGUcEZ68f/q/+tVlpZDhXOCDw+OP8/596a8iA7mUnPIwefXI9amBXAZTkHkg8Z9qilG7g8E8jI4NQCPA4JBxgEd/binDCtg8d/YelSFwiqAFIc4yRyBx0/OovMZOUY7s8gf55FTM+5QVRCMZPAxj1z+mP8aI1UsTyRnoAOPpj+VSNz0DYPUHoOo49KaUBBBGB1AP9KqyEq20MQO2Tx9P/r0/53GC3I5J/wA/lTHXDcnjpz6+mKeB5kRDHJUcEdh9f8imo2VxwTjgZ/z+X0pY2YEEAEKclG5BPTj0Pv8A5M3mRMThCMdR19v8/h61JId4UZBX1H+eDUQQ5BHIHUc5FKdgwWIJJwBjkn0FQs7OceWAoPG3JwOvNG7ceQMHuD/n3pqyGIsAcLnJB7f5/GpJ04DgArnBwBgfgf502R2Zd2SMjJwT+lMjndQVZs46bv6nr/L/AAlyk45BQrwT1H+P+fpTo0LH5W3cZIH5dOo6d6JIGVtufmK8Y/8ArfjTVKRDb5bHdxk/wjnn36+1QupiYsM4zg//AKqlRwQQcYJxyMEflSqCSPXpnnj8alU7DgcZPOeh9iP6/wD1zTwuTx164PUfQ96gb5mBBIx09/wpq/I2TyD6HmmlsMAW5x37/iaRWRshlYccgKP8/wCfzcJAAUYEpnIx/IfrQEBYKAxAGMEjIH4cflSqkZPJwRzgsCD7VIuxJgqMFUj5sAk/gaQxRKCTuHOASAc+vA7UnlQuCgbaOgBGOP6U1WcMUxuAHc4APYn8qWUkkqBuIGPTI/x5/wA8UyNeByOmRkYyOTj/AD6Up/dkbj1OR6fj/ntTw4Awc46EY6VLv2x5AVgDgH07j/8AVTWZDhiME8nH86iYAkkEgnvikQDqQT6Y7+2aRhjBU8jjJzkD/D/GhSHOGDAng5/nUijGIiAQPut0/A47f57U0xLuJyVOMEHt2qR4XRQqHlhnk9aifzFGBtJzg47D8PrTQRjcwGRznOT+lSmdANpAI6cYyP8A61NYMeVw6no2f504MjkE7lYcNjv6nFKwyoDcDd1I/Ht/n+VMVG4C8AcZB4P9aep2jGCcnB9/pn/P8qUoC+4ZBxjPUH2I9Pzolj2nJUgkckH/ADmkjkRxlwy5OPUD/Ae3NDIdvBBUjIPXj3B/CohtwQdw7YHUe36VIAc5+8OhyRke/wD+qneYUPKAnPBOcfSo5LgyMWzweMdh7UhIJxwDjk/rx2JoyEQMAAehxnn8KjWMOx/eBSOxyefw6VMkDqSA4Kg8lSCPx/8Ar1JhQ+4DDcAZz+vPPX2/Wp/LRlAKAKxwctyR2IprSEDbGAFHTA5+tVxcMwwOBnnj9AR/npT4iXYbieuDk/ngj/61S3DYUmP5to5Ujgj/AB6CoJY8SZT7p5wT9M/h+VVyWikGwlTjnrz9cdepqcOk2I5CA2MBlABHXrT0tFBZjKHQDnt/+oUnkDG0kt6EHOf8+tNmgLATInYBgPbjPv2pjMAcKcj0IPH+eKarAHDj5CMEg/XkfzqdYG3n5sjGeg6/zocjoQwAHY+361CJNjbSQOeDnrUyysylkOWXgDGQR9KcsKSLmEkHGSvp9B6VCYCjEgHjggfWnq+eAMDPOOTUkbDdhu4xzzn65omDNEoBJweAO/8AWqrYcYJyeoJ+nc/hQGKLkDgtjP5VLgghgcHGBz0/Gnht52n5X7N0B/z6iml5o3+Zjj8weP8A64pBslBG3bIo/hJwR147/hUHfOcY4zz/ADHPfNWY59kflPuIB+VgenHSmuN8YdTuA7jp9COx6VAVLEEAHPUZxj65p1ruEnBHIzxirEqujblBBzk46g+v0pgumZgsoUjpkdf/AK/0okUDJBBA79jTlZeh69s9fekhZR8o545Gen4UksQB3oeD6/y9e/8AOogu6PGQBu44GM/4fpyPxfEfkwcZ9+3+cdqkBGCAcjp/n1pCzRrjAKdx0/z+tKsW754zznlTxg57H/PfrUo8tkbeNsg+9gdfwqHNuBgq/wCAxx/X/wDXUkUcRB27ue2eOn6dKZJGiknLEg5IxzimCVQD5a7XI5DEn0HB+hpvzxScksMc57jH+R/nFJJEB86nIPUYwQfSlUEAjsRgjt+NNbhsE9TgcfpRtd34BB6gen41ODn7y5U8EDr9RSC3AjBUhgeenIPr7d6QwyMu5ASwOCDgAn1waRHBO1gVJ9sZp7tlcAjPv3pinapZVJ9cHBH4d6czCQCXfhhwS3Gf8/lSdBgrgdDx0PHUflSMhVQ0RJDDJHXB44Pv/nmlE2SVdMkdM9u1MEeyUEH5T1BPI7df/wBVKWYMVIIUDj/63t1oAO0g5K5wD6e/+cUvQcYBzkDsetLs43AZI5z0zT5dsRION4GQM/lwKazsFCqDg/MMjr6Cp1BMOUPI5INMfDEbSeT3PQ1HJC4YAMDjqM89uDnjtUTnbwxIIGAff6d6dG2xsHGOhz6en+elStGNxRCQrjAJ9euPTqP1/OJJN48sj5c8c9PpVlTiUBNqx9+eDx69/wD9VQ3DxSPt24x0I/wqMMUU7jkDjIPXnuDTTMXUEYIxjkAY6/0pQSGJBwe/HB9j/h/kWVO8ZIxxk4oMZADEYGcZIquQS2M4wcc/p9OMU1lIb5yc9QSev0/OrUBGQucg9aRozGW24IA5wPwJxURlHljGScdxz09f8/rSM2VAxkZzjOD17H/P49l8puqjOTnGMmpHkEYAAwcZIOcD8aiYBSr7jgnBGOh649+P5GpV2mPawA5yueCD6ewqtJExG8AYJxgNn/PpU8UG+IjIBxkHt+NQojhWyAT6ZGfyqeLY/LKBgclfx/XtS5OMAgnOQF4BH4/Q0Mxddv3T19j/AJzTykYi27Np+uf1qJo325Rgw64zyB701CqAkqVOc5GeamcZXcBkMDu5/lnrwc+nFV8bHyckdieeP59ulIwwQA2eMkY5/L0qdDsQsRn0FD4lDMeTjselMWUoRgEDOCemfy70krMGJ+YoDwc9fX+R+n40wkBe+fTv/njpUiSOijpgc8HqKch3y7iAB1JH05wKVmcsQEYA9cD9ST/nioDleCec578+vPr/AIGpYyhJLEke3r9T9MV//9k=" dir="ltr">
<p><a href="http://komatitsch.free.fr/">Home page of Dimitri
Komatitsch</a></p>
<p align="center"><a name="_x0000_i1025"></a><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ4AAAAeCAMAAADq61eRAAADAFBMVEUAAAD///8AzGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////iU7EIAAABB0lEQVR4nO2U7Q6DMAhFCe//0MsSP+ByYbX8sEtKssX22uOxoqJLl7wtUNfW69TW69Q/6cm37iM5xm6SH51Dk5TYGkL17FqiF2JCdpcvsW/ouasjlWEf6BkCnHnBXHwMVZyeIZnFiK0guZ5fGvR+kc1u4E2rWv9Jvegadu+eoXqIh7mGntquwY6Jsfs90HO9RyCpnnoj1IO4qZdCcj2zQ0zPx8cz0Tk9TSGVnuZvbozn9GAwrHeGiV6MRSToDb65jjSs5z9skYO7h2TTpHjXFXbs4dp+ExjEWN0/6VhCZT3jIbicgbTWS8iISLDTetdOcz2IqZ49J8E29NarrdeprdeprdepxfU+YbUcyfgWpCYAAAAASUVORK5CYII=" name="graphics1" align="bottom" width="158" height="30" border="0"/>
</p>
<p> </p>
<p><font color="#ff0000"><font size="3" style="font-size: 13pt">SEISMIC_CPML
is a set of </font></font><font color="#ff0000"><font size="3" style="font-size: 13pt">fourteen</font></font><font color="#ff0000">
</font><font color="#ff0000"><font size="3" style="font-size: 13pt">open-source
Fortran90 programs under the GNU GPL version </font></font><font color="#ff0000"><font size="3" style="font-size: 13pt">3</font></font><font color="#ff0000"><font size="3" style="font-size: 13pt">
license</font></font> <font size="3" style="font-size: 13pt">to solve
the two-dimensional or three-dimensional isotropic or anisotropic
acoustic, elastic, viscoelastic or poroelastic wave equation using a
finite-difference method with Convolutional or Auxiliary Perfectly
Matched Layer (C-PML or ADE-PML) conditions, developed by Dimitri
Komatitsch and Roland Martin from CNRS, France. Contributions by
other authors have recently been added.</font>
</p>
<p><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">You
can get the full source code of the programs at the official Web
site: <a href="http://geodynamics.org/cig/software/seismic_cpml">http://geodynamics.org/cig/software/seismic_cpml</a></font></font></p>
<p><font size="3" style="font-size: 13pt">The codes are then
self-explanatory and very easy to use; to understand how to use them
just edit the source codes and read the comments they contain.</font></p>
<p><font size="3" style="font-size: 13pt">The unsplit <b>Convolutional
Perfectly Matched Layer (C-PML) for the 3D elastic wave equation</b>
was introduced and is described in detail in: </font>
</p>
<p><font size="3" style="font-size: 13pt"><b>Dimitri Komatitsch and
Roland Martin,</b></font> <span style="font-variant: normal"><font size="3" style="font-size: 13pt"><span style="font-style: normal">An
unsplit convolutional Perfectly Matched Layer improved at grazing
incidence for the seismic wave equation</span></font></span><font size="3" style="font-size: 13pt"><i>,
Geophysics</i></font><font size="3" style="font-size: 13pt">, vol.
72(5), p SM155-SM167, doi: 10.1190/1.2757586 (2007). <a href="http://komatitsch.free.fr/preprints/geophysics_CPML_2007_elastic_typos_fixed.pdf">Preprint</a>
<a href="http://komatitsch.free.fr/bibtex_komatitsch.bib">BibTeX</a></font></p>
<p><font size="3" style="font-size: 13pt">It was originally developed
for Maxwell's equations by Roden and Gedney (2000) (see reference
below).</font></p>
<p><font size="3" style="font-size: 13pt">An extension to
viscoelastic media is developed in:</font></p>
<p><font size="3" style="font-size: 13pt"><b>Roland Martin and
Dimitri Komatitsch, </b></font><font size="3" style="font-size: 13pt">An
unsplit convolutional perfectly matched layer technique improved at
grazing incidence for the viscoelastic wave equation, </font><font size="3" style="font-size: 13pt"><i>Geophysical
Journal International</i></font><font size="3" style="font-size: 13pt">,
vol. 179(1), p. 333-344, </font><span style="font-variant: normal"><font face="serif"><font size="3" style="font-size: 13pt"><span style="font-style: normal">doi:
10.1111/j.1365-246X.2009.04278.x </span></font></font></span><font size="3" style="font-size: 13pt">(2009).</font>
<font face="serif"><font size="3" style="font-size: 13pt"><a href="http://komatitsch.free.fr/preprints/GJI_CPML_2009_viscoelastic.pdf">Preprint</a>
<a href="http://komatitsch.free.fr/bibtex_komatitsch.bib">BibTeX</a></font></font></p>
<p><font size="3" style="font-size: 13pt">and the viscoelastic
parameters of the Zener body model used to fit a constant-Q model are
computed based upon:</font></p>
<p><font face="serif"><font size="3" style="font-size: 13pt"><b>Émilie
Blanc, Dimitri Komatitsch, Emmanuel Chaljub, Bruno</b></font></font>
<font face="serif"><font size="3" style="font-size: 13pt"><b>Lombard
and Zhinan Xie</b></font></font><font face="serif"><font size="3" style="font-size: 13pt">,
Highly-accurate stability-preserving optimization of the Zener
viscoelastic model, with application to wave propagation in the
presence of strong attenuation, </font></font><font face="serif"><font size="3" style="font-size: 13pt"><i>Geophysical
Journal International,</i></font></font> <span style="font-variant: normal"><font face="serif"><font size="3" style="font-size: 13pt"><span style="font-style: normal">vol.
205(1), p. 427-439, </span></font></font></span><font face="serif"><font size="3" style="font-size: 13pt">doi:
10.1093/gji/ggw024</font></font> <font face="serif"><font size="3" style="font-size: 13pt">(2016).</font></font>
<font face="serif"><font size="3" style="font-size: 13pt"><a href="http://komatitsch.free.fr/preprints/GJI_Lombard_2016.pdf">Preprint</a>
<a href="http://komatitsch.free.fr/bibtex_komatitsch.bib">BibTeX</a></font></font></p>
<p><br/>
<br/>
</p>
<p><font size="3" style="font-size: 13pt">An extension to poroelastic
media is developed in:</font></p>
<p><font size="3" style="font-size: 13pt"><b>Roland Martin, Dimitri
Komatitsch and Abdelaâziz Ezziani</b></font><font size="3" style="font-size: 13pt">,
</font><span style="font-variant: normal"><font size="3" style="font-size: 13pt"><span style="font-style: normal">An
unsplit convolutional Perfectly Matched Layer improved at grazing
incidence for seismic wave propagation in poroelastic media</span></font></span><font size="3" style="font-size: 13pt"><i>,
Geophysics</i></font><font size="3" style="font-size: 13pt">, vol.
73(4), p T51-T61, doi: 10.1190/1.2939484 (2008). <a href="http://komatitsch.free.fr/preprints/geophysics_CPML_2008_poroelastic_typos_fixed.pdf">Preprint</a>
<a href="http://komatitsch.free.fr/bibtex_komatitsch.bib">BibTeX</a></font></p>
<p><font size="3" style="font-size: 13pt">and a variational
formulation is developed in:</font></p>
<p><font size="3" style="font-size: 13pt"><b>Roland Martin, </b></font><font face="serif"><font size="3" style="font-size: 13pt"><b>Dimitri
Komatitsch</b></font></font> <font size="3" style="font-size: 13pt"><b>and
Stephen D. Gedney</b></font><font size="3" style="font-size: 13pt">,
A variational formulation of a stabilized unsplit convolutional
perfectly matched layer for the isotropic or anisotropic seismic wave
equation, </font><font size="3" style="font-size: 13pt"><i>Computer
Modeling in Engineering and Sciences</i></font><font size="3" style="font-size: 13pt">,
vol. 37(3), p. 274-304 (2008). </font><font face="serif"><font size="3" style="font-size: 13pt"><a href="http://komatitsch.free.fr/preprints/CMES_CPML_2008_typos_fixed.pdf">Preprint</a>
<a href="http://komatitsch.free.fr/bibtex_komatitsch.bib">BibTeX</a></font></font></p>
<p><font size="3" style="font-size: 13pt">An extension to
higher-order time schemes, called ADE-PML (Auxiliary Differential
Equation - PML) is developed in:</font></p>
<p><font face="serif"><font size="4" style="font-size: 14pt"><b>Roland
Martin, Dimitri Komatitsch, Stephen D. Gedney and Émilien Bruthiaux</b></font></font><font face="serif"><font size="4" style="font-size: 14pt">,
A high-order time and space formulation of the unsplit perfectly
matched layer for the seismic wave equation using Auxiliary
Differential Equations (ADE-PML), </font></font><font face="serif"><font size="4" style="font-size: 14pt"><i>Computer
Modeling in Engineering and Sciences</i></font></font><font face="serif"><font size="4" style="font-size: 14pt">,
vol. 56(1), p. 17-42 (2010).</font></font> <font size="3" style="font-size: 13pt"><a href="http://komatitsch.free.fr/preprints/CMES_ADE_PML_2010.pdf">Preprint</a>
<a href="http://komatitsch.free.fr/bibtex_komatitsch.bib">BibTeX</a></font></p>
<p><font size="3" style="font-size: 13pt">Note that in the case of an
anisotropic medium the modification made is not strictly speaking
perfectly matched any more, i.e., not a PML, but rather </font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">a
“Modified PML / M-PML” based on Meza-Fajardo and Papageorgiou,
</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><i>Bulletin
of the Seismological Society of America</i></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">,
vol. 98(4), p. 1811-1836 (2008). H</font></font><font size="3" style="font-size: 13pt">owever,
it works well in practice even if it is not perfectly matched any
more from a mathematical point of view.</font></p>
<p><font color="#ff0000"><font size="3" style="font-size: 13pt"><b>IMPORTANT:
all of our codes are written in Fortran; if you have written or if
you write a C or C++ version of some of these codes and want to make
them open source (GNU GPL version 3) and part of the package, please
do not hesitate to send them to us, we will add them to our tar file
and will acknowledge you as the author.</b></font></font></p>
<p><font size="3" style="font-size: 13pt">This software is governed
by the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html">GNU GPL
version </a></font><a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><font size="3" style="font-size: 13pt">3</font><font size="3" style="font-size: 13pt">
license</font></a><font size="3" style="font-size: 13pt">.</font></p>
<p><font size="3" style="font-size: 13pt">If you use this code for
your own research, please cite some (or all) of these articles:</font></p>
<p><font face="Courier 10 Pitch"><font size="3" style="font-size: 13pt">@ARTICLE{BlKoChLoXi16,
<br/>
title = {Highly accurate stability-preserving optimization of
the {Z}ener viscoelastic model, with application to wave propagation
in the presence of strong attenuation}, <br/>
author = {\'Emilie
Blanc and Dimitri Komatitsch and Emmanuel Chaljub and Bruno Lombard
and Zhinan Xie}, <br/>
journal = {Geophysical Journal
International},<br/>
year = {2016}, <br/>
number = {1}, <br/>
pages =
{427-439}, <br/>
volume = {205}, <br/>
doi = {10.1093/gji/ggw024}} </font></font>
</p>
<p><font face="Courier 10 Pitch"><font size="3" style="font-size: 13pt">@ARTICLE{MaKo09,<br/>
author
= {Roland Martin and Dimitri Komatitsch},<br/>
title = {An unsplit
convolutional perfectly matched layer technique improved at grazing
incidence for the viscoelastic wave equation},<br/>
journal =
{Geophysical Journal International},<br/>
year = {2009},<br/>
volume
= {179},<br/>
number = {1},<br/>
pages = {333-344},<br/>
doi =
{10.1111/j.1365-246X.2009.04278.x}}<br/>
<br/>
@ARTICLE{MaKoEz08,<br/>
author
= {Roland Martin and Dimitri Komatitsch and Abdelaaziz
Ezziani},<br/>
title = {An unsplit convolutional perfectly matched
layer improved at grazing incidence for seismic wave equation in
poroelastic media},<br/>
journal = {Geophysics},<br/>
year =
{2008},<br/>
volume = {73},<br/>
pages = {T51-T61},<br/>
number =
{4},<br/>
doi = {10.1190/1.2939484}}<br/>
<br/>
@ARTICLE{MaKoGe08,<br/>
author
= {Roland Martin and Dimitri Komatitsch and Stephen D. Gedney},<br/>
title
= {A variational formulation of a stabilized unsplit convolutional
perfectly matched layer for the isotropic or anisotropic seismic wave
equation},<br/>
journal = {Computer Modeling in Engineering and
Sciences},<br/>
year = {2008},<br/>
volume = {37},<br/>
pages =
{274-304},<br/>
number = {3}}</font></font></p>
<p><font face="Courier 10 Pitch"><font size="3" style="font-size: 13pt">@ARTICLE{MaKoGeBr10,<br/>
author
= {Roland Martin and Dimitri Komatitsch and Stephen D. Gedney and
Emilien Bruthiaux},<br/>
title = {A high-order time and space
formulation of the unsplit perfectly matched layer for the seismic
wave equation using {Auxiliary Differential Equations
(ADE-PML)}},<br/>
journal = {Computer Modeling in Engineering and
Sciences},<br/>
year = {2010},<br/>
volume = {56},<br/>
pages =
{17-42},<br/>
number = {1}}</font></font></p>
<p><font face="Courier 10 Pitch"><font size="3" style="font-size: 13pt">@ARTICLE{KoMa07,<br/>
author
= {Dimitri Komatitsch and Roland Martin},<br/>
title = {An unsplit
convolutional {P}erfectly {M}atched {L}ayer improved at grazing
incidence for the seismic wave equation},<br/>
journal =
{Geophysics},<br/>
year = {2007},<br/>
volume = {72},<br/>
number =
{5},<br/>
pages = {SM155-SM167},<br/>
doi = {10.1190/1.2757586}}</font></font></p>
<p><br/>
<br/>
</p>
<p><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">Roden
and Gedney's original article for Maxwell's equations
is:</font></font><font face="Liberation Serif, serif"><font size="1" style="font-size: 6pt"><br/>
<br/>
<br/>
</font></font><font face="Courier 10 Pitch"><font size="3" style="font-size: 13pt">@ARTICLE{RoGe00,<br/>
author
= {J. A. Roden and S. D. Gedney},<br/>
title = {Convolution {PML}
({CPML}): {A}n Efficient {FDTD} Implementation of the {CFS}-{PML} for
Arbitrary Media},<br/>
journal = {Microwave and Optical Technology
Letters},<br/>
year = {2000},<br/>
volume = {27},<br/>
number =
{5},<br/>
pages = {334-339},<br/>
doi =
{10.1002/1098-2760(20001205)27:5<334::AID-MOP14>3.0.CO;2-A}}</font></font><font face="Courier New, monospace"><font size="3" style="font-size: 13pt"><br/>
</font></font><a href="http://www.geodynamics.org/cig/software/"><font face="Liberation Serif, serif"><font size="1" style="font-size: 6pt"><b><br/>
<br/>
</b></font></font></a><font size="3" style="font-size: 13pt">The
package is composed of the following </font><font size="3" style="font-size: 13pt">fourteen</font><font size="3" style="font-size: 13pt">
programs:</font></p>
<p><br/>
<br/>
</p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_pressure_second_order.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for an acoustic</font></font> <font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">medium
using a second-order finite-difference spatial operator </font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">for
the pressure equation written as a second-order system in time</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for a </font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">visco</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">acoustic
medium using a second-order finite-difference spatial operator </font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">for
the velocity and pressure equation written as a split first-order
system in time</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for a</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">
visco</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">acoustic
medium using a </font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">fourth</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">-order
finite-difference spatial operator </font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">for
the velocity and pressure equation written as a split first-order
system in time</font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_isotropic_second_order.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for an elastic isotropic medium using a second-order
finite-difference spatial operator.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_isotropic_fourth_order.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for an elastic isotropic medium using a fourth-order
finite-difference spatial operator.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_anisotropic.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for an elastic anisotropic medium using a
second-order finite-difference spatial operator. More precisely we
implement a “Modified PML / M-PML” based on Meza-Fajardo and
Papageorgiou, </font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><i>Bulletin
of the Seismological Society of America</i></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">,
vol. 98(4), p. 1811-1836 (2008). Strictly speaking the layers are not
perfectly matched any more from a mathematical point of view, but the
code works well in practice.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_2D_poroelastic_fourth_order.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D C-PML program for a poroelastic medium using a fourth-order
finite-difference spatial operator.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_ADEPML_2D_elastic_RK4_eighth_order.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D ADE-PML program for an isotropic elastic medium using an
eighth-order finite-difference spatial operator and fourth-order
Runge-Kutta implicit, semi implicit or explicit time scheme.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D ADE-PML program for an isotropic viscoelastic medium using an
eighth-order finite-difference spatial operator and fourth-order
Runge-Kutta implicit, semi implicit or explicit time scheme.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_PML_Collino_2D_isotropic.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D classical split PML program for an isotropic medium using a
second-order finite-difference spatial operator, for comparison.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_PML_Collino_2D_anisotropic_fourth.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
2D classical split PML program for an anisotropic medium using a
fourth-order finite-difference spatial operator, for comparison.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_3D_isotropic_MPI_OpenMP.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
3D C-PML program for an isotropic medium using a second-order
finite-difference spatial operator. Parallel implementation based on
both MPI and OpenMP.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_PML_Collino_3D_isotropic_OpenMP.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
3D classical split PML program for an isotropic medium using a
second-order finite-difference spatial operator, for comparison.
Parallel implementation based on OpenMP.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>seismic_CPML_3D_viscoelastic_MPI.f90</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
3D C-PML program for a viscoelastic medium using a fourth-order
finite-difference spatial operator. Parallel implementation based on
MPI.</font></font></p>
<p><font color="#ff0000"><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt"><b>Makefile</b></font></font></font><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">:
a standard Makefile. You can type “make all” to compile all the
codes.</font></font></p>
<p><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">For
more details about the classical PML, see for instance <a href="http://en.wikipedia.org/wiki/Perfectly_Matched_Layer">Wikipedia
about PML</a>.</font></font></p>
<p><font face="Liberation Serif, serif"><font size="3" style="font-size: 13pt">For
more details about finite differences in the time domain (FDTD), see
for instance <a href="http://en.wikipedia.org/wiki/Finite-difference_time-domain_method">Wikipedia
about FDTD</a>.</font></font></p>
<p><a href="http://komatitsch.free.fr/"><font size="3" style="font-size: 13pt">Home
page of Dimitri Komatitsch</font></a></p>
</body>
</html>
================================================
FILE: analytical_solution_viscoacoustic_Carcione_version1.f90
================================================
program analytical_solution
!! DK DK to compare to our finite-difference codes from SEISMIC_CPML or SOUNDVIEW,
!! DK DK we divide the source by 4 * PI * cp^2 to get the right amplitude (our convention being to use a source of amplitude 1,
!! DK DK while the convention used by Carcione in his 1988 paper is to use a source of amplitude 4 * PI * cp^2
! this program implements the analytical solution for a viscoacoustic medium
! from Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
!! DK DK Dimitri Komatitsch, CNRS Marseille, France, April 2017
!! DK DK adapted from a program written for the viscoelastic case by Jose' M. Carcione.
implicit none
! compute the non-viscoacoustic case as a reference if needed, i.e. turn attenuation off
logical, parameter :: TURN_ATTENUATION_OFF = .false. ! .true.
!! DK DK Dimitri Komatitsch, CNRS Marseille, France, October 2015:
!! DK DK by default I turned off the fix for attenuation causality (using the unrelaxed velocities
!! DK DK as reference instead of the relaxed ones) because it is not useful any more,
!! DK DK this modification was not consistent with the calculations of the tau values
!! DK DK made by Carcione et al. 1988 and by Carcione 1993.
!! Comment from Quentin Brissaud, March 2018:
!! This flag will tell the code that the input velocities are the relaxed one (omega -> zero frequency)
!! instead of the unrelaxed ones (by default omega -> + infinity)
logical, parameter :: FIX_ATTENUATION_CAUSALITY = .true.
integer, parameter :: iratio = 64
integer, parameter :: nfreq = 524288
integer, parameter :: nt = iratio * nfreq
double precision, parameter :: freqmax = 1000.d0 ! 225.d0
!! DK DK to print the velocity if we want to display the curve of how velocity varies with frequency
!! DK DK for instance to compute the unrelaxed velocity in the Zener model
! double precision, parameter :: freqmax = 20000.d0
double precision, parameter :: freqseuil = 0.00005d0
double precision, parameter :: pi = 3.141592653589793d0
! for the solution in time domain
integer it
real wsave(4*nt+15)
complex c(nt)
!! DK DK for my slow inverse Discrete Fourier Transform using a double loop
complex :: input(nt), i_imaginary_constant
integer :: j,m
! density of the medium
double precision, parameter :: rho = 2000.d0
! definition position recepteur Carcione
double precision x1,x2
! Definition source Dimitri
double precision, parameter :: f0 = 35.d0
double precision, parameter :: t0 = 1.2d0 / f0
! Definition source Carcione
! double precision f0,t0,eta,epsil
! parameter(f0 = 50.d0)
! parameter(t0 = 0.06d0)
! parameter(epsil = 1.d0)
! parameter(eta = 0.5d0)
! number of Zener standard linear solids in parallel
! integer, parameter :: L_mech = 5
integer, parameter :: L_mech = 3
! DK DK I implemented a very simple and slow inverse Discrete Fourier Transform
! DK DK at some point, for verification, using a double loop. I keep it just in case.
! DK DK For large number of points it is extremely slow because of the double loop.
! DK DK Thus there is no reason to turn this flag on.
logical, parameter :: USE_SLOW_FOURIER_TRANSFORM = .false.
! attenuation constants from Carcione 1988 GJI vol 95 p 604
double precision, dimension(L_mech) :: tau_epsilon_nu1, tau_sigma_nu1
! this value comes from page 397 of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
double precision, parameter :: vp = 2000.d0
double precision, parameter :: M_relaxed = rho*vp**2
integer :: ifreq,i_mech,iposition
double precision :: deltafreq,freq,omega,omega0,deltat,time,a,sum_of_coefficients
double complex :: comparg,sum_to_compute
! Fourier transform of the Ricker wavelet source
double complex fomega(0:nfreq)
! real and imaginary parts
double precision ra(0:nfreq),rb(0:nfreq)
! spectral amplitude
double precision ampli(0:nfreq)
! analytical solution for the single scalar component (pressure)
double complex phi1(-nfreq:nfreq)
! external functions
double complex, external :: u1
! modules elastiques
double complex :: MC, V1
! ********** end of variable declarations ************
!! DK DK July 2018: values computed to fit Q = 65 for the example I designed for the "SOUNDVIEW" finite-difference code
tau_epsilon_nu1 = (/ 2.408158185805540d-002, 4.699608990946073d-003, 9.567997872679109d-004/)
tau_sigma_nu1 = (/ 2.256014638685252d-002, 4.508471279793884d-003, 8.937876403997143d-004/)
! position of the receiver
do iposition = 1,3
if (iposition == 1) then
x1 = +200.
x2 = +200.
else if (iposition == 2) then
x1 = +500.
x2 = +500.
else
!!!!!!!! x1 = +800.
!!!!!!!! x2 = +800.
!! DK DK modified to fall exactly on a grid point
x1 = +801.
x2 = +801.
endif
print *,'Pressure source located at the origin (0,0)'
print *,'Receiver located in (x,z) = ',x1,x2
if (TURN_ATTENUATION_OFF) then
print *,'BEWARE: computing the acoustic reference solution (i.e., without attenuation) instead of the viscoacoustic solution'
else
print *,'Computing the viscoacoustic solution'
endif
! step in frequency
deltafreq = freqmax / dble(nfreq)
! define parameters for the Ricker source
omega0 = 2.d0 * pi * f0
a = pi**2 * f0**2
deltat = 1.d0 / (freqmax*dble(iratio))
print *,'deltat = ',deltat
! define the spectrum of the source
do ifreq=0,nfreq
freq = deltafreq * dble(ifreq)
omega = 2.d0 * pi * freq
! typo in equation (B10) of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988), the exponential is of -i omega t0,
! fixed here by adding the minus sign
comparg = dcmplx(0.d0,-omega*t0)
! definir le spectre du Ricker de Carcione avec cos()
! equation (B10) of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
! fomega(ifreq) = pi * dsqrt(pi/eta) * (1.d0/omega0) * cdexp(comparg) * ( dexp(- (pi*pi/eta) * (epsil/2 - omega/omega0)**2) &
! + dexp(- (pi*pi/eta) * (epsil/2 + omega/omega0)**2) )
! definir le spectre d'un Ricker classique (centre en t0)
fomega(ifreq) = dsqrt(pi) * cdexp(comparg) * omega**2 * dexp(-omega**2/(4.d0*a)) / (2.d0 * dsqrt(a**3))
!! DK DK to compare to our finite-difference codes from SEISMIC_CPML or SOUNDVIEW,
!! DK DK we divide the source by 4 * PI * cp^2 to get the right amplitude (our convention being to use a source of amplitude 1,
!! DK DK while the convention used by Carcione in his 1988 paper is to use a source of amplitude 4 * PI * cp^2
fomega(ifreq) = fomega(ifreq) / (4.d0 * PI * vp**2)
ra(ifreq) = dreal(fomega(ifreq))
rb(ifreq) = dimag(fomega(ifreq))
! prendre le module de l'amplitude spectrale
ampli(ifreq) = dsqrt(ra(ifreq)**2 + rb(ifreq)**2)
enddo
! sauvegarde du spectre d'amplitude de la source en Hz au format Gnuplot
open(unit=10,file='spectrum_of_the_source_used.gnu',status='unknown')
do ifreq = 0,nfreq
freq = deltafreq * dble(ifreq)
write(10,*) sngl(freq),sngl(ampli(ifreq))
enddo
close(10)
! ************** calcul solution analytique ****************
! d'apres Carcione GJI vol 95 p 611 (1988)
do ifreq=0,nfreq
freq = deltafreq * dble(ifreq)
omega = 2.d0 * pi * freq
! critere ad-hoc pour eviter singularite en zero
if (freq < freqseuil) omega = 2.d0 * pi * freqseuil
! equation (16) of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
sum_to_compute = dcmplx(0.d0,0.d0)
do i_mech = 1,L_mech
sum_to_compute = sum_to_compute + dcmplx(1.d0,omega*tau_epsilon_nu1(i_mech)) / dcmplx(1.d0,omega*tau_sigma_nu1(i_mech))
enddo
!! DK DK Quentin Brissaud in March 2018 added the 1/L factor here (it is missing in Carcione's older papers)
MC = M_relaxed * (1.d0 + (1./L_mech)*(-L_mech + sum_to_compute))
! use more standard infinite frequency (unrelaxed) reference,
! in which waves slow down when attenuation is turned on,
! or use far less standard zero frequency (relaxed) reference,
! in which waves speed up when attenuation is turned on
if (FIX_ATTENUATION_CAUSALITY) then
sum_of_coefficients = 0.d0
do i_mech = 1,L_mech
sum_of_coefficients = sum_of_coefficients + tau_epsilon_nu1(i_mech) / tau_sigma_nu1(i_mech)
enddo
!! DK DK Quentin Brissaud in March 2018 added the 1/L factor here (it is missing in Carcione's older papers)
MC = MC / (1.d0 + (1./L_mech)*(-L_mech + sum_of_coefficients))
endif
! equation (18) of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
V1 = cdsqrt(MC / rho)
! compute the non-viscoacoustic case as a reference if needed, i.e. turn attenuation off
if (TURN_ATTENUATION_OFF) V1 = cdsqrt(dcmplx(M_relaxed,0.d0) / rho)
! calcul de la solution analytique en frequence
phi1(ifreq) = u1(omega,V1,x1,x2) * fomega(ifreq)
enddo
! take the conjugate value for negative frequencies
do ifreq=-nfreq,-1
phi1(ifreq) = dconjg(phi1(-ifreq))
enddo
! save the result in the frequency domain
! open(unit=11,file='cmplx_phi',status='unknown')
! do ifreq=-nfreq,nfreq
! freq = deltafreq * dble(ifreq)
! write(11,*) sngl(freq),sngl(dreal(phi1(ifreq))),sngl(dimag(phi1(ifreq)))
! enddo
! close(11)
! ***************************************************************************
! Calculation of the time domain solution (using routine "cfftb" from Netlib)
! ***************************************************************************
! ****************
! Compute pressure
! ****************
! initialize FFT arrays
call cffti(nt,wsave)
! clear array of Fourier coefficients
do it = 1,nt
c(it) = cmplx(0.,0.)
enddo
! use the Fourier values for pressure
c(1) = cmplx(phi1(0))
do ifreq=1,nfreq-2
c(ifreq+1) = cmplx(phi1(ifreq))
c(nt+1-ifreq) = conjg(cmplx(phi1(ifreq)))
enddo
! perform the inverse FFT for pressure
if (.not. USE_SLOW_FOURIER_TRANSFORM) then
call cfftb(nt,c,wsave)
else
! DK DK I implemented a very simple and slow inverse Discrete Fourier Transform here
! DK DK at some point, for verification, using a double loop. I keep it just in case.
! DK DK For large number of points it is extremely slow because of the double loop.
input(:) = c(:)
! imaginary constant "i"
i_imaginary_constant = (0.,1.)
do it = 1,nt
if (mod(it,1000) == 0) print *,'FFT inverse it = ',it,' out of ',nt
j = it
c(j) = cmplx(0.,0.)
do m = 1,nt
c(j) = c(j) + input(m) * exp(2.d0 * PI * i_imaginary_constant * dble((m-1) * (j-1)) / nt)
enddo
enddo
endif
! in the inverse Discrete Fourier transform one needs to divide by N, the number of samples (number of time steps here)
c(:) = c(:) / nt
! value of a time step
deltat = 1.d0 / (freqmax*dble(iratio))
! to get the amplitude right, we need to divide by the time step
c(:) = c(:) / deltat
! save time result inverse FFT for pressure
if (iposition == 1) then
if (TURN_ATTENUATION_OFF) then
open(unit=11,file='pressure_time_analytical_solution_acoustic_200.dat',status='unknown')
else
open(unit=11,file='pressure_time_analytical_solution_viscoacoustic_200.dat',status='unknown')
endif
else if (iposition == 2) then
if (TURN_ATTENUATION_OFF) then
open(unit=11,file='pressure_time_analytical_solution_acoustic_500.dat',status='unknown')
else
open(unit=11,file='pressure_time_analytical_solution_viscoacoustic_500.dat',status='unknown')
endif
else
if (TURN_ATTENUATION_OFF) then
open(unit=11,file='pressure_time_analytical_solution_acoustic_800.dat',status='unknown')
else
open(unit=11,file='pressure_time_analytical_solution_viscoacoustic_800.dat',status='unknown')
endif
endif
do it=1,nt
! DK DK Dec 2011: subtract t0 to be consistent with the SPECFEM2D code
time = dble(it-1)*deltat - t0
! the seismograms are very long due to the very large number of FFT points used,
! thus keeping the useful part of the signal only (the first six seconds of the seismogram)
if (time >= 0.d0 .and. time <= 6.d0) write(11,*) sngl(time),real(c(it))
enddo
close(11)
print *,'Maximum positive amplitude of the time-domain solution = ',maxval(real(c(:)))
print *
enddo ! of loop on the three positions of the receiver
end
! -----------
double complex function u1(omega,v1,x1,x2)
implicit none
double precision omega
double complex v1
double complex G1
external G1
double precision x1,x2,r
! source-receiver distance
r = dsqrt(x1**2 + x2**2)
! equation (B8a) of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
u1 = G1(r,omega,v1)
end
! -----------
double complex function G1(r,omega,v1)
implicit none
double precision r,omega
double complex v1
double complex hankel0
external hankel0
double precision pi
parameter (pi = 3.141592653589793d0)
! equation (B8a) of Carcione et al., Wave propagation simulation in a linear viscoacoustic medium,
! Geophysical Journal, vol. 93, p. 393-407 (1988)
G1 = hankel0(omega*r/v1) * dcmplx(0.d0,-pi)
end
! -----------
double complex function hankel0(z)
implicit none
double complex z
! on utilise la routine NAG appelee S17DLE (simple precision)
integer ifail,nz
complex result
ifail = -1
call S17DLE(2,0.0,cmplx(z),1,'U',result,nz,ifail)
if (ifail /= 0) stop 'S17DLE failed in hankel0'
if (nz > 0) print *,nz,' termes mis a zero par underflow'
hankel0 = dcmplx(result)
end
! ***************** routine de FFT pour signal en temps ****************
! FFT routine taken from Netlib
subroutine CFFTB (N,C,WSAVE)
DIMENSION C(1) ,WSAVE(1)
if (N == 1) return
IW1 = N+N+1
IW2 = IW1+N+N
CALL CFFTB1 (N,C,WSAVE,WSAVE(IW1),WSAVE(IW2))
END
subroutine CFFTB1 (N,C,CH,WA,IFAC)
DIMENSION CH(1) ,C(1) ,WA(1) ,IFAC(1)
NF = IFAC(2)
NA = 0
L1 = 1
IW = 1
DO 116 K1=1,NF
IP = IFAC(K1+2)
L2 = IP*L1
IDO = N/L2
IDOT = IDO+IDO
IDL1 = IDOT*L1
if (IP /= 4) goto 103
IX2 = IW+IDOT
IX3 = IX2+IDOT
if (NA /= 0) goto 101
CALL PASSB4 (IDOT,L1,C,CH,WA(IW),WA(IX2),WA(IX3))
goto 102
101 CALL PASSB4 (IDOT,L1,CH,C,WA(IW),WA(IX2),WA(IX3))
102 NA = 1-NA
goto 115
103 if (IP /= 2) goto 106
if (NA /= 0) goto 104
CALL PASSB2 (IDOT,L1,C,CH,WA(IW))
goto 105
104 CALL PASSB2 (IDOT,L1,CH,C,WA(IW))
105 NA = 1-NA
goto 115
106 if (IP /= 3) goto 109
IX2 = IW+IDOT
if (NA /= 0) goto 107
CALL PASSB3 (IDOT,L1,C,CH,WA(IW),WA(IX2))
goto 108
107 CALL PASSB3 (IDOT,L1,CH,C,WA(IW),WA(IX2))
108 NA = 1-NA
goto 115
109 if (IP /= 5) goto 112
IX2 = IW+IDOT
IX3 = IX2+IDOT
IX4 = IX3+IDOT
if (NA /= 0) goto 110
CALL PASSB5 (IDOT,L1,C,CH,WA(IW),WA(IX2),WA(IX3),WA(IX4))
goto 111
110 CALL PASSB5 (IDOT,L1,CH,C,WA(IW),WA(IX2),WA(IX3),WA(IX4))
111 NA = 1-NA
goto 115
112 if (NA /= 0) goto 113
CALL PASSB (NAC,IDOT,IP,L1,IDL1,C,C,C,CH,CH,WA(IW))
goto 114
113 CALL PASSB (NAC,IDOT,IP,L1,IDL1,CH,CH,CH,C,C,WA(IW))
114 if (NAC /= 0) NA = 1-NA
115 L1 = L2
IW = IW+(IP-1)*IDOT
116 continue
if (NA == 0) return
N2 = N+N
DO 117 I=1,N2
C(I) = CH(I)
117 continue
END
subroutine PASSB (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA)
DIMENSION CH(IDO,L1,IP) ,CC(IDO,IP,L1), &
C1(IDO,L1,IP) ,WA(1) ,C2(IDL1,IP), &
CH2(IDL1,IP)
IDOT = IDO/2
NT = IP*IDL1
IPP2 = IP+2
IPPH = (IP+1)/2
IDP = IP*IDO
if (IDO < L1) goto 106
DO 103 J=2,IPPH
JC = IPP2-J
DO 102 K=1,L1
DO 101 I=1,IDO
CH(I,K,J) = CC(I,J,K)+CC(I,JC,K)
CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K)
101 continue
102 continue
103 continue
DO 105 K=1,L1
DO 104 I=1,IDO
CH(I,K,1) = CC(I,1,K)
104 continue
105 continue
goto 112
106 DO 109 J=2,IPPH
JC = IPP2-J
DO 108 I=1,IDO
DO 107 K=1,L1
CH(I,K,J) = CC(I,J,K)+CC(I,JC,K)
CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K)
107 continue
108 continue
109 continue
DO 111 I=1,IDO
DO 110 K=1,L1
CH(I,K,1) = CC(I,1,K)
110 continue
111 continue
112 IDL = 2-IDO
INC = 0
DO 116 L=2,IPPH
LC = IPP2-L
IDL = IDL+IDO
DO 113 IK=1,IDL1
C2(IK,L) = CH2(IK,1)+WA(IDL-1)*CH2(IK,2)
C2(IK,LC) = WA(IDL)*CH2(IK,IP)
113 continue
IDLJ = IDL
INC = INC+IDO
DO 115 J=3,IPPH
JC = IPP2-J
IDLJ = IDLJ+INC
if (IDLJ > IDP) IDLJ = IDLJ-IDP
WAR = WA(IDLJ-1)
WAI = WA(IDLJ)
DO 114 IK=1,IDL1
C2(IK,L) = C2(IK,L)+WAR*CH2(IK,J)
C2(IK,LC) = C2(IK,LC)+WAI*CH2(IK,JC)
114 continue
115 continue
116 continue
DO 118 J=2,IPPH
DO 117 IK=1,IDL1
CH2(IK,1) = CH2(IK,1)+CH2(IK,J)
117 continue
118 continue
DO 120 J=2,IPPH
JC = IPP2-J
DO 119 IK=2,IDL1,2
CH2(IK-1,J) = C2(IK-1,J)-C2(IK,JC)
CH2(IK-1,JC) = C2(IK-1,J)+C2(IK,JC)
CH2(IK,J) = C2(IK,J)+C2(IK-1,JC)
CH2(IK,JC) = C2(IK,J)-C2(IK-1,JC)
119 continue
120 continue
NAC = 1
if (IDO == 2) return
NAC = 0
DO 121 IK=1,IDL1
C2(IK,1) = CH2(IK,1)
121 continue
DO 123 J=2,IP
DO 122 K=1,L1
C1(1,K,J) = CH(1,K,J)
C1(2,K,J) = CH(2,K,J)
122 continue
123 continue
if (IDOT > L1) goto 127
IDIJ = 0
DO 126 J=2,IP
IDIJ = IDIJ+2
DO 125 I=4,IDO,2
IDIJ = IDIJ+2
DO 124 K=1,L1
C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)-WA(IDIJ)*CH(I,K,J)
C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)+WA(IDIJ)*CH(I-1,K,J)
124 continue
125 continue
126 continue
return
127 IDJ = 2-IDO
DO 130 J=2,IP
IDJ = IDJ+IDO
DO 129 K=1,L1
IDIJ = IDJ
DO 128 I=4,IDO,2
IDIJ = IDIJ+2
C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)-WA(IDIJ)*CH(I,K,J)
C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)+WA(IDIJ)*CH(I-1,K,J)
128 continue
129 continue
130 continue
END
subroutine PASSB2 (IDO,L1,CC,CH,WA1)
DIMENSION CC(IDO,2,L1) ,CH(IDO,L1,2), &
WA1(1)
if (IDO > 2) goto 102
DO 101 K=1,L1
CH(1,K,1) = CC(1,1,K)+CC(1,2,K)
CH(1,K,2) = CC(1,1,K)-CC(1,2,K)
CH(2,K,1) = CC(2,1,K)+CC(2,2,K)
CH(2,K,2) = CC(2,1,K)-CC(2,2,K)
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
CH(I-1,K,1) = CC(I-1,1,K)+CC(I-1,2,K)
TR2 = CC(I-1,1,K)-CC(I-1,2,K)
CH(I,K,1) = CC(I,1,K)+CC(I,2,K)
TI2 = CC(I,1,K)-CC(I,2,K)
CH(I,K,2) = WA1(I-1)*TI2+WA1(I)*TR2
CH(I-1,K,2) = WA1(I-1)*TR2-WA1(I)*TI2
103 continue
104 continue
END
subroutine PASSB3 (IDO,L1,CC,CH,WA1,WA2)
DIMENSION CC(IDO,3,L1) ,CH(IDO,L1,3), &
WA1(1) ,WA2(1)
DATA TAUR,TAUI /-.5,.866025403784439/
if (IDO /= 2) goto 102
DO 101 K=1,L1
TR2 = CC(1,2,K)+CC(1,3,K)
CR2 = CC(1,1,K)+TAUR*TR2
CH(1,K,1) = CC(1,1,K)+TR2
TI2 = CC(2,2,K)+CC(2,3,K)
CI2 = CC(2,1,K)+TAUR*TI2
CH(2,K,1) = CC(2,1,K)+TI2
CR3 = TAUI*(CC(1,2,K)-CC(1,3,K))
CI3 = TAUI*(CC(2,2,K)-CC(2,3,K))
CH(1,K,2) = CR2-CI3
CH(1,K,3) = CR2+CI3
CH(2,K,2) = CI2+CR3
CH(2,K,3) = CI2-CR3
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
TR2 = CC(I-1,2,K)+CC(I-1,3,K)
CR2 = CC(I-1,1,K)+TAUR*TR2
CH(I-1,K,1) = CC(I-1,1,K)+TR2
TI2 = CC(I,2,K)+CC(I,3,K)
CI2 = CC(I,1,K)+TAUR*TI2
CH(I,K,1) = CC(I,1,K)+TI2
CR3 = TAUI*(CC(I-1,2,K)-CC(I-1,3,K))
CI3 = TAUI*(CC(I,2,K)-CC(I,3,K))
DR2 = CR2-CI3
DR3 = CR2+CI3
DI2 = CI2+CR3
DI3 = CI2-CR3
CH(I,K,2) = WA1(I-1)*DI2+WA1(I)*DR2
CH(I-1,K,2) = WA1(I-1)*DR2-WA1(I)*DI2
CH(I,K,3) = WA2(I-1)*DI3+WA2(I)*DR3
CH(I-1,K,3) = WA2(I-1)*DR3-WA2(I)*DI3
103 continue
104 continue
END
subroutine PASSB4 (IDO,L1,CC,CH,WA1,WA2,WA3)
DIMENSION CC(IDO,4,L1) ,CH(IDO,L1,4), &
WA1(1) ,WA2(1) ,WA3(1)
if (IDO /= 2) goto 102
DO 101 K=1,L1
TI1 = CC(2,1,K)-CC(2,3,K)
TI2 = CC(2,1,K)+CC(2,3,K)
TR4 = CC(2,4,K)-CC(2,2,K)
TI3 = CC(2,2,K)+CC(2,4,K)
TR1 = CC(1,1,K)-CC(1,3,K)
TR2 = CC(1,1,K)+CC(1,3,K)
TI4 = CC(1,2,K)-CC(1,4,K)
TR3 = CC(1,2,K)+CC(1,4,K)
CH(1,K,1) = TR2+TR3
CH(1,K,3) = TR2-TR3
CH(2,K,1) = TI2+TI3
CH(2,K,3) = TI2-TI3
CH(1,K,2) = TR1+TR4
CH(1,K,4) = TR1-TR4
CH(2,K,2) = TI1+TI4
CH(2,K,4) = TI1-TI4
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
TI1 = CC(I,1,K)-CC(I,3,K)
TI2 = CC(I,1,K)+CC(I,3,K)
TI3 = CC(I,2,K)+CC(I,4,K)
TR4 = CC(I,4,K)-CC(I,2,K)
TR1 = CC(I-1,1,K)-CC(I-1,3,K)
TR2 = CC(I-1,1,K)+CC(I-1,3,K)
TI4 = CC(I-1,2,K)-CC(I-1,4,K)
TR3 = CC(I-1,2,K)+CC(I-1,4,K)
CH(I-1,K,1) = TR2+TR3
CR3 = TR2-TR3
CH(I,K,1) = TI2+TI3
CI3 = TI2-TI3
CR2 = TR1+TR4
CR4 = TR1-TR4
CI2 = TI1+TI4
CI4 = TI1-TI4
CH(I-1,K,2) = WA1(I-1)*CR2-WA1(I)*CI2
CH(I,K,2) = WA1(I-1)*CI2+WA1(I)*CR2
CH(I-1,K,3) = WA2(I-1)*CR3-WA2(I)*CI3
CH(I,K,3) = WA2(I-1)*CI3+WA2(I)*CR3
CH(I-1,K,4) = WA3(I-1)*CR4-WA3(I)*CI4
CH(I,K,4) = WA3(I-1)*CI4+WA3(I)*CR4
103 continue
104 continue
END
subroutine PASSB5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4)
DIMENSION CC(IDO,5,L1) ,CH(IDO,L1,5), &
WA1(1) ,WA2(1) ,WA3(1) ,WA4(1)
DATA TR11,TI11,TR12,TI12 /.309016994374947,.951056516295154, &
-.809016994374947,.587785252292473/
if (IDO /= 2) goto 102
DO 101 K=1,L1
TI5 = CC(2,2,K)-CC(2,5,K)
TI2 = CC(2,2,K)+CC(2,5,K)
TI4 = CC(2,3,K)-CC(2,4,K)
TI3 = CC(2,3,K)+CC(2,4,K)
TR5 = CC(1,2,K)-CC(1,5,K)
TR2 = CC(1,2,K)+CC(1,5,K)
TR4 = CC(1,3,K)-CC(1,4,K)
TR3 = CC(1,3,K)+CC(1,4,K)
CH(1,K,1) = CC(1,1,K)+TR2+TR3
CH(2,K,1) = CC(2,1,K)+TI2+TI3
CR2 = CC(1,1,K)+TR11*TR2+TR12*TR3
CI2 = CC(2,1,K)+TR11*TI2+TR12*TI3
CR3 = CC(1,1,K)+TR12*TR2+TR11*TR3
CI3 = CC(2,1,K)+TR12*TI2+TR11*TI3
CR5 = TI11*TR5+TI12*TR4
CI5 = TI11*TI5+TI12*TI4
CR4 = TI12*TR5-TI11*TR4
CI4 = TI12*TI5-TI11*TI4
CH(1,K,2) = CR2-CI5
CH(1,K,5) = CR2+CI5
CH(2,K,2) = CI2+CR5
CH(2,K,3) = CI3+CR4
CH(1,K,3) = CR3-CI4
CH(1,K,4) = CR3+CI4
CH(2,K,4) = CI3-CR4
CH(2,K,5) = CI2-CR5
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
TI5 = CC(I,2,K)-CC(I,5,K)
TI2 = CC(I,2,K)+CC(I,5,K)
TI4 = CC(I,3,K)-CC(I,4,K)
TI3 = CC(I,3,K)+CC(I,4,K)
TR5 = CC(I-1,2,K)-CC(I-1,5,K)
TR2 = CC(I-1,2,K)+CC(I-1,5,K)
TR4 = CC(I-1,3,K)-CC(I-1,4,K)
TR3 = CC(I-1,3,K)+CC(I-1,4,K)
CH(I-1,K,1) = CC(I-1,1,K)+TR2+TR3
CH(I,K,1) = CC(I,1,K)+TI2+TI3
CR2 = CC(I-1,1,K)+TR11*TR2+TR12*TR3
CI2 = CC(I,1,K)+TR11*TI2+TR12*TI3
CR3 = CC(I-1,1,K)+TR12*TR2+TR11*TR3
CI3 = CC(I,1,K)+TR12*TI2+TR11*TI3
CR5 = TI11*TR5+TI12*TR4
CI5 = TI11*TI5+TI12*TI4
CR4 = TI12*TR5-TI11*TR4
CI4 = TI12*TI5-TI11*TI4
DR3 = CR3-CI4
DR4 = CR3+CI4
DI3 = CI3+CR4
DI4 = CI3-CR4
DR5 = CR2+CI5
DR2 = CR2-CI5
DI5 = CI2-CR5
DI2 = CI2+CR5
CH(I-1,K,2) = WA1(I-1)*DR2-WA1(I)*DI2
CH(I,K,2) = WA1(I-1)*DI2+WA1(I)*DR2
CH(I-1,K,3) = WA2(I-1)*DR3-WA2(I)*DI3
CH(I,K,3) = WA2(I-1)*DI3+WA2(I)*DR3
CH(I-1,K,4) = WA3(I-1)*DR4-WA3(I)*DI4
CH(I,K,4) = WA3(I-1)*DI4+WA3(I)*DR4
CH(I-1,K,5) = WA4(I-1)*DR5-WA4(I)*DI5
CH(I,K,5) = WA4(I-1)*DI5+WA4(I)*DR5
103 continue
104 continue
END
subroutine CFFTI (N,WSAVE)
DIMENSION WSAVE(1)
if (N == 1) return
IW1 = N+N+1
IW2 = IW1+N+N
CALL CFFTI1 (N,WSAVE(IW1),WSAVE(IW2))
END
subroutine CFFTI1 (N,WA,IFAC)
DIMENSION WA(1) ,IFAC(1) ,NTRYH(4)
DATA NTRYH(1),NTRYH(2),NTRYH(3),NTRYH(4)/3,4,2,5/
NL = N
NF = 0
J = 0
101 J = J+1
if (J-4) 102,102,103
102 NTRY = NTRYH(J)
goto 104
103 NTRY = NTRY+2
104 NQ = NL/NTRY
NR = NL-NTRY*NQ
if (NR) 101,105,101
105 NF = NF+1
IFAC(NF+2) = NTRY
NL = NQ
if (NTRY /= 2) goto 107
if (NF == 1) goto 107
DO 106 I=2,NF
IB = NF-I+2
IFAC(IB+2) = IFAC(IB+1)
106 continue
IFAC(3) = 2
107 if (NL /= 1) goto 104
IFAC(1) = N
IFAC(2) = NF
TPI = 6.28318530717959
ARGH = TPI/FLOAT(N)
I = 2
L1 = 1
DO 110 K1=1,NF
IP = IFAC(K1+2)
LD = 0
L2 = L1*IP
IDO = N/L2
IDOT = IDO+IDO+2
IPM = IP-1
DO 109 J=1,IPM
I1 = I
WA(I-1) = 1.
WA(I) = 0.
LD = LD+L1
FI = 0.
ARGLD = FLOAT(LD)*ARGH
DO 108 II=4,IDOT,2
I = I+2
FI = FI+1.
ARG = FI*ARGLD
WA(I-1) = COS(ARG)
WA(I) = SIN(ARG)
108 continue
if (IP <= 5) goto 109
WA(I1-1) = WA(I-1)
WA(I1) = WA(I)
109 continue
L1 = L2
110 continue
END
subroutine CFFTF (N,C,WSAVE)
DIMENSION C(1) ,WSAVE(1)
if (N == 1) return
IW1 = N+N+1
IW2 = IW1+N+N
CALL CFFTF1 (N,C,WSAVE,WSAVE(IW1),WSAVE(IW2))
END
subroutine CFFTF1 (N,C,CH,WA,IFAC)
DIMENSION CH(1) ,C(1) ,WA(1) ,IFAC(1)
NF = IFAC(2)
NA = 0
L1 = 1
IW = 1
DO 116 K1=1,NF
IP = IFAC(K1+2)
L2 = IP*L1
IDO = N/L2
IDOT = IDO+IDO
IDL1 = IDOT*L1
if (IP /= 4) goto 103
IX2 = IW+IDOT
IX3 = IX2+IDOT
if (NA /= 0) goto 101
CALL PASSF4 (IDOT,L1,C,CH,WA(IW),WA(IX2),WA(IX3))
goto 102
101 CALL PASSF4 (IDOT,L1,CH,C,WA(IW),WA(IX2),WA(IX3))
102 NA = 1-NA
goto 115
103 if (IP /= 2) goto 106
if (NA /= 0) goto 104
CALL PASSF2 (IDOT,L1,C,CH,WA(IW))
goto 105
104 CALL PASSF2 (IDOT,L1,CH,C,WA(IW))
105 NA = 1-NA
goto 115
106 if (IP /= 3) goto 109
IX2 = IW+IDOT
if (NA /= 0) goto 107
CALL PASSF3 (IDOT,L1,C,CH,WA(IW),WA(IX2))
goto 108
107 CALL PASSF3 (IDOT,L1,CH,C,WA(IW),WA(IX2))
108 NA = 1-NA
goto 115
109 if (IP /= 5) goto 112
IX2 = IW+IDOT
IX3 = IX2+IDOT
IX4 = IX3+IDOT
if (NA /= 0) goto 110
CALL PASSF5 (IDOT,L1,C,CH,WA(IW),WA(IX2),WA(IX3),WA(IX4))
goto 111
110 CALL PASSF5 (IDOT,L1,CH,C,WA(IW),WA(IX2),WA(IX3),WA(IX4))
111 NA = 1-NA
goto 115
112 if (NA /= 0) goto 113
CALL PASSF (NAC,IDOT,IP,L1,IDL1,C,C,C,CH,CH,WA(IW))
goto 114
113 CALL PASSF (NAC,IDOT,IP,L1,IDL1,CH,CH,CH,C,C,WA(IW))
114 if (NAC /= 0) NA = 1-NA
115 L1 = L2
IW = IW+(IP-1)*IDOT
116 continue
if (NA == 0) return
N2 = N+N
DO 117 I=1,N2
C(I) = CH(I)
117 continue
END
subroutine PASSF (NAC,IDO,IP,L1,IDL1,CC,C1,C2,CH,CH2,WA)
DIMENSION CH(IDO,L1,IP) ,CC(IDO,IP,L1), &
C1(IDO,L1,IP) ,WA(1) ,C2(IDL1,IP), &
CH2(IDL1,IP)
IDOT = IDO/2
NT = IP*IDL1
IPP2 = IP+2
IPPH = (IP+1)/2
IDP = IP*IDO
if (IDO < L1) goto 106
DO 103 J=2,IPPH
JC = IPP2-J
DO 102 K=1,L1
DO 101 I=1,IDO
CH(I,K,J) = CC(I,J,K)+CC(I,JC,K)
CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K)
101 continue
102 continue
103 continue
DO 105 K=1,L1
DO 104 I=1,IDO
CH(I,K,1) = CC(I,1,K)
104 continue
105 continue
goto 112
106 DO 109 J=2,IPPH
JC = IPP2-J
DO 108 I=1,IDO
DO 107 K=1,L1
CH(I,K,J) = CC(I,J,K)+CC(I,JC,K)
CH(I,K,JC) = CC(I,J,K)-CC(I,JC,K)
107 continue
108 continue
109 continue
DO 111 I=1,IDO
DO 110 K=1,L1
CH(I,K,1) = CC(I,1,K)
110 continue
111 continue
112 IDL = 2-IDO
INC = 0
DO 116 L=2,IPPH
LC = IPP2-L
IDL = IDL+IDO
DO 113 IK=1,IDL1
C2(IK,L) = CH2(IK,1)+WA(IDL-1)*CH2(IK,2)
C2(IK,LC) = -WA(IDL)*CH2(IK,IP)
113 continue
IDLJ = IDL
INC = INC+IDO
DO 115 J=3,IPPH
JC = IPP2-J
IDLJ = IDLJ+INC
if (IDLJ > IDP) IDLJ = IDLJ-IDP
WAR = WA(IDLJ-1)
WAI = WA(IDLJ)
DO 114 IK=1,IDL1
C2(IK,L) = C2(IK,L)+WAR*CH2(IK,J)
C2(IK,LC) = C2(IK,LC)-WAI*CH2(IK,JC)
114 continue
115 continue
116 continue
DO 118 J=2,IPPH
DO 117 IK=1,IDL1
CH2(IK,1) = CH2(IK,1)+CH2(IK,J)
117 continue
118 continue
DO 120 J=2,IPPH
JC = IPP2-J
DO 119 IK=2,IDL1,2
CH2(IK-1,J) = C2(IK-1,J)-C2(IK,JC)
CH2(IK-1,JC) = C2(IK-1,J)+C2(IK,JC)
CH2(IK,J) = C2(IK,J)+C2(IK-1,JC)
CH2(IK,JC) = C2(IK,J)-C2(IK-1,JC)
119 continue
120 continue
NAC = 1
if (IDO == 2) return
NAC = 0
DO 121 IK=1,IDL1
C2(IK,1) = CH2(IK,1)
121 continue
DO 123 J=2,IP
DO 122 K=1,L1
C1(1,K,J) = CH(1,K,J)
C1(2,K,J) = CH(2,K,J)
122 continue
123 continue
if (IDOT > L1) goto 127
IDIJ = 0
DO 126 J=2,IP
IDIJ = IDIJ+2
DO 125 I=4,IDO,2
IDIJ = IDIJ+2
DO 124 K=1,L1
C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)+WA(IDIJ)*CH(I,K,J)
C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)-WA(IDIJ)*CH(I-1,K,J)
124 continue
125 continue
126 continue
return
127 IDJ = 2-IDO
DO 130 J=2,IP
IDJ = IDJ+IDO
DO 129 K=1,L1
IDIJ = IDJ
DO 128 I=4,IDO,2
IDIJ = IDIJ+2
C1(I-1,K,J) = WA(IDIJ-1)*CH(I-1,K,J)+WA(IDIJ)*CH(I,K,J)
C1(I,K,J) = WA(IDIJ-1)*CH(I,K,J)-WA(IDIJ)*CH(I-1,K,J)
128 continue
129 continue
130 continue
END
subroutine PASSF2 (IDO,L1,CC,CH,WA1)
DIMENSION CC(IDO,2,L1) ,CH(IDO,L1,2), &
WA1(1)
if (IDO > 2) goto 102
DO 101 K=1,L1
CH(1,K,1) = CC(1,1,K)+CC(1,2,K)
CH(1,K,2) = CC(1,1,K)-CC(1,2,K)
CH(2,K,1) = CC(2,1,K)+CC(2,2,K)
CH(2,K,2) = CC(2,1,K)-CC(2,2,K)
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
CH(I-1,K,1) = CC(I-1,1,K)+CC(I-1,2,K)
TR2 = CC(I-1,1,K)-CC(I-1,2,K)
CH(I,K,1) = CC(I,1,K)+CC(I,2,K)
TI2 = CC(I,1,K)-CC(I,2,K)
CH(I,K,2) = WA1(I-1)*TI2-WA1(I)*TR2
CH(I-1,K,2) = WA1(I-1)*TR2+WA1(I)*TI2
103 continue
104 continue
END
subroutine PASSF3 (IDO,L1,CC,CH,WA1,WA2)
DIMENSION CC(IDO,3,L1) ,CH(IDO,L1,3), &
WA1(1) ,WA2(1)
DATA TAUR,TAUI /-.5,-.866025403784439/
if (IDO /= 2) goto 102
DO 101 K=1,L1
TR2 = CC(1,2,K)+CC(1,3,K)
CR2 = CC(1,1,K)+TAUR*TR2
CH(1,K,1) = CC(1,1,K)+TR2
TI2 = CC(2,2,K)+CC(2,3,K)
CI2 = CC(2,1,K)+TAUR*TI2
CH(2,K,1) = CC(2,1,K)+TI2
CR3 = TAUI*(CC(1,2,K)-CC(1,3,K))
CI3 = TAUI*(CC(2,2,K)-CC(2,3,K))
CH(1,K,2) = CR2-CI3
CH(1,K,3) = CR2+CI3
CH(2,K,2) = CI2+CR3
CH(2,K,3) = CI2-CR3
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
TR2 = CC(I-1,2,K)+CC(I-1,3,K)
CR2 = CC(I-1,1,K)+TAUR*TR2
CH(I-1,K,1) = CC(I-1,1,K)+TR2
TI2 = CC(I,2,K)+CC(I,3,K)
CI2 = CC(I,1,K)+TAUR*TI2
CH(I,K,1) = CC(I,1,K)+TI2
CR3 = TAUI*(CC(I-1,2,K)-CC(I-1,3,K))
CI3 = TAUI*(CC(I,2,K)-CC(I,3,K))
DR2 = CR2-CI3
DR3 = CR2+CI3
DI2 = CI2+CR3
DI3 = CI2-CR3
CH(I,K,2) = WA1(I-1)*DI2-WA1(I)*DR2
CH(I-1,K,2) = WA1(I-1)*DR2+WA1(I)*DI2
CH(I,K,3) = WA2(I-1)*DI3-WA2(I)*DR3
CH(I-1,K,3) = WA2(I-1)*DR3+WA2(I)*DI3
103 continue
104 continue
END
subroutine PASSF4 (IDO,L1,CC,CH,WA1,WA2,WA3)
DIMENSION CC(IDO,4,L1) ,CH(IDO,L1,4), &
WA1(1) ,WA2(1) ,WA3(1)
if (IDO /= 2) goto 102
DO 101 K=1,L1
TI1 = CC(2,1,K)-CC(2,3,K)
TI2 = CC(2,1,K)+CC(2,3,K)
TR4 = CC(2,2,K)-CC(2,4,K)
TI3 = CC(2,2,K)+CC(2,4,K)
TR1 = CC(1,1,K)-CC(1,3,K)
TR2 = CC(1,1,K)+CC(1,3,K)
TI4 = CC(1,4,K)-CC(1,2,K)
TR3 = CC(1,2,K)+CC(1,4,K)
CH(1,K,1) = TR2+TR3
CH(1,K,3) = TR2-TR3
CH(2,K,1) = TI2+TI3
CH(2,K,3) = TI2-TI3
CH(1,K,2) = TR1+TR4
CH(1,K,4) = TR1-TR4
CH(2,K,2) = TI1+TI4
CH(2,K,4) = TI1-TI4
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
TI1 = CC(I,1,K)-CC(I,3,K)
TI2 = CC(I,1,K)+CC(I,3,K)
TI3 = CC(I,2,K)+CC(I,4,K)
TR4 = CC(I,2,K)-CC(I,4,K)
TR1 = CC(I-1,1,K)-CC(I-1,3,K)
TR2 = CC(I-1,1,K)+CC(I-1,3,K)
TI4 = CC(I-1,4,K)-CC(I-1,2,K)
TR3 = CC(I-1,2,K)+CC(I-1,4,K)
CH(I-1,K,1) = TR2+TR3
CR3 = TR2-TR3
CH(I,K,1) = TI2+TI3
CI3 = TI2-TI3
CR2 = TR1+TR4
CR4 = TR1-TR4
CI2 = TI1+TI4
CI4 = TI1-TI4
CH(I-1,K,2) = WA1(I-1)*CR2+WA1(I)*CI2
CH(I,K,2) = WA1(I-1)*CI2-WA1(I)*CR2
CH(I-1,K,3) = WA2(I-1)*CR3+WA2(I)*CI3
CH(I,K,3) = WA2(I-1)*CI3-WA2(I)*CR3
CH(I-1,K,4) = WA3(I-1)*CR4+WA3(I)*CI4
CH(I,K,4) = WA3(I-1)*CI4-WA3(I)*CR4
103 continue
104 continue
END
subroutine PASSF5 (IDO,L1,CC,CH,WA1,WA2,WA3,WA4)
DIMENSION CC(IDO,5,L1) ,CH(IDO,L1,5), &
WA1(1) ,WA2(1) ,WA3(1) ,WA4(1)
DATA TR11,TI11,TR12,TI12 /.309016994374947,-.951056516295154, &
-.809016994374947,-.587785252292473/
if (IDO /= 2) goto 102
DO 101 K=1,L1
TI5 = CC(2,2,K)-CC(2,5,K)
TI2 = CC(2,2,K)+CC(2,5,K)
TI4 = CC(2,3,K)-CC(2,4,K)
TI3 = CC(2,3,K)+CC(2,4,K)
TR5 = CC(1,2,K)-CC(1,5,K)
TR2 = CC(1,2,K)+CC(1,5,K)
TR4 = CC(1,3,K)-CC(1,4,K)
TR3 = CC(1,3,K)+CC(1,4,K)
CH(1,K,1) = CC(1,1,K)+TR2+TR3
CH(2,K,1) = CC(2,1,K)+TI2+TI3
CR2 = CC(1,1,K)+TR11*TR2+TR12*TR3
CI2 = CC(2,1,K)+TR11*TI2+TR12*TI3
CR3 = CC(1,1,K)+TR12*TR2+TR11*TR3
CI3 = CC(2,1,K)+TR12*TI2+TR11*TI3
CR5 = TI11*TR5+TI12*TR4
CI5 = TI11*TI5+TI12*TI4
CR4 = TI12*TR5-TI11*TR4
CI4 = TI12*TI5-TI11*TI4
CH(1,K,2) = CR2-CI5
CH(1,K,5) = CR2+CI5
CH(2,K,2) = CI2+CR5
CH(2,K,3) = CI3+CR4
CH(1,K,3) = CR3-CI4
CH(1,K,4) = CR3+CI4
CH(2,K,4) = CI3-CR4
CH(2,K,5) = CI2-CR5
101 continue
return
102 DO 104 K=1,L1
DO 103 I=2,IDO,2
TI5 = CC(I,2,K)-CC(I,5,K)
TI2 = CC(I,2,K)+CC(I,5,K)
TI4 = CC(I,3,K)-CC(I,4,K)
TI3 = CC(I,3,K)+CC(I,4,K)
TR5 = CC(I-1,2,K)-CC(I-1,5,K)
TR2 = CC(I-1,2,K)+CC(I-1,5,K)
TR4 = CC(I-1,3,K)-CC(I-1,4,K)
TR3 = CC(I-1,3,K)+CC(I-1,4,K)
CH(I-1,K,1) = CC(I-1,1,K)+TR2+TR3
CH(I,K,1) = CC(I,1,K)+TI2+TI3
CR2 = CC(I-1,1,K)+TR11*TR2+TR12*TR3
CI2 = CC(I,1,K)+TR11*TI2+TR12*TI3
CR3 = CC(I-1,1,K)+TR12*TR2+TR11*TR3
CI3 = CC(I,1,K)+TR12*TI2+TR11*TI3
CR5 = TI11*TR5+TI12*TR4
CI5 = TI11*TI5+TI12*TI4
CR4 = TI12*TR5-TI11*TR4
CI4 = TI12*TI5-TI11*TI4
DR3 = CR3-CI4
DR4 = CR3+CI4
DI3 = CI3+CR4
DI4 = CI3-CR4
DR5 = CR2+CI5
DR2 = CR2-CI5
DI5 = CI2-CR5
DI2 = CI2+CR5
CH(I-1,K,2) = WA1(I-1)*DR2+WA1(I)*DI2
CH(I,K,2) = WA1(I-1)*DI2-WA1(I)*DR2
CH(I-1,K,3) = WA2(I-1)*DR3+WA2(I)*DI3
CH(I,K,3) = WA2(I-1)*DI3-WA2(I)*DR3
CH(I-1,K,4) = WA3(I-1)*DR4+WA3(I)*DI4
CH(I,K,4) = WA3(I-1)*DI4-WA3(I)*DR4
CH(I-1,K,5) = WA4(I-1)*DR5+WA4(I)*DI5
CH(I,K,5) = WA4(I-1)*DI5-WA4(I)*DR5
103 continue
104 continue
END
! DK DK march99 : routines sur le Cray (simple precision)
subroutine ABZP01
! MARK 11.5(F77) RELEASE. NAG COPYRIGHT 1986.
!
! Terminates execution when a hard failure occurs.
!
! ******************** IMPLEMENTATION NOTE ********************
! The following STOP statement may be replaced by a call to an
! implementation-dependent routine to display a message and/or
! to abort the program.
! *************************************************************
! .. Executable Statements ..
STOP
END
subroutine DCYS18(Z,FNU,KODE,MR,N,Y,NZ,TOL,ELIM,ALIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-785 (DEC 1989).
!
! Original name: CUNK2
!
! DCYS18 COMPUTES K(FNU,Z) AND ITS ANALYTIC CONTINUATION FROM THE
! RIGHT HALF PLANE TO THE LEFT HALF PLANE BY MEANS OF THE
! UNIFORM ASYMPTOTIC EXPANSIONS FOR H(KIND,FNU,ZN) AND J(FNU,ZN)
! WHERE ZN IS IN THE RIGHT HALF PLANE, KIND=(3-MR)/2, MR=+1 OR
! -1. HERE ZN=ZR*I OR -ZR*I WHERE ZR=Z IF Z IS IN THE RIGHT
! HALF PLANE OR ZR=-Z IF Z IS IN THE LEFT HALF PLANE. MR INDIC-
! ATES THE DIRECTION OF ROTATION FOR ANALYTIC CONTINUATION.
! NZ=-1 MEANS AN OVERFLOW WILL OCCUR
!
! .. Scalar Arguments ..
COMPLEX Z
REAL ALIM, ELIM, FNU, TOL
INTEGER KODE, MR, N, NZ
! .. Array Arguments ..
COMPLEX Y(N)
! .. Local Scalars ..
COMPLEX AI, ARGD, ASUMD, BSUMD, C1, C2, CFN, CI, CK, &
CONE, CR1, CR2, CRSC, CS, CSCL, CSGN, CSPN, &
CZERO, DAI, PHID, RZ, S1, S2, ZB, ZETA1D, &
ZETA2D, ZN, ZR
REAL AARG, AIC, ANG, APHI, ASC, ASCLE, C2I, C2M, C2R, &
CAR, CPN, FMR, FN, FNF, HPI, PI, RS1, SAR, SGN, &
SPN, X, YY
INTEGER I, IB, IC, IDUM, IFLAG, IFN, IL, IN, INU, IPARD, &
IUF, J, K, KDFLG, KFLAG, KK, NAI, NDAI, NW
! .. Local Arrays ..
COMPLEX ARG(2), ASUM(2), BSUM(2), CIP(4), CSR(3), &
CSS(3), CY(2), PHI(2), ZETA1(2), ZETA2(2)
REAL BRY(3)
! .. External functions ..
REAL X02AME, X02ALE
EXTERNAL X02AME, X02ALE
! .. External subroutines ..
EXTERNAL DEUS17, S17DGE, DGSS17, DGVS17
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, CONJG, COS, EXP, INT, LOG, &
MAX, MOD, REAL, SIGN, SIN
! .. Data statements ..
DATA CZERO, CONE, CI, CR1, CR2/(0.0E0,0.0E0), &
(1.0E0,0.0E0), (0.0E0,1.0E0), &
(1.0E0,1.73205080756887729E0), &
(-0.5E0,-8.66025403784438647E-01)/
DATA HPI, PI, AIC/1.57079632679489662E+00, &
3.14159265358979324E+00, &
1.26551212348464539E+00/
DATA CIP(1), CIP(2), CIP(3), CIP(4)/(1.0E0,0.0E0), &
(0.0E0,-1.0E0), (-1.0E0,0.0E0), (0.0E0,1.0E0)/
! .. Executable Statements ..
!
KDFLG = 1
NZ = 0
! ------------------------------------------------------------------
! EXP(-ALIM)=EXP(-ELIM)/TOL=APPROX. ONE PRECISION GREATER THAN
! THE UNDERFLOW LIMIT
! ------------------------------------------------------------------
CSCL = CMPLX(1.0E0/TOL,0.0E0)
CRSC = CMPLX(TOL,0.0E0)
CSS(1) = CSCL
CSS(2) = CONE
CSS(3) = CRSC
CSR(1) = CRSC
CSR(2) = CONE
CSR(3) = CSCL
BRY(1) = (1.0E+3*X02AME())/TOL
BRY(2) = 1.0E0/BRY(1)
BRY(3) = X02ALE()
X = REAL(Z)
ZR = Z
if (X < 0.0E0) ZR = -Z
YY = AIMAG(ZR)
ZN = -ZR*CI
ZB = ZR
INU = INT(FNU)
FNF = FNU - INU
ANG = -HPI*FNF
CAR = COS(ANG)
SAR = SIN(ANG)
CPN = -HPI*CAR
SPN = -HPI*SAR
C2 = CMPLX(-SPN,CPN)
KK = MOD(INU,4) + 1
CS = CR1*C2*CIP(KK)
if (YY <= 0.0E0) then
ZN = CONJG(-ZN)
ZB = CONJG(ZB)
endif
! ------------------------------------------------------------------
! K(FNU,Z) IS COMPUTED FROM H(2,FNU,-I*Z) WHERE Z IS IN THE FIRST
! QUADRANT. FOURTH QUADRANT VALUES (YY <= 0.0E0) ARE COMPUTED BY
! CONJUGATION SINCE THE K function IS REAL ON THE POSITIVE REAL AXIS
! ------------------------------------------------------------------
J = 2
DO 40 I = 1, N
! ---------------------------------------------------------------
! J FLIP FLOPS BETWEEN 1 AND 2 IN J = 3 - J
! ---------------------------------------------------------------
J = 3 - J
FN = FNU + I - 1
CALL DEUS17(ZN,FN,0,TOL,PHI(J),ARG(J),ZETA1(J),ZETA2(J),ASUM(J) &
,BSUM(J),ELIM)
if (KODE == 1) then
S1 = ZETA1(J) - ZETA2(J)
ELSE
CFN = CMPLX(FN,0.0E0)
S1 = ZETA1(J) - CFN*(CFN/(ZB+ZETA2(J)))
endif
! ---------------------------------------------------------------
! TEST FOR UNDERFLOW AND OVERFLOW
! ---------------------------------------------------------------
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
if (KDFLG == 1) KFLAG = 2
if (ABS(RS1) >= ALIM) then
! ---------------------------------------------------------
! REFINE TEST AND SCALE
! ---------------------------------------------------------
APHI = ABS(PHI(J))
AARG = ABS(ARG(J))
RS1 = RS1 + LOG(APHI) - 0.25E0*LOG(AARG) - AIC
if (ABS(RS1) > ELIM) then
goto 20
ELSE
if (KDFLG == 1) KFLAG = 1
if (RS1 >= 0.0E0) then
if (KDFLG == 1) KFLAG = 3
endif
endif
endif
! ------------------------------------------------------------
! SCALE S1 TO KEEP INTERMEDIATE ARITHMETIC ON SCALE NEAR
! EXPONENT EXTREMES
! ------------------------------------------------------------
C2 = ARG(J)*CR2
IDUM = 1
! S17DGE assumed not to fail, therefore IDUM set to one.
CALL S17DGE('F',C2,'S',AI,NAI,IDUM)
IDUM = 1
CALL S17DGE('D',C2,'S',DAI,NDAI,IDUM)
S2 = CS*PHI(J)*(AI*ASUM(J)+CR2*DAI*BSUM(J))
C2R = REAL(S1)
C2I = AIMAG(S1)
C2M = EXP(C2R)*REAL(CSS(KFLAG))
S1 = CMPLX(C2M,0.0E0)*CMPLX(COS(C2I),SIN(C2I))
S2 = S2*S1
if (KFLAG == 1) then
CALL DGVS17(S2,NW,BRY(1),TOL)
if (NW /= 0) goto 20
endif
if (YY <= 0.0E0) S2 = CONJG(S2)
CY(KDFLG) = S2
Y(I) = S2*CSR(KFLAG)
CS = -CI*CS
if (KDFLG == 2) then
goto 60
ELSE
KDFLG = 2
goto 40
endif
endif
20 if (RS1 > 0.0E0) then
goto 280
! ------------------------------------------------------------
! FOR X < 0.0, THE I function TO BE ADDED WILL OVERFLOW
! ------------------------------------------------------------
else if (X < 0.0E0) then
goto 280
ELSE
KDFLG = 1
Y(I) = CZERO
CS = -CI*CS
NZ = NZ + 1
if (I /= 1) then
if (Y(I-1) /= CZERO) then
Y(I-1) = CZERO
NZ = NZ + 1
endif
endif
endif
40 continue
I = N
60 RZ = CMPLX(2.0E0,0.0E0)/ZR
CK = CMPLX(FN,0.0E0)*RZ
IB = I + 1
if (N >= IB) then
! ---------------------------------------------------------------
! TEST LAST MEMBER FOR UNDERFLOW AND OVERFLOW, SET SEQUENCE TO
! ZERO ON UNDERFLOW
! ---------------------------------------------------------------
FN = FNU + N - 1
IPARD = 1
if (MR /= 0) IPARD = 0
CALL DEUS17(ZN,FN,IPARD,TOL,PHID,ARGD,ZETA1D,ZETA2D,ASUMD, &
BSUMD,ELIM)
if (KODE == 1) then
S1 = ZETA1D - ZETA2D
ELSE
CFN = CMPLX(FN,0.0E0)
S1 = ZETA1D - CFN*(CFN/(ZB+ZETA2D))
endif
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
if (ABS(RS1) >= ALIM) then
! ---------------------------------------------------------
! REFINE ESTIMATE AND TEST
! ---------------------------------------------------------
APHI = ABS(PHID)
AARG = ABS(ARGD)
RS1 = RS1 + LOG(APHI) - 0.25E0*LOG(AARG) - AIC
if (ABS(RS1) >= ELIM) goto 100
endif
! ------------------------------------------------------------
! SCALED FORWARD RECURRENCE FOR REMAINDER OF THE SEQUENCE
! ------------------------------------------------------------
S1 = CY(1)
S2 = CY(2)
C1 = CSR(KFLAG)
ASCLE = BRY(KFLAG)
DO 80 I = IB, N
C2 = S2
S2 = CK*S2 + S1
S1 = C2
CK = CK + RZ
C2 = S2*C1
Y(I) = C2
if (KFLAG < 3) then
C2R = REAL(C2)
C2I = AIMAG(C2)
C2R = ABS(C2R)
C2I = ABS(C2I)
C2M = MAX(C2R,C2I)
if (C2M > ASCLE) then
KFLAG = KFLAG + 1
ASCLE = BRY(KFLAG)
S1 = S1*C1
S2 = C2
S1 = S1*CSS(KFLAG)
S2 = S2*CSS(KFLAG)
C1 = CSR(KFLAG)
endif
endif
80 continue
goto 140
endif
100 if (RS1 > 0.0E0) then
goto 280
! ------------------------------------------------------------
! FOR X < 0.0, THE I function TO BE ADDED WILL OVERFLOW
! ------------------------------------------------------------
else if (X < 0.0E0) then
goto 280
ELSE
NZ = N
DO 120 I = 1, N
Y(I) = CZERO
120 continue
return
endif
endif
140 if (MR == 0) then
return
ELSE
! ---------------------------------------------------------------
! ANALYTIC CONTINUATION FOR RE(Z) < 0.0E0
! ---------------------------------------------------------------
NZ = 0
FMR = MR
SGN = -SIGN(PI,FMR)
! ---------------------------------------------------------------
! CSPN AND CSGN ARE COEFF OF K AND I functionS RESP.
! ---------------------------------------------------------------
CSGN = CMPLX(0.0E0,SGN)
if (YY <= 0.0E0) CSGN = CONJG(CSGN)
IFN = INU + N - 1
ANG = FNF*SGN
CPN = COS(ANG)
SPN = SIN(ANG)
CSPN = CMPLX(CPN,SPN)
if (MOD(IFN,2) == 1) CSPN = -CSPN
! ---------------------------------------------------------------
! CS=COEFF OF THE J function TO GET THE I function. I(FNU,Z) IS
! COMPUTED FROM EXP(I*FNU*HPI)*J(FNU,-I*Z) WHERE Z IS IN THE
! FIRST QUADRANT. FOURTH QUADRANT VALUES (YY <= 0.0E0) ARE
! COMPUTED BY CONJUGATION SINCE THE I function IS REAL ON THE
! POSITIVE REAL AXIS
! ---------------------------------------------------------------
CS = CMPLX(CAR,-SAR)*CSGN
IN = MOD(IFN,4) + 1
C2 = CIP(IN)
CS = CS*CONJG(C2)
ASC = BRY(1)
KK = N
KDFLG = 1
IB = IB - 1
IC = IB - 1
IUF = 0
DO 220 K = 1, N
! ------------------------------------------------------------
! LOGIC TO SORT OUT CASES WHOSE PARAMETERS WERE SET FOR THE K
! function ABOVE
! ------------------------------------------------------------
FN = FNU + KK - 1
if (N > 2) then
if ((KK == N) .and. (IB < N)) then
goto 160
else if ((KK /= IB) .and. (KK /= IC)) then
CALL DEUS17(ZN,FN,0,TOL,PHID,ARGD,ZETA1D,ZETA2D,ASUMD, &
BSUMD,ELIM)
goto 160
endif
endif
PHID = PHI(J)
ARGD = ARG(J)
ZETA1D = ZETA1(J)
ZETA2D = ZETA2(J)
ASUMD = ASUM(J)
BSUMD = BSUM(J)
J = 3 - J
160 if (KODE == 1) then
S1 = -ZETA1D + ZETA2D
ELSE
CFN = CMPLX(FN,0.0E0)
S1 = -ZETA1D + CFN*(CFN/(ZB+ZETA2D))
endif
! ------------------------------------------------------------
! TEST FOR UNDERFLOW AND OVERFLOW
! ------------------------------------------------------------
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
if (KDFLG == 1) IFLAG = 2
if (ABS(RS1) >= ALIM) then
! ------------------------------------------------------
! REFINE TEST AND SCALE
! ------------------------------------------------------
APHI = ABS(PHID)
AARG = ABS(ARGD)
RS1 = RS1 + LOG(APHI) - 0.25E0*LOG(AARG) - AIC
if (ABS(RS1) > ELIM) then
goto 180
ELSE
if (KDFLG == 1) IFLAG = 1
if (RS1 >= 0.0E0) then
if (KDFLG == 1) IFLAG = 3
endif
endif
endif
IDUM = 1
! S17DGE assumed not to fail, therefore IDUM set to one.
CALL S17DGE('F',ARGD,'S',AI,NAI,IDUM)
IDUM = 1
CALL S17DGE('D',ARGD,'S',DAI,NDAI,IDUM)
S2 = CS*PHID*(AI*ASUMD+DAI*BSUMD)
C2R = REAL(S1)
C2I = AIMAG(S1)
C2M = EXP(C2R)*REAL(CSS(IFLAG))
S1 = CMPLX(C2M,0.0E0)*CMPLX(COS(C2I),SIN(C2I))
S2 = S2*S1
if (IFLAG == 1) then
CALL DGVS17(S2,NW,BRY(1),TOL)
if (NW /= 0) S2 = CMPLX(0.0E0,0.0E0)
endif
goto 200
endif
180 if (RS1 > 0.0E0) then
goto 280
ELSE
S2 = CZERO
endif
200 if (YY <= 0.0E0) S2 = CONJG(S2)
CY(KDFLG) = S2
C2 = S2
S2 = S2*CSR(IFLAG)
! ------------------------------------------------------------
! ADD I AND K functionS, K SEQUENCE IN Y(I), I=1,N
! ------------------------------------------------------------
S1 = Y(KK)
if (KODE /= 1) then
CALL DGSS17(ZR,S1,S2,NW,ASC,ALIM,IUF)
NZ = NZ + NW
endif
Y(KK) = S1*CSPN + S2
KK = KK - 1
CSPN = -CSPN
CS = -CS*CI
if (C2 == CZERO) then
KDFLG = 1
else if (KDFLG == 2) then
goto 240
ELSE
KDFLG = 2
endif
220 continue
K = N
240 IL = N - K
if (IL /= 0) then
! ------------------------------------------------------------
! RECUR BACKWARD FOR REMAINDER OF I SEQUENCE AND ADD IN THE
! K functionS, SCALING THE I SEQUENCE DURING RECURRENCE TO
! KEEP INTERMEDIATE ARITHMETIC ON SCALE NEAR EXPONENT
! EXTREMES.
! ------------------------------------------------------------
S1 = CY(1)
S2 = CY(2)
CS = CSR(IFLAG)
ASCLE = BRY(IFLAG)
FN = INU + IL
DO 260 I = 1, IL
C2 = S2
S2 = S1 + CMPLX(FN+FNF,0.0E0)*RZ*S2
S1 = C2
FN = FN - 1.0E0
C2 = S2*CS
CK = C2
C1 = Y(KK)
if (KODE /= 1) then
CALL DGSS17(ZR,C1,C2,NW,ASC,ALIM,IUF)
NZ = NZ + NW
endif
Y(KK) = C1*CSPN + C2
KK = KK - 1
CSPN = -CSPN
if (IFLAG < 3) then
C2R = REAL(CK)
C2I = AIMAG(CK)
C2R = ABS(C2R)
C2I = ABS(C2I)
C2M = MAX(C2R,C2I)
if (C2M > ASCLE) then
IFLAG = IFLAG + 1
ASCLE = BRY(IFLAG)
S1 = S1*CS
S2 = CK
S1 = S1*CSS(IFLAG)
S2 = S2*CSS(IFLAG)
CS = CSR(IFLAG)
endif
endif
260 continue
endif
return
endif
280 NZ = -1
return
END
subroutine DCZS18(Z,FNU,KODE,MR,N,Y,NZ,TOL,ELIM,ALIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-786 (DEC 1989).
!
! Original name: CUNK1
!
! DCZS18 COMPUTES K(FNU,Z) AND ITS ANALYTIC CONTINUATION FROM THE
! RIGHT HALF PLANE TO THE LEFT HALF PLANE BY MEANS OF THE
! UNIFORM ASYMPTOTIC EXPANSION.
! MR INDICATES THE DIRECTION OF ROTATION FOR ANALYTIC CONTINUATION.
! NZ=-1 MEANS AN OVERFLOW WILL OCCUR
!
! .. Scalar Arguments ..
COMPLEX Z
REAL ALIM, ELIM, FNU, TOL
INTEGER KODE, MR, N, NZ
! .. Array Arguments ..
COMPLEX Y(N)
! .. Local Scalars ..
COMPLEX C1, C2, CFN, CK, CONE, CRSC, CS, CSCL, CSGN, &
CSPN, CZERO, PHID, RZ, S1, S2, SUMD, ZETA1D, &
ZETA2D, ZR
REAL ANG, APHI, ASC, ASCLE, C2I, C2M, C2R, CPN, FMR, &
FN, FNF, PI, RS1, SGN, SPN, X
INTEGER I, IB, IC, IFLAG, IFN, IL, INITD, INU, IPARD, &
IUF, J, K, KDFLG, KFLAG, KK, M, NW
! .. Local Arrays ..
COMPLEX CSR(3), CSS(3), CWRK(16,3), CY(2), PHI(2), &
SUM(2), ZETA1(2), ZETA2(2)
REAL BRY(3)
INTEGER INIT(2)
! .. External functions ..
REAL X02AME, X02ALE
EXTERNAL X02AME, X02ALE
! .. External subroutines ..
EXTERNAL DEWS17, DGSS17, DGVS17
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, COS, EXP, INT, LOG, MAX, MOD, &
REAL, SIGN, SIN
! .. Data statements ..
DATA CZERO, CONE/(0.0E0,0.0E0), (1.0E0,0.0E0)/
DATA PI/3.14159265358979324E0/
! .. Executable Statements ..
!
KDFLG = 1
NZ = 0
! ------------------------------------------------------------------
! EXP(-ALIM)=EXP(-ELIM)/TOL=APPROX. ONE PRECISION GREATER THAN
! THE UNDERFLOW LIMIT
! ------------------------------------------------------------------
CSCL = CMPLX(1.0E0/TOL,0.0E0)
CRSC = CMPLX(TOL,0.0E0)
CSS(1) = CSCL
CSS(2) = CONE
CSS(3) = CRSC
CSR(1) = CRSC
CSR(2) = CONE
CSR(3) = CSCL
BRY(1) = (1.0E+3*X02AME())/TOL
BRY(2) = 1.0E0/BRY(1)
BRY(3) = X02ALE()
X = REAL(Z)
ZR = Z
if (X < 0.0E0) ZR = -Z
J = 2
DO 40 I = 1, N
! ---------------------------------------------------------------
! J FLIP FLOPS BETWEEN 1 AND 2 IN J = 3 - J
! ---------------------------------------------------------------
J = 3 - J
FN = FNU + I - 1
INIT(J) = 0
CALL DEWS17(ZR,FN,2,0,TOL,INIT(J),PHI(J),ZETA1(J),ZETA2(J), &
SUM(J),CWRK(1,J),ELIM)
if (KODE == 1) then
S1 = ZETA1(J) - ZETA2(J)
ELSE
CFN = CMPLX(FN,0.0E0)
S1 = ZETA1(J) - CFN*(CFN/(ZR+ZETA2(J)))
endif
! ---------------------------------------------------------------
! TEST FOR UNDERFLOW AND OVERFLOW
! ---------------------------------------------------------------
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
if (KDFLG == 1) KFLAG = 2
if (ABS(RS1) >= ALIM) then
! ---------------------------------------------------------
! REFINE TEST AND SCALE
! ---------------------------------------------------------
APHI = ABS(PHI(J))
RS1 = RS1 + LOG(APHI)
if (ABS(RS1) > ELIM) then
goto 20
ELSE
if (KDFLG == 1) KFLAG = 1
if (RS1 >= 0.0E0) then
if (KDFLG == 1) KFLAG = 3
endif
endif
endif
! ------------------------------------------------------------
! SCALE S1 TO KEEP INTERMEDIATE ARITHMETIC ON SCALE NEAR
! EXPONENT EXTREMES
! ------------------------------------------------------------
S2 = PHI(J)*SUM(J)
C2R = REAL(S1)
C2I = AIMAG(S1)
C2M = EXP(C2R)*REAL(CSS(KFLAG))
S1 = CMPLX(C2M,0.0E0)*CMPLX(COS(C2I),SIN(C2I))
S2 = S2*S1
if (KFLAG == 1) then
CALL DGVS17(S2,NW,BRY(1),TOL)
if (NW /= 0) goto 20
endif
CY(KDFLG) = S2
Y(I) = S2*CSR(KFLAG)
if (KDFLG == 2) then
goto 60
ELSE
KDFLG = 2
goto 40
endif
endif
20 if (RS1 > 0.0E0) then
goto 280
! ------------------------------------------------------------
! FOR X < 0.0, THE I function TO BE ADDED WILL OVERFLOW
! ------------------------------------------------------------
else if (X < 0.0E0) then
goto 280
ELSE
KDFLG = 1
Y(I) = CZERO
NZ = NZ + 1
if (I /= 1) then
if (Y(I-1) /= CZERO) then
Y(I-1) = CZERO
NZ = NZ + 1
endif
endif
endif
40 continue
I = N
60 RZ = CMPLX(2.0E0,0.0E0)/ZR
CK = CMPLX(FN,0.0E0)*RZ
IB = I + 1
if (N >= IB) then
! ---------------------------------------------------------------
! TEST LAST MEMBER FOR UNDERFLOW AND OVERFLOW, SET SEQUENCE TO
! ZERO ON UNDERFLOW
! ---------------------------------------------------------------
FN = FNU + N - 1
IPARD = 1
if (MR /= 0) IPARD = 0
INITD = 0
CALL DEWS17(ZR,FN,2,IPARD,TOL,INITD,PHID,ZETA1D,ZETA2D,SUMD, &
CWRK(1,3),ELIM)
if (KODE == 1) then
S1 = ZETA1D - ZETA2D
ELSE
CFN = CMPLX(FN,0.0E0)
S1 = ZETA1D - CFN*(CFN/(ZR+ZETA2D))
endif
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
if (ABS(RS1) >= ALIM) then
! ---------------------------------------------------------
! REFINE ESTIMATE AND TEST
! ---------------------------------------------------------
APHI = ABS(PHID)
RS1 = RS1 + LOG(APHI)
if (ABS(RS1) >= ELIM) goto 100
endif
! ------------------------------------------------------------
! RECUR FORWARD FOR REMAINDER OF THE SEQUENCE
! ------------------------------------------------------------
S1 = CY(1)
S2 = CY(2)
C1 = CSR(KFLAG)
ASCLE = BRY(KFLAG)
DO 80 I = IB, N
C2 = S2
S2 = CK*S2 + S1
S1 = C2
CK = CK + RZ
C2 = S2*C1
Y(I) = C2
if (KFLAG < 3) then
C2R = REAL(C2)
C2I = AIMAG(C2)
C2R = ABS(C2R)
C2I = ABS(C2I)
C2M = MAX(C2R,C2I)
if (C2M > ASCLE) then
KFLAG = KFLAG + 1
ASCLE = BRY(KFLAG)
S1 = S1*C1
S2 = C2
S1 = S1*CSS(KFLAG)
S2 = S2*CSS(KFLAG)
C1 = CSR(KFLAG)
endif
endif
80 continue
goto 140
endif
100 if (RS1 > 0.0E0) then
goto 280
! ------------------------------------------------------------
! FOR X < 0.0, THE I function TO BE ADDED WILL OVERFLOW
! ------------------------------------------------------------
else if (X < 0.0E0) then
goto 280
ELSE
NZ = N
DO 120 I = 1, N
Y(I) = CZERO
120 continue
return
endif
endif
140 if (MR == 0) then
return
ELSE
! ---------------------------------------------------------------
! ANALYTIC CONTINUATION FOR RE(Z) < 0.0E0
! ---------------------------------------------------------------
NZ = 0
FMR = MR
SGN = -SIGN(PI,FMR)
! ---------------------------------------------------------------
! CSPN AND CSGN ARE COEFF OF K AND I FUNCIONS RESP.
! ---------------------------------------------------------------
CSGN = CMPLX(0.0E0,SGN)
INU = INT(FNU)
FNF = FNU - INU
IFN = INU + N - 1
ANG = FNF*SGN
CPN = COS(ANG)
SPN = SIN(ANG)
CSPN = CMPLX(CPN,SPN)
if (MOD(IFN,2) == 1) CSPN = -CSPN
ASC = BRY(1)
KK = N
IUF = 0
KDFLG = 1
IB = IB - 1
IC = IB - 1
DO 220 K = 1, N
FN = FNU + KK - 1
! ------------------------------------------------------------
! LOGIC TO SORT OUT CASES WHOSE PARAMETERS WERE SET FOR THE K
! function ABOVE
! ------------------------------------------------------------
M = 3
if (N > 2) then
if ((KK == N) .and. (IB < N)) then
goto 160
else if ((KK /= IB) .and. (KK /= IC)) then
INITD = 0
goto 160
endif
endif
INITD = INIT(J)
PHID = PHI(J)
ZETA1D = ZETA1(J)
ZETA2D = ZETA2(J)
SUMD = SUM(J)
M = J
J = 3 - J
160 CALL DEWS17(ZR,FN,1,0,TOL,INITD,PHID,ZETA1D,ZETA2D,SUMD, &
CWRK(1,M),ELIM)
if (KODE == 1) then
S1 = -ZETA1D + ZETA2D
ELSE
CFN = CMPLX(FN,0.0E0)
S1 = -ZETA1D + CFN*(CFN/(ZR+ZETA2D))
endif
! ------------------------------------------------------------
! TEST FOR UNDERFLOW AND OVERFLOW
! ------------------------------------------------------------
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
if (KDFLG == 1) IFLAG = 2
if (ABS(RS1) >= ALIM) then
! ------------------------------------------------------
! REFINE TEST AND SCALE
! ------------------------------------------------------
APHI = ABS(PHID)
RS1 = RS1 + LOG(APHI)
if (ABS(RS1) > ELIM) then
goto 180
ELSE
if (KDFLG == 1) IFLAG = 1
if (RS1 >= 0.0E0) then
if (KDFLG == 1) IFLAG = 3
endif
endif
endif
S2 = CSGN*PHID*SUMD
C2R = REAL(S1)
C2I = AIMAG(S1)
C2M = EXP(C2R)*REAL(CSS(IFLAG))
S1 = CMPLX(C2M,0.0E0)*CMPLX(COS(C2I),SIN(C2I))
S2 = S2*S1
if (IFLAG == 1) then
CALL DGVS17(S2,NW,BRY(1),TOL)
if (NW /= 0) S2 = CMPLX(0.0E0,0.0E0)
endif
goto 200
endif
180 if (RS1 > 0.0E0) then
goto 280
ELSE
S2 = CZERO
endif
200 CY(KDFLG) = S2
C2 = S2
S2 = S2*CSR(IFLAG)
! ------------------------------------------------------------
! ADD I AND K functionS, K SEQUENCE IN Y(I), I=1,N
! ------------------------------------------------------------
S1 = Y(KK)
if (KODE /= 1) then
CALL DGSS17(ZR,S1,S2,NW,ASC,ALIM,IUF)
NZ = NZ + NW
endif
Y(KK) = S1*CSPN + S2
KK = KK - 1
CSPN = -CSPN
if (C2 == CZERO) then
KDFLG = 1
else if (KDFLG == 2) then
goto 240
ELSE
KDFLG = 2
endif
220 continue
K = N
240 IL = N - K
if (IL /= 0) then
! ------------------------------------------------------------
! RECUR BACKWARD FOR REMAINDER OF I SEQUENCE AND ADD IN THE
! K functionS, SCALING THE I SEQUENCE DURING RECURRENCE TO
! KEEP INTERMEDIATE ARITHMETIC ON SCALE NEAR EXPONENT
! EXTREMES.
! ------------------------------------------------------------
S1 = CY(1)
S2 = CY(2)
CS = CSR(IFLAG)
ASCLE = BRY(IFLAG)
FN = INU + IL
DO 260 I = 1, IL
C2 = S2
S2 = S1 + CMPLX(FN+FNF,0.0E0)*RZ*S2
S1 = C2
FN = FN - 1.0E0
C2 = S2*CS
CK = C2
C1 = Y(KK)
if (KODE /= 1) then
CALL DGSS17(ZR,C1,C2,NW,ASC,ALIM,IUF)
NZ = NZ + NW
endif
Y(KK) = C1*CSPN + C2
KK = KK - 1
CSPN = -CSPN
if (IFLAG < 3) then
C2R = REAL(CK)
C2I = AIMAG(CK)
C2R = ABS(C2R)
C2I = ABS(C2I)
C2M = MAX(C2R,C2I)
if (C2M > ASCLE) then
IFLAG = IFLAG + 1
ASCLE = BRY(IFLAG)
S1 = S1*CS
S2 = CK
S1 = S1*CSS(IFLAG)
S2 = S2*CSS(IFLAG)
CS = CSR(IFLAG)
endif
endif
260 continue
endif
return
endif
280 NZ = -1
return
END
subroutine DERS17(Z,FNU,N,CY,TOL)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-761 (DEC 1989).
!
! Original name: CRATI
!
! DERS17 COMPUTES RATIOS OF I BESSEL functionS BY BACKWARD
! RECURRENCE. THE STARTING INDEX IS DETERMINED BY FORWARD
! RECURRENCE AS DESCRIBED IN J. RES. OF NAT. BUR. OF STANDARDS-B,
! MATHEMATICAL SCIENCES, VOL 77B, P111-114, SEPTEMBER, 1973,
! BESSEL functionS I AND J OF COMPLEX ARGUMENT AND INTEGER ORDER,
! BY D. J. SOOKNE.
!
! .. Scalar Arguments ..
COMPLEX Z
REAL FNU, TOL
INTEGER N
! .. Array Arguments ..
COMPLEX CY(N)
! .. Local Scalars ..
COMPLEX CDFNU, CONE, CZERO, P1, P2, PT, RZ, T1
REAL AK, AMAGZ, AP1, AP2, ARG, AZ, DFNU, FDNU, FLAM, &
FNUP, RAP1, RHO, TEST, TEST1
INTEGER I, ID, IDNU, INU, ITIME, K, KK, MAGZ
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, INT, MAX, MIN, REAL, SQRT
! .. Data statements ..
DATA CZERO, CONE/(0.0E0,0.0E0), (1.0E0,0.0E0)/
! .. Executable Statements ..
!
AZ = ABS(Z)
INU = INT(FNU)
IDNU = INU + N - 1
FDNU = IDNU
MAGZ = INT(AZ)
AMAGZ = MAGZ + 1
FNUP = MAX(AMAGZ,FDNU)
ID = IDNU - MAGZ - 1
ITIME = 1
K = 1
RZ = (CONE+CONE)/Z
T1 = CMPLX(FNUP,0.0E0)*RZ
P2 = -T1
P1 = CONE
T1 = T1 + RZ
if (ID > 0) ID = 0
AP2 = ABS(P2)
AP1 = ABS(P1)
! ------------------------------------------------------------------
! THE OVERFLOW TEST ON K(FNU+I-1,Z) BEFORE THE CALL TO CBKNX
! GUARANTEES THAT P2 IS ON SCALE. SCALE TEST1 AND ALL SUBSEQUENT
! P2 VALUES BY AP1 TO ENSURE THAT AN OVERFLOW DOES NOT OCCUR
! PREMATURELY.
! ------------------------------------------------------------------
ARG = (AP2+AP2)/(AP1*TOL)
TEST1 = SQRT(ARG)
TEST = TEST1
RAP1 = 1.0E0/AP1
P1 = P1*CMPLX(RAP1,0.0E0)
P2 = P2*CMPLX(RAP1,0.0E0)
AP2 = AP2*RAP1
20 continue
K = K + 1
AP1 = AP2
PT = P2
P2 = P1 - T1*P2
P1 = PT
T1 = T1 + RZ
AP2 = ABS(P2)
if (AP1 <= TEST) then
goto 20
else if (ITIME /= 2) then
AK = ABS(T1)*0.5E0
FLAM = AK + SQRT(AK*AK-1.0E0)
RHO = MIN(AP2/AP1,FLAM)
TEST = TEST1*SQRT(RHO/(RHO*RHO-1.0E0))
ITIME = 2
goto 20
endif
KK = K + 1 - ID
AK = KK
DFNU = FNU + N - 1
CDFNU = CMPLX(DFNU,0.0E0)
T1 = CMPLX(AK,0.0E0)
P1 = CMPLX(1.0E0/AP2,0.0E0)
P2 = CZERO
DO 40 I = 1, KK
PT = P1
P1 = RZ*(CDFNU+T1)*P1 + P2
P2 = PT
T1 = T1 - CONE
40 continue
if (REAL(P1) == 0.0E0 .and. AIMAG(P1) == 0.0E0) P1 = CMPLX(TOL, &
TOL)
CY(N) = P2/P1
if (N /= 1) then
K = N - 1
AK = K
T1 = CMPLX(AK,0.0E0)
CDFNU = CMPLX(FNU,0.0E0)*RZ
DO 60 I = 2, N
PT = CDFNU + T1*RZ + CY(K+1)
if (REAL(PT) == 0.0E0 .and. AIMAG(PT) == 0.0E0) &
PT = CMPLX(TOL,TOL)
CY(K) = CONE/PT
T1 = T1 - CONE
K = K - 1
60 continue
endif
return
END
subroutine DESS17(ZR,FNU,KODE,N,Y,NZ,CW,TOL,ELIM,ALIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-762 (DEC 1989).
!
! Original name: CWRSK
!
! DESS17 COMPUTES THE I BESSEL function FOR RE(Z) >= 0.0 BY
! NORMALIZING THE I function RATIOS FROM DERS17 BY THE WRONSKIAN
!
! .. Scalar Arguments ..
COMPLEX ZR
REAL ALIM, ELIM, FNU, TOL
INTEGER KODE, N, NZ
! .. Array Arguments ..
COMPLEX CW(2), Y(N)
! .. Local Scalars ..
COMPLEX C1, C2, CINU, CSCL, CT, RCT, ST
REAL ACT, ACW, ASCLE, S1, S2, YY
INTEGER I, NW
! .. External functions ..
REAL X02AME
EXTERNAL X02AME
! .. External subroutines ..
EXTERNAL DERS17, DGXS17
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, CONJG, COS, SIN
! .. Executable Statements ..
! ------------------------------------------------------------------
! I(FNU+I-1,Z) BY BACKWARD RECURRENCE FOR RATIOS
! Y(I)=I(FNU+I,Z)/I(FNU+I-1,Z) FROM DERS17 NORMALIZED BY THE
! WRONSKIAN WITH K(FNU,Z) AND K(FNU+1,Z) FROM DGXS17.
! ------------------------------------------------------------------
NZ = 0
CALL DGXS17(ZR,FNU,KODE,2,CW,NW,TOL,ELIM,ALIM)
if (NW /= 0) then
NZ = -1
if (NW == (-2)) NZ = -2
if (NW == (-3)) NZ = -3
ELSE
CALL DERS17(ZR,FNU,N,Y,TOL)
! ---------------------------------------------------------------
! RECUR FORWARD ON I(FNU+1,Z) = R(FNU,Z)*I(FNU,Z),
! R(FNU+J-1,Z)=Y(J), J=1,...,N
! ---------------------------------------------------------------
CINU = CMPLX(1.0E0,0.0E0)
if (KODE /= 1) then
YY = AIMAG(ZR)
S1 = COS(YY)
S2 = SIN(YY)
CINU = CMPLX(S1,S2)
endif
! ---------------------------------------------------------------
! ON LOW EXPONENT MACHINES THE K functionS CAN BE CLOSE TO BOTH
! THE UNDER AND OVERFLOW LIMITS AND THE NORMALIZATION MUST BE
! SCALED TO PREVENT OVER OR UNDERFLOW. DEVS17 HAS DETERMINED THAT
! THE RESULT IS ON SCALE.
! ---------------------------------------------------------------
ACW = ABS(CW(2))
ASCLE = (1.0E+3*X02AME())/TOL
CSCL = CMPLX(1.0E0,0.0E0)
if (ACW > ASCLE) then
ASCLE = 1.0E0/ASCLE
if (ACW >= ASCLE) CSCL = CMPLX(TOL,0.0E0)
ELSE
CSCL = CMPLX(1.0E0/TOL,0.0E0)
endif
C1 = CW(1)*CSCL
C2 = CW(2)*CSCL
ST = Y(1)
! ---------------------------------------------------------------
! CINU=CINU*(CONJG(CT)/CABS(CT))*(1.0E0/CABS(CT) PREVENTS
! UNDER- OR OVERFLOW PREMATURELY BY SQUARING CABS(CT)
! ---------------------------------------------------------------
CT = ZR*(C2+ST*C1)
ACT = ABS(CT)
RCT = CMPLX(1.0E0/ACT,0.0E0)
CT = CONJG(CT)*RCT
CINU = CINU*RCT*CT
Y(1) = CINU*CSCL
if (N /= 1) then
DO 20 I = 2, N
CINU = ST*CINU
ST = Y(I)
Y(I) = CINU*CSCL
20 continue
endif
endif
return
END
subroutine DETS17(Z,FNU,KODE,N,Y,NZ,NLAST,FNUL,TOL,ELIM,ALIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-763 (DEC 1989).
!
! Original name: CUNI2
!
! DETS17 COMPUTES I(FNU,Z) IN THE RIGHT HALF PLANE BY MEANS OF
! UNIFORM ASYMPTOTIC EXPANSION FOR J(FNU,ZN) WHERE ZN IS Z*I
! OR -Z*I AND ZN IS IN THE RIGHT HALF PLANE ALSO.
!
! FNUL IS THE SMALLEST ORDER PERMITTED FOR THE ASYMPTOTIC
! EXPANSION. NLAST=0 MEANS ALL OF THE Y VALUES WERE SET.
! NLAST /= 0 IS THE NUMBER LEFT TO BE COMPUTED BY ANOTHER
! FORMULA FOR ORDERS FNU TO FNU+NLAST-1 BECAUSE FNU+NLAST-1 < FNUL.
! Y(I)=CZERO FOR I=NLAST+1,N
!
! .. Scalar Arguments ..
COMPLEX Z
REAL ALIM, ELIM, FNU, FNUL, TOL
INTEGER KODE, N, NLAST, NZ
! .. Array Arguments ..
COMPLEX Y(N)
! .. Local Scalars ..
COMPLEX AI, ARG, ASUM, BSUM, C1, C2, CFN, CI, CID, CONE, &
CRSC, CSCL, CZERO, DAI, PHI, RZ, S1, S2, ZB, &
ZETA1, ZETA2, ZN
REAL AARG, AIC, ANG, APHI, ASCLE, AY, C2I, C2M, C2R, &
CAR, FN, HPI, RS1, SAR, YY
INTEGER I, IDUM, IFLAG, IN, INU, J, K, NAI, ND, NDAI, &
NN, NUF, NW
! .. Local Arrays ..
COMPLEX CIP(4), CSR(3), CSS(3), CY(2)
REAL BRY(3)
! .. External functions ..
REAL X02AME, X02ALE
EXTERNAL X02AME, X02ALE
! .. External subroutines ..
EXTERNAL DEUS17, DEVS17, S17DGE, DGVS17
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, CONJG, COS, EXP, INT, LOG, &
MAX, MIN, MOD, REAL, SIN
! .. Data statements ..
DATA CZERO, CONE, CI/(0.0E0,0.0E0), (1.0E0,0.0E0), &
(0.0E0,1.0E0)/
DATA CIP(1), CIP(2), CIP(3), CIP(4)/(1.0E0,0.0E0), &
(0.0E0,1.0E0), (-1.0E0,0.0E0), (0.0E0,-1.0E0)/
DATA HPI, AIC/1.57079632679489662E+00, &
1.265512123484645396E+00/
! .. Executable Statements ..
!
NZ = 0
ND = N
NLAST = 0
! ------------------------------------------------------------------
! COMPUTED VALUES WITH EXPONENTS BETWEEN ALIM AND ELIM IN MAG-
! NITUDE ARE SCALED TO KEEP INTERMEDIATE ARITHMETIC ON SCALE,
! EXP(ALIM)=EXP(ELIM)*TOL
! ------------------------------------------------------------------
CSCL = CMPLX(1.0E0/TOL,0.0E0)
CRSC = CMPLX(TOL,0.0E0)
CSS(1) = CSCL
CSS(2) = CONE
CSS(3) = CRSC
CSR(1) = CRSC
CSR(2) = CONE
CSR(3) = CSCL
BRY(1) = (1.0E+3*X02AME())/TOL
YY = AIMAG(Z)
! ------------------------------------------------------------------
! ZN IS IN THE RIGHT HALF PLANE AFTER ROTATION BY CI OR -CI
! ------------------------------------------------------------------
ZN = -Z*CI
ZB = Z
CID = -CI
INU = INT(FNU)
ANG = HPI*(FNU-INU)
CAR = COS(ANG)
SAR = SIN(ANG)
C2 = CMPLX(CAR,SAR)
IN = INU + N - 1
IN = MOD(IN,4)
C2 = C2*CIP(IN+1)
if (YY <= 0.0E0) then
ZN = CONJG(-ZN)
ZB = CONJG(ZB)
CID = -CID
C2 = CONJG(C2)
endif
! ------------------------------------------------------------------
! CHECK FOR UNDERFLOW AND OVERFLOW ON FIRST MEMBER
! ------------------------------------------------------------------
FN = MAX(FNU,1.0E0)
CALL DEUS17(ZN,FN,1,TOL,PHI,ARG,ZETA1,ZETA2,ASUM,BSUM,ELIM)
if (KODE == 1) then
S1 = -ZETA1 + ZETA2
ELSE
CFN = CMPLX(FNU,0.0E0)
S1 = -ZETA1 + CFN*(CFN/(ZB+ZETA2))
endif
RS1 = REAL(S1)
if (ABS(RS1) <= ELIM) then
20 continue
NN = MIN(2,ND)
DO 40 I = 1, NN
FN = FNU + ND - I
CALL DEUS17(ZN,FN,0,TOL,PHI,ARG,ZETA1,ZETA2,ASUM,BSUM,ELIM)
if (KODE == 1) then
S1 = -ZETA1 + ZETA2
ELSE
CFN = CMPLX(FN,0.0E0)
AY = ABS(YY)
S1 = -ZETA1 + CFN*(CFN/(ZB+ZETA2)) + CMPLX(0.0E0,AY)
endif
! ------------------------------------------------------------
! TEST FOR UNDERFLOW AND OVERFLOW
! ------------------------------------------------------------
RS1 = REAL(S1)
if (ABS(RS1) > ELIM) then
goto 60
ELSE
if (I == 1) IFLAG = 2
if (ABS(RS1) >= ALIM) then
! ------------------------------------------------------
! REFINE TEST AND SCALE
! ------------------------------------------------------
! ------------------------------------------------------
APHI = ABS(PHI)
AARG = ABS(ARG)
RS1 = RS1 + LOG(APHI) - 0.25E0*LOG(AARG) - AIC
if (ABS(RS1) > ELIM) then
goto 60
ELSE
if (I == 1) IFLAG = 1
if (RS1 >= 0.0E0) then
if (I == 1) IFLAG = 3
endif
endif
endif
! ---------------------------------------------------------
! SCALE S1 TO KEEP INTERMEDIATE ARITHMETIC ON SCALE NEAR
! EXPONENT EXTREMES
! ---------------------------------------------------------
IDUM = 1
! S17DGE assumed not to fail, therefore IDUM set to one.
CALL S17DGE('F',ARG,'S',AI,NAI,IDUM)
IDUM = 1
CALL S17DGE('D',ARG,'S',DAI,NDAI,IDUM)
S2 = PHI*(AI*ASUM+DAI*BSUM)
C2R = REAL(S1)
C2I = AIMAG(S1)
C2M = EXP(C2R)*REAL(CSS(IFLAG))
S1 = CMPLX(C2M,0.0E0)*CMPLX(COS(C2I),SIN(C2I))
S2 = S2*S1
if (IFLAG == 1) then
CALL DGVS17(S2,NW,BRY(1),TOL)
if (NW /= 0) goto 60
endif
if (YY <= 0.0E0) S2 = CONJG(S2)
J = ND - I + 1
S2 = S2*C2
CY(I) = S2
Y(J) = S2*CSR(IFLAG)
C2 = C2*CID
endif
40 continue
goto 80
60 if (RS1 > 0.0E0) then
goto 160
ELSE
! ------------------------------------------------------------
! SET UNDERFLOW AND UPDATE PARAMETERS
! ------------------------------------------------------------
Y(ND) = CZERO
NZ = NZ + 1
ND = ND - 1
if (ND == 0) then
return
ELSE
CALL DEVS17(Z,FNU,KODE,1,ND,Y,NUF,TOL,ELIM,ALIM)
if (NUF < 0) then
goto 160
ELSE
ND = ND - NUF
NZ = NZ + NUF
if (ND == 0) then
return
ELSE
FN = FNU + ND - 1
if (FN < FNUL) then
goto 120
ELSE
! FN = AIMAG(CID)
! J = NUF + 1
! K = MOD(J,4) + 1
! S1 = CIP(K)
! if (FN < 0.0E0) S1 = CONJG(S1)
! C2 = C2*S1
! The above 6 lines were replaced by the 5 below
! to fix a bug discovered during implementation
! on a Multics machine, whereby some results
! were returned wrongly scaled by sqrt(-1.0). MWP.
C2 = CMPLX(CAR,SAR)
IN = INU + ND - 1
IN = MOD(IN,4) + 1
C2 = C2*CIP(IN)
if (YY <= 0.0E0) C2 = CONJG(C2)
goto 20
endif
endif
endif
endif
endif
80 if (ND > 2) then
RZ = CMPLX(2.0E0,0.0E0)/Z
BRY(2) = 1.0E0/BRY(1)
BRY(3) = X02ALE()
S1 = CY(1)
S2 = CY(2)
C1 = CSR(IFLAG)
ASCLE = BRY(IFLAG)
K = ND - 2
FN = K
DO 100 I = 3, ND
C2 = S2
S2 = S1 + CMPLX(FNU+FN,0.0E0)*RZ*S2
S1 = C2
C2 = S2*C1
Y(K) = C2
K = K - 1
FN = FN - 1.0E0
if (IFLAG < 3) then
C2R = REAL(C2)
C2I = AIMAG(C2)
C2R = ABS(C2R)
C2I = ABS(C2I)
C2M = MAX(C2R,C2I)
if (C2M > ASCLE) then
IFLAG = IFLAG + 1
ASCLE = BRY(IFLAG)
S1 = S1*C1
S2 = C2
S1 = S1*CSS(IFLAG)
S2 = S2*CSS(IFLAG)
C1 = CSR(IFLAG)
endif
endif
100 continue
endif
return
120 NLAST = ND
return
else if (RS1 <= 0.0E0) then
NZ = N
DO 140 I = 1, N
Y(I) = CZERO
140 continue
return
endif
160 NZ = -1
return
END
subroutine DEUS17(Z,FNU,IPMTR,TOL,PHI,ARG,ZETA1,ZETA2,ASUM,BSUM, &
ELIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-764 (DEC 1989).
!
! Original name: CUNHJ
!
! REFERENCES
! HANDBOOK OF MATHEMATICAL functionS BY M. ABRAMOWITZ AND I.A.
! STEGUN, AMS55, NATIONAL BUREAU OF STANDARDS, 1965, CHAPTER 9.
!
! ASYMPTOTICS AND SPECIAL functionS BY F.W.J. OLVER, ACADEMIC
! PRESS, N.Y., 1974, PAGE 420
!
! ABSTRACT
! DEUS17 COMPUTES PARAMETERS FOR BESSEL functionS C(FNU,Z) =
! J(FNU,Z), Y(FNU,Z) OR H(I,FNU,Z) I=1,2 FOR LARGE ORDERS FNU
! BY MEANS OF THE UNIFORM ASYMPTOTIC EXPANSION
!
! C(FNU,Z)=C1*PHI*( ASUM*AIRY(ARG) + C2*BSUM*DAIRY(ARG) )
!
! FOR PROPER CHOICES OF C1, C2, AIRY AND DAIRY WHERE AIRY IS
! AN AIRY function AND DAIRY IS ITS DERIVATIVE.
!
! (2/3)*FNU*ZETA**1.5 = ZETA1-ZETA2,
!
! ZETA1=0.5*FNU*CLOG((1+W)/(1-W)), ZETA2=FNU*W FOR SCALING
! PURPOSES IN AIRY functionS FROM S17DGE OR S17DHE.
!
! MCONJ=SIGN OF AIMAG(Z), BUT IS AMBIGUOUS WHEN Z IS REAL AND
! MUST BE SPECIFIED. IPMTR=0 returnS ALL PARAMETERS. IPMTR=
! 1 COMPUTES ALL EXCEPT ASUM AND BSUM.
!
! .. Scalar Arguments ..
COMPLEX ARG, ASUM, BSUM, PHI, Z, ZETA1, ZETA2
REAL ELIM, FNU, TOL
INTEGER IPMTR
! .. Local Scalars ..
COMPLEX CFNU, CONE, CZERO, PRZTH, PTFN, RFN13, RTZTA, &
RZTH, SUMA, SUMB, T2, TFN, W, W2, ZA, ZB, ZC, &
ZETA, ZTH
REAL ANG, ASUMI, ASUMR, ATOL, AW2, AZTH, BSUMI, &
BSUMR, BTOL, EX1, EX2, FN13, FN23, HPI, PI, PP, &
RFNU, RFNU2, TEST, THPI, TSTI, TSTR, WI, WR, &
ZCI, ZCR, ZETAI, ZETAR, ZTHI, ZTHR
INTEGER IAS, IBS, IS, J, JR, JU, K, KMAX, KP1, KS, L, &
L1, L2, LR, LRP1, M
! .. Local Arrays ..
COMPLEX CR(14), DR(14), P(30), UP(14)
REAL ALFA(180), AP(30), AR(14), BETA(210), BR(14), &
C(105), GAMA(30)
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, ATAN, CMPLX, COS, EXP, LOG, REAL, &
SIN, SQRT
! .. Data statements ..
DATA AR(1), AR(2), AR(3), AR(4), AR(5), AR(6), AR(7), &
AR(8), AR(9), AR(10), AR(11), AR(12), AR(13), &
AR(14)/1.00000000000000000E+00, &
1.04166666666666667E-01, &
8.35503472222222222E-02, &
1.28226574556327160E-01, &
2.91849026464140464E-01, &
8.81627267443757652E-01, &
3.32140828186276754E+00, &
1.49957629868625547E+01, &
7.89230130115865181E+01, &
4.74451538868264323E+02, &
3.20749009089066193E+03, &
2.40865496408740049E+04, &
1.98923119169509794E+05, &
1.79190200777534383E+06/
DATA BR(1), BR(2), BR(3), BR(4), BR(5), BR(6), BR(7), &
BR(8), BR(9), BR(10), BR(11), BR(12), BR(13), &
BR(14)/1.00000000000000000E+00, &
-1.45833333333333333E-01, &
-9.87413194444444444E-02, &
-1.43312053915895062E-01, &
-3.17227202678413548E-01, &
-9.42429147957120249E-01, &
-3.51120304082635426E+00, &
-1.57272636203680451E+01, &
-8.22814390971859444E+01, &
-4.92355370523670524E+02, &
-3.31621856854797251E+03, &
-2.48276742452085896E+04, &
-2.04526587315129788E+05, &
-1.83844491706820990E+06/
DATA C(1), C(2), C(3), C(4), C(5), C(6), C(7), C(8), &
C(9), C(10), C(11), C(12), C(13), C(14), C(15), &
C(16)/1.00000000000000000E+00, &
-2.08333333333333333E-01, &
1.25000000000000000E-01, &
3.34201388888888889E-01, &
-4.01041666666666667E-01, &
7.03125000000000000E-02, &
-1.02581259645061728E+00, &
1.84646267361111111E+00, &
-8.91210937500000000E-01, &
7.32421875000000000E-02, &
4.66958442342624743E+00, &
-1.12070026162229938E+01, &
8.78912353515625000E+00, &
-2.36408691406250000E+00, &
1.12152099609375000E-01, &
-2.82120725582002449E+01/
DATA C(17), C(18), C(19), C(20), C(21), C(22), C(23), &
C(24)/8.46362176746007346E+01, &
-9.18182415432400174E+01, &
4.25349987453884549E+01, &
-7.36879435947963170E+00, &
2.27108001708984375E-01, &
2.12570130039217123E+02, &
-7.65252468141181642E+02, &
1.05999045252799988E+03/
DATA C(25), C(26), C(27), C(28), C(29), C(30), C(31), &
C(32), C(33), C(34), C(35), C(36), C(37), C(38), &
C(39), C(40)/-6.99579627376132541E+02, &
2.18190511744211590E+02, &
-2.64914304869515555E+01, &
5.72501420974731445E-01, &
-1.91945766231840700E+03, &
8.06172218173730938E+03, &
-1.35865500064341374E+04, &
1.16553933368645332E+04, &
-5.30564697861340311E+03, &
1.20090291321635246E+03, &
-1.08090919788394656E+02, &
1.72772750258445740E+00, &
2.02042913309661486E+04, &
-9.69805983886375135E+04, &
1.92547001232531532E+05, &
-2.03400177280415534E+05/
DATA C(41), C(42), C(43), C(44), C(45), C(46), C(47), &
C(48)/1.22200464983017460E+05, &
-4.11926549688975513E+04, &
7.10951430248936372E+03, &
-4.93915304773088012E+02, &
6.07404200127348304E+00, &
-2.42919187900551333E+05, &
1.31176361466297720E+06, &
-2.99801591853810675E+06/
DATA C(49), C(50), C(51), C(52), C(53), C(54), C(55), &
C(56), C(57), C(58), C(59), C(60), C(61), C(62), &
C(63), C(64)/3.76327129765640400E+06, &
-2.81356322658653411E+06, &
1.26836527332162478E+06, &
-3.31645172484563578E+05, &
4.52187689813627263E+04, &
-2.49983048181120962E+03, &
2.43805296995560639E+01, &
3.28446985307203782E+06, &
-1.97068191184322269E+07, &
5.09526024926646422E+07, &
-7.41051482115326577E+07, &
6.63445122747290267E+07, &
-3.75671766607633513E+07, &
1.32887671664218183E+07, &
-2.78561812808645469E+06, &
3.08186404612662398E+05/
DATA C(65), C(66), C(67), C(68), C(69), C(70), C(71), &
C(72)/-1.38860897537170405E+04, &
1.10017140269246738E+02, &
-4.93292536645099620E+07, &
3.25573074185765749E+08, &
-9.39462359681578403E+08, &
1.55359689957058006E+09, &
-1.62108055210833708E+09, &
1.10684281682301447E+09/
DATA C(73), C(74), C(75), C(76), C(77), C(78), C(79), &
C(80), C(81), C(82), C(83), C(84), C(85), C(86), &
C(87), C(88)/-4.95889784275030309E+08, &
1.42062907797533095E+08, &
-2.44740627257387285E+07, &
2.24376817792244943E+06, &
-8.40054336030240853E+04, &
5.51335896122020586E+02, &
8.14789096118312115E+08, &
-5.86648149205184723E+09, &
1.86882075092958249E+10, &
-3.46320433881587779E+10, &
4.12801855797539740E+10, &
-3.30265997498007231E+10, &
1.79542137311556001E+10, &
-6.56329379261928433E+09, &
1.55927986487925751E+09, &
-2.25105661889415278E+08/
DATA C(89), C(90), C(91), C(92), C(93), C(94), C(95), &
C(96)/1.73951075539781645E+07, &
-5.49842327572288687E+05, &
3.03809051092238427E+03, &
-1.46792612476956167E+10, &
1.14498237732025810E+11, &
-3.99096175224466498E+11, &
8.19218669548577329E+11, &
-1.09837515608122331E+12/
DATA C(97), C(98), C(99), C(100), C(101), C(102), &
C(103), C(104), C(105)/1.00815810686538209E+12, &
-6.45364869245376503E+11, &
2.87900649906150589E+11, &
-8.78670721780232657E+10, &
1.76347306068349694E+10, &
-2.16716498322379509E+09, &
1.43157876718888981E+08, &
-3.87183344257261262E+06, &
1.82577554742931747E+04/
DATA ALFA(1), ALFA(2), ALFA(3), ALFA(4), ALFA(5), &
ALFA(6), ALFA(7), ALFA(8), ALFA(9), ALFA(10), &
ALFA(11), ALFA(12), ALFA(13), &
ALFA(14)/-4.44444444444444444E-03, &
-9.22077922077922078E-04, &
-8.84892884892884893E-05, &
1.65927687832449737E-04, &
2.46691372741792910E-04, &
2.65995589346254780E-04, &
2.61824297061500945E-04, &
2.48730437344655609E-04, &
2.32721040083232098E-04, &
2.16362485712365082E-04, &
2.00738858762752355E-04, &
1.86267636637545172E-04, &
1.73060775917876493E-04, &
1.61091705929015752E-04/
DATA ALFA(15), ALFA(16), ALFA(17), ALFA(18), &
ALFA(19), ALFA(20), ALFA(21), &
ALFA(22)/1.50274774160908134E-04, &
1.40503497391269794E-04, &
1.31668816545922806E-04, &
1.23667445598253261E-04, &
1.16405271474737902E-04, &
1.09798298372713369E-04, &
1.03772410422992823E-04, &
9.82626078369363448E-05/
DATA ALFA(23), ALFA(24), ALFA(25), ALFA(26), &
ALFA(27), ALFA(28), ALFA(29), ALFA(30), &
ALFA(31), ALFA(32), ALFA(33), ALFA(34), &
ALFA(35), ALFA(36)/9.32120517249503256E-05, &
8.85710852478711718E-05, &
8.42963105715700223E-05, &
8.03497548407791151E-05, &
7.66981345359207388E-05, &
7.33122157481777809E-05, &
7.01662625163141333E-05, &
6.72375633790160292E-05, &
6.93735541354588974E-04, &
2.32241745182921654E-04, &
-1.41986273556691197E-05, &
-1.16444931672048640E-04, &
-1.50803558053048762E-04, &
-1.55121924918096223E-04/
DATA ALFA(37), ALFA(38), ALFA(39), ALFA(40), &
ALFA(41), ALFA(42), ALFA(43), &
ALFA(44)/-1.46809756646465549E-04, &
-1.33815503867491367E-04, &
-1.19744975684254051E-04, &
-1.06184319207974020E-04, &
-9.37699549891194492E-05, &
-8.26923045588193274E-05, &
-7.29374348155221211E-05, &
-6.44042357721016283E-05/
DATA ALFA(45), ALFA(46), ALFA(47), ALFA(48), &
ALFA(49), ALFA(50), ALFA(51), ALFA(52), &
ALFA(53), ALFA(54), ALFA(55), ALFA(56), &
ALFA(57), ALFA(58)/-5.69611566009369048E-05, &
-5.04731044303561628E-05, &
-4.48134868008882786E-05, &
-3.98688727717598864E-05, &
-3.55400532972042498E-05, &
-3.17414256609022480E-05, &
-2.83996793904174811E-05, &
-2.54522720634870566E-05, &
-2.28459297164724555E-05, &
-2.05352753106480604E-05, &
-1.84816217627666085E-05, &
-1.66519330021393806E-05, &
-1.50179412980119482E-05, &
-1.35554031379040526E-05/
DATA ALFA(59), ALFA(60), ALFA(61), ALFA(62), &
ALFA(63), ALFA(64), ALFA(65), &
ALFA(66)/-1.22434746473858131E-05, &
-1.10641884811308169E-05, &
-3.54211971457743841E-04, &
-1.56161263945159416E-04, &
3.04465503594936410E-05, &
1.30198655773242693E-04, &
1.67471106699712269E-04, &
1.70222587683592569E-04/
DATA ALFA(67), ALFA(68), ALFA(69), ALFA(70), &
ALFA(71), ALFA(72), ALFA(73), ALFA(74), &
ALFA(75), ALFA(76), ALFA(77), ALFA(78), &
ALFA(79), ALFA(80)/1.56501427608594704E-04, &
1.36339170977445120E-04, &
1.14886692029825128E-04, &
9.45869093034688111E-05, &
7.64498419250898258E-05, &
6.07570334965197354E-05, &
4.74394299290508799E-05, &
3.62757512005344297E-05, &
2.69939714979224901E-05, &
1.93210938247939253E-05, &
1.30056674793963203E-05, &
7.82620866744496661E-06, &
3.59257485819351583E-06, &
1.44040049814251817E-07/
DATA ALFA(81), ALFA(82), ALFA(83), ALFA(84), &
ALFA(85), ALFA(86), ALFA(87), &
ALFA(88)/-2.65396769697939116E-06, &
-4.91346867098485910E-06, &
-6.72739296091248287E-06, &
-8.17269379678657923E-06, &
-9.31304715093561232E-06, &
-1.02011418798016441E-05, &
-1.08805962510592880E-05, &
-1.13875481509603555E-05/
DATA ALFA(89), ALFA(90), ALFA(91), ALFA(92), &
ALFA(93), ALFA(94), ALFA(95), ALFA(96), &
ALFA(97), ALFA(98), ALFA(99), ALFA(100), &
ALFA(101), ALFA(102)/-1.17519675674556414E-05, &
-1.19987364870944141E-05, &
3.78194199201772914E-04, &
2.02471952761816167E-04, &
-6.37938506318862408E-05, &
-2.38598230603005903E-04, &
-3.10916256027361568E-04, &
-3.13680115247576316E-04, &
-2.78950273791323387E-04, &
-2.28564082619141374E-04, &
-1.75245280340846749E-04, &
-1.25544063060690348E-04, &
-8.22982872820208365E-05, &
-4.62860730588116458E-05/
DATA ALFA(103), ALFA(104), ALFA(105), ALFA(106), &
ALFA(107), ALFA(108), ALFA(109), &
ALFA(110)/-1.72334302366962267E-05, &
5.60690482304602267E-06, &
2.31395443148286800E-05, &
3.62642745856793957E-05, &
4.58006124490188752E-05, &
5.24595294959114050E-05, &
5.68396208545815266E-05, &
5.94349820393104052E-05/
DATA ALFA(111), ALFA(112), ALFA(113), ALFA(114), &
ALFA(115), ALFA(116), ALFA(117), ALFA(118), &
ALFA(119), ALFA(120), ALFA(121), &
ALFA(122)/6.06478527578421742E-05, &
6.08023907788436497E-05, &
6.01577894539460388E-05, &
5.89199657344698500E-05, &
5.72515823777593053E-05, &
5.52804375585852577E-05, &
5.31063773802880170E-05, &
5.08069302012325706E-05, &
4.84418647620094842E-05, &
4.60568581607475370E-05, &
-6.91141397288294174E-04, &
-4.29976633058871912E-04/
DATA ALFA(123), ALFA(124), ALFA(125), ALFA(126), &
ALFA(127), ALFA(128), ALFA(129), &
ALFA(130)/1.83067735980039018E-04, &
6.60088147542014144E-04, &
8.75964969951185931E-04, &
8.77335235958235514E-04, &
7.49369585378990637E-04, &
5.63832329756980918E-04, &
3.68059319971443156E-04, &
1.88464535514455599E-04/
DATA ALFA(131), ALFA(132), ALFA(133), ALFA(134), &
ALFA(135), ALFA(136), ALFA(137), ALFA(138), &
ALFA(139), ALFA(140), ALFA(141), &
ALFA(142)/3.70663057664904149E-05, &
-8.28520220232137023E-05, &
-1.72751952869172998E-04, &
-2.36314873605872983E-04, &
-2.77966150694906658E-04, &
-3.02079514155456919E-04, &
-3.12594712643820127E-04, &
-3.12872558758067163E-04, &
-3.05678038466324377E-04, &
-2.93226470614557331E-04, &
-2.77255655582934777E-04, &
-2.59103928467031709E-04/
DATA ALFA(143), ALFA(144), ALFA(145), ALFA(146), &
ALFA(147), ALFA(148), ALFA(149), &
ALFA(150)/-2.39784014396480342E-04, &
-2.20048260045422848E-04, &
-2.00443911094971498E-04, &
-1.81358692210970687E-04, &
-1.63057674478657464E-04, &
-1.45712672175205844E-04, &
-1.29425421983924587E-04, &
-1.14245691942445952E-04/
DATA ALFA(151), ALFA(152), ALFA(153), ALFA(154), &
ALFA(155), ALFA(156), ALFA(157), ALFA(158), &
ALFA(159), ALFA(160), ALFA(161), &
ALFA(162)/1.92821964248775885E-03, &
1.35592576302022234E-03, &
-7.17858090421302995E-04, &
-2.58084802575270346E-03, &
-3.49271130826168475E-03, &
-3.46986299340960628E-03, &
-2.82285233351310182E-03, &
-1.88103076404891354E-03, &
-8.89531718383947600E-04, &
3.87912102631035228E-06, &
7.28688540119691412E-04, &
1.26566373053457758E-03/
DATA ALFA(163), ALFA(164), ALFA(165), ALFA(166), &
ALFA(167), ALFA(168), ALFA(169), &
ALFA(170)/1.62518158372674427E-03, &
1.83203153216373172E-03, &
1.91588388990527909E-03, &
1.90588846755546138E-03, &
1.82798982421825727E-03, &
1.70389506421121530E-03, &
1.55097127171097686E-03, &
1.38261421852276159E-03/
DATA ALFA(171), ALFA(172), ALFA(173), ALFA(174), &
ALFA(175), ALFA(176), ALFA(177), ALFA(178), &
ALFA(179), ALFA(180)/1.20881424230064774E-03, &
1.03676532638344962E-03, &
8.71437918068619115E-04, &
7.16080155297701002E-04, &
5.72637002558129372E-04, &
4.42089819465802277E-04, &
3.24724948503090564E-04, &
2.20342042730246599E-04, &
1.28412898401353882E-04, &
4.82005924552095464E-05/
DATA BETA(1), BETA(2), BETA(3), BETA(4), BETA(5), &
BETA(6), BETA(7), BETA(8), BETA(9), BETA(10), &
BETA(11), BETA(12), BETA(13), &
BETA(14)/1.79988721413553309E-02, &
5.59964911064388073E-03, &
2.88501402231132779E-03, &
1.80096606761053941E-03, &
1.24753110589199202E-03, &
9.22878876572938311E-04, &
7.14430421727287357E-04, &
5.71787281789704872E-04, &
4.69431007606481533E-04, &
3.93232835462916638E-04, &
3.34818889318297664E-04, &
2.88952148495751517E-04, &
2.52211615549573284E-04, &
2.22280580798883327E-04/
DATA BETA(15), BETA(16), BETA(17), BETA(18), &
BETA(19), BETA(20), BETA(21), &
BETA(22)/1.97541838033062524E-04, &
1.76836855019718004E-04, &
1.59316899661821081E-04, &
1.44347930197333986E-04, &
1.31448068119965379E-04, &
1.20245444949302884E-04, &
1.10449144504599392E-04, &
1.01828770740567258E-04/
DATA BETA(23), BETA(24), BETA(25), BETA(26), &
BETA(27), BETA(28), BETA(29), BETA(30), &
BETA(31), BETA(32), BETA(33), BETA(34), &
BETA(35), BETA(36)/9.41998224204237509E-05, &
8.74130545753834437E-05, &
8.13466262162801467E-05, &
7.59002269646219339E-05, &
7.09906300634153481E-05, &
6.65482874842468183E-05, &
6.25146958969275078E-05, &
5.88403394426251749E-05, &
-1.49282953213429172E-03, &
-8.78204709546389328E-04, &
-5.02916549572034614E-04, &
-2.94822138512746025E-04, &
-1.75463996970782828E-04, &
-1.04008550460816434E-04/
DATA BETA(37), BETA(38), BETA(39), BETA(40), &
BETA(41), BETA(42), BETA(43), &
BETA(44)/-5.96141953046457895E-05, &
-3.12038929076098340E-05, &
-1.26089735980230047E-05, &
-2.42892608575730389E-07, &
8.05996165414273571E-06, &
1.36507009262147391E-05, &
1.73964125472926261E-05, &
1.98672978842133780E-05/
DATA BETA(45), BETA(46), BETA(47), BETA(48), &
BETA(49), BETA(50), BETA(51), BETA(52), &
BETA(53), BETA(54), BETA(55), BETA(56), &
BETA(57), BETA(58)/2.14463263790822639E-05, &
2.23954659232456514E-05, &
2.28967783814712629E-05, &
2.30785389811177817E-05, &
2.30321976080909144E-05, &
2.28236073720348722E-05, &
2.25005881105292418E-05, &
2.20981015361991429E-05, &
2.16418427448103905E-05, &
2.11507649256220843E-05, &
2.06388749782170737E-05, &
2.01165241997081666E-05, &
1.95913450141179244E-05, &
1.90689367910436740E-05/
DATA BETA(59), BETA(60), BETA(61), BETA(62), &
BETA(63), BETA(64), BETA(65), &
BETA(66)/1.85533719641636667E-05, &
1.80475722259674218E-05, &
5.52213076721292790E-04, &
4.47932581552384646E-04, &
2.79520653992020589E-04, &
1.52468156198446602E-04, &
6.93271105657043598E-05, &
1.76258683069991397E-05/
DATA BETA(67), BETA(68), BETA(69), BETA(70), &
BETA(71), BETA(72), BETA(73), BETA(74), &
BETA(75), BETA(76), BETA(77), BETA(78), &
BETA(79), BETA(80)/-1.35744996343269136E-05, &
-3.17972413350427135E-05, &
-4.18861861696693365E-05, &
-4.69004889379141029E-05, &
-4.87665447413787352E-05, &
-4.87010031186735069E-05, &
-4.74755620890086638E-05, &
-4.55813058138628452E-05, &
-4.33309644511266036E-05, &
-4.09230193157750364E-05, &
-3.84822638603221274E-05, &
-3.60857167535410501E-05, &
-3.37793306123367417E-05, &
-3.15888560772109621E-05/
DATA BETA(81), BETA(82), BETA(83), BETA(84), &
BETA(85), BETA(86), BETA(87), &
BETA(88)/-2.95269561750807315E-05, &
-2.75978914828335759E-05, &
-2.58006174666883713E-05, &
-2.41308356761280200E-05, &
-2.25823509518346033E-05, &
-2.11479656768912971E-05, &
-1.98200638885294927E-05, &
-1.85909870801065077E-05/
DATA BETA(89), BETA(90), BETA(91), BETA(92), &
BETA(93), BETA(94), BETA(95), BETA(96), &
BETA(97), BETA(98), BETA(99), BETA(100), &
BETA(101), BETA(102)/-1.74532699844210224E-05, &
-1.63997823854497997E-05, &
-4.74617796559959808E-04, &
-4.77864567147321487E-04, &
-3.20390228067037603E-04, &
-1.61105016119962282E-04, &
-4.25778101285435204E-05, &
3.44571294294967503E-05, &
7.97092684075674924E-05, &
1.03138236708272200E-04, &
1.12466775262204158E-04, &
1.13103642108481389E-04, &
1.08651634848774268E-04, &
1.01437951597661973E-04/
DATA BETA(103), BETA(104), BETA(105), BETA(106), &
BETA(107), BETA(108), BETA(109), &
BETA(110)/9.29298396593363896E-05, &
8.40293133016089978E-05, &
7.52727991349134062E-05, &
6.69632521975730872E-05, &
5.92564547323194704E-05, &
5.22169308826975567E-05, &
4.58539485165360646E-05, &
4.01445513891486808E-05/
DATA BETA(111), BETA(112), BETA(113), BETA(114), &
BETA(115), BETA(116), BETA(117), BETA(118), &
BETA(119), BETA(120), BETA(121), &
BETA(122)/3.50481730031328081E-05, &
3.05157995034346659E-05, &
2.64956119950516039E-05, &
2.29363633690998152E-05, &
1.97893056664021636E-05, &
1.70091984636412623E-05, &
1.45547428261524004E-05, &
1.23886640995878413E-05, &
1.04775876076583236E-05, &
8.79179954978479373E-06, &
7.36465810572578444E-04, &
8.72790805146193976E-04/
DATA BETA(123), BETA(124), BETA(125), BETA(126), &
BETA(127), BETA(128), BETA(129), &
BETA(130)/6.22614862573135066E-04, &
2.85998154194304147E-04, &
3.84737672879366102E-06, &
-1.87906003636971558E-04, &
-2.97603646594554535E-04, &
-3.45998126832656348E-04, &
-3.53382470916037712E-04, &
-3.35715635775048757E-04/
DATA BETA(131), BETA(132), BETA(133), BETA(134), &
BETA(135), BETA(136), BETA(137), BETA(138), &
BETA(139), BETA(140), BETA(141), &
BETA(142)/-3.04321124789039809E-04, &
-2.66722723047612821E-04, &
-2.27654214122819527E-04, &
-1.89922611854562356E-04, &
-1.55058918599093870E-04, &
-1.23778240761873630E-04, &
-9.62926147717644187E-05, &
-7.25178327714425337E-05, &
-5.22070028895633801E-05, &
-3.50347750511900522E-05, &
-2.06489761035551757E-05, &
-8.70106096849767054E-06/
DATA BETA(143), BETA(144), BETA(145), BETA(146), &
BETA(147), BETA(148), BETA(149), &
BETA(150)/1.13698686675100290E-06, &
9.16426474122778849E-06, &
1.56477785428872620E-05, &
2.08223629482466847E-05, &
2.48923381004595156E-05, &
2.80340509574146325E-05, &
3.03987774629861915E-05, &
3.21156731406700616E-05/
DATA BETA(151), BETA(152), BETA(153), BETA(154), &
BETA(155), BETA(156), BETA(157), BETA(158), &
BETA(159), BETA(160), BETA(161), &
BETA(162)/-1.80182191963885708E-03, &
-2.43402962938042533E-03, &
-1.83422663549856802E-03, &
-7.62204596354009765E-04, &
2.39079475256927218E-04, &
9.49266117176881141E-04, &
1.34467449701540359E-03, &
1.48457495259449178E-03, &
1.44732339830617591E-03, &
1.30268261285657186E-03, &
1.10351597375642682E-03, &
8.86047440419791759E-04/
DATA BETA(163), BETA(164), BETA(165), BETA(166), &
BETA(167), BETA(168), BETA(169), &
BETA(170)/6.73073208165665473E-04, &
4.77603872856582378E-04, &
3.05991926358789362E-04, &
1.60315694594721630E-04, &
4.00749555270613286E-05, &
-5.66607461635251611E-05, &
-1.32506186772982638E-04, &
-1.90296187989614057E-04/
DATA BETA(171), BETA(172), BETA(173), BETA(174), &
BETA(175), BETA(176), BETA(177), BETA(178), &
BETA(179), BETA(180), BETA(181), &
BETA(182)/-2.32811450376937408E-04, &
-2.62628811464668841E-04, &
-2.82050469867598672E-04, &
-2.93081563192861167E-04, &
-2.97435962176316616E-04, &
-2.96557334239348078E-04, &
-2.91647363312090861E-04, &
-2.83696203837734166E-04, &
-2.73512317095673346E-04, &
-2.61750155806768580E-04, &
6.38585891212050914E-03, &
9.62374215806377941E-03/
DATA BETA(183), BETA(184), BETA(185), BETA(186), &
BETA(187), BETA(188), BETA(189), &
BETA(190)/7.61878061207001043E-03, &
2.83219055545628054E-03, &
-2.09841352012720090E-03, &
-5.73826764216626498E-03, &
-7.70804244495414620E-03, &
-8.21011692264844401E-03, &
-7.65824520346905413E-03, &
-6.47209729391045177E-03/
DATA BETA(191), BETA(192), BETA(193), BETA(194), &
BETA(195), BETA(196), BETA(197), BETA(198), &
BETA(199), BETA(200), BETA(201), &
BETA(202)/-4.99132412004966473E-03, &
-3.45612289713133280E-03, &
-2.01785580014170775E-03, &
-7.59430686781961401E-04, &
2.84173631523859138E-04, &
1.10891667586337403E-03, &
1.72901493872728771E-03, &
2.16812590802684701E-03, &
2.45357710494539735E-03, &
2.61281821058334862E-03, &
2.67141039656276912E-03, &
2.65203073395980430E-03/
DATA BETA(203), BETA(204), BETA(205), BETA(206), &
BETA(207), BETA(208), BETA(209), &
BETA(210)/2.57411652877287315E-03, &
2.45389126236094427E-03, &
2.30460058071795494E-03, &
2.13684837686712662E-03, &
1.95896528478870911E-03, &
1.77737008679454412E-03, &
1.59690280765839059E-03, &
1.42111975664438546E-03/
DATA GAMA(1), GAMA(2), GAMA(3), GAMA(4), GAMA(5), &
GAMA(6), GAMA(7), GAMA(8), GAMA(9), GAMA(10), &
GAMA(11), GAMA(12), GAMA(13), &
GAMA(14)/6.29960524947436582E-01, &
2.51984209978974633E-01, &
1.54790300415655846E-01, &
1.10713062416159013E-01, &
8.57309395527394825E-02, &
6.97161316958684292E-02, &
5.86085671893713576E-02, &
5.04698873536310685E-02, &
4.42600580689154809E-02, &
3.93720661543509966E-02, &
3.54283195924455368E-02, &
3.21818857502098231E-02, &
2.94646240791157679E-02, &
2.71581677112934479E-02/
DATA GAMA(15), GAMA(16), GAMA(17), GAMA(18), &
GAMA(19), GAMA(20), GAMA(21), &
GAMA(22)/2.51768272973861779E-02, &
2.34570755306078891E-02, &
2.19508390134907203E-02, &
2.06210828235646240E-02, &
1.94388240897880846E-02, &
1.83810633800683158E-02, &
1.74293213231963172E-02, &
1.65685837786612353E-02/
DATA GAMA(23), GAMA(24), GAMA(25), GAMA(26), &
GAMA(27), GAMA(28), GAMA(29), &
GAMA(30)/1.57865285987918445E-02, &
1.50729501494095594E-02, &
1.44193250839954639E-02, &
1.38184805735341786E-02, &
1.32643378994276568E-02, &
1.27517121970498651E-02, &
1.22761545318762767E-02, &
1.18338262398482403E-02/
DATA EX1, EX2, HPI, PI, THPI/3.33333333333333333E-01, &
6.66666666666666667E-01, &
1.57079632679489662E+00, &
3.14159265358979324E+00, &
4.71238898038468986E+00/
DATA CZERO, CONE/(0.0E0,0.0E0), (1.0E0,0.0E0)/
! .. Executable Statements ..
!
RFNU = 1.0E0/FNU
TSTR = REAL(Z)
TSTI = AIMAG(Z)
TEST = FNU*EXP(-ELIM)
if (ABS(TSTR) < TEST) TSTR = 0.0E0
if (ABS(TSTI) < TEST) TSTI = 0.0E0
if (TSTR == 0.0E0 .and. TSTI == 0.0E0) then
ZETA1 = CMPLX(ELIM+ELIM+FNU,0.0E0)
ZETA2 = CMPLX(FNU,0.0E0)
PHI = CONE
ARG = CONE
return
endif
ZB = CMPLX(TSTR,TSTI)*CMPLX(RFNU,0.0E0)
RFNU2 = RFNU*RFNU
! ------------------------------------------------------------------
! COMPUTE IN THE FOURTH QUADRANT
! ------------------------------------------------------------------
FN13 = FNU**EX1
FN23 = FN13*FN13
RFN13 = CMPLX(1.0E0/FN13,0.0E0)
W2 = CONE - ZB*ZB
AW2 = ABS(W2)
if (AW2 > 0.25E0) then
! ---------------------------------------------------------------
! CABS(W2)>0.25E0
! ---------------------------------------------------------------
W = SQRT(W2)
WR = REAL(W)
WI = AIMAG(W)
if (WR < 0.0E0) WR = 0.0E0
if (WI < 0.0E0) WI = 0.0E0
W = CMPLX(WR,WI)
ZA = (CONE+W)/ZB
ZC = LOG(ZA)
ZCR = REAL(ZC)
ZCI = AIMAG(ZC)
if (ZCI < 0.0E0) ZCI = 0.0E0
if (ZCI > HPI) ZCI = HPI
if (ZCR < 0.0E0) ZCR = 0.0E0
ZC = CMPLX(ZCR,ZCI)
ZTH = (ZC-W)*CMPLX(1.5E0,0.0E0)
CFNU = CMPLX(FNU,0.0E0)
ZETA1 = ZC*CFNU
ZETA2 = W*CFNU
AZTH = ABS(ZTH)
ZTHR = REAL(ZTH)
ZTHI = AIMAG(ZTH)
ANG = THPI
if (ZTHR < 0.0E0 .or. ZTHI >= 0.0E0) then
ANG = HPI
if (ZTHR /= 0.0E0) then
ANG = ATAN(ZTHI/ZTHR)
if (ZTHR < 0.0E0) ANG = ANG + PI
endif
endif
PP = AZTH**EX2
ANG = ANG*EX2
ZETAR = PP*COS(ANG)
ZETAI = PP*SIN(ANG)
if (ZETAI < 0.0E0) ZETAI = 0.0E0
ZETA = CMPLX(ZETAR,ZETAI)
ARG = ZETA*CMPLX(FN23,0.0E0)
RTZTA = ZTH/ZETA
ZA = RTZTA/W
PHI = SQRT(ZA+ZA)*RFN13
if (IPMTR /= 1) then
TFN = CMPLX(RFNU,0.0E0)/W
RZTH = CMPLX(RFNU,0.0E0)/ZTH
ZC = RZTH*CMPLX(AR(2),0.0E0)
T2 = CONE/W2
UP(2) = (T2*CMPLX(C(2),0.0E0)+CMPLX(C(3),0.0E0))*TFN
BSUM = UP(2) + ZC
ASUM = CZERO
if (RFNU >= TOL) then
PRZTH = RZTH
PTFN = TFN
UP(1) = CONE
PP = 1.0E0
BSUMR = REAL(BSUM)
BSUMI = AIMAG(BSUM)
BTOL = TOL*(ABS(BSUMR)+ABS(BSUMI))
KS = 0
KP1 = 2
L = 3
IAS = 0
IBS = 0
DO 100 LR = 2, 12, 2
LRP1 = LR + 1
! ------------------------------------------------------
! COMPUTE TWO ADDITIONAL CR, DR, AND UP FOR TWO MORE
! TERMS IN NEXT SUMA AND SUMB
! ------------------------------------------------------
DO 40 K = LR, LRP1
KS = KS + 1
KP1 = KP1 + 1
L = L + 1
ZA = CMPLX(C(L),0.0E0)
DO 20 J = 2, KP1
L = L + 1
ZA = ZA*T2 + CMPLX(C(L),0.0E0)
20 continue
PTFN = PTFN*TFN
UP(KP1) = PTFN*ZA
CR(KS) = PRZTH*CMPLX(BR(KS+1),0.0E0)
PRZTH = PRZTH*RZTH
DR(KS) = PRZTH*CMPLX(AR(KS+2),0.0E0)
40 continue
PP = PP*RFNU2
if (IAS /= 1) then
SUMA = UP(LRP1)
JU = LRP1
DO 60 JR = 1, LR
JU = JU - 1
SUMA = SUMA + CR(JR)*UP(JU)
60 continue
ASUM = ASUM + SUMA
ASUMR = REAL(ASUM)
ASUMI = AIMAG(ASUM)
TEST = ABS(ASUMR) + ABS(ASUMI)
if (PP < TOL .and. TEST < TOL) IAS = 1
endif
if (IBS /= 1) then
SUMB = UP(LR+2) + UP(LRP1)*ZC
JU = LRP1
DO 80 JR = 1, LR
JU = JU - 1
SUMB = SUMB + DR(JR)*UP(JU)
80 continue
BSUM = BSUM + SUMB
BSUMR = REAL(BSUM)
BSUMI = AIMAG(BSUM)
TEST = ABS(BSUMR) + ABS(BSUMI)
if (PP < BTOL .and. TEST < TOL) IBS = 1
endif
if (IAS == 1 .and. IBS == 1) goto 120
100 continue
endif
120 ASUM = ASUM + CONE
BSUM = -BSUM*RFN13/RTZTA
endif
ELSE
! ---------------------------------------------------------------
! POWER SERIES FOR CABS(W2) <= 0.25E0
! ---------------------------------------------------------------
K = 1
P(1) = CONE
SUMA = CMPLX(GAMA(1),0.0E0)
AP(1) = 1.0E0
if (AW2 >= TOL) then
DO 140 K = 2, 30
P(K) = P(K-1)*W2
SUMA = SUMA + P(K)*CMPLX(GAMA(K),0.0E0)
AP(K) = AP(K-1)*AW2
if (AP(K) < TOL) goto 160
140 continue
K = 30
endif
160 KMAX = K
ZETA = W2*SUMA
ARG = ZETA*CMPLX(FN23,0.0E0)
ZA = SQRT(SUMA)
ZETA2 = SQRT(W2)*CMPLX(FNU,0.0E0)
ZETA1 = ZETA2*(CONE+ZETA*ZA*CMPLX(EX2,0.0E0))
ZA = ZA + ZA
PHI = SQRT(ZA)*RFN13
if (IPMTR /= 1) then
! ------------------------------------------------------------
! SUM SERIES FOR ASUM AND BSUM
! ------------------------------------------------------------
SUMB = CZERO
DO 180 K = 1, KMAX
SUMB = SUMB + P(K)*CMPLX(BETA(K),0.0E0)
180 continue
ASUM = CZERO
BSUM = SUMB
L1 = 0
L2 = 30
BTOL = TOL*ABS(BSUM)
ATOL = TOL
PP = 1.0E0
IAS = 0
IBS = 0
if (RFNU2 >= TOL) then
DO 280 IS = 2, 7
ATOL = ATOL/RFNU2
PP = PP*RFNU2
if (IAS /= 1) then
SUMA = CZERO
DO 200 K = 1, KMAX
M = L1 + K
SUMA = SUMA + P(K)*CMPLX(ALFA(M),0.0E0)
if (AP(K) < ATOL) goto 220
200 continue
220 ASUM = ASUM + SUMA*CMPLX(PP,0.0E0)
if (PP < TOL) IAS = 1
endif
if (IBS /= 1) then
SUMB = CZERO
DO 240 K = 1, KMAX
M = L2 + K
SUMB = SUMB + P(K)*CMPLX(BETA(M),0.0E0)
if (AP(K) < ATOL) goto 260
240 continue
260 BSUM = BSUM + SUMB*CMPLX(PP,0.0E0)
if (PP < BTOL) IBS = 1
endif
if (IAS == 1 .and. IBS == 1) then
goto 300
ELSE
L1 = L1 + 30
L2 = L2 + 30
endif
280 continue
endif
300 ASUM = ASUM + CONE
PP = RFNU*REAL(RFN13)
BSUM = BSUM*CMPLX(PP,0.0E0)
endif
endif
return
END
subroutine DEVS17(Z,FNU,KODE,IKFLG,N,Y,NUF,TOL,ELIM,ALIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-765 (DEC 1989).
!
! Original name: CUOIK
!
! DEVS17 COMPUTES THE LEADING TERMS OF THE UNIFORM ASYMPTOTIC
! EXPANSIONS FOR THE I AND K functionS AND COMPARES THEM
! (IN LOGARITHMIC FORM) TO ALIM AND ELIM FOR OVER AND UNDERFLOW
! WHERE ALIM < ELIM. IF THE MAGNITUDE, BASED ON THE LEADING
! EXPONENTIAL, IS LESS THAN ALIM OR GREATER THAN -ALIM, THEN
! THE RESULT IS ON SCALE. IF NOT, THEN A REFINED TEST USING OTHER
! MULTIPLIERS (IN LOGARITHMIC FORM) IS MADE BASED ON ELIM. HERE
! EXP(-ELIM)=SMALLEST MACHINE NUMBER*1.0E+3 AND EXP(-ALIM)=
! EXP(-ELIM)/TOL
!
! IKFLG=1 MEANS THE I SEQUENCE IS TESTED
! =2 MEANS THE K SEQUENCE IS TESTED
! NUF = 0 MEANS THE LAST MEMBER OF THE SEQUENCE IS ON SCALE
! =-1 MEANS AN OVERFLOW WOULD OCCUR
! IKFLG=1 AND NUF>0 MEANS THE LAST NUF Y VALUES WERE SET TO ZERO
! THE FIRST N-NUF VALUES MUST BE SET BY ANOTHER ROUTINE
! IKFLG=2 AND NUF==N MEANS ALL Y VALUES WERE SET TO ZERO
! IKFLG=2 AND 0 < NUF < N NOT CONSIDERED. Y MUST BE SET BY
! ANOTHER ROUTINE
!
! .. Scalar Arguments ..
COMPLEX Z
REAL ALIM, ELIM, FNU, TOL
INTEGER IKFLG, KODE, N, NUF
! .. Array Arguments ..
COMPLEX Y(N)
! .. Local Scalars ..
COMPLEX ARG, ASUM, BSUM, CZ, CZERO, PHI, SUM, ZB, ZETA1, &
ZETA2, ZN, ZR
REAL AARG, AIC, APHI, ASCLE, AX, AY, FNN, GNN, GNU, &
RCZ, X, YY
INTEGER I, IFORM, INIT, NN, NW
! .. Local Arrays ..
COMPLEX CWRK(16)
! .. External functions ..
REAL X02AME
EXTERNAL X02AME
! .. External subroutines ..
EXTERNAL DEUS17, DEWS17, DGVS17
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, CONJG, COS, EXP, LOG, MAX, &
REAL, SIN
! .. Data statements ..
DATA CZERO/(0.0E0,0.0E0)/
DATA AIC/1.265512123484645396E+00/
! .. Executable Statements ..
!
NUF = 0
NN = N
X = REAL(Z)
ZR = Z
if (X < 0.0E0) ZR = -Z
ZB = ZR
YY = AIMAG(ZR)
AX = ABS(X)*1.7321E0
AY = ABS(YY)
IFORM = 1
if (AY > AX) IFORM = 2
GNU = MAX(FNU,1.0E0)
if (IKFLG /= 1) then
FNN = NN
GNN = FNU + FNN - 1.0E0
GNU = MAX(GNN,FNN)
endif
! ------------------------------------------------------------------
! ONLY THE MAGNITUDE OF ARG AND PHI ARE NEEDED ALONG WITH THE
! REAL PARTS OF ZETA1, ZETA2 AND ZB. NO ATTEMPT IS MADE TO GET
! THE SIGN OF THE IMAGINARY PART CORRECT.
! ------------------------------------------------------------------
if (IFORM == 2) then
ZN = -ZR*CMPLX(0.0E0,1.0E0)
if (YY <= 0.0E0) ZN = CONJG(-ZN)
CALL DEUS17(ZN,GNU,1,TOL,PHI,ARG,ZETA1,ZETA2,ASUM,BSUM,ELIM)
CZ = -ZETA1 + ZETA2
AARG = ABS(ARG)
ELSE
INIT = 0
CALL DEWS17(ZR,GNU,IKFLG,1,TOL,INIT,PHI,ZETA1,ZETA2,SUM,CWRK, &
ELIM)
CZ = -ZETA1 + ZETA2
endif
if (KODE == 2) CZ = CZ - ZB
if (IKFLG == 2) CZ = -CZ
APHI = ABS(PHI)
RCZ = REAL(CZ)
! ------------------------------------------------------------------
! OVERFLOW TEST
! ------------------------------------------------------------------
if (RCZ <= ELIM) then
if (RCZ < ALIM) then
! ------------------------------------------------------------
! UNDERFLOW TEST
! ------------------------------------------------------------
if (RCZ >= (-ELIM)) then
if (RCZ > (-ALIM)) then
goto 40
ELSE
RCZ = RCZ + LOG(APHI)
if (IFORM == 2) RCZ = RCZ - 0.25E0*LOG(AARG) - AIC
if (RCZ > (-ELIM)) then
ASCLE = (1.0E+3*X02AME())/TOL
CZ = CZ + LOG(PHI)
if (IFORM /= 1) CZ = CZ - CMPLX(0.25E0,0.0E0) &
*LOG(ARG) - CMPLX(AIC,0.0E0)
AX = EXP(RCZ)/TOL
AY = AIMAG(CZ)
CZ = CMPLX(AX,0.0E0)*CMPLX(COS(AY),SIN(AY))
CALL DGVS17(CZ,NW,ASCLE,TOL)
if (NW /= 1) goto 40
endif
endif
endif
DO 20 I = 1, NN
Y(I) = CZERO
20 continue
NUF = NN
return
ELSE
RCZ = RCZ + LOG(APHI)
if (IFORM == 2) RCZ = RCZ - 0.25E0*LOG(AARG) - AIC
if (RCZ > ELIM) goto 80
endif
40 if (IKFLG /= 2) then
if (N /= 1) then
60 continue
! ---------------------------------------------------------
! SET UNDERFLOWS ON I SEQUENCE
! ---------------------------------------------------------
GNU = FNU + NN - 1
if (IFORM == 2) then
CALL DEUS17(ZN,GNU,1,TOL,PHI,ARG,ZETA1,ZETA2,ASUM, &
BSUM,ELIM)
CZ = -ZETA1 + ZETA2
AARG = ABS(ARG)
ELSE
INIT = 0
CALL DEWS17(ZR,GNU,IKFLG,1,TOL,INIT,PHI,ZETA1,ZETA2, &
SUM,CWRK,ELIM)
CZ = -ZETA1 + ZETA2
endif
if (KODE == 2) CZ = CZ - ZB
APHI = ABS(PHI)
RCZ = REAL(CZ)
if (RCZ >= (-ELIM)) then
if (RCZ > (-ALIM)) then
return
ELSE
RCZ = RCZ + LOG(APHI)
if (IFORM == 2) RCZ = RCZ - 0.25E0*LOG(AARG) - AIC
if (RCZ > (-ELIM)) then
ASCLE = (1.0E+3*X02AME())/TOL
CZ = CZ + LOG(PHI)
if (IFORM /= 1) CZ = CZ - CMPLX(0.25E0,0.0E0) &
*LOG(ARG) - CMPLX(AIC, &
0.0E0)
AX = EXP(RCZ)/TOL
AY = AIMAG(CZ)
CZ = CMPLX(AX,0.0E0)*CMPLX(COS(AY),SIN(AY))
CALL DGVS17(CZ,NW,ASCLE,TOL)
if (NW /= 1) return
endif
endif
endif
Y(NN) = CZERO
NN = NN - 1
NUF = NUF + 1
if (NN /= 0) goto 60
endif
endif
return
endif
80 NUF = -1
return
END
subroutine DEWS17(ZR,FNU,IKFLG,IPMTR,TOL,INIT,PHI,ZETA1,ZETA2,SUM, &
CWRK,ELIM)
! MARK 13 RELEASE. NAG COPYRIGHT 1988.
! MARK 14 REVISED. IER-766 (DEC 1989).
!
! Original name: CUNIK
!
! DEWS17 COMPUTES PARAMETERS FOR THE UNIFORM ASYMPTOTIC
! EXPANSIONS OF THE I AND K functionS ON IKFLG= 1 OR 2
! RESPECTIVELY BY
!
! W(FNU,ZR) = PHI*EXP(ZETA)*SUM
!
! WHERE ZETA=-ZETA1 + ZETA2 OR
! ZETA1 - ZETA2
!
! THE FIRST CALL MUST HAVE INIT=0. SUBSEQUENT CALLS WITH THE
! SAME ZR AND FNU WILL return THE I OR K function ON IKFLG=
! 1 OR 2 WITH NO CHANGE IN INIT. CWRK IS A COMPLEX WORK
! ARRAY. IPMTR=0 COMPUTES ALL PARAMETERS. IPMTR=1 COMPUTES PHI,
! ZETA1,ZETA2.
!
! .. Scalar Arguments ..
COMPLEX PHI, SUM, ZETA1, ZETA2, ZR
REAL ELIM, FNU, TOL
INTEGER IKFLG, INIT, IPMTR
! .. Array Arguments ..
COMPLEX CWRK(16)
! .. Local Scalars ..
COMPLEX CFN, CONE, CRFN, CZERO, S, SR, T, T2, ZN
REAL AC, RFN, TEST, TSTI, TSTR
INTEGER I, J, K, L
! .. Local Arrays ..
COMPLEX CON(2)
REAL C(120)
!bc
! .. external functions ..
real x02ane
external x02ane
! .. Intrinsic functions ..
INTRINSIC ABS, AIMAG, CMPLX, EXP, LOG, REAL, SQRT
! .. Data statements ..
DATA CZERO, CONE/(0.0E0,0.0E0), (1.0E0,0.0E0)/
DATA CON(1), CON(2)/(3.98942280401432678E-01,0.0E0), &
(1.25331413731550025E+00,0.0E0)/
DATA C(1), C(2), C(3), C(4), C(5), C(6), C(7), C(8), &
C(9), C(10), C(11), C(12), C(13), C(14), C(15), &
C(16)/1.00000000000000000E+00, &
-2.08333333333333333E-01, &
1.25000000000000000E-01, &
3.34201388888888889E-01, &
-4.01041666666666667E-01, &
7.03125000000000000E-02, &
-1.02581259645061728E+00, &
1.84646267361111111E+00, &
-8.91210937500000000E-01, &
7.32421875
gitextract_pzg7djl1/ ├── .gitignore ├── AUTHORS ├── LICENSE ├── Makefile ├── README ├── README_seismic_cpml.html ├── analytical_solution_viscoacoustic_Carcione_version1.f90 ├── analytical_solution_viscoelastic_2D_plane_strain_Carcione_correct_with_1_over_L.f90 ├── attenuation_model_with_SolvOpt.f90 ├── conversion_between_Qp_Qs_and_Qkappa_Qmu_from_Dahlen_Tromp_959_960_in_3D_and_in_2D_plane_strain.f90 ├── email_from_Youshan_Liu_about_bug_in_the_original_fourth_order_Runge_Kutta_scheme.txt ├── explanation_from_Youshan_Liu_about_bug_in_the_original_fourth_order_Runge_Kutta_scheme.docx ├── plotall_fit_is_perfect_for_viscoelastic_fourth_order.gnu ├── seismic_ADEPML_2D_elastic_RK4_eighth_order.f90 ├── seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.f90 ├── seismic_CPML_2D_anisotropic.f90 ├── seismic_CPML_2D_isotropic_fourth_order.f90 ├── seismic_CPML_2D_isotropic_second_order.f90 ├── seismic_CPML_2D_poroelastic_fourth_order.f90 ├── seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic.f90 ├── seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic.f90 ├── seismic_CPML_2D_pressure_second_order.f90 ├── seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic.f90 ├── seismic_CPML_2D_velocity_and_stress_second_order_viscoelastic.f90 ├── seismic_CPML_3D_isotropic_MPI_OpenMP.f90 ├── seismic_CPML_3D_viscoelastic_MPI.f90 ├── seismic_PML_Collino_2D_anisotropic_fourth.f90 ├── seismic_PML_Collino_2D_isotropic.f90 └── seismic_PML_Collino_3D_isotropic_OpenMP.f90
Condensed preview — 29 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,404K chars).
[
{
"path": ".gitignore",
"chars": 450,
"preview": "# 2D\n\nxseismic_CPML_2D_isotropic_second_order\nxseismic_CPML_2D_isotropic_fourth_order\nxseismic_CPML_2D_anisotropic\n\nxsei"
},
{
"path": "AUTHORS",
"chars": 271,
"preview": "Main historical authors: Dimitri Komatitsch, CNRS / University of Marseille, France\n and Roland Martin, CNRS / Universi"
},
{
"path": "LICENSE",
"chars": 35147,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "Makefile",
"chars": 5605,
"preview": "#\n# Makefile for SEISMIC_CPML Version 1.2, April 2015.\n# Dimitri Komatitsch, CNRS, France\n#\nSHELL=/bin/sh\n\nO = obj\n\n# th"
},
{
"path": "README",
"chars": 472,
"preview": "seismic_cpml\n============\n\nSEISMIC_CPML is a set of twelve open-source Fortran90 programs to solve the two-dimensional o"
},
{
"path": "README_seismic_cpml.html",
"chars": 28452,
"preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n<html>\n<head>\n\t<meta http-equiv=\"content-type\" content=\"t"
},
{
"path": "analytical_solution_viscoacoustic_Carcione_version1.f90",
"chars": 259523,
"preview": "\n program analytical_solution\n\n!! DK DK to compare to our finite-difference codes from SEISMIC_CPML or SOUNDVIEW,\n!! DK"
},
{
"path": "analytical_solution_viscoelastic_2D_plane_strain_Carcione_correct_with_1_over_L.f90",
"chars": 265354,
"preview": "\n program analytical_solution\n\n!! DK DK we compute the solution for velocity instead of for displacement in this versio"
},
{
"path": "attenuation_model_with_SolvOpt.f90",
"chars": 61194,
"preview": "\n! use of SolvOpt to compute attenuation relaxation mechanisms,\n! from Emilie Blanc, Bruno Lombard and Dimitri Komatitsc"
},
{
"path": "conversion_between_Qp_Qs_and_Qkappa_Qmu_from_Dahlen_Tromp_959_960_in_3D_and_in_2D_plane_strain.f90",
"chars": 2526,
"preview": "\n program conversion\n\n! Dimitri Komatitsch, CNRS Marseille, France, July 2018\n\n! see formulas 9.59 and 9.60 in the book"
},
{
"path": "email_from_Youshan_Liu_about_bug_in_the_original_fourth_order_Runge_Kutta_scheme.txt",
"chars": 2258,
"preview": "\nSubject: some questions about your CPML code\nFrom: ysliu\nDate: 08/03/2015 05:22 AM\nTo: komatitsch\n\nDear Prof. Komatits"
},
{
"path": "plotall_fit_is_perfect_for_viscoelastic_fourth_order.gnu",
"chars": 592,
"preview": "\n# this is a comparison of the results of seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic.f90\n# and of the"
},
{
"path": "seismic_ADEPML_2D_elastic_RK4_eighth_order.f90",
"chars": 46996,
"preview": "!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, France.\n! Contributors: Roland Martin, roland DO"
},
{
"path": "seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.f90",
"chars": 66722,
"preview": "!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, France.\n! Contributors: Roland Martin, roland DO"
},
{
"path": "seismic_CPML_2D_anisotropic.f90",
"chars": 31339,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
},
{
"path": "seismic_CPML_2D_isotropic_fourth_order.f90",
"chars": 35582,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
},
{
"path": "seismic_CPML_2D_isotropic_second_order.f90",
"chars": 34696,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
},
{
"path": "seismic_CPML_2D_poroelastic_fourth_order.f90",
"chars": 45046,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
},
{
"path": "seismic_CPML_2D_pressure_and_velocity_fourth_order_viscoacoustic.f90",
"chars": 43759,
"preview": "!\n! SEISMIC_CPML Version 1.1.3, July 2018.\n!\n! Copyright CNRS, France.\n! Contributor: Dimitri Komatitsch, komatitsch aT "
},
{
"path": "seismic_CPML_2D_pressure_and_velocity_second_order_viscoacoustic.f90",
"chars": 42332,
"preview": "!\n! SEISMIC_CPML Version 1.1.3, July 2018.\n!\n! Copyright CNRS, France.\n! Contributor: Dimitri Komatitsch, komatitsch aT "
},
{
"path": "seismic_CPML_2D_pressure_second_order.f90",
"chars": 29315,
"preview": "!\n! SEISMIC_CPML Version 1.1.3, July 2018.\n!\n! Copyright CNRS, France.\n! Contributor: Dimitri Komatitsch, komatitsch aT "
},
{
"path": "seismic_CPML_2D_velocity_and_stress_fourth_order_viscoelastic.f90",
"chars": 55468,
"preview": "!\n! SEISMIC_CPML Version 1.1.3, July 2018.\n!\n! Copyright CNRS, France.\n! Contributor: Dimitri Komatitsch, komatitsch aT "
},
{
"path": "seismic_CPML_2D_velocity_and_stress_second_order_viscoelastic.f90",
"chars": 53786,
"preview": "!\n! SEISMIC_CPML Version 1.1.3, July 2018.\n!\n! Copyright CNRS, France.\n! Contributor: Dimitri Komatitsch, komatitsch aT "
},
{
"path": "seismic_CPML_3D_isotropic_MPI_OpenMP.f90",
"chars": 56623,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
},
{
"path": "seismic_CPML_3D_viscoelastic_MPI.f90",
"chars": 65042,
"preview": "!\n! SEISMIC_CPML Version 1.2, April 2015.\n!\n! Copyright CNRS, France.\n! Contributors: Roland Martin, roland DOT martin a"
},
{
"path": "seismic_PML_Collino_2D_anisotropic_fourth.f90",
"chars": 29034,
"preview": "!\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n!\n! Program s"
},
{
"path": "seismic_PML_Collino_2D_isotropic.f90",
"chars": 25333,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
},
{
"path": "seismic_PML_Collino_3D_isotropic_OpenMP.f90",
"chars": 38341,
"preview": "!\n! SEISMIC_CPML Version 1.1.1, November 2009.\n!\n! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, F"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the geodynamics/seismic_cpml GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 29 files (1.3 MB), approximately 459.8k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.