master
Philip Crivelli 2023-01-20 10:29:35 +01:00
parent 6fc22b0da5
commit 766efce688
475 changed files with 72727 additions and 1 deletions

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app

687
LICENSE Normal file
View File

@ -0,0 +1,687 @@
GNU GENERAL PUBLIC LICENSE
OpenFOAM(R) is Copyright (C) 2011 OpenFOAM Foundation
Contact: OpenFOAM Foundation (OpenFOAM.Foundation@gmail.com)
You may use, distribute and copy the OpenFOAM CFD Toolbox under the terms
of GNU General Public License version 3, which is displayed below, or
(at your option) any later version.
-------------------------------------------------------------------------
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>.
-------------------------------------------------------------------------

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
wclean libso DPMTurbulenceModels
wclean
#------------------------------------------------------------------------------

View File

@ -0,0 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1
set -x
wmake DPMTurbulenceModels
wmake

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;
if (mesh.nInternalFaces())
{
scalarField sumPhi
(
fvc::surfaceSum(mag(phic))().internalField()
);
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl;
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PhaseIncompressibleTurbulenceModel.H"
#include "singlePhaseTransportModel.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
#include "laminar.H"
#include "RASModel.H"
#include "LESModel.H"
makeBaseTurbulenceModel
(
volScalarField,
geometricOneField,
incompressibleTurbulenceModel,
PhaseIncompressibleTurbulenceModel,
singlePhaseTransportModel
);
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, RAS, Type)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, LES, Type)
#include "kEpsilon.H"
makeRASModel(kEpsilon);
#include "Smagorinsky.H"
makeLESModel(Smagorinsky);
#include "kEqn.H"
makeLESModel(kEqn);
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
DPMTurbulenceModels.C
LIB = $(FOAM_USER_LIBBIN)/libDPMTurbulenceModelsNew

View File

@ -0,0 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/foam/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude

View File

@ -0,0 +1,3 @@
snowBedFoam.C
EXE = $(FOAM_USER_APPBIN)/snowBedFoam

View File

@ -0,0 +1,40 @@
EXE_INC = \
-I./DPMTurbulenceModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(WM_PROJECT_USER_DIR)/src/lagrangianCRYOS/intermediateCRYOS/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-llagrangian \
-lthermophysicalFunctions \
-lspecie \
-lradiationModels \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-lfvOptions \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-L$(FOAM_USER_LIBBIN) \
-lDPMTurbulenceModelsNew \
-llagrangianIntermediateCRYOS

View File

@ -0,0 +1,51 @@
/*fvVectorMatrix UcEqn
(
fvm::ddt(alphac, Uc) + fvm::div(phic, Uc)
- fvm::Sp(fvc::ddt(alphac) + fvc::div(phic), Uc)
+ continuousPhaseTurbulence->divDevRhoReff(Uc)
==
fvOptions(Uc) // J added
//+ gradP // J added
// + (1.0/rhoc)*cloudSU
);*/
fvVectorMatrix UcEqn
(
fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc)
- fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc)
+ continuousPhaseTurbulence->divDevRhoReff(Uc)
==
fvOptions(Uc) // J added
+ gradP // J added
+ (1.0/rhoc)*cloudSU
);
UcEqn.relax();
fvOptions.constrain(UcEqn); // J added
volScalarField rAUc(1.0/UcEqn.A());
surfaceScalarField rAUcf("Dp", fvc::interpolate(rAUc));
surfaceScalarField phicForces
(
(fvc::interpolate(rAUc*cloudVolSUSu/rhoc) & mesh.Sf())
//+
//rAUcf*(g & mesh.Sf())
);
if (pimple.momentumPredictor())
{
solve
(
UcEqn
==
fvc::reconstruct
(
phicForces/rAUcf - fvc::snGrad(p)*mesh.magSf()
)
);
fvOptions.correct(Uc); // J added
}

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
continuityErrs
Description
Calculates and prints the continuity errors.
\*---------------------------------------------------------------------------*/
{
volScalarField contErr(fvc::ddt(alphac) + fvc::div(alphacf*phic));
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr
<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,279 @@
Info<< "\nReading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
word contiuousPhaseName(transportProperties.lookup("contiuousPhaseName"));
dimensionedScalar rhocValue
(
IOobject::groupName("rho", contiuousPhaseName),
dimDensity,
transportProperties.lookup
(
IOobject::groupName("rho", contiuousPhaseName)
)
);
volScalarField rhoc
(
IOobject
(
rhocValue.name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
rhocValue
);
Info<< "Reading field U\n" << endl;
volVectorField Uc
(
IOobject
(
IOobject::groupName("U", contiuousPhaseName),
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading/calculating continuous-phase face flux field phic\n"
<< endl;
surfaceScalarField phic
(
IOobject
(
IOobject::groupName("phi", contiuousPhaseName),
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(Uc) & mesh.Sf()
);
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
Info<< "Creating turbulence model\n" << endl;
singlePhaseTransportModel continuousPhaseTransport(Uc, phic);
volScalarField muc
(
IOobject
(
IOobject::groupName("mu", contiuousPhaseName),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rhoc*continuousPhaseTransport.nu()
);
Info << "Creating field alphac\n" << endl;
// alphac must be constructed before the cloud
// so that the drag-models can find it
volScalarField alphac
(
IOobject
(
IOobject::groupName("alpha", contiuousPhaseName),
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0)
);
word kinematicCloudName("kinematicCloud");
args.optionReadIfPresent("cloudName", kinematicCloudName);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicTypeCloud kinematicCloud
(
kinematicCloudName,
rhoc,
Uc,
muc,
g
);
// Particle fraction upper limit
scalar alphacMin
(
1.0
- readScalar
(
kinematicCloud.particleProperties().subDict("constantProperties")
.lookup("alphaMax")
)
);
// Update alphac from the particle locations
alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
alphac.correctBoundaryConditions();
surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));
surfaceScalarField alphaPhic("alphaPhic", alphacf*phic);
autoPtr<PhaseIncompressibleTurbulenceModel<singlePhaseTransportModel> >
continuousPhaseTurbulence
(
PhaseIncompressibleTurbulenceModel<singlePhaseTransportModel>::New
(
alphac,
Uc,
alphaPhic,
phic,
continuousPhaseTransport
)
);
//autoPtr<incompressible::turbulenceModel> continuousPhaseTurbulence
//(
//incompressible::turbulenceModel::New(Uc, phic, continuousPhaseTransport)
//);
//////////////////////////////// parts added to buoyantBoussinesqPimpleFoam /////////////////////////////////
// Jafari added
scalar vKC_ = readScalar(transportProperties.lookup("vKC"));
Info << "Reading k_, the Von Kármán constant " << vKC_ << "\n" << endl;
scalar Z0_ = readScalar(transportProperties.lookup("Z0"));
Info << "Reading Z0_, the surface roughness, in m " << Z0_ << "\n" << endl;
scalar Ustar_ = readScalar(transportProperties.lookup("Ustar"));
Info << "Reading Ustar_, the friction velocity, in m s-1" << Ustar_ << "\n" << endl;
scalar H_ = readScalar(transportProperties.lookup("H"));
Info << "Reading H_, the height for the fluid domain " << H_ << "\n" << endl;
vector flowDirection_(transportProperties.lookup("flowDirection"));
Info << "Reading flowDirection_, the flow direction " << flowDirection_ << "\n" << endl;
bool constantPGrad_(transportProperties.lookupOrDefault<bool>("constantPGrad", false));
Info << "Reading the flag if constant pressure gradients is applied to momentum , " << constantPGrad_ << "\n" << endl;
vector dP_dx = (constantPGrad_) ? (Foam::pow(Ustar_,2.0)/H_)*flowDirection_ : vector::zero;
Info << "Calculating the pressure gradient in the flow direction " << dP_dx << "\n" << endl;
scalar noiseFactor_ = readScalar(transportProperties.lookup("noiseFactor")); //O added
Info << "Reading noiseFactor_, the noise factor " << noiseFactor_ << "\n" << endl; //O added
const pointField& ctrs = mesh.cellCentres();
/*
IOField<scalar> SfOut
(
IOobject
(
"Sf",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh.magSf().boundaryField()[1]
);
SfOut.write();
*/
volVectorField gradP
(
IOobject
(
"gradP",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("gradP", dimForce/dimVolume/dimDensity, dP_dx),
zeroGradientFvPatchVectorField::typeName
);
if ( runTime.timeName() == "0")
{
Random ranGen_(label(0));
label totalCellNumber=ctrs.size();
reduce(totalCellNumber, sumOp<label>());// Collect across all processors
scalarField randomNumbersAllMesh(totalCellNumber, 0.0);
forAll(randomNumbersAllMesh, i)
{
randomNumbersAllMesh[i]=ranGen_.scalar01();
}
Info << "\nthe total cell number: " << totalCellNumber << endl << endl;
labelList LcellN(Pstream::nProcs());
LcellN[Pstream::myProcNo()] = ctrs.size();
Pstream::gatherList(LcellN);
Pstream::scatterList(LcellN);
label startLable=0;
for(label proc=1; proc<=Pstream::myProcNo(); proc++)
{
startLable+=LcellN[proc-1];
}
Info<< "The streamwise velocity is initialized based on log law at Time = " << runTime.timeName() << nl << endl;
forAll(ctrs, cellI)
{
scalar randNumber=randomNumbersAllMesh[cellI+startLable];
scalar noise_ = (2.0*randNumber)-1.0; //O added
scalar varianceFact_ = 3.0*noiseFactor_*pow(Ustar_,2); //O added
scalar cellHeight = ctrs[cellI].z();
//Uc[cellI].x() = (Ustar_/vKC_)*Foam::log(cellHeight/Z0_); //;U_ * Foam::log(cellHeight/Z0_)/Foam::log(Z_/Z0_);
//Uc[cellI].x() = ((Ustar_/vKC_)*Foam::log(cellHeight/Z0_))+varianceFact_*noise_*((H_-0.9*cellHeight)/H_); //O added
Uc[cellI] = (((Ustar_/vKC_)*Foam::log(cellHeight/Z0_))+varianceFact_*noise_*((H_-0.9*cellHeight)/H_))*flowDirection_; //O added
//Info << "Uc[cellI]: " << Uc[cellI] << endl;
}
Uc.correctBoundaryConditions();
phic=linearInterpolate(Uc) & mesh.Sf();
}
//////////////////////////////////////////////////////////

View File

@ -0,0 +1,53 @@
{
volVectorField HbyA("HbyA", Uc);
HbyA = rAUc*UcEqn.H();
surfaceScalarField phiHbyA
(
"phiHbyA",
(
(fvc::interpolate(HbyA) & mesh.Sf())
+ alphacf*rAUcf*fvc::ddtCorr(Uc, phic)
+ phicForces
)
);
// Update the fixedFluxPressure BCs to ensure flux consistency
setSnGrad<fixedFluxPressureFvPatchScalarField>
(
p.boundaryField(),
(
phiHbyA.boundaryField()
- (mesh.Sf().boundaryField() & Uc.boundaryField())
)/(mesh.magSf().boundaryField()*rAUcf.boundaryField())
);
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(alphacf*rAUcf, p)
==
fvc::ddt(alphac) + fvc::div(alphacf*phiHbyA)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phic = phiHbyA - pEqn.flux()/alphacf;
p.relax();
Uc = HbyA
+ rAUc*fvc::reconstruct((phicForces - pEqn.flux()/alphacf)/rAUcf);
Uc.correctBoundaryConditions();
fvOptions.correct(Uc); // J added
}
}
}
#include "continuityErrs.H"

View File

@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
DPMFoam
Description
Transient solver for the coupled transport of a single kinematic particle
cloud including the effect of the volume fraction of particles on the
continuous phase.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "PhaseIncompressibleTurbulenceModel.H"
#include "pimpleControl.H"
#include "fvIOoptionList.H" // J added
#include "IOporosityModelList.H" // J added
#include "IOMRFZoneList.H" // J added
#include "fixedFluxPressureFvPatchScalarField.H"
#include "Random.H" //O added
#include "basicKinematicCloud.H"
#define basicKinematicTypeCloud basicKinematicCloud
int main(int argc, char *argv[])
{
argList::addOption
(
"cloudName",
"name",
"specify alternative cloud name. default is 'kinematicCloud'"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "createFvOptions.H" // J added
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
//continuousPhaseTransport.correct();
//muc = rhoc*continuousPhaseTransport.nu();
Info<< "Evolving " << kinematicCloud.name() << endl;
kinematicCloud.evolve();
// Update continuous phase volume fraction field
alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
alphac.correctBoundaryConditions();
alphacf = fvc::interpolate(alphac);
alphaPhic = alphacf*phic;
fvVectorMatrix cloudSU(kinematicCloud.SU(Uc));
volVectorField cloudVolSUSu
(
IOobject
(
"cloudVolSUSu",
runTime.timeName(),
mesh
),
mesh,
dimensionedVector
(
"0",
cloudSU.dimensions()/dimVolume,
vector::zero
),
zeroGradientFvPatchVectorField::typeName
);
cloudVolSUSu.internalField() = -cloudSU.source()/mesh.V();
cloudVolSUSu.correctBoundaryConditions();
cloudSU.source() = vector::zero;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UcEqn.H"
// --- PISO loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
continuousPhaseTurbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

Binary file not shown.

Binary file not shown.

56
exampleCase/0/U Normal file
View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
atmosphere
{
type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (0 0 0 0 0 1);
value uniform (0 0 0);
}
snowBed
{
type fixedValue;
value uniform (0 0 0);
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

52
exampleCase/0/epsilon Normal file
View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 14.855;
boundaryField
{
atmosphere
{
type zeroGradient;
}
snowBed
{
type epsilonLowReWallFunction;
value uniform 14.855;
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

52
exampleCase/0/k Normal file
View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.24;
boundaryField
{
atmosphere
{
type zeroGradient;
}
snowBed
{
type kLowReWallFunction;
value uniform 0.24;
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

51
exampleCase/0/nuSgs Normal file
View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nuSgs;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
atmosphere
{
type zeroGradient;
}
snowBed
{
type zeroGradient;
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

51
exampleCase/0/nuTilda Normal file
View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
atmosphere
{
type zeroGradient;
}
snowBed
{
type zeroGradient;
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

53
exampleCase/0/nut Normal file
View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
atmosphere
{
type zeroGradient;
}
snowBed
{
type nutkAtmRoughWallFunction;
z0 1e-05;
value uniform 0;
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

51
exampleCase/0/p Normal file
View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
atmosphere
{
type zeroGradient;
}
snowBed
{
type zeroGradient;
}
xMin
{
type cyclic;
}
xMax
{
type cyclic;
}
yMin
{
type cyclic;
}
yMax
{
type cyclic;
}
}
// ************************************************************************* //

9
exampleCase/Allclean Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
# ----------------------------------------------------------------- end-of-file

29
exampleCase/Allrunp Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
rm -r log.*
rm -r *.obj
# Get application directory
application=`getApplication`
echo $application
## Get the number of processors to run on from system/decomposeParDict
nProc=$(getNumberOfProcessors)
echo "the number of processors to run on from system/decomposeParDict: $nProc"
# Create mesh
runApplication fluent3DMeshToFoam MOSAiC_seaice.msh
# Re-assign the patches
runApplication createPatch -overwrite
# Distribute domain among processors
runApplication decomposePar
# Run snow transport model
runApplication mpirun -np $nProc $application -parallel

Binary file not shown.

22
exampleCase/constant/g Normal file
View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,191 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object kinematicCloudProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "../setUp" // include file with all the settings
// NUMERICAL SETTINGS
solution
{
// Activation of particles and coupling method
active true;//false; // activation of particles
coupled true;//false; //two-way coupling
transient yes;
cellValueSourceCorrection on;
// Interpolation method
interpolationSchemes
{
rho cell;
U cellPoint;
mu cell;
}
// Integration method
integrationSchemes
{
U analytical; //Euler;
}
// Relaxation
sourceTerms
{
schemes
{
U semiImplicit 0.5; //the number is relaxCoeff for the field
}
}
}
// FLOW PROPERTIES
constantProperties
{
rho0 $rhoPar;
alphaMax 1;
}
// PARTICLE SUBMODELS
subModels
{
// Acting forces
particleForces
{
sphereDrag;
gravity;
}
// Injection models
injectionModels
{
/*
model1
{
type patchInjection;
parcelBasisType mass;
patchName atmosphere; //patch for injecting particles
U0 (0 0 -1.544); //terminal fall velocity
sizeDistribution //particle size distribution
{
type normal;
normalDistribution
{
expectation 0.0002;
variance 0.00005;
minValue 5e-5;
maxValue 0.0005;
}
}
flowRateProfile constant 1; //flow rate
massTotal 3543.45; //kg. Mass injected in "duration"
SOI 0;
duration 3600; //s. Time duration where massTotal is injected.
parcelsPerSecond 0.05e6; //number of particles per s.
}
*/
}
// Particle dispersion model
dispersionModel none;
// Rebound-splash of snow particles
patchInteractionModel localInteractionStickReboundSplash; //none;
localInteractionStickReboundSplashCoeffs
{
patches
(
atmosphere
{
type escape;
e 1.0;
mu 0.0;
}
// Snow surface settings
snowBed
{
// Rebound coefficients
type stickReboundSplash;
Pm 0.9; //(-) max probability of rebound.
gamma 2.0; //(-) rebound
// Splash entrainment coefficients
epsilonr 0.25; //(-) energy balance
mur 0.5; //(-) momentum balance
muf 0.4; //(-) momentum balance
bEne 10e-9; //(-) bed cohesion
corrm 0.0; //(-) mass-velocity correlation
corre 0.0; //(-) mass-velocity correlation
pppMax $pppMax; //maximum number of particles per parcel
// Particle diameter properties
dm $dm; //m. mean particle diameter
ds $ds; //m. std deviation of diameter
d_max $d_max; //m. maximum particle diameter
d_min $d_min; //m. minimum particle diameter
}
);
// Particle probability distributions
sizeDistributionTriple
{
type normalLogNormalExponential;
normalLogNormalExponentialDistribution
{
//nothing
}
}
}
heatTransferModel none;
surfaceFilmModel none;
collisionModel none;
stochasticCollisionModel none;
radiation off;
// Aerodynamic entrainment of snow particles
bedAerodynamicLiftInjectionModel logLawShearStress; //none;
logLawShearStressCoeffs
{
// Particle probability distributions
sizeDistributionTriple
{
type normalLogNormalExponential;
normalLogNormalExponentialDistribution
{
//nothing
}
};
// Particle and coefficient settings
aerodynamicLiftPatch snowBed; //patch for entrainement
tauLogLaw false; //shear stress computation method
dm $dm; //m. mean particle diameter.
ds $ds; //m. std deviation of diameter
d_max $d_max; //m. maximum particle diameter
d_min $d_min; //m. minimum particle diameter
z0 $Z0; //m. aerodynamic roughness.
pppMin $pppMin; //number of particles per parcel.
SOA 100; //s. start of activation.
Acst 0.2; //(-). fluid threshold coefficient.
}
}
cloudFunctions
{
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6
(
xMi_shadow
{
type patch;
nFaces 8004;
startFace 6108402;
}
xMi
{
type patch;
nFaces 8004;
startFace 6116406;
}
yMi_shadow
{
type patch;
nFaces 7482;
startFace 6124410;
}
yMi
{
type patch;
nFaces 7482;
startFace 6131892;
}
atmosphere
{
type patch;
nFaces 71208;
startFace 6139374;
}
snowBed
{
type wall;
inGroups 1(wall);
nFaces 71208;
startFace 6210582;
}
)
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "../setUp"
contiuousPhaseName ;
transportModel Newtonian;
rho $rho; //continuous phase field
nu nu [ 0 2 -1 0 0 0 0 ] $nu; //continuous phase field
// ************************************************************************* //
vKC $vKC; // the Von Kármán constant
Z0 $Z0; // the surface roughness, in m s-1
Ustar $Ustar; // the friction velocity, in m s-1
flowDirection $flowDirection; // the friction velocity, (0 0 0) means no cyclic BCs and no external pressure gradient
H $zMax; // the height for the fluid domain, in m
noiseFactor $noiseFactor;
// ************************************************************************* //
constantPGrad true;

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
// Optional model coefficients, kEpsilon
kEpsilonCoeffs
{
Cmu 0.033;
C1 1.44;
C2 1.92;
C3 0.0;
sigmak 1.0;
sigmaEps 1.85;
}
// ************************************************************************* //

0
exampleCase/foam.foam Normal file
View File

42
exampleCase/setUp Normal file
View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// ************************************************************************* //
zMax 15; // maximum z-extent of domain (m).
// Initial values for the variables.
p0 0.0; // initial pressure (normalized by density) (m^2/s^2).
nut0 0.0; // initial turbulent viscosity (m^2/s).
nuTilda0 0.0; // initial value for nuTilda (m^2/s).
k0 0.24; // initial turbulent kinetic energy (m^2/s^2).
epsilon0 14.855; // initial turbulent dissipation energy (m^2/s^2).
omega0 440.15; // initial value for omega (s^-1).
// General conditions and parameters for flow.
nu 1.134e-5;// continuous phase field-kinetic viscosity (m^2/s).
rho 1.41034; // continuous phase field density (kg/m3).
// General parameters for the Lagrangian particles (cfr kinematicCloudProperties).
rhoPar 900; // particle density (kg m-3)
dm 0.0002; // mean particle diameter (m)
ds 0.00005; // std deviation of particle diameter (m)
d_max 0.0005; // maximum particle diameter (m)
d_min 5e-5; // minimum particle diameter (m)
pppMax 1000; // number of particles per parcel (splash entrainment)
pppMin 100; // number of particles per parcel (aerodynamic entrainment)
// General parameters for fluid forcing.
vKC 0.41; // von Kármán constant (-)
Z0 0.00001; // aerodynamic surface roughness (m)
Ustar 0.314; // friction velocity (m s-1)
flowDirection (0 1 0); // direction vector of friction velocity, (x y z) with x+y+z=1
H $zMax; // vertical height for the fluid component (m)
noiseFactor 0.0; // create artificial turbulence (noise factor)
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application snowBedFoam; //snow transport solver
startFrom latestTime;
startTime 0; //initial timestep (s)
stopAt endTime;
endTime 1000; //end of simulation time (s)
deltaT 1.e-3; //if fixed timestep (s)
writeControl adjustableRunTime; //timestep adjusted to maxCo
writeInterval 1;
purgeWrite 100;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
adjustTimeStep yes;
maxCo 2; //maximum CFL number
maxDeltaT 0.01; //maximum timestep (s)
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// This application/dictionary controls:
// - optional: create new patches from boundary faces (either given as
// a set of patches or as a faceSet)
// - always: order faces on coupled patches such that they are opposite. This
// is done for all coupled faces, not just for any patches created.
// - optional: synchronise points on coupled patches.
// - always: remove zero-sized (non-coupled) patches (that were not added)
// 1. Create cyclic:
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier
// - always create both halves in one invocation with correct 'neighbourPatch'
// setting.
// - optionally pointSync true to guarantee points to line up.
pointSync false;
// Patches to create.
patches
(
{
// Name of new patch
name xMin;
// Dictionary to construct new patch from
patchInfo
{
type cyclic;
neighbourPatch xMax;
transform unknown;
matchTolerance 0.01;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (xMi);
}
{
// Name of new patch
name xMax;
// Dictionary to construct new patch from
patchInfo
{
type cyclic;
neighbourPatch xMin;
transform unknown;//rotational;
matchTolerance 0.01;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (xMi_shadow);
}
{
// Name of new patch
name yMin;
// Dictionary to construct new patch from
patchInfo
{
type cyclic;
neighbourPatch yMax;
transform unknown;
matchTolerance 0.01;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (yMi);
}
{
// Name of new patch
name yMax;
// Dictionary to construct new patch from
patchInfo
{
type cyclic;
neighbourPatch yMin;
transform unknown; //rotational;
matchTolerance 0.01;
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (yMi_shadow);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 20; //number of processors
method simple; //decomposition method
preservePatches (xMin xMax yMin yMax); //for cyclic BCs
simpleCoeffs
{
n (5 4 1); //number of processors in x,y,z direction
delta 0.001;
}
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
grad(U) Gauss linear;
}
divSchemes
{
default none;
div(alphaPhic,U) bounded Gauss linearUpwind grad(U);
div(((alpha*nuEff)*dev2(T(grad(U))))) Gauss linear;
div(phiGByA,kinematicCloud:alpha) Gauss linear;
div(((alpha*nuEff)*dev2(T(grad(U))))) Gauss linear;
div(alphaPhic,k) bounded Gauss upwind;
div(alphaPhic,epsilon) bounded Gauss upwind;
div(alphaPhic,omega) bounded Gauss upwind;
}
laplacianSchemes
{
default Gauss linear limited 0.333;
}
interpolationSchemes
{
default linear;
interpolate(U) linear;
}
snGradSchemes
{
default limited 0.333;
}
fluxRequired
{
default no;
p ;
kinematicCloud:alpha;
}
// ************************************************************************* //

View File

@ -0,0 +1,89 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 1e-06;
relTol 0.01;
smoother GaussSeidel;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}
pFinal
{
solver GAMG;
tolerance 1e-06;
relTol 0;
smoother GaussSeidel;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}
"(U|k|omega|epsilon|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
}
"(U|k|omega|epsilon|nuTilda)Final"
{
$U;
tolerance 1e-05;
relTol 0;
}
/*kinematicCloud:alpha
{
solver GAMG;
tolerance 1e-06;
relTol 0.1;
smoother GaussSeidel;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}*/
}
PIMPLE
{
nOuterCorrectors 2;
nCorrectors 2;
momentumPredictor yes;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
relaxationFactors
{
}
// ************************************************************************* //

48
readme Normal file
View File

@ -0,0 +1,48 @@
The instructions for compiling snowBedFoam solver in OpenFOAM-2.3.0:
(by Mahdi Jafari and Océane Hames, 2021)
_____________________________________________________________________
Open a terminal in this directory.
First, activate the OpenFOAM-2.3.0 environment:
of230
Then, run the following commands:
cp -rp src/lagrangianCRYOS $WM_PROJECT_USER_DIR/src/.
cp -rp applications/solvers/snowBedFoam $WM_PROJECT_USER_DIR/applications/solvers/.
Then, compile the new libraries by typing the following commands:
cd $WM_PROJECT_USER_DIR/src/lagrangianCRYOS/distributionModelsTriple
wclean
wmake
cd $WM_PROJECT_USER_DIR/src/lagrangianCRYOS/intermediateCRYOS
wclean
wmake libso
Finally, compile new solvers:
cd $WM_PROJECT_USER_DIR/applications/solvers/snowBedFoam
./Allwclean
./Allwmake
_____________________________________________________________________
The exampleCase folder is the simulation case used in the paper titled as:
"Modelling the small-scale deposition of snow onto structured Arctic sea ice during a MOSAiC storm using snowBedFoam 1.0."
https://doi.org/10.5194/gmd-2021-254
_____________________________________________________________________
The instructions for (1) programming the snow model and (2) running the simulation case are provided in the "documentation" folder.

@ -1 +0,0 @@
Subproject commit 8c28a1e1ce0d919a52579656fb978e7aedd4a9f9

View File

@ -0,0 +1,6 @@
distributionModelTriple/distributionModelTriple.C
distributionModelTriple/distributionModelTripleNew.C
normalLogNormalExponential/normalLogNormalExponential.C
LIB = $(FOAM_USER_LIBBIN)/libdistributionModelTriple

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "distributionModelTriple.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace distributionModelsTriple
{
defineTypeNameAndDebug(distributionModelTriple, 0);
defineRunTimeSelectionTable(distributionModelTriple, dictionary);
}
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::distributionModelsTriple::distributionModelTriple::check() const //O added
//void Foam::distributionModelsTriple::distributionModelTriple::check() const
{
// nothing needed here
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::distributionModelsTriple::distributionModelTriple::distributionModelTriple
(
const word& name,
const dictionary& dict,
cachedRandom& rndGen
)
:
distributionModelTripleDict_(dict.subDict(name + "Distribution")),
rndGen_(rndGen)
{}
Foam::distributionModelsTriple::distributionModelTriple::distributionModelTriple
(
const distributionModelTriple& p
)
:
distributionModelTripleDict_(p.distributionModelTripleDict_),
rndGen_(p.rndGen_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::distributionModelsTriple::distributionModelTriple::~distributionModelTriple()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::distributionModelsTriple::distributionModelTriple::normalSample(scalar mean_, scalar std_) const
{
notImplemented
(
"Foam::scalar "
"Foam::distributionModelsTriple::distributionModelTriple::normalSample() const"
);
return 0.0;
}
Foam::scalar Foam::distributionModelsTriple::distributionModelTriple::logNormalSample(scalar mean_, scalar std_) const
{
notImplemented
(
"Foam::scalar "
"Foam::distributionModelsTriple::distributionModelTriple::logNormalSample() const"
);
return 0.0;
}
Foam::scalar Foam::distributionModelsTriple::distributionModelTriple::exponentialSample(scalar mean_, scalar std_) const
{
notImplemented
(
"Foam::scalar "
"Foam::distributionModelsTriple::distributionModelTriple::exponentialSample() const"
);
return 0.0;
}
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::distributionModelTriple
Description
A library of runtime-selectable distribution models.
Returns a sampled value given the expectation (nu) and variance (sigma^2)
Current distribution models include:
- exponential
- fixedValue
- general
- multi-normal
- normal
- Rosin-Rammler
- uniform
The distributionModelTriple is tabulated in equidistant nPoints, in an interval.
These values are integrated to obtain the cumulated distribution model,
which is then used to change the distribution from unifrom to
the actual distributionModelTriple.
SourceFiles
distributionModelTriple.C
distributionModelTriple.C
\*---------------------------------------------------------------------------*/
#ifndef distributionModelTriple_H
#define distributionModelTriple_H
#include "IOdictionary.H"
#include "autoPtr.H"
#include "cachedRandom.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace distributionModelsTriple
{
/*---------------------------------------------------------------------------*\
Class distributionModelTriple Declaration
\*---------------------------------------------------------------------------*/
class distributionModelTriple
{
protected:
// Protected data
//- Coefficients dictionary
const dictionary distributionModelTripleDict_;
//- Reference to the random number generator
cachedRandom& rndGen_;
// Protected Member Functions
//- Check that the distribution model is valid
virtual void check() const;
public:
//-Runtime type information
TypeName("distributionModelTriple");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
distributionModelTriple,
dictionary,
(
const dictionary& dict,
cachedRandom& rndGen
),
(dict, rndGen)
);
// Constructors
//- Construct from dictionary
distributionModelTriple
(
const word& name,
const dictionary& dict,
cachedRandom& rndGen
);
//- Construct copy
distributionModelTriple(const distributionModelTriple& p);
//- Construct and return a clone
virtual autoPtr<distributionModelTriple> clone() const
{
return autoPtr<distributionModelTriple>(new distributionModelTriple(*this));
}
//- Selector
static autoPtr<distributionModelTriple> New
(
const dictionary& dict,
cachedRandom& rndGen
);
//- Destructor
virtual ~distributionModelTriple();
// Member Functions
//- Sample the normal distribution model
virtual scalar normalSample(scalar mean_, scalar std_) const;
//- Sample the lognormal distribution model
virtual scalar logNormalSample(scalar mean_, scalar std_) const;
//- Sample the exponential distribution model
virtual scalar exponentialSample(scalar mean_, scalar std_) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace distributionModelsNew
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "distributionModelTriple.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::distributionModelsTriple::distributionModelTriple>
Foam::distributionModelsTriple::distributionModelTriple::New
(
const dictionary& dict,
cachedRandom& rndGen
)
{
const word modelType(dict.lookup("type"));
Info<< "Selecting distribution model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"distributionModelsTriple::distributionModelTriple::New"
"("
"const dictionary&, "
"cachedRandom&"
")"
)
<< "Unknown distribution model type " << modelType << nl << nl
<< "Valid distribution model types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<distributionModelTriple>(cstrIter()(dict, rndGen));
}
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "normalLogNormalExponential.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace distributionModelsTriple
{
defineTypeNameAndDebug(normalLogNormalExponential, 0);
addToRunTimeSelectionTable(distributionModelTriple, normalLogNormalExponential, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::distributionModelsTriple::normalLogNormalExponential::normalLogNormalExponential
(
const dictionary& dict,
cachedRandom& rndGen
)
:
distributionModelTriple(typeName, dict, rndGen)//,
//mean_(readScalar(distributionModelTripleDict_.lookup("mean_"))),
//std_(readScalar(distributionModelTripleDict_.lookup("std")))
{
check();
}
Foam::distributionModelsTriple::normalLogNormalExponential::normalLogNormalExponential(const normalLogNormalExponential& p)
:
distributionModelTriple(p)//,
//mean_(p.mean_),
//std_(p.std_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::distributionModelsTriple::normalLogNormalExponential::~normalLogNormalExponential()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::distributionModelsTriple::normalLogNormalExponential::normalSample(scalar mean_, scalar std_) const
{
scalar rand1=rndGen_.sample01<scalar>();
scalar rand2=rndGen_.sample01<scalar>();
rand1=min(rand1+ROOTVSMALL,1.0);
scalar val=mean_+std_*sqrt(-2.0*log(rand1))*cos(2.0*constant::mathematical::pi*rand2);
return val;
}
Foam::scalar Foam::distributionModelsTriple::normalLogNormalExponential::logNormalSample(scalar mean_, scalar std_) const
{
scalar s2 = log(1.0+pow(std_/mean_,2.0));
scalar m = log(mean_) - 0.5*s2;
scalar rand1=rndGen_.sample01<scalar>();
scalar rand2=rndGen_.sample01<scalar>();
rand1=min(rand1+ROOTVSMALL,1.0);
scalar val=m+sqrt(s2)*sqrt(-2.0*log(rand1))*cos(2.0*constant::mathematical::pi*rand2);
val=exp(val);
return val;
}
Foam::scalar Foam::distributionModelsTriple::normalLogNormalExponential::exponentialSample(scalar mean_, scalar std_) const
{
scalar rand1=rndGen_.sample01<scalar>();
rand1=min(rand1,1.0-ROOTVSMALL);
scalar val = -mean_*log(1.0-rand1);
return val;
}
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::normalLogNormalExponential
Description
normalLogNormalExponential distribution model
SourceFiles
normalLogNormalExponential.C
\*---------------------------------------------------------------------------*/
#ifndef normalLogNormalExponential_H
#define normalLogNormalExponential_H
#include "distributionModelTriple.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace distributionModelsTriple
{
/*---------------------------------------------------------------------------*\
Class normalLogNormalExponential Declaration
\*---------------------------------------------------------------------------*/
class normalLogNormalExponential
:
public distributionModelTriple
{
// Private data
//- the mean value of the distribution
//scalar mean_;
//- the standard deviation of the distribution
//scalar std_;
public:
//- Runtime type information
TypeName("normalLogNormalExponential");
// Constructors
//- Construct from components
normalLogNormalExponential(const dictionary& dict, cachedRandom& rndGen);
//- Construct copy
normalLogNormalExponential(const normalLogNormalExponential& p);
//- Construct and return a clone
virtual autoPtr<distributionModelTriple> clone() const
{
return autoPtr<distributionModelTriple>(new normalLogNormalExponential(*this));
}
//- Destructor
virtual ~normalLogNormalExponential();
// Member Functions
//- Sample the normal distribution model
virtual scalar normalSample(scalar mean_, scalar std_) const;
//- Sample the lognormal distribution model
virtual scalar logNormalSample(scalar mean_, scalar std_) const;
//- Sample the exponential distribution model
virtual scalar exponentialSample(scalar mean_, scalar std_) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace distributionModelsTriple
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Analytical.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Analytical<Type>::Analytical
(
const word& phiName,
const dictionary& dict
)
:
IntegrationScheme<Type>(phiName, dict)
{}
template<class Type>
Foam::Analytical<Type>::Analytical(const Analytical& is)
:
IntegrationScheme<Type>(is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Analytical<Type>::~Analytical()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
typename Foam::IntegrationScheme<Type>::integrationResult
Foam::Analytical<Type>::integrate
(
const Type& phi,
const scalar dt,
const Type& alphaBeta,
const scalar beta
) const
{
typename IntegrationScheme<Type>::integrationResult retValue;
const scalar expTerm = exp(min(50, -beta*dt));
if (beta > ROOTVSMALL)
{
const Type alpha = alphaBeta/beta;
retValue.average() = alpha + (phi - alpha)*(1 - expTerm)/(beta*dt);
retValue.value() = alpha + (phi - alpha)*expTerm;
}
else
{
retValue.value() = phi + alphaBeta*dt; //O added
retValue.average() = 0.5*(phi + retValue.value()); //O added
//retValue.average() = phi;
//retValue.value() = phi;
}
return retValue;
}
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::Analytical
Description
Analytical integration
\*---------------------------------------------------------------------------*/
#ifndef Analytical_H
#define Analytical_H
#include "IntegrationScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class Analytical Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class Analytical
:
public IntegrationScheme<Type>
{
public:
//- Runtime type information
TypeName("analytical");
// Constructors
//- Construct from components
Analytical(const word& phiName, const dictionary& dict);
//- Copy constructor
Analytical(const Analytical& is);
//- Construct and return clone
virtual autoPtr<IntegrationScheme<Type> > clone() const
{
return autoPtr<IntegrationScheme<Type> >
(
new Analytical<Type>(*this)
);
}
//- Destructor
virtual ~Analytical();
// Member Functions
//- Perform the integration
virtual typename IntegrationScheme<Type>::integrationResult integrate
(
const Type& phi,
const scalar dt,
const Type& alphaBeta,
const scalar beta
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Analytical.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Euler.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Euler<Type>::Euler
(
const word& phiName,
const dictionary& dict
)
:
IntegrationScheme<Type>(phiName, dict)
{}
template<class Type>
Foam::Euler<Type>::Euler(const Euler& is)
:
IntegrationScheme<Type>(is)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Euler<Type>::~Euler()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
typename Foam::IntegrationScheme<Type>::integrationResult
Foam::Euler<Type>::integrate
(
const Type& phi,
const scalar dt,
const Type& alphaBeta,
const scalar beta
) const
{
typename IntegrationScheme<Type>::integrationResult retValue;
retValue.value() = (phi + alphaBeta*dt)/(1.0 + beta*dt);
retValue.average() = 0.5*(phi + retValue.value());
return retValue;
}
// ************************************************************************* //

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::Euler
Description
Euler-implicit integration
\*---------------------------------------------------------------------------*/
#ifndef Euler_H
#define Euler_H
#include "IntegrationScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class Euler Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class Euler
:
public IntegrationScheme<Type>
{
public:
//- Runtime type information
TypeName("Euler");
// Constructors
//- Construct from components
Euler(const word& phiName, const dictionary& dict);
//- Copy constructor
Euler(const Euler& is);
//- Construct and return clone
virtual autoPtr<IntegrationScheme<Type> > clone() const
{
return autoPtr<IntegrationScheme<Type> >(new Euler<Type>(*this));
}
//- Destructor
virtual ~Euler();
// Member Functions
//- Perform the integration
virtual typename IntegrationScheme<Type>::integrationResult integrate
(
const Type& phi,
const scalar dt,
const Type& alphaBeta,
const scalar beta
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Euler.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IntegrationScheme.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::IntegrationScheme<Type>::IntegrationScheme
(
const word& phiName,
const dictionary& dict
)
:
phiName_(phiName),
dict_(dict)
{}
template<class Type>
Foam::IntegrationScheme<Type>::IntegrationScheme(const IntegrationScheme& is)
:
phiName_(is.phiName_),
dict_(is.dict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
Foam::IntegrationScheme<Type>::~IntegrationScheme()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
typename Foam::IntegrationScheme<Type>::integrationResult
Foam::IntegrationScheme<Type>::integrate
(
const Type& phi,
const scalar dt,
const Type& alphaBeta,
const scalar beta
) const
{
notImplemented
(
"Foam::IntegrationScheme<Type>::integrationResult"
"Foam::IntegrationScheme<Type>::integrate"
"("
"const Type&, "
"const scalar, "
"const Type&, "
"const scalar"
") const"
);
typename IntegrationScheme<Type>::integrationResult retValue;
retValue.average() = pTraits<Type>::zero;
retValue.value() = pTraits<Type>::zero;
return retValue;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "IntegrationSchemeNew.C"
// ************************************************************************* //

View File

@ -0,0 +1,228 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IntegrationScheme
Description
Top level model for Integration schemes
SourceFiles
IntegrationScheme.C
\*---------------------------------------------------------------------------*/
#ifndef IntegrationScheme_H
#define IntegrationScheme_H
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IntegrationScheme Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class IntegrationScheme
{
public:
//- Helper class to supply results of integration
class integrationResult
{
//- Integration value
Type value_;
//- Average value across integration step
Type average_;
public:
//- Constructor
integrationResult()
:
value_(pTraits<Type>::zero),
average_(pTraits<Type>::zero)
{}
// Member functions
// Access
//- Return const access to the value
Type value() const
{
return value_;
}
//- Return const access to the average
Type average() const
{
return average_;
}
// Edit
//- Return access to the value for changing
Type& value()
{
return value_;
}
//- Return access to the average for changing
Type& average()
{
return average_;
}
};
private:
// Private data
//- Name of the Integration variable
const word& phiName_;
//- Reference to the dictionary
const dictionary& dict_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const IntegrationScheme&);
public:
//- Runtime type information
TypeName("integrationScheme");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
IntegrationScheme,
dictionary,
(
const word& phiName,
const dictionary& dict
),
(phiName, dict)
);
// Constructors
//- Construct from components
IntegrationScheme(const word& phiName, const dictionary& dict);
//- Copy constructor
IntegrationScheme(const IntegrationScheme& is);
//- Construct and return clone
virtual autoPtr<IntegrationScheme<Type> > clone() const
{
return autoPtr<IntegrationScheme<Type> >
(
new IntegrationScheme<Type>(*this)
);
}
// Selectors
//- Return a reference to the selected radiation model
static autoPtr<IntegrationScheme> New
(
const word& phiName,
const dictionary& dict
);
//- Destructor
virtual ~IntegrationScheme();
// Member Functions
//- Perform the Integration
virtual integrationResult integrate
(
const Type& phi,
const scalar dt,
const Type& alphaBeta,
const scalar beta
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeIntegrationScheme(Type) \
\
defineNamedTemplateTypeNameAndDebug(IntegrationScheme<Type>, 0); \
\
defineTemplateRunTimeSelectionTable \
( \
IntegrationScheme<Type>, \
dictionary \
);
#define makeIntegrationSchemeType(SS, Type) \
\
defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
\
IntegrationScheme<Type>::adddictionaryConstructorToTable<SS<Type> > \
add##SS##Type##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IntegrationScheme.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "IntegrationScheme.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::autoPtr<Foam::IntegrationScheme<Type> >
Foam::IntegrationScheme<Type>::New
(
const word& phiName,
const dictionary& dict
)
{
const word schemeName(dict.lookup(phiName));
Info<< "Selecting " << phiName << " integration scheme "
<< schemeName << endl;
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(schemeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"IntegrationScheme::New(const dictionary&)"
) << "Unknown integration scheme type "
<< schemeName << nl << nl
<< "Valid integration scheme types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
return autoPtr<IntegrationScheme<Type> >(cstrIter()(phiName, dict));
}
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::scalarIntegrationScheme
Description
Foam::scalarIntegrationScheme
Typedef
Foam::vectorIntegrationScheme;
Description
Foam::vectorIntegrationScheme;
SourceFiles
IntegrationScheme.C
\*---------------------------------------------------------------------------*/
#ifndef IntegrationSchemesFwd_H
#define IntegrationSchemesFwd_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
class IntegrationScheme;
typedef IntegrationScheme<scalar> scalarIntegrationScheme;
typedef IntegrationScheme<vector> vectorIntegrationScheme;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IntegrationScheme.H"
#include "Euler.H"
#include "Analytical.H"
#include "scalar.H"
#include "vector.H"
namespace Foam
{
makeIntegrationScheme(scalar);
makeIntegrationSchemeType(Euler, scalar);
makeIntegrationSchemeType(Analytical, scalar);
makeIntegrationScheme(vector);
makeIntegrationSchemeType(Euler, vector);
makeIntegrationSchemeType(Analytical, vector);
}
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
PARCELS=parcels
BASEPARCELS=$(PARCELS)/baseClasses
DERIVEDPARCELS=$(PARCELS)/derived
CLOUDS=clouds
BASECLOUDS=$(CLOUDS)/baseClasses
DERIVEDCLOUDS=$(CLOUDS)/derived
/* Cloud base classes */
$(BASECLOUDS)/kinematicCloud/kinematicCloud.C
$(BASECLOUDS)/thermoCloud/thermoCloud.C
$(BASECLOUDS)/reactingCloud/reactingCloud.C
$(BASECLOUDS)/reactingMultiphaseCloud/reactingMultiphaseCloud.C
/* kinematic parcel sub-models */
KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
/* kinematic colliding parcel sub-models */
KINEMATICCOLLIDINGPARCEL=$(DERIVEDPARCELS)/basicKinematicCollidingParcel
$(KINEMATICCOLLIDINGPARCEL)/defineBasicKinematicCollidingParcel.C
$(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C
/* thermo parcel sub-models */
THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel
$(THERMOPARCEL)/defineBasicThermoParcel.C
$(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C
/* reacting parcel sub-models */
REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel
$(REACTINGPARCEL)/defineBasicReactingParcel.C
$(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C
/* reacting multiphase parcel sub-models */
REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel
$(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C
$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
/* kinematic MPPIC parcel sub-models */
KINEMATICMPPICPARCEL=$(DERIVEDPARCELS)/basicKinematicMPPICParcel
$(KINEMATICMPPICPARCEL)/defineBasicKinematicMPPICParcel.C
$(KINEMATICMPPICPARCEL)/makeBasicKinematicMPPICParcelSubmodels.C
/* bolt-on models */
RADIATION=submodels/addOns/radiation
$(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C
$(RADIATION)/scatter/cloudScatter/cloudScatter.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionDataList.C
submodels/Kinematic/PatchInteractionModel/LocalInteractionReboundingSplashing/patchInteractionStickReboundSplashData.C
submodels/Kinematic/PatchInteractionModel/LocalInteractionReboundingSplashing/patchInteractionStickReboundSplashDataList.C
KINEMATICINJECTION=submodels/Kinematic/InjectionModel
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.C
$(KINEMATICINJECTION)/PatchInjection/patchInjectionBase.C
THERMOINJECTION=submodels/Thermodynamic/InjectionModel
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.C
REACTINGMPINJECTION=submodels/ReactingMultiphase/InjectionModel
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionData.C
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.C
MPPICPARTICLESTRESS=submodels/MPPIC/ParticleStressModels
$(MPPICPARTICLESTRESS)/ParticleStressModel/ParticleStressModel.C
$(MPPICPARTICLESTRESS)/HarrisCrighton/HarrisCrighton.C
$(MPPICPARTICLESTRESS)/Lun/Lun.C
$(MPPICPARTICLESTRESS)/exponential/exponential.C
MPPICCORRECTIONLIMITING=submodels/MPPIC/CorrectionLimitingMethods
$(MPPICCORRECTIONLIMITING)/CorrectionLimitingMethod/CorrectionLimitingMethod.C
$(MPPICCORRECTIONLIMITING)/noCorrectionLimiting/noCorrectionLimiting.C
$(MPPICCORRECTIONLIMITING)/absolute/absolute.C
$(MPPICCORRECTIONLIMITING)/relative/relative.C
MPPICTIMESCALE=submodels/MPPIC/TimeScaleModels
$(MPPICTIMESCALE)/TimeScaleModel/TimeScaleModel.C
$(MPPICTIMESCALE)/equilibrium/equilibrium.C
$(MPPICTIMESCALE)/nonEquilibrium/nonEquilibrium.C
$(MPPICTIMESCALE)/isotropic/isotropic.C
/* integration schemes */
IntegrationScheme/makeIntegrationSchemes.C
/* phase properties */
phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C
phaseProperties/phasePropertiesList/phasePropertiesList.C
/* additional helper classes */
clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C
/* averaging methods */
submodels/MPPIC/AveragingMethods/makeAveragingMethods.C
LIB = $(FOAM_USER_LIBBIN)/liblagrangianIntermediateCRYOS

View File

@ -0,0 +1,52 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I../distributionModelsTriple/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/OpenFOAM/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-llagrangian \
-ldistributionModels \
-lspecie \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lreactionThermophysicalModels \
-lSLGThermo \
-lradiationModels \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-ldynamicFvMesh \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-L$(FOAM_USER_LIBBIN) \
-ldistributionModelTriple

View File

@ -0,0 +1,251 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollidingCloud.H"
#include "CollisionModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::CollidingCloud<CloudType>::setModels()
{
collisionModel_.reset
(
CollisionModel<CollidingCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
}
template<class CloudType>
template<class TrackData>
void Foam::CollidingCloud<CloudType>::moveCollide
(
TrackData& td,
const scalar deltaT
)
{
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, deltaT);
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, deltaT);
// td.part() = TrackData::tpRotationalTrack;
// CloudType::move(td);
this->updateCellOccupancy();
this->collision().collide();
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, deltaT);
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::cloudReset(CollidingCloud<CloudType>& c)
{
CloudType::cloudReset(c);
collisionModel_.reset(c.collisionModel_.ptr());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CollidingCloud<CloudType>::CollidingCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields
)
:
CloudType(cloudName, rho, U, mu, g, false),
constProps_(this->particleProperties()),
collisionModel_(NULL)
{
if (this->solution().steadyState())
{
FatalErrorIn
(
"Foam::CollidingCloud<CloudType>::CollidingCloud"
"("
"const word&, "
"const volScalarField&, "
"const volVectorField&, "
"const volScalarField&, "
"const dimensionedVector&, "
"bool"
")"
) << "Collision modelling not currently available for steady state "
<< "calculations" << exit(FatalError);
}
if (this->solution().active())
{
setModels();
if (readFields)
{
parcelType::readFields(*this);
}
}
}
template<class CloudType>
Foam::CollidingCloud<CloudType>::CollidingCloud
(
CollidingCloud<CloudType>& c,
const word& name
)
:
CloudType(c, name),
collisionModel_(c.collisionModel_->clone())
{}
template<class CloudType>
Foam::CollidingCloud<CloudType>::CollidingCloud
(
const fvMesh& mesh,
const word& name,
const CollidingCloud<CloudType>& c
)
:
CloudType(mesh, name, c),
collisionModel_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CollidingCloud<CloudType>::~CollidingCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::CollidingCloud<CloudType>::hasWallImpactDistance() const
{
return !collision().controlsWallInteraction();
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<CollidingCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
);
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<CollidingCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class CloudType>
template<class TrackData>
void Foam::CollidingCloud<CloudType>::motion(TrackData& td)
{
// Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force
// + move positions with new velocity
// + calculate forces in new position
// + apply half deltaV with new force
label nSubCycles = collision().nSubCycles();
if (nSubCycles > 1)
{
Info<< " " << nSubCycles << " move-collide subCycles" << endl;
subCycleTime moveCollideSubCycle
(
const_cast<Time&>(this->db().time()),
nSubCycles
);
while(!(++moveCollideSubCycle).end())
{
moveCollide(td, this->db().time().deltaTValue());
}
moveCollideSubCycle.endSubCycle();
}
else
{
moveCollide(td, this->db().time().deltaTValue());
}
}
template<class CloudType>
void Foam::CollidingCloud<CloudType>::info()
{
CloudType::info();
scalar rotationalKineticEnergy = rotationalKineticEnergyOfSystem();
reduce(rotationalKineticEnergy, sumOp<scalar>());
Info<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,256 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CollidingCloud
Description
Adds coolisions to kinematic clouds
SourceFiles
CollidingCloudI.H
CollidingCloud.C
\*---------------------------------------------------------------------------*/
#ifndef CollidingCloud_H
#define CollidingCloud_H
#include "particle.H"
#include "Cloud.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class CollisionModel;
/*---------------------------------------------------------------------------*\
Class CollidingCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class CollidingCloud
:
public CloudType
{
public:
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef CollidingCloud<CloudType> collidingCloudType;
private:
// Private data
//- Cloud copy pointer
autoPtr<CollidingCloud<CloudType> > cloudCopyPtr_;
// Private Member Functions
//- Disallow default bitwise copy construct
CollidingCloud(const CollidingCloud&);
//- Disallow default bitwise assignment
void operator=(const CollidingCloud&);
protected:
// Protected data
//- Thermo parcel constant properties
typename parcelType::constantProperties constProps_;
// References to the cloud sub-models
//- Collision model
autoPtr<CollisionModel<CollidingCloud<CloudType> > >
collisionModel_;
// Initialisation
//- Set cloud sub-models
void setModels();
// Cloud evolution functions
//- Move-collide particles
template<class TrackData>
void moveCollide(TrackData& td, const scalar deltaT);
//- Reset state of cloud
void cloudReset(CollidingCloud<CloudType>& c);
public:
// Constructors
//- Construct given carrier gas fields
CollidingCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields = true
);
//- Copy constructor with new name
CollidingCloud
(
CollidingCloud<CloudType>& c,
const word& name
);
//- Copy constructor with new name - creates bare cloud
CollidingCloud
(
const fvMesh& mesh,
const word& name,
const CollidingCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new CollidingCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new CollidingCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~CollidingCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const CollidingCloud& cloudCopy() const;
//- Return the constant properties
inline const typename parcelType::constantProperties&
constProps() const;
//- If the collision model controls the wall interaction,
// then the wall impact distance should be zero.
// Otherwise, it should be allowed to be the value from
// the Parcel.
virtual bool hasWallImpactDistance() const;
// Sub-models
//- Return const access to the collision model
inline const CollisionModel<CollidingCloud<CloudType> >&
collision() const;
//- Return reference to the collision model
inline CollisionModel<CollidingCloud<CloudType> >&
collision();
// Check
//- Total rotational kinetic energy in the system
inline scalar rotationalKineticEnergyOfSystem() const;
// Cloud evolution functions
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Evolve the cloud
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
// I-O
//- Print cloud information
void info();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollidingCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CollidingCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::CollidingCloud<CloudType>&
Foam::CollidingCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::CollidingCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class CloudType>
inline const Foam::CollisionModel<Foam::CollidingCloud<CloudType> >&
Foam::CollidingCloud<CloudType>::collision() const
{
return collisionModel_();
}
template<class CloudType>
inline Foam::CollisionModel<Foam::CollidingCloud<CloudType> >&
Foam::CollidingCloud<CloudType>::collision()
{
return collisionModel_();
}
template<class CloudType>
inline Foam::scalar
Foam::CollidingCloud<CloudType>::rotationalKineticEnergyOfSystem() const
{
scalar rotationalKineticEnergy = 0.0;
forAllConstIter(typename CollidingCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
rotationalKineticEnergy +=
p.nParticle()*0.5*p.momentOfInertia()*(p.omega() & p.omega());
}
return rotationalKineticEnergy;
}
// ************************************************************************* //

View File

@ -0,0 +1,694 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::KinematicCloud
Description
Templated base class for kinematic cloud
- cloud function objects
- particle forces, e.g.
- buoyancy
- drag
- pressure gradient
- ...
- sub-models:
- dispersion model
- injection model
- patch interaction model
- stochastic collision model
- surface film model
SourceFiles
KinematicCloudI.H
KinematicCloud.C
\*---------------------------------------------------------------------------*/
#ifndef KinematicCloud_H
#define KinematicCloud_H
#include "particle.H"
#include "Cloud.H"
#include "kinematicCloud.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "cachedRandom.H"
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
#include "IntegrationSchemesFwd.H"
#include "cloudSolution.H"
#include "ParticleForceList.H"
#include "CloudFunctionObjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class InjectionModelList;
template<class CloudType>
class DispersionModel;
template<class CloudType>
class PatchInteractionModel;
template<class CloudType>
class SurfaceFilmModel;
template<class CloudType>
class StochasticCollisionModel;
template<class CloudType>
class BedAerodynamicLiftInjectionModel; //O added
/*---------------------------------------------------------------------------*\
Class KinematicCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class KinematicCloud
:
public CloudType,
public kinematicCloud
{
public:
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef KinematicCloud<CloudType> kinematicCloudType;
//- Force models type
typedef ParticleForceList<KinematicCloud<CloudType> > forceType;
//- Function object type
typedef CloudFunctionObjectList<KinematicCloud<CloudType> >
functionType;
private:
// Private data
//- Cloud copy pointer
autoPtr<KinematicCloud<CloudType> > cloudCopyPtr_;
// Private Member Functions
//- Disallow default bitwise copy construct
KinematicCloud(const KinematicCloud&);
//- Disallow default bitwise assignment
void operator=(const KinematicCloud&);
protected:
// Protected data
//- References to the mesh and time databases
const fvMesh& mesh_;
//- Dictionary of particle properties
IOdictionary particleProperties_;
//- Dictionary of output properties
IOdictionary outputProperties_;
//- Solution properties
cloudSolution solution_;
//- Parcel constant properties
typename parcelType::constantProperties constProps_;
//- Sub-models dictionary
const dictionary subModelProperties_;
//- Random number generator - used by some injection routines
cachedRandom rndGen_;
//- Cell occupancy information for each parcel, (demand driven)
autoPtr<List<DynamicList<parcelType*> > > cellOccupancyPtr_;
//- Cell length scale
scalarField cellLengthScale_;
// References to the carrier gas fields
//- Density [kg/m3]
const volScalarField& rho_;
//- Velocity [m/s]
const volVectorField& U_;
//- Dynamic viscosity [Pa.s]
const volScalarField& mu_;
// Environmental properties
//- Gravity
const dimensionedVector& g_;
//- Averaged ambient domain pressure
scalar pAmbient_;
//- Optional particle forces
forceType forces_;
//- Optional cloud function objects
functionType functions_;
// References to the cloud sub-models
//- Injector models
InjectionModelList<KinematicCloud<CloudType> > injectors_;
//- Dispersion model
autoPtr<DispersionModel<KinematicCloud<CloudType> > >
dispersionModel_;
//- Patch interaction model
autoPtr<PatchInteractionModel<KinematicCloud<CloudType> > >
patchInteractionModel_;
//- Stochastic collision model
autoPtr<StochasticCollisionModel<KinematicCloud<CloudType> > >
stochasticCollisionModel_;
//- Bed aerodynamic lift injection model
autoPtr<BedAerodynamicLiftInjectionModel<KinematicCloud<CloudType> > >
bedAerodynamicLiftInjectionModel_;//O added
//- Surface film model
autoPtr<SurfaceFilmModel<KinematicCloud<CloudType> > >
surfaceFilmModel_;
// Reference to the particle integration schemes
//- Velocity integration
autoPtr<vectorIntegrationScheme> UIntegrator_;
// Sources
//- Momentum
autoPtr<DimensionedField<vector, volMesh> > UTrans_;
//- Coefficient for carrier phase U equation
autoPtr<DimensionedField<scalar, volMesh> > UCoeff_;
//- Mass deposition
autoPtr<volScalarField> massDeposition_; //O added
//- Mass deposition, set to 0 to check small mass transfers
autoPtr<volScalarField> massCheckPatterns_; //O added
//- Mass deposition rate
autoPtr<volScalarField> massDepRate_; //O added
//- Surface friction velocity, set to justify erosion patterns
autoPtr<volScalarField> surfaceUfric_; //O added
// Initialisation
//- Set cloud sub-models
void setModels();
// Cloud evolution functions
//- Solve the cloud - calls all evolution functions
template<class TrackData>
void solve(TrackData& td);
//- Build the cellOccupancy
void buildCellOccupancy();
//- Update (i.e. build) the cellOccupancy if it has
// already been used
void updateCellOccupancy();
//- Evolve the cloud
template<class TrackData>
void evolveCloud(TrackData& td);
//- Post-evolve
void postEvolve();
//- Reset state of cloud
void cloudReset(KinematicCloud<CloudType>& c);
public:
// Constructors
//- Construct given carrier gas fields
KinematicCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields = true
);
//- Copy constructor with new name
KinematicCloud
(
KinematicCloud<CloudType>& c,
const word& name
);
//- Copy constructor with new name - creates bare cloud
KinematicCloud
(
const fvMesh& mesh,
const word& name,
const KinematicCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new KinematicCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new KinematicCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~KinematicCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const KinematicCloud& cloudCopy() const;
//- Switch to specify if particles of the cloud can return
// non-zero wall distance values - true for kinematic parcels
virtual bool hasWallImpactDistance() const;
// References to the mesh and databases
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return particle properties dictionary
inline const IOdictionary& particleProperties() const;
//- Return output properties dictionary
inline const IOdictionary& outputProperties() const;
//- Return non-const access to the output properties dictionary
inline IOdictionary& outputProperties();
//- Return const access to the solution properties
inline const cloudSolution& solution() const;
//- Return access to the solution properties
inline cloudSolution& solution();
//- Return the constant properties
inline const typename parcelType::constantProperties&
constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
//- Return reference to the sub-models dictionary
inline const dictionary& subModelProperties() const;
// Cloud data
//- Return reference to the random object
inline cachedRandom& rndGen();
//- Return the cell occupancy information for each
// parcel, non-const access, the caller is
// responsible for updating it for its own purposes
// if particles are removed or created.
inline List<DynamicList<parcelType*> >& cellOccupancy();
//- Return the cell length scale
inline const scalarField& cellLengthScale() const;
// References to the carrier gas fields
//- Return carrier gas velocity
inline const volVectorField& U() const;
//- Return carrier gas density
inline const volScalarField& rho() const;
//- Return carrier gas dynamic viscosity
inline const volScalarField& mu() const;
// Environmental properties
//- Gravity
inline const dimensionedVector& g() const;
//- Return const-access to the ambient pressure
inline scalar pAmbient() const;
//- Return reference to the ambient pressure
inline scalar& pAmbient();
//- Optional particle forces
// inline const typename parcelType::forceType& forces() const;
inline const forceType& forces() const;
//- Return the optional particle forces
inline forceType& forces();
//- Optional cloud function objects
inline functionType& functions();
// Sub-models
//- Return const access to the injection model
inline const InjectionModelList<KinematicCloud<CloudType> >&
injectors() const;
//- Return reference to the injection model
inline InjectionModelList<KinematicCloud<CloudType> >&
injectors();
//- Return const-access to the dispersion model
inline const DispersionModel<KinematicCloud<CloudType> >&
dispersion() const;
//- Return reference to the dispersion model
inline DispersionModel<KinematicCloud<CloudType> >&
dispersion();
//- Return const-access to the patch interaction model
inline const PatchInteractionModel<KinematicCloud<CloudType> >&
patchInteraction() const;
//- Return reference to the patch interaction model
inline PatchInteractionModel<KinematicCloud<CloudType> >&
patchInteraction();
//- Return const-access to the stochastic collision model
inline const
StochasticCollisionModel<KinematicCloud<CloudType> >&
stochasticCollision() const;
//- Return reference to the stochastic collision model
inline StochasticCollisionModel<KinematicCloud<CloudType> >&
stochasticCollision();
//- Return const-access to the bed aerodynamic lift model
inline const
BedAerodynamicLiftInjectionModel<KinematicCloud<CloudType> >&
bedAerodynamicLiftInjection() const; //O added
//- Return reference to the bed aerodynamic lift model
inline BedAerodynamicLiftInjectionModel<KinematicCloud<CloudType> >&
bedAerodynamicLiftInjection(); //O added
//- Return const-access to the surface film model
inline const SurfaceFilmModel<KinematicCloud<CloudType> >&
surfaceFilm() const;
//- Return reference to the surface film model
inline SurfaceFilmModel<KinematicCloud<CloudType> >&
surfaceFilm();
// Integration schemes
//-Return reference to velocity integration
inline const vectorIntegrationScheme& UIntegrator() const;
// Sources
// Momentum
//- Return reference to momentum source
inline DimensionedField<vector, volMesh>& UTrans();
//- Return const reference to momentum source
inline const DimensionedField<vector, volMesh>&
UTrans() const;
//- Return coefficient for carrier phase U equation
inline DimensionedField<scalar, volMesh>& UCoeff();
//- Return const coefficient for carrier phase U equation
inline const DimensionedField<scalar, volMesh>&
UCoeff() const;
//- Return coefficient for mass deposition field
inline volScalarField& massDeposition(); //O added
//- Return const coefficient for mass deposition field
inline const volScalarField& //O added
massDeposition() const;
//- Return coefficient for mass deposition patterns field
inline volScalarField& massCheckPatterns(); //O added
//- Return const coefficient for mass deposition patterns field
inline const volScalarField& //O added
massCheckPatterns() const;
//- Return coefficient for mass deposition patterns field
inline volScalarField& massDepRate(); //O added 01.09.20
//- Return const coefficient for mass deposition patterns field
inline const volScalarField& //O added 01.09.20
massDepRate() const;
//- Return coefficient for surface friction velocity field
inline volScalarField& surfaceUfric(); //O added
//- Return const coefficient for surface friction velocity field
inline const volScalarField& //O added
surfaceUfric() const;
//- Return tmp momentum source term
inline tmp<fvVectorMatrix> SU(volVectorField& U) const;
// Check
//- Total number of parcels
inline label nParcels() const;
//- Total mass in system
inline scalar massInSystem() const;
//- Total linear momentum of the system
inline vector linearMomentumOfSystem() const;
//- Total linear kinetic energy in the system
inline scalar linearKineticEnergyOfSystem() const;
//- Total rotational kinetic energy in the system
inline scalar rotationalKineticEnergyOfSystem() const;
//- Penetration for fraction [0-1] of the current total mass
inline scalar penetration(const scalar fraction) const;
//- Mean diameter Dij
inline scalar Dij(const label i, const label j) const;
//- Max diameter
inline scalar Dmax() const;
// Fields
//- Volume swept rate of parcels per cell
inline const tmp<volScalarField> vDotSweep() const;
//- Return the particle volume fraction field
// Note: for particles belonging to this cloud only
inline const tmp<volScalarField> theta() const;
//- Return the particle mass fraction field
// Note: for particles belonging to this cloud only
inline const tmp<volScalarField> alpha() const;
//- Return the particle effective density field
// Note: for particles belonging to this cloud only
inline const tmp<volScalarField> rhoEff() const;
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
);
//- Check parcel properties
void checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Reset the cloud source terms
void resetSourceTerms();
//- Relax field
template<class Type>
void relax
(
DimensionedField<Type, volMesh>& field,
const DimensionedField<Type, volMesh>& field0,
const word& name
) const;
//- Scale field
template<class Type>
void scale
(
DimensionedField<Type, volMesh>& field,
const word& name
) const;
//- Apply relaxation to (steady state) cloud sources
void relaxSources(const KinematicCloud<CloudType>& cloudOldTime);
//- Apply scaling to (transient) cloud sources
void scaleSources();
//- Pre-evolve
void preEvolve();
//- Evolve the cloud
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
//- Calculate the patch normal and velocity to interact with,
// accounting for patch motion if required.
void patchData
(
const parcelType& p,
const polyPatch& pp,
const scalar trackFraction,
const tetIndices& tetIs,
vector& normal,
vector& Up
) const;
// Mapping
//- Update mesh
void updateMesh();
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
// I-O
//- Print cloud information
void info();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "KinematicCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "KinematicCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,820 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fvmSup.H"
#include "SortableList.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::KinematicCloud<CloudType>&
Foam::KinematicCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline const Foam::fvMesh& Foam::KinematicCloud<CloudType>::mesh() const
{
return mesh_;
}
template<class CloudType>
inline const Foam::IOdictionary&
Foam::KinematicCloud<CloudType>::particleProperties() const
{
return particleProperties_;
}
template<class CloudType>
inline const Foam::IOdictionary&
Foam::KinematicCloud<CloudType>::outputProperties() const
{
return outputProperties_;
}
template<class CloudType>
inline Foam::IOdictionary& Foam::KinematicCloud<CloudType>::outputProperties()
{
return outputProperties_;
}
template<class CloudType>
inline const Foam::cloudSolution&
Foam::KinematicCloud<CloudType>::solution() const
{
return solution_;
}
template<class CloudType>
inline Foam::cloudSolution& Foam::KinematicCloud<CloudType>::solution()
{
return solution_;
}
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::KinematicCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::KinematicCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType>
inline const Foam::dictionary&
Foam::KinematicCloud<CloudType>::subModelProperties() const
{
return subModelProperties_;
}
template<class CloudType>
inline const Foam::volScalarField& Foam::KinematicCloud<CloudType>::rho() const
{
return rho_;
}
template<class CloudType>
inline const Foam::volVectorField& Foam::KinematicCloud<CloudType>::U() const
{
return U_;
}
template<class CloudType>
inline const Foam::volScalarField& Foam::KinematicCloud<CloudType>::mu() const
{
return mu_;
}
template<class CloudType>
inline const Foam::dimensionedVector& Foam::KinematicCloud<CloudType>::g() const
{
return g_;
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::pAmbient() const
{
return pAmbient_;
}
template<class CloudType>
inline Foam::scalar& Foam::KinematicCloud<CloudType>::pAmbient()
{
return pAmbient_;
}
template<class CloudType>
//inline const typename CloudType::parcelType::forceType&
inline const typename Foam::KinematicCloud<CloudType>::forceType&
Foam::KinematicCloud<CloudType>::forces() const
{
return forces_;
}
template<class CloudType>
inline typename Foam::KinematicCloud<CloudType>::forceType&
Foam::KinematicCloud<CloudType>::forces()
{
return forces_;
}
template<class CloudType>
inline typename Foam::KinematicCloud<CloudType>::functionType&
Foam::KinematicCloud<CloudType>::functions()
{
return functions_;
}
template<class CloudType>
inline const Foam::InjectionModelList<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::injectors() const
{
return injectors_;
}
template<class CloudType>
inline Foam::InjectionModelList<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::injectors()
{
return injectors_;
}
template<class CloudType>
inline const Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::dispersion() const
{
return dispersionModel_;
}
template<class CloudType>
inline Foam::DispersionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::dispersion()
{
return dispersionModel_();
}
template<class CloudType>
inline const Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::patchInteraction() const
{
return patchInteractionModel_;
}
template<class CloudType>
inline Foam::PatchInteractionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::patchInteraction()
{
return patchInteractionModel_();
}
template<class CloudType>
inline const Foam::StochasticCollisionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::stochasticCollision() const
{
return stochasticCollisionModel_();
}
template<class CloudType>
inline Foam::StochasticCollisionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::stochasticCollision()
{
return stochasticCollisionModel_();
}
template<class CloudType>
inline const Foam::BedAerodynamicLiftInjectionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::bedAerodynamicLiftInjection() const
{
return bedAerodynamicLiftInjectionModel_();
} //O added
template<class CloudType>
inline Foam::BedAerodynamicLiftInjectionModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::bedAerodynamicLiftInjection()
{
return bedAerodynamicLiftInjectionModel_();
} //O added
template<class CloudType>
inline const Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::surfaceFilm() const
{
return surfaceFilmModel_();
}
template<class CloudType>
inline Foam::SurfaceFilmModel<Foam::KinematicCloud<CloudType> >&
Foam::KinematicCloud<CloudType>::surfaceFilm()
{
return surfaceFilmModel_();
}
template<class CloudType>
inline const Foam::vectorIntegrationScheme&
Foam::KinematicCloud<CloudType>::UIntegrator() const
{
return UIntegrator_;
}
template<class CloudType>
inline Foam::label Foam::KinematicCloud<CloudType>::nParcels() const
{
return this->size();
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const
{
scalar sysMass = 0.0;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
sysMass += p.nParticle()*p.mass();
}
return sysMass;
}
template<class CloudType>
inline Foam::vector
Foam::KinematicCloud<CloudType>::linearMomentumOfSystem() const
{
vector linearMomentum(vector::zero);
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
linearMomentum += p.nParticle()*p.mass()*p.U();
}
return linearMomentum;
}
template<class CloudType>
inline Foam::scalar
Foam::KinematicCloud<CloudType>::linearKineticEnergyOfSystem() const
{
scalar linearKineticEnergy = 0.0;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
linearKineticEnergy += p.nParticle()*0.5*p.mass()*(p.U() & p.U());
}
return linearKineticEnergy;
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij
(
const label i,
const label j
) const
{
scalar si = 0.0;
scalar sj = 0.0;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
si += p.nParticle()*pow(p.d(), i);
sj += p.nParticle()*pow(p.d(), j);
}
reduce(si, sumOp<scalar>());
reduce(sj, sumOp<scalar>());
sj = max(sj, VSMALL);
return si/sj;
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::Dmax() const
{
scalar d = -GREAT;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
d = max(d, p.d());
}
reduce(d, maxOp<scalar>());
return max(0.0, d);
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration
(
const scalar fraction
) const
{
if ((fraction < 0) || (fraction > 1))
{
FatalErrorIn
(
"inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration"
"("
"const scalar"
") const"
)
<< "fraction should be in the range 0 < fraction < 1"
<< exit(FatalError);
}
scalar distance = 0.0;
const label nParcel = this->size();
globalIndex globalParcels(nParcel);
const label nParcelSum = globalParcels.size();
if (nParcelSum == 0)
{
return distance;
}
// lists of parcels mass and distance from initial injection point
List<List<scalar> > procMass(Pstream::nProcs());
List<List<scalar> > procDist(Pstream::nProcs());
List<scalar>& mass = procMass[Pstream::myProcNo()];
List<scalar>& dist = procDist[Pstream::myProcNo()];
mass.setSize(nParcel);
dist.setSize(nParcel);
label i = 0;
scalar mSum = 0.0;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
scalar m = p.nParticle()*p.mass();
scalar d = mag(p.position() - p.position0());
mSum += m;
mass[i] = m;
dist[i] = d;
i++;
}
// calculate total mass across all processors
reduce(mSum, sumOp<scalar>());
Pstream::gatherList(procMass);
Pstream::gatherList(procDist);
if (Pstream::master())
{
// flatten the mass lists
List<scalar> allMass(nParcelSum, 0.0);
SortableList<scalar> allDist(nParcelSum, 0.0);
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{
SubList<scalar>
(
allMass,
globalParcels.localSize(procI),
globalParcels.offset(procI)
).assign(procMass[procI]);
// flatten the distance list
SubList<scalar>
(
allDist,
globalParcels.localSize(procI),
globalParcels.offset(procI)
).assign(procDist[procI]);
}
// sort allDist distances into ascending order
// note: allMass masses are left unsorted
allDist.sort();
if (nParcelSum > 1)
{
const scalar mLimit = fraction*mSum;
const labelList& indices = allDist.indices();
if (mLimit > (mSum - allMass[indices.last()]))
{
distance = allDist.last();
}
else
{
// assuming that 'fraction' is generally closer to 1 than 0,
// loop through in reverse distance order
const scalar mThreshold = (1.0 - fraction)*mSum;
scalar mCurrent = 0.0;
label i0 = 0;
forAllReverse(indices, i)
{
label indI = indices[i];
mCurrent += allMass[indI];
if (mCurrent > mThreshold)
{
i0 = i;
break;
}
}
if (i0 == indices.size() - 1)
{
distance = allDist.last();
}
else
{
// linearly interpolate to determine distance
scalar alpha = (mCurrent - mThreshold)/allMass[indices[i0]];
distance =
allDist[i0] + alpha*(allDist[i0+1] - allDist[i0]);
}
}
}
else
{
distance = allDist.first();
}
}
Pstream::scatter(distance);
return distance;
}
template<class CloudType>
inline Foam::cachedRandom& Foam::KinematicCloud<CloudType>::rndGen()
{
return rndGen_;
}
template<class CloudType>
inline Foam::List<Foam::DynamicList<typename CloudType::particleType*> >&
Foam::KinematicCloud<CloudType>::cellOccupancy()
{
if (cellOccupancyPtr_.empty())
{
buildCellOccupancy();
}
return cellOccupancyPtr_();
}
template<class CloudType>
inline const Foam::scalarField&
Foam::KinematicCloud<CloudType>::cellLengthScale() const
{
return cellLengthScale_;
}
template<class CloudType>
inline Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<CloudType>::UTrans()
{
return UTrans_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<CloudType>::UTrans() const
{
return UTrans_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::KinematicCloud<CloudType>::UCoeff()
{
return UCoeff_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::KinematicCloud<CloudType>::UCoeff() const
{
return UCoeff_();
}
template<class CloudType> //O added
inline Foam::volScalarField&
Foam::KinematicCloud<CloudType>::massDeposition()
{
return massDeposition_();
}
template<class CloudType> //O added
inline const Foam::volScalarField&
Foam::KinematicCloud<CloudType>::massDeposition() const
{
return massDeposition_();
}
template<class CloudType> //O added
inline Foam::volScalarField&
Foam::KinematicCloud<CloudType>::massCheckPatterns()
{
return massCheckPatterns_();
}
template<class CloudType> //O added
inline const Foam::volScalarField&
Foam::KinematicCloud<CloudType>::massCheckPatterns() const
{
return massCheckPatterns_();
}
template<class CloudType> //O added 01.09.20
inline Foam::volScalarField&
Foam::KinematicCloud<CloudType>::massDepRate()
{
return massDepRate_();
}
template<class CloudType> //O added 01.09.20
inline const Foam::volScalarField&
Foam::KinematicCloud<CloudType>::massDepRate() const
{
return massDepRate_();
}
template<class CloudType> //O added
inline Foam::volScalarField&
Foam::KinematicCloud<CloudType>::surfaceUfric()
{
return surfaceUfric_();
}
template<class CloudType> //O added
inline const Foam::volScalarField&
Foam::KinematicCloud<CloudType>::surfaceUfric() const
{
return surfaceUfric_();
}
template<class CloudType>
inline Foam::tmp<Foam::fvVectorMatrix>
Foam::KinematicCloud<CloudType>::SU(volVectorField& U) const
{
if (debug)
{
Info<< "UTrans min/max = " << min(UTrans()).value() << ", "
<< max(UTrans()).value() << nl
<< "UCoeff min/max = " << min(UCoeff()).value() << ", "
<< max(UCoeff()).value() << endl;
}
if (solution_.coupled())
{
if (solution_.semiImplicit("U"))
{
const DimensionedField<scalar, volMesh>
Vdt(mesh_.V()*this->db().time().deltaT());
return UTrans()/Vdt - fvm::Sp(UCoeff()/Vdt, U) + UCoeff()/Vdt*U;
}
else
{
tmp<fvVectorMatrix> tfvm(new fvVectorMatrix(U, dimForce));
fvVectorMatrix& fvm = tfvm();
fvm.source() = -UTrans()/(this->db().time().deltaT());
return tfvm;
}
}
return tmp<fvVectorMatrix>(new fvVectorMatrix(U, dimForce));
}
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::vDotSweep() const
{
tmp<volScalarField> tvDotSweep
(
new volScalarField
(
IOobject
(
this->name() + ":vDotSweep",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimless/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
volScalarField& vDotSweep = tvDotSweep();
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
const label cellI = p.cell();
vDotSweep[cellI] += p.nParticle()*p.areaP()*mag(p.U() - U_[cellI]);
}
vDotSweep.internalField() /= mesh_.V();
vDotSweep.correctBoundaryConditions();
return tvDotSweep;
}
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::theta() const
{
tmp<volScalarField> ttheta
(
new volScalarField
(
IOobject
(
this->name() + ":theta",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimless, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
volScalarField& theta = ttheta();
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
const label cellI = p.cell();
theta[cellI] += p.nParticle()*p.volume();
}
theta.internalField() /= mesh_.V();
theta.correctBoundaryConditions();
return ttheta;
}
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::alpha() const
{
tmp<volScalarField> talpha
(
new volScalarField
(
IOobject
(
this->name() + ":alpha",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimless, 0.0)
)
);
scalarField& alpha = talpha().internalField();
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
const label cellI = p.cell();
alpha[cellI] += p.nParticle()*p.mass();
}
alpha /= (mesh_.V()*rho_);
return talpha;
}
template<class CloudType>
inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::rhoEff() const
{
tmp<volScalarField> trhoEff
(
new volScalarField
(
IOobject
(
this->name() + ":rhoEff",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimDensity, 0.0)
)
);
scalarField& rhoEff = trhoEff().internalField();
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
const label cellI = p.cell();
rhoEff[cellI] += p.nParticle()*p.mass();
}
rhoEff /= mesh_.V();
return trhoEff;
}
// ************************************************************************* //

View File

@ -0,0 +1,232 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cloudSolution.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cloudSolution::cloudSolution
(
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
dict_(dict),
active_(dict.lookup("active")),
transient_(false),
calcFrequency_(1),
maxCo_(0.3),
iter_(1),
trackTime_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(true),
schemes_()
{
if (active_)
{
read();
}
}
Foam::cloudSolution::cloudSolution
(
const cloudSolution& cs
)
:
mesh_(cs.mesh_),
dict_(cs.dict_),
active_(cs.active_),
transient_(cs.transient_),
calcFrequency_(cs.calcFrequency_),
maxCo_(cs.maxCo_),
iter_(cs.iter_),
trackTime_(cs.trackTime_),
coupled_(cs.coupled_),
cellValueSourceCorrection_(cs.cellValueSourceCorrection_),
maxTrackTime_(cs.maxTrackTime_),
resetSourcesOnStartup_(cs.resetSourcesOnStartup_),
schemes_(cs.schemes_)
{}
Foam::cloudSolution::cloudSolution
(
const fvMesh& mesh
)
:
mesh_(mesh),
dict_(dictionary::null),
active_(false),
transient_(false),
calcFrequency_(0),
maxCo_(GREAT),
iter_(0),
trackTime_(0.0),
coupled_(false),
cellValueSourceCorrection_(false),
maxTrackTime_(0.0),
resetSourcesOnStartup_(false),
schemes_()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cloudSolution::~cloudSolution()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cloudSolution::read()
{
dict_.lookup("transient") >> transient_;
dict_.lookup("coupled") >> coupled_;
dict_.lookup("cellValueSourceCorrection") >> cellValueSourceCorrection_;
dict_.readIfPresent("maxCo", maxCo_);
if (steadyState())
{
dict_.lookup("calcFrequency") >> calcFrequency_;
dict_.lookup("maxTrackTime") >> maxTrackTime_;
if (coupled_)
{
dict_.subDict("sourceTerms").lookup("resetOnStartup")
>> resetSourcesOnStartup_;
}
}
if (coupled_)
{
const dictionary&
schemesDict(dict_.subDict("sourceTerms").subDict("schemes"));
wordList vars(schemesDict.toc());
schemes_.setSize(vars.size());
forAll(vars, i)
{
// read solution variable name
schemes_[i].first() = vars[i];
// set semi-implicit (1) explicit (0) flag
Istream& is = schemesDict.lookup(vars[i]);
const word scheme(is);
if (scheme == "semiImplicit")
{
schemes_[i].second().first() = true;
}
else if (scheme == "explicit")
{
schemes_[i].second().first() = false;
}
else
{
FatalErrorIn("void cloudSolution::read()")
<< "Invalid scheme " << scheme << ". Valid schemes are "
<< "explicit and semiImplicit" << exit(FatalError);
}
// read under-relaxation factor
is >> schemes_[i].second().second();
}
}
}
Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
{
forAll(schemes_, i)
{
if (fieldName == schemes_[i].first())
{
return schemes_[i].second().second();
}
}
FatalErrorIn("scalar cloudSolution::relaxCoeff(const word&) const")
<< "Field name " << fieldName << " not found in schemes"
<< abort(FatalError);
return 1.0;
}
bool Foam::cloudSolution::semiImplicit(const word& fieldName) const
{
forAll(schemes_, i)
{
if (fieldName == schemes_[i].first())
{
return schemes_[i].second().first();
}
}
FatalErrorIn("bool cloudSolution::semiImplicit(const word&) const")
<< "Field name " << fieldName << " not found in schemes"
<< abort(FatalError);
return false;
}
bool Foam::cloudSolution::solveThisStep() const
{
return
active_
&& (
mesh_.time().outputTime()
|| (mesh_.time().timeIndex() % calcFrequency_ == 0)
);
}
bool Foam::cloudSolution::canEvolve()
{
if (transient_)
{
trackTime_ = mesh_.time().deltaTValue();
}
else
{
trackTime_ = maxTrackTime_;
}
return solveThisStep();
}
bool Foam::cloudSolution::output() const
{
return active_ && mesh_.time().outputTime();
}
// ************************************************************************* //

View File

@ -0,0 +1,225 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::cloudSolution
Description
Stores all relevant solution info for cloud
SourceFiles
cloudSolutionI.H
cloudSolution.C
\*---------------------------------------------------------------------------*/
#ifndef cloudSolution_H
#define cloudSolution_H
#include "fvMesh.H"
#include "Switch.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cloudSolution Declaration
\*---------------------------------------------------------------------------*/
class cloudSolution
{
// Private Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Dictionary used during construction
dictionary dict_;
//- Cloud active flag
const Switch active_;
//- Transient flag
Switch transient_;
//- Calculation frequency - carrier steps per cloud step
// NOTE: Steady operation only
label calcFrequency_;
//- Maximum particle Courant number
// Max fraction of current cell that can be traversed in a single
// step
scalar maxCo_;
//- Current cloud iteration
label iter_;
//- Particle track time
scalar trackTime_;
// Run-time options
//- Flag to indicate whether parcels are coupled to the carrier
// phase, i.e. whether or not to generate source terms for
// carrier phase
Switch coupled_;
//- Flag to correct cell values with latest transfer information
// during the lagrangian timestep
Switch cellValueSourceCorrection_;
//- Maximum particle track time [s]
scalar maxTrackTime_;
//- Flag to indicate whether coupling source terms should be
// reset on start-up/first read
Switch resetSourcesOnStartup_;
//- List schemes, e.g. U semiImplicit 1
List<Tuple2<word, Tuple2<bool, scalar> > > schemes_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const cloudSolution&);
public:
// Constructors
//- Construct null from mesh reference
cloudSolution(const fvMesh& mesh);
//- Construct from mesh and dictionary
cloudSolution(const fvMesh& mesh, const dictionary& dict);
//- Construct copy
cloudSolution(const cloudSolution& cs);
//- Destructor
virtual ~cloudSolution();
// Member functions
//- Read properties from dictionary
void read();
// Access
//- Return relaxation coefficient for field
scalar relaxCoeff(const word& fieldName) const;
//- Return semi-implicit flag coefficient for field
bool semiImplicit(const word& fieldName) const;
//- Return reference to the mesh
inline const fvMesh& mesh() const;
//- Return const access to the dictionary
inline const dictionary& dict() const;
//- Return the active flag
inline const Switch active() const;
//- Return const access to the transient flag
inline const Switch transient() const;
//- Return const access to the steady flag
inline const Switch steadyState() const;
//- Return const access to the calculation frequency
inline label calcFrequency() const;
//- Return const access to the max particle Courant number
inline scalar maxCo() const;
//- Return const access to the current cloud iteration
inline label iter() const;
//- Increment and return iter counter
inline label nextIter();
//- Return the particle track time
inline scalar trackTime() const;
//- Return const access to the coupled flag
inline const Switch coupled() const;
//- Return non-const access to the coupled flag
inline Switch& coupled();
//- Return const access to the cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return const access to the particle track time
inline scalar maxTrackTime() const;
//- Return const access to the reset sources flag
inline const Switch resetSourcesOnStartup() const;
//- Source terms dictionary
inline const dictionary& sourceTermDict() const;
//- Interpolation schemes dictionary
inline const dictionary& interpolationSchemes() const;
//- Integration schemes dictionary
inline const dictionary& integrationSchemes() const;
// Helper functions
//- Returns true if performing a cloud iteration this calc step
bool solveThisStep() const;
//- Returns true if possible to evolve the cloud and sets timestep
// parameters
bool canEvolve();
//- Returns true if writing this step
bool output() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "cloudSolutionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
inline const Foam::fvMesh& Foam::cloudSolution::mesh() const
{
return mesh_;
}
inline const Foam::dictionary& Foam::cloudSolution::dict() const
{
return dict_;
}
inline const Foam::Switch Foam::cloudSolution::active() const
{
return active_;
}
inline const Foam::dictionary& Foam::cloudSolution::sourceTermDict() const
{
return dict_.subDict("sourceTerms");
}
inline const Foam::dictionary& Foam::cloudSolution::interpolationSchemes() const
{
return dict_.subDict("interpolationSchemes");
}
inline const Foam::dictionary& Foam::cloudSolution::integrationSchemes() const
{
return dict_.subDict("integrationSchemes");
}
inline const Foam::Switch Foam::cloudSolution::transient() const
{
return transient_;
}
inline const Foam::Switch Foam::cloudSolution::steadyState() const
{
return !transient_;
}
inline Foam::label Foam::cloudSolution::calcFrequency() const
{
return calcFrequency_;
}
inline Foam::scalar Foam::cloudSolution::maxCo() const
{
return maxCo_;
}
inline Foam::label Foam::cloudSolution::iter() const
{
return iter_;
}
inline Foam::label Foam::cloudSolution::nextIter()
{
return ++iter_;
}
inline Foam::scalar Foam::cloudSolution::trackTime() const
{
return trackTime_;
}
inline Foam::Switch& Foam::cloudSolution::coupled()
{
return coupled_;
}
inline const Foam::Switch Foam::cloudSolution::coupled() const
{
return coupled_;
}
inline const Foam::Switch Foam::cloudSolution::cellValueSourceCorrection() const
{
return cellValueSourceCorrection_;
}
inline Foam::scalar Foam::cloudSolution::maxTrackTime() const
{
return maxTrackTime_;
}
inline const Foam::Switch Foam::cloudSolution::resetSourcesOnStartup() const
{
return resetSourcesOnStartup_;
}
// ************************************************************************* //

View File

@ -0,0 +1,306 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "MPPICCloud.H"
#include "PackingModel.H"
#include "ParticleStressModel.H"
#include "DampingModel.H"
#include "IsotropyModel.H"
#include "TimeScaleModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::MPPICCloud<CloudType>::setModels()
{
packingModel_.reset
(
PackingModel<MPPICCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
dampingModel_.reset
(
DampingModel<MPPICCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
isotropyModel_.reset
(
IsotropyModel<MPPICCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::MPPICCloud<CloudType>::MPPICCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields
)
:
CloudType(cloudName, rho, U, mu, g, false),
packingModel_(NULL),
dampingModel_(NULL),
isotropyModel_(NULL)
{
if (this->solution().steadyState())
{
FatalErrorIn
(
"Foam::MPPICCloud<CloudType>::MPPICCloud"
"("
"const word&, "
"const volScalarField&, "
"const volVectorField&, "
"const volScalarField&, "
"const dimensionedVector&, "
"bool"
")"
) << "MPPIC modelling not available for steady state calculations"
<< exit(FatalError);
}
if (this->solution().active())
{
setModels();
if (readFields)
{
parcelType::readFields(*this);
}
}
}
template<class CloudType>
Foam::MPPICCloud<CloudType>::MPPICCloud
(
MPPICCloud<CloudType>& c,
const word& name
)
:
CloudType(c, name),
packingModel_(c.packingModel_->clone()),
dampingModel_(c.dampingModel_->clone()),
isotropyModel_(c.isotropyModel_->clone())
{}
template<class CloudType>
Foam::MPPICCloud<CloudType>::MPPICCloud
(
const fvMesh& mesh,
const word& name,
const MPPICCloud<CloudType>& c
)
:
CloudType(mesh, name, c),
packingModel_(NULL),
dampingModel_(NULL),
isotropyModel_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::MPPICCloud<CloudType>::~MPPICCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::MPPICCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<MPPICCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
);
}
template<class CloudType>
void Foam::MPPICCloud<CloudType>::restoreState()
{
this->cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class CloudType>
void Foam::MPPICCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<MPPICCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class CloudType>
template<class TrackData>
void Foam::MPPICCloud<CloudType>::motion(TrackData& td)
{
// Kinematic
// ~~~~~~~~~
// force calculation and tracking
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, this->db().time().deltaTValue());
// Preliminary
// ~~~~~~~~~~~
// switch forces off so they are not applied in corrector steps
this->forces().setCalcNonCoupled(false);
this->forces().setCalcCoupled(false);
// Damping
// ~~~~~~~
if (dampingModel_->active())
{
// update averages
td.updateAverages(*this);
// memory allocation and eulerian calculations
dampingModel_->cacheFields(true);
// calculate the damping velocity corrections without moving the parcels
td.part() = TrackData::tpDampingNoTrack;
CloudType::move(td, this->db().time().deltaTValue());
// correct the parcel positions and velocities
td.part() = TrackData::tpCorrectTrack;
CloudType::move(td, this->db().time().deltaTValue());
// finalise and free memory
dampingModel_->cacheFields(false);
}
// Packing
// ~~~~~~~
if (packingModel_->active())
{
// same procedure as for damping
td.updateAverages(*this);
packingModel_->cacheFields(true);
td.part() = TrackData::tpPackingNoTrack;
CloudType::move(td, this->db().time().deltaTValue());
td.part() = TrackData::tpCorrectTrack;
CloudType::move(td, this->db().time().deltaTValue());
packingModel_->cacheFields(false);
}
// Isotropy
// ~~~~~~~~
if (isotropyModel_->active())
{
// update averages
td.updateAverages(*this);
// apply isotropy model
isotropyModel_->calculate();
}
// Final
// ~~~~~
// update cell occupancy
this->updateCellOccupancy();
// switch forces back on
this->forces().setCalcNonCoupled(true);
this->forces().setCalcCoupled(this->solution().coupled());
}
template<class CloudType>
void Foam::MPPICCloud<CloudType>::info()
{
CloudType::info();
tmp<volScalarField> alpha = this->theta();
const scalar alphaMin = gMin(alpha().internalField());
const scalar alphaMax = gMax(alpha().internalField());
Info<< " Min cell volume fraction = " << alphaMin << endl;
Info<< " Max cell volume fraction = " << alphaMax << endl;
if (alphaMax < SMALL)
{
return;
}
scalar nMin = GREAT;
forAll(this->mesh().cells(), cellI)
{
const label n = this->cellOccupancy()[cellI].size();
const scalar nPack = n*alphaMax/alpha()[cellI];
if (n > 0 && nPack < nMin)
{
nMin = nPack;
}
}
reduce(nMin, minOp<scalar>());
Info<< " Min dense number of parcels = " << nMin << endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,249 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::MPPICCloud
Description
Adds MPPIC modelling to kinematic clouds
SourceFiles
MPPICCloudI.H
MPPICCloud.C
\*---------------------------------------------------------------------------*/
#ifndef MPPICCloud_H
#define MPPICCloud_H
#include "particle.H"
#include "Cloud.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class PackingModel;
template<class CloudType>
class DampingModel;
template<class CloudType>
class IsotropyModel;
/*---------------------------------------------------------------------------*\
Class MPPICCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class MPPICCloud
:
public CloudType
{
public:
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::parcelType parcelType;
//- Convenience typedef for this cloud type
typedef MPPICCloud<CloudType> MPPICCloudType;
private:
// Private data
//- Cloud copy pointer
autoPtr<MPPICCloud<CloudType> > cloudCopyPtr_;
// Private Member Functions
//- Disallow default bitwise copy construct
MPPICCloud(const MPPICCloud&);
//- Disallow default bitwise assignment
void operator=(const MPPICCloud&);
protected:
// Protected data
// References to the cloud sub-models
//- Packing model
autoPtr<PackingModel<MPPICCloud<CloudType> > > packingModel_;
//- Damping model
autoPtr<DampingModel<MPPICCloud<CloudType> > >
dampingModel_;
//- Exchange model
autoPtr<IsotropyModel<MPPICCloud<CloudType> > >
isotropyModel_;
// Initialisation
//- Set cloud sub-models
void setModels();
public:
// Constructors
//- Construct given carrier gas fields
MPPICCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields = true
);
//- Copy constructor with new name
MPPICCloud
(
MPPICCloud<CloudType>& c,
const word& name
);
//- Copy constructor with new name - creates bare cloud
MPPICCloud
(
const fvMesh& mesh,
const word& name,
const MPPICCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new MPPICCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new MPPICCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~MPPICCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const MPPICCloud& cloudCopy() const;
//- Return const access to the packing model
inline const PackingModel<MPPICCloud<CloudType> >&
packingModel() const;
//- Return a reference to the packing model
inline PackingModel<MPPICCloud<CloudType> >& packingModel();
//- Return condt access to the damping model
inline const DampingModel<MPPICCloud<CloudType> >&
dampingModel() const;
//- Return a reference to the damping model
inline DampingModel<MPPICCloud<CloudType> >& dampingModel();
//- Return condt access to the isotropy model
inline const IsotropyModel<MPPICCloud<CloudType> >&
isotropyModel() const;
//- Return a reference to the isotropy model
inline IsotropyModel<MPPICCloud<CloudType> >& isotropyModel();
// Cloud evolution functions
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Evolve the cloud
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
//- I-O
//- Print cloud information
void info();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "MPPICCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "MPPICCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::MPPICCloud<CloudType>&
Foam::MPPICCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline const Foam::PackingModel<Foam::MPPICCloud<CloudType> >&
Foam::MPPICCloud<CloudType>::packingModel() const
{
return packingModel_();
}
template<class CloudType>
inline Foam::PackingModel<Foam::MPPICCloud<CloudType> >&
Foam::MPPICCloud<CloudType>::packingModel()
{
return packingModel_();
}
template<class CloudType>
inline const Foam::DampingModel<Foam::MPPICCloud<CloudType> >&
Foam::MPPICCloud<CloudType>::dampingModel() const
{
return dampingModel_();
}
template<class CloudType>
inline Foam::DampingModel<Foam::MPPICCloud<CloudType> >&
Foam::MPPICCloud<CloudType>::dampingModel()
{
return dampingModel_();
}
template<class CloudType>
inline const Foam::IsotropyModel<Foam::MPPICCloud<CloudType> >&
Foam::MPPICCloud<CloudType>::isotropyModel() const
{
return isotropyModel_();
}
template<class CloudType>
inline Foam::IsotropyModel<Foam::MPPICCloud<CloudType> >&
Foam::MPPICCloud<CloudType>::isotropyModel()
{
return isotropyModel_();
}
// ************************************************************************* //

View File

@ -0,0 +1,371 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ReactingCloud.H"
#include "CompositionModel.H"
#include "PhaseChangeModel.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class CloudType>
void Foam::ReactingCloud<CloudType>::setModels()
{
compositionModel_.reset
(
CompositionModel<ReactingCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
phaseChangeModel_.reset
(
PhaseChangeModel<ReactingCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::checkSuppliedComposition
(
const scalarField& YSupplied,
const scalarField& Y,
const word& YName
)
{
if (YSupplied.size() != Y.size())
{
FatalErrorIn
(
"ReactingCloud<CloudType>::checkSuppliedComposition"
"("
"const scalarField&, "
"const scalarField&, "
"const word&"
")"
) << YName << " supplied, but size is not compatible with "
<< "parcel composition: " << nl << " "
<< YName << "(" << YSupplied.size() << ") vs required composition "
<< YName << "(" << Y.size() << ")" << nl
<< abort(FatalError);
}
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::cloudReset(ReactingCloud<CloudType>& c)
{
CloudType::cloudReset(c);
compositionModel_.reset(c.compositionModel_.ptr());
phaseChangeModel_.reset(c.phaseChangeModel_.ptr());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingCloud<CloudType>::ReactingCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& thermo,
bool readFields
)
:
CloudType(cloudName, rho, U, g, thermo, false),
reactingCloud(),
cloudCopyPtr_(NULL),
constProps_(this->particleProperties()),
compositionModel_(NULL),
phaseChangeModel_(NULL),
rhoTrans_(thermo.carrier().species().size())
{
if (this->solution().active())
{
setModels();
if (readFields)
{
parcelType::readFields(*this, this->composition());
}
}
// Set storage for mass source fields and initialise to zero
forAll(rhoTrans_, i)
{
const word& specieName = thermo.carrier().species()[i];
rhoTrans_.set
(
i,
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":rhoTrans_" + specieName,
this->db().time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass, 0.0)
)
);
}
if (this->solution().resetSourcesOnStartup())
{
resetSourceTerms();
}
}
template<class CloudType>
Foam::ReactingCloud<CloudType>::ReactingCloud
(
ReactingCloud<CloudType>& c,
const word& name
)
:
CloudType(c, name),
reactingCloud(),
cloudCopyPtr_(NULL),
constProps_(c.constProps_),
compositionModel_(c.compositionModel_->clone()),
phaseChangeModel_(c.phaseChangeModel_->clone()),
rhoTrans_(c.rhoTrans_.size())
{
forAll(c.rhoTrans_, i)
{
const word& specieName = this->thermo().carrier().species()[i];
rhoTrans_.set
(
i,
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":rhoTrans_" + specieName,
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
c.rhoTrans_[i]
)
);
}
}
template<class CloudType>
Foam::ReactingCloud<CloudType>::ReactingCloud
(
const fvMesh& mesh,
const word& name,
const ReactingCloud<CloudType>& c
)
:
CloudType(mesh, name, c),
reactingCloud(),
cloudCopyPtr_(NULL),
constProps_(),
compositionModel_(c.compositionModel_->clone()),
// compositionModel_(NULL),
phaseChangeModel_(NULL),
rhoTrans_(0)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingCloud<CloudType>::~ReactingCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ReactingCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
)
{
CloudType::setParcelThermoProperties(parcel, lagrangianDt);
parcel.pc() = this->thermo().thermo().p()[parcel.cell()];
parcel.Y() = composition().YMixture0();
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
if (fullyDescribed)
{
checkSuppliedComposition
(
parcel.Y(),
composition().YMixture0(),
"YMixture"
);
}
// derived information - store initial mass
parcel.mass0() = parcel.mass();
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<ReactingCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
);
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::resetSourceTerms()
{
CloudType::resetSourceTerms();
forAll(rhoTrans_, i)
{
rhoTrans_[i].field() = 0.0;
}
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::relaxSources
(
const ReactingCloud<CloudType>& cloudOldTime
)
{
CloudType::relaxSources(cloudOldTime);
typedef DimensionedField<scalar, volMesh> dsfType;
forAll(rhoTrans_, fieldI)
{
dsfType& rhoT = rhoTrans_[fieldI];
const dsfType& rhoT0 = cloudOldTime.rhoTrans()[fieldI];
this->relax(rhoT, rhoT0, "rho");
}
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::scaleSources()
{
CloudType::scaleSources();
typedef DimensionedField<scalar, volMesh> dsfType;
forAll(rhoTrans_, fieldI)
{
dsfType& rhoT = rhoTrans_[fieldI];
this->scale(rhoT, "rho");
}
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<ReactingCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
{
typedef typename particle::TrackingData<ReactingCloud<CloudType> > tdType;
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
this->updateMesh();
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::info()
{
CloudType::info();
this->phaseChange().info(Info);
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::writeFields() const
{
if (this->size())
{
CloudType::particleType::writeFields(*this, this->composition());
}
}
// ************************************************************************* //

View File

@ -0,0 +1,334 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::ReactingCloud
Description
Templated base class for reacting cloud
- Adds to thermodynamic cloud
- Variable composition (single phase)
- Phase change
SourceFiles
ReactingCloudI.H
ReactingCloud.C
\*---------------------------------------------------------------------------*/
#ifndef ReactingCloud_H
#define ReactingCloud_H
#include "reactingCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class CompositionModel;
template<class CloudType>
class PhaseChangeModel;
/*---------------------------------------------------------------------------*\
Class ReactingCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ReactingCloud
:
public CloudType,
public reactingCloud
{
public:
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef ReactingCloud<CloudType> reactingCloudType;
private:
// Private data
//- Cloud copy pointer
autoPtr<ReactingCloud<CloudType> > cloudCopyPtr_;
// Private member functions
//- Disallow default bitwise copy construct
ReactingCloud(const ReactingCloud&);
//- Disallow default bitwise assignment
void operator=(const ReactingCloud&);
protected:
// Protected data
//- Parcel constant properties
typename parcelType::constantProperties constProps_;
// References to the cloud sub-models
//- Reacting composition model
autoPtr<CompositionModel<ReactingCloud<CloudType> > >
compositionModel_;
//- Reacting phase change model
autoPtr<PhaseChangeModel<ReactingCloud<CloudType> > >
phaseChangeModel_;
// Sources
//- Mass transfer fields - one per carrier phase specie
PtrList<DimensionedField<scalar, volMesh> > rhoTrans_;
// Protected Member Functions
// New parcel helper functions
//- Check that size of a composition field is valid
void checkSuppliedComposition
(
const scalarField& YSupplied,
const scalarField& Y,
const word& YName
);
// Initialisation
//- Set cloud sub-models
void setModels();
// Cloud evolution functions
//- Reset state of cloud
void cloudReset(ReactingCloud<CloudType>& c);
public:
// Constructors
//- Construct given carrier gas fields
ReactingCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& thermo,
bool readFields = true
);
//- Copy constructor with new name
ReactingCloud(ReactingCloud<CloudType>& c, const word& name);
//- Copy constructor with new name - creates bare cloud
ReactingCloud
(
const fvMesh& mesh,
const word& name,
const ReactingCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new ReactingCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new ReactingCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~ReactingCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const ReactingCloud& cloudCopy() const;
//- Return the constant properties
inline const typename parcelType::constantProperties&
constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
// Sub-models
//- Return const access to reacting composition model
inline const CompositionModel<ReactingCloud<CloudType> >&
composition() const;
//- Return const access to reacting phase change model
inline const PhaseChangeModel<ReactingCloud<CloudType> >&
phaseChange() const;
//- Return reference to reacting phase change model
inline PhaseChangeModel<ReactingCloud<CloudType> >&
phaseChange();
// Sources
//- Mass
//- Return reference to mass source for field i
inline DimensionedField<scalar, volMesh>&
rhoTrans(const label i);
//- Return const access to mass source fields
inline const PtrList<DimensionedField<scalar, volMesh> >&
rhoTrans() const;
//- Return reference to mass source fields
inline PtrList<DimensionedField<scalar, volMesh> >&
rhoTrans();
//- Return mass source term for specie i - specie eqn
inline tmp<fvScalarMatrix> SYi
(
const label i,
volScalarField& Yi
) const;
//- Return tmp mass source for field i - fully explicit
inline tmp<DimensionedField<scalar, volMesh> >
Srho(const label i) const;
//- Return tmp total mass source for carrier phase
// - fully explicit
inline tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return total mass source term [kg/m3/s]
inline tmp<fvScalarMatrix> Srho(volScalarField& rho) const;
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
);
//- Check parcel properties
void checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Reset the cloud source terms
void resetSourceTerms();
//- Apply relaxation to (steady state) cloud sources
void relaxSources(const ReactingCloud<CloudType>& cloudOldTime);
//- Apply scaling to (transient) cloud sources
void scaleSources();
//- Evolve the cloud
void evolve();
// Mapping
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
// I-O
//- Print cloud information
void info();
//- Write the field data for the cloud
virtual void writeFields() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ReactingCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReactingCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,292 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::ReactingCloud<CloudType>&
Foam::ReactingCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::ReactingCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::ReactingCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType>
inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::composition() const
{
return compositionModel_;
}
template<class CloudType>
inline const Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::phaseChange() const
{
return phaseChangeModel_;
}
template<class CloudType>
inline Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::phaseChange()
{
return phaseChangeModel_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ReactingCloud<CloudType>::rhoTrans(const label i)
{
return rhoTrans_[i];
}
template<class CloudType>
inline
const Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ReactingCloud<CloudType>::rhoTrans() const
{
return rhoTrans_;
}
template<class CloudType>
inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ReactingCloud<CloudType>::rhoTrans()
{
return rhoTrans_;
}
template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
(
const label i,
volScalarField& Yi
) const
{
if (this->solution().coupled())
{
if (this->solution().semiImplicit("Yi"))
{
tmp<volScalarField> trhoTrans
(
new volScalarField
(
IOobject
(
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimTime/dimVolume, 0.0)
)
);
volScalarField& sourceField = trhoTrans();
sourceField.internalField() =
rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V());
const dimensionedScalar YiSMALL("YiSMALL", dimless, SMALL);
return
fvm::Sp(neg(sourceField)*sourceField/(Yi + YiSMALL), Yi)
+ pos(sourceField)*sourceField;
}
else
{
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(Yi, dimMass/dimTime));
fvScalarMatrix& fvm = tfvm();
fvm.source() = -rhoTrans_[i]/this->db().time().deltaTValue();
return tfvm;
}
}
return tmp<fvScalarMatrix>(new fvScalarMatrix(Yi, dimMass/dimTime));
}
template<class CloudType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ReactingCloud<CloudType>::Srho(const label i) const
{
tmp<DimensionedField<scalar, volMesh> > tRhoi
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
rhoTrans_[0].dimensions()/dimTime/dimVolume,
0.0
)
)
);
if (this->solution().coupled())
{
scalarField& rhoi = tRhoi();
rhoi = rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V());
}
return tRhoi;
}
template<class CloudType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ReactingCloud<CloudType>::Srho() const
{
tmp<DimensionedField<scalar, volMesh> > trhoTrans
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar
(
"zero",
rhoTrans_[0].dimensions()/dimTime/dimVolume,
0.0
)
)
);
if (this->solution().coupled())
{
scalarField& sourceField = trhoTrans();
forAll(rhoTrans_, i)
{
sourceField += rhoTrans_[i];
}
sourceField /= this->db().time().deltaTValue()*this->mesh().V();
}
return trhoTrans;
}
template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
{
if (this->solution().coupled())
{
tmp<volScalarField> trhoTrans
(
new volScalarField
(
IOobject
(
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimTime/dimVolume, 0.0)
)
);
scalarField& sourceField = trhoTrans();
if (this->solution().semiImplicit("rho"))
{
forAll(rhoTrans_, i)
{
sourceField += rhoTrans_[i];
}
sourceField /= this->db().time().deltaTValue()*this->mesh().V();
return fvm::SuSp(trhoTrans()/rho, rho);
}
else
{
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(rho, dimMass/dimTime));
fvScalarMatrix& fvm = tfvm();
forAll(rhoTrans_, i)
{
sourceField += rhoTrans_[i];
}
fvm.source() = -trhoTrans()/this->db().time().deltaT();
return tfvm;
}
}
return tmp<fvScalarMatrix>(new fvScalarMatrix(rho, dimMass/dimTime));
}
// ************************************************************************* //

View File

@ -0,0 +1,292 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ReactingMultiphaseCloud.H"
#include "DevolatilisationModel.H"
#include "SurfaceReactionModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::setModels()
{
devolatilisationModel_.reset
(
DevolatilisationModel<ReactingMultiphaseCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
surfaceReactionModel_.reset
(
SurfaceReactionModel<ReactingMultiphaseCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::cloudReset
(
ReactingMultiphaseCloud<CloudType>& c
)
{
CloudType::cloudReset(c);
devolatilisationModel_.reset(c.devolatilisationModel_.ptr());
surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr());
dMassDevolatilisation_ = c.dMassDevolatilisation_;
dMassSurfaceReaction_ = c.dMassSurfaceReaction_;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& thermo,
bool readFields
)
:
CloudType(cloudName, rho, U, g, thermo, false),
reactingMultiphaseCloud(),
cloudCopyPtr_(NULL),
constProps_(this->particleProperties()),
devolatilisationModel_(NULL),
surfaceReactionModel_(NULL),
dMassDevolatilisation_(0.0),
dMassSurfaceReaction_(0.0)
{
if (this->solution().active())
{
setModels();
if (readFields)
{
parcelType::readFields(*this, this->composition());
}
}
if (this->solution().resetSourcesOnStartup())
{
resetSourceTerms();
}
}
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
(
ReactingMultiphaseCloud<CloudType>& c,
const word& name
)
:
CloudType(c, name),
reactingMultiphaseCloud(),
cloudCopyPtr_(NULL),
constProps_(c.constProps_),
devolatilisationModel_(c.devolatilisationModel_->clone()),
surfaceReactionModel_(c.surfaceReactionModel_->clone()),
dMassDevolatilisation_(c.dMassDevolatilisation_),
dMassSurfaceReaction_(c.dMassSurfaceReaction_)
{}
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
(
const fvMesh& mesh,
const word& name,
const ReactingMultiphaseCloud<CloudType>& c
)
:
CloudType(mesh, name, c),
reactingMultiphaseCloud(),
cloudCopyPtr_(NULL),
constProps_(),
devolatilisationModel_(NULL),
surfaceReactionModel_(NULL),
dMassDevolatilisation_(0.0),
dMassSurfaceReaction_(0.0)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingMultiphaseCloud<CloudType>::~ReactingMultiphaseCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
)
{
CloudType::setParcelThermoProperties(parcel, lagrangianDt);
label idGas = this->composition().idGas();
label idLiquid = this->composition().idLiquid();
label idSolid = this->composition().idSolid();
parcel.YGas() = this->composition().Y0(idGas);
parcel.YLiquid() = this->composition().Y0(idLiquid);
parcel.YSolid() = this->composition().Y0(idSolid);
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
if (fullyDescribed)
{
label idGas = this->composition().idGas();
label idLiquid = this->composition().idLiquid();
label idSolid = this->composition().idSolid();
this->checkSuppliedComposition
(
parcel.YGas(),
this->composition().Y0(idGas),
"YGas"
);
this->checkSuppliedComposition
(
parcel.YLiquid(),
this->composition().Y0(idLiquid),
"YLiquid"
);
this->checkSuppliedComposition
(
parcel.YSolid(),
this->composition().Y0(idSolid),
"YSolid"
);
}
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<ReactingMultiphaseCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
);
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::resetSourceTerms()
{
CloudType::resetSourceTerms();
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<ReactingMultiphaseCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::autoMap
(
const mapPolyMesh& mapper
)
{
typedef typename particle::TrackingData<ReactingMultiphaseCloud<CloudType> >
tdType;
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
this->updateMesh();
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::info()
{
CloudType::info();
this->devolatilisation().info(Info);
this->surfaceReaction().info(Info);
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::writeFields() const
{
if (this->size())
{
CloudType::particleType::writeFields(*this, this->composition());
}
}
// ************************************************************************* //

View File

@ -0,0 +1,314 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::ReactingMultiphaseCloud
Description
Templated base class for multiphase reacting cloud
- Adds to reacting cloud
- multiphase composition
- devolatilisatsion
- surface reactions
SourceFiles
ReactingMultiphaseCloudI.H
ReactingMultiphaseCloud.C
\*---------------------------------------------------------------------------*/
#ifndef ReactingMultiphaseCloud_H
#define ReactingMultiphaseCloud_H
#include "reactingMultiphaseCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class DevolatilisationModel;
template<class CloudType>
class SurfaceReactionModel;
/*---------------------------------------------------------------------------*\
Class ReactingMultiphaseCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ReactingMultiphaseCloud
:
public CloudType,
public reactingMultiphaseCloud
{
public:
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef ReactingMultiphaseCloud<CloudType> reactingMultiphaseCloudType;
private:
// Private data
//- Cloud copy pointer
autoPtr<ReactingMultiphaseCloud<CloudType> > cloudCopyPtr_;
// Private member functions
//- Disallow default bitwise copy construct
ReactingMultiphaseCloud(const ReactingMultiphaseCloud&);
//- Disallow default bitwise assignment
void operator=(const ReactingMultiphaseCloud&);
protected:
// Protected data
//- Parcel constant properties
typename parcelType::constantProperties constProps_;
// References to the cloud sub-models
//- Devolatilisation model
autoPtr
<
DevolatilisationModel<ReactingMultiphaseCloud<CloudType> >
>
devolatilisationModel_;
//- Surface reaction model
autoPtr
<
SurfaceReactionModel<ReactingMultiphaseCloud<CloudType> >
>
surfaceReactionModel_;
// Check
//- Total mass transferred to continuous phase via devolatilisation
scalar dMassDevolatilisation_;
//- Total mass transferred to continuous phase via surface
// reactions
scalar dMassSurfaceReaction_;
// Protected Member Functions
// Initialisation
//- Set cloud sub-models
void setModels();
// Cloud evolution functions
//- Reset state of cloud
void cloudReset(ReactingMultiphaseCloud<CloudType>& c);
public:
// Constructors
//- Construct given carrier gas fields
ReactingMultiphaseCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& thermo,
bool readFields = true
);
//- Copy constructor with new name
ReactingMultiphaseCloud
(
ReactingMultiphaseCloud<CloudType>& c,
const word& name
);
//- Copy constructor with new name - creates bare cloud
ReactingMultiphaseCloud
(
const fvMesh& mesh,
const word& name,
const ReactingMultiphaseCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new ReactingMultiphaseCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new ReactingMultiphaseCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~ReactingMultiphaseCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const ReactingMultiphaseCloud& cloudCopy() const;
//- Return the constant properties
inline const typename parcelType::constantProperties&
constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
// Sub-models
//- Return const access to devolatilisation model
inline const DevolatilisationModel
<
ReactingMultiphaseCloud<CloudType>
>&
devolatilisation() const;
//- Return reference to devolatilisation model
inline DevolatilisationModel
<
ReactingMultiphaseCloud<CloudType>
>&
devolatilisation();
//- Return const access to reacting surface reaction model
inline const SurfaceReactionModel
<
ReactingMultiphaseCloud<CloudType>
>&
surfaceReaction() const;
//- Return reference to reacting surface reaction model
inline SurfaceReactionModel
<
ReactingMultiphaseCloud<CloudType>
>&
surfaceReaction();
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
);
//- Check parcel properties
void checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Reset the cloud source terms
void resetSourceTerms();
//- Evolve the cloud
void evolve();
// Mapping
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
// I-O
//- Print cloud information
void info();
//- Write the field data for the cloud
virtual void writeFields() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ReactingMultiphaseCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReactingMultiphaseCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,96 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::ReactingMultiphaseCloud<CloudType>&
Foam::ReactingMultiphaseCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::ReactingMultiphaseCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::ReactingMultiphaseCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType>
inline const Foam::DevolatilisationModel
<
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation() const
{
return devolatilisationModel_;
}
template<class CloudType>
inline Foam::DevolatilisationModel
<
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation()
{
return devolatilisationModel_();
}
template<class CloudType>
inline const Foam::SurfaceReactionModel
<
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction() const
{
return surfaceReactionModel_;
}
template<class CloudType>
inline Foam::SurfaceReactionModel
<
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction()
{
return surfaceReactionModel_();
}
// ************************************************************************* //

View File

@ -0,0 +1,505 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ThermoCloud.H"
#include "ThermoParcel.H"
#include "HeatTransferModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class CloudType>
void Foam::ThermoCloud<CloudType>::setModels()
{
heatTransferModel_.reset
(
HeatTransferModel<ThermoCloud<CloudType> >::New
(
this->subModelProperties(),
*this
).ptr()
);
TIntegrator_.reset
(
scalarIntegrationScheme::New
(
"T",
this->solution().integrationSchemes()
).ptr()
);
if (this->solution().coupled())
{
this->subModelProperties().lookup("radiation") >> radiation_;
}
if (radiation_)
{
radAreaP_.reset
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":radAreaP",
this->db().time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimArea, 0.0)
)
);
radT4_.reset
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":radT4",
this->db().time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar("zero", pow4(dimTemperature), 0.0)
)
);
radAreaPT4_.reset
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":radAreaPT4",
this->db().time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar
(
"zero",
sqr(dimLength)*pow4(dimTemperature),
0.0
)
)
);
}
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::cloudReset(ThermoCloud<CloudType>& c)
{
CloudType::cloudReset(c);
heatTransferModel_.reset(c.heatTransferModel_.ptr());
TIntegrator_.reset(c.TIntegrator_.ptr());
radiation_ = c.radiation_;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ThermoCloud<CloudType>::ThermoCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& thermo,
bool readFields
)
:
CloudType
(
cloudName,
rho,
U,
thermo.thermo().mu(),
g,
false
),
thermoCloud(),
cloudCopyPtr_(NULL),
constProps_(this->particleProperties()),
thermo_(thermo),
T_(thermo.thermo().T()),
p_(thermo.thermo().p()),
heatTransferModel_(NULL),
TIntegrator_(NULL),
radiation_(false),
radAreaP_(NULL),
radT4_(NULL),
radAreaPT4_(NULL),
hsTrans_
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":hsTrans",
this->db().time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimEnergy, 0.0)
)
),
hsCoeff_
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":hsCoeff",
this->db().time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimEnergy/dimTemperature, 0.0)
)
)
{
if (this->solution().active())
{
setModels();
if (readFields)
{
parcelType::readFields(*this);
}
}
if (this->solution().resetSourcesOnStartup())
{
resetSourceTerms();
}
}
template<class CloudType>
Foam::ThermoCloud<CloudType>::ThermoCloud
(
ThermoCloud<CloudType>& c,
const word& name
)
:
CloudType(c, name),
thermoCloud(),
cloudCopyPtr_(NULL),
constProps_(c.constProps_),
thermo_(c.thermo_),
T_(c.T()),
p_(c.p()),
heatTransferModel_(c.heatTransferModel_->clone()),
TIntegrator_(c.TIntegrator_->clone()),
radiation_(c.radiation_),
radAreaP_(NULL),
radT4_(NULL),
radAreaPT4_(NULL),
hsTrans_
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":hsTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
c.hsTrans()
)
),
hsCoeff_
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":hsCoeff",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
c.hsCoeff()
)
)
{
if (radiation_)
{
radAreaP_.reset
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":radAreaP",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
c.radAreaP()
)
);
radT4_.reset
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":radT4",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
c.radT4()
)
);
radAreaPT4_.reset
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
this->name() + ":radAreaPT4",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
c.radAreaPT4()
)
);
}
}
template<class CloudType>
Foam::ThermoCloud<CloudType>::ThermoCloud
(
const fvMesh& mesh,
const word& name,
const ThermoCloud<CloudType>& c
)
:
CloudType(mesh, name, c),
thermoCloud(),
cloudCopyPtr_(NULL),
constProps_(),
thermo_(c.thermo()),
T_(c.T()),
p_(c.p()),
heatTransferModel_(NULL),
TIntegrator_(NULL),
radiation_(false),
radAreaP_(NULL),
radT4_(NULL),
radAreaPT4_(NULL),
hsTrans_(NULL),
hsCoeff_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ThermoCloud<CloudType>::~ThermoCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ThermoCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
)
{
CloudType::setParcelThermoProperties(parcel, lagrangianDt);
parcel.T() = constProps_.T0();
parcel.Cp() = constProps_.Cp0();
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::storeState()
{
cloudCopyPtr_.reset
(
static_cast<ThermoCloud<CloudType>*>
(
clone(this->name() + "Copy").ptr()
)
);
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::restoreState()
{
cloudReset(cloudCopyPtr_());
cloudCopyPtr_.clear();
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::resetSourceTerms()
{
CloudType::resetSourceTerms();
hsTrans_->field() = 0.0;
hsCoeff_->field() = 0.0;
if (radiation_)
{
radAreaP_->field() = 0.0;
radT4_->field() = 0.0;
radAreaPT4_->field() = 0.0;
}
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::relaxSources
(
const ThermoCloud<CloudType>& cloudOldTime
)
{
CloudType::relaxSources(cloudOldTime);
this->relax(hsTrans_(), cloudOldTime.hsTrans(), "h");
this->relax(hsCoeff_(), cloudOldTime.hsCoeff(), "h");
if (radiation_)
{
this->relax(radAreaP_(), cloudOldTime.radAreaP(), "radiation");
this->relax(radT4_(), cloudOldTime.radT4(), "radiation");
this->relax(radAreaPT4_(), cloudOldTime.radAreaPT4(), "radiation");
}
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::scaleSources()
{
CloudType::scaleSources();
this->scale(hsTrans_(), "h");
this->scale(hsCoeff_(), "h");
if (radiation_)
{
this->scale(radAreaP_(), "radiation");
this->scale(radT4_(), "radiation");
this->scale(radAreaPT4_(), "radiation");
}
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::preEvolve()
{
CloudType::preEvolve();
this->pAmbient() = thermo_.thermo().p().average().value();
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<ThermoCloud<CloudType> > td(*this);
this->solve(td);
}
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
{
typedef typename particle::TrackingData<ThermoCloud<CloudType> > tdType;
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
this->updateMesh();
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::info()
{
CloudType::info();
Info<< " Temperature min/max = " << Tmin() << ", " << Tmax()
<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,394 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::ThermoCloud
Description
Templated base class for thermodynamic cloud
- Adds to kinematic cloud
- Heat transfer
SourceFiles
ThermoCloudI.H
ThermoCloud.C
\*---------------------------------------------------------------------------*/
#ifndef ThermoCloud_H
#define ThermoCloud_H
#include "KinematicCloud.H"
#include "thermoCloud.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class HeatTransferModel;
/*---------------------------------------------------------------------------*\
Class ThermoCloud Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ThermoCloud
:
public CloudType,
public thermoCloud
{
public:
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef ThermoCloud<CloudType> thermoCloudType;
private:
// Private data
//- Cloud copy pointer
autoPtr<ThermoCloud<CloudType> > cloudCopyPtr_;
// Private member functions
//- Disallow default bitwise copy construct
ThermoCloud(const ThermoCloud&);
//- Disallow default bitwise assignment
void operator=(const ThermoCloud&);
protected:
// Protected data
//- Thermo parcel constant properties
typename parcelType::constantProperties constProps_;
// References to the carrier gas fields
//- SLG thermodynamics package
const SLGThermo& thermo_;
//- Temperature [K]
const volScalarField& T_;
//- Pressure [Pa]
const volScalarField& p_;
// References to the cloud sub-models
//- Heat transfer model
autoPtr<HeatTransferModel<ThermoCloud<CloudType> > >
heatTransferModel_;
// Reference to the particle integration schemes
//- Temperature integration
autoPtr<scalarIntegrationScheme> TIntegrator_;
// Modelling options
//- Include radiation
Switch radiation_;
//- Radiation sum of parcel projected areas
autoPtr<DimensionedField<scalar, volMesh> > radAreaP_;
//- Radiation sum of parcel temperature^4
autoPtr<DimensionedField<scalar, volMesh> > radT4_;
//- Radiation sum of parcel projected areas * temperature^4
autoPtr<DimensionedField<scalar, volMesh> > radAreaPT4_;
// Sources
//- Sensible enthalpy transfer [J/kg]
autoPtr<DimensionedField<scalar, volMesh> > hsTrans_;
//- Coefficient for carrier phase hs equation [W/K]
autoPtr<DimensionedField<scalar, volMesh> > hsCoeff_;
// Protected Member Functions
// Initialisation
//- Set cloud sub-models
void setModels();
// Cloud evolution functions
//- Reset state of cloud
void cloudReset(ThermoCloud<CloudType>& c);
public:
// Constructors
//- Construct given carrier gas fields
ThermoCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& thermo,
bool readFields = true
);
//- Copy constructor with new name
ThermoCloud(ThermoCloud<CloudType>& c, const word& name);
//- Copy constructor with new name - creates bare cloud
ThermoCloud
(
const fvMesh& mesh,
const word& name,
const ThermoCloud<CloudType>& c
);
//- Construct and return clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > clone(const word& name)
{
return autoPtr<Cloud<parcelType> >
(
new ThermoCloud(*this, name)
);
}
//- Construct and return bare clone based on (this) with new name
virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
{
return autoPtr<Cloud<parcelType> >
(
new ThermoCloud(this->mesh(), name, *this)
);
}
//- Destructor
virtual ~ThermoCloud();
// Member Functions
// Access
//- Return a reference to the cloud copy
inline const ThermoCloud& cloudCopy() const;
//- Return the constant properties
inline const typename parcelType::constantProperties&
constProps() const;
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
//- Return const access to thermo package
inline const SLGThermo& thermo() const;
//- Return const access to the carrier temperature field
inline const volScalarField& T() const;
//- Return const access to the carrier prressure field
inline const volScalarField& p() const;
// Sub-models
//- Return reference to heat transfer model
inline const HeatTransferModel<ThermoCloud<CloudType> >&
heatTransfer() const;
// Integration schemes
//-Return reference to velocity integration
inline const scalarIntegrationScheme& TIntegrator() const;
// Modelling options
//- Radiation flag
inline bool radiation() const;
//- Radiation sum of parcel projected areas [m2]
inline DimensionedField<scalar, volMesh>& radAreaP();
//- Radiation sum of parcel projected areas [m2]
inline const DimensionedField<scalar, volMesh>&
radAreaP() const;
//- Radiation sum of parcel temperature^4 [K4]
inline DimensionedField<scalar, volMesh>& radT4();
//- Radiation sum of parcel temperature^4 [K4]
inline const DimensionedField<scalar, volMesh>& radT4() const;
//- Radiation sum of parcel projected area*temperature^4 [m2K4]
inline DimensionedField<scalar, volMesh>& radAreaPT4();
//- Radiation sum of parcel temperature^4 [m2K4]
inline const DimensionedField<scalar, volMesh>&
radAreaPT4() const;
// Sources
// Enthalpy
//- Sensible enthalpy transfer [J/kg]
inline DimensionedField<scalar, volMesh>& hsTrans();
//- Sensible enthalpy transfer [J/kg]
inline const DimensionedField<scalar, volMesh>&
hsTrans() const;
//- Return coefficient for carrier phase hs equation
inline DimensionedField<scalar, volMesh>& hsCoeff();
//- Return const coefficient for carrier phase hs equation
inline const DimensionedField<scalar, volMesh>&
hsCoeff() const;
//- Return sensible enthalpy source term [J/kg/m3/s]
inline tmp<fvScalarMatrix> Sh(volScalarField& hs) const;
// Radiation - overrides thermoCloud virtual abstract members
//- Return tmp equivalent particulate emission
inline tmp<volScalarField> Ep() const;
//- Return tmp equivalent particulate absorption
inline tmp<volScalarField> ap() const;
//- Return tmp equivalent particulate scattering factor
inline tmp<volScalarField> sigmap() const;
// Check
//- Maximum temperature
inline scalar Tmax() const;
//- Minimum temperature
inline scalar Tmin() const;
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt
);
//- Check parcel properties
void checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Store the current cloud state
void storeState();
//- Reset the current cloud to the previously stored state
void restoreState();
//- Reset the cloud source terms
void resetSourceTerms();
//- Apply relaxation to (steady state) cloud sources
void relaxSources(const ThermoCloud<CloudType>& cloudOldTime);
//- Apply scaling to (transient) cloud sources
void scaleSources();
//- Pre-evolve
void preEvolve();
//- Evolve the cloud
void evolve();
// Mapping
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
// I-O
//- Print cloud information
void info();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ThermoCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ThermoCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,442 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "physicoChemicalConstants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
inline const Foam::ThermoCloud<CloudType>&
Foam::ThermoCloud<CloudType>::cloudCopy() const
{
return cloudCopyPtr_();
}
template<class CloudType>
inline const typename CloudType::particleType::constantProperties&
Foam::ThermoCloud<CloudType>::constProps() const
{
return constProps_;
}
template<class CloudType>
inline typename CloudType::particleType::constantProperties&
Foam::ThermoCloud<CloudType>::constProps()
{
return constProps_;
}
template<class CloudType>
inline const Foam::SLGThermo& Foam::ThermoCloud<CloudType>::thermo() const
{
return thermo_;
}
template<class CloudType>
inline const Foam::volScalarField& Foam::ThermoCloud<CloudType>::T() const
{
return T_;
}
template<class CloudType>
inline const Foam::volScalarField& Foam::ThermoCloud<CloudType>::p() const
{
return p_;
}
template<class CloudType>
inline const Foam::HeatTransferModel<Foam::ThermoCloud<CloudType> >&
Foam::ThermoCloud<CloudType>::heatTransfer() const
{
return heatTransferModel_;
}
template<class CloudType>
inline const Foam::scalarIntegrationScheme&
Foam::ThermoCloud<CloudType>::TIntegrator() const
{
return TIntegrator_;
}
template<class CloudType>
inline bool Foam::ThermoCloud<CloudType>::radiation() const
{
return radiation_;
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::radAreaP()
{
if (!radiation_)
{
FatalErrorIn
(
"inline Foam::DimensionedField<Foam::scalar, Foam::volMesh> "
"Foam::ThermoCloud<CloudType>::radAreaP()"
) << "Radiation field requested, but radiation model not active"
<< abort(FatalError);
}
return radAreaP_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::radAreaP() const
{
if (!radiation_)
{
FatalErrorIn
(
"inline Foam::DimensionedField<Foam::scalar, Foam::volMesh> "
"Foam::ThermoCloud<CloudType>::radAreaP()"
) << "Radiation field requested, but radiation model not active"
<< abort(FatalError);
}
return radAreaP_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::radT4()
{
if (!radiation_)
{
FatalErrorIn
(
"inline Foam::DimensionedField<Foam::scalar, Foam::volMesh> "
"Foam::ThermoCloud<CloudType>::radT4()"
) << "Radiation field requested, but radiation model not active"
<< abort(FatalError);
}
return radT4_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::radT4() const
{
if (!radiation_)
{
FatalErrorIn
(
"inline Foam::DimensionedField<Foam::scalar, Foam::volMesh> "
"Foam::ThermoCloud<CloudType>::radT4()"
) << "Radiation field requested, but radiation model not active"
<< abort(FatalError);
}
return radT4_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::radAreaPT4()
{
if (!radiation_)
{
FatalErrorIn
(
"inline Foam::DimensionedField<Foam::scalar, Foam::volMesh> "
"Foam::ThermoCloud<CloudType>::radAreaPT4()"
) << "Radiation field requested, but radiation model not active"
<< abort(FatalError);
}
return radAreaPT4_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::radAreaPT4() const
{
if (!radiation_)
{
FatalErrorIn
(
"inline Foam::DimensionedField<Foam::scalar, Foam::volMesh> "
"Foam::ThermoCloud<CloudType>::radAreaPT4()"
) << "Radiation field requested, but radiation model not active"
<< abort(FatalError);
}
return radAreaPT4_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::hsTrans()
{
return hsTrans_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::hsTrans() const
{
return hsTrans_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::hsCoeff()
{
return hsCoeff_();
}
template<class CloudType>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ThermoCloud<CloudType>::hsCoeff() const
{
return hsCoeff_();
}
template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
{
if (debug)
{
Info<< "hsTrans min/max = " << min(hsTrans()).value() << ", "
<< max(hsTrans()).value() << nl
<< "hsCoeff min/max = " << min(hsCoeff()).value() << ", "
<< max(hsCoeff()).value() << endl;
}
if (this->solution().coupled())
{
if (this->solution().semiImplicit("h"))
{
const volScalarField Cp(thermo_.thermo().Cp());
const DimensionedField<scalar, volMesh>
Vdt(this->mesh().V()*this->db().time().deltaT());
return
hsTrans()/Vdt
- fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
+ hsCoeff()/(Cp*Vdt)*hs;
}
else
{
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(hs, dimEnergy/dimTime));
fvScalarMatrix& fvm = tfvm();
fvm.source() = -hsTrans()/(this->db().time().deltaT());
return tfvm;
}
}
return tmp<fvScalarMatrix>(new fvScalarMatrix(hs, dimEnergy/dimTime));
}
template<class CloudType>
inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
{
tmp<volScalarField> tEp
(
new volScalarField
(
IOobject
(
this->name() + ":radiation:Ep",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimLength/pow3(dimTime), 0.0)
)
);
if (radiation_)
{
scalarField& Ep = tEp().internalField();
const scalar dt = this->db().time().deltaTValue();
const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0();
const scalarField& sumAreaPT4 = radAreaPT4_->field();
Ep = sumAreaPT4*epsilon*physicoChemical::sigma.value()/V/dt;
}
return tEp;
}
template<class CloudType>
inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const
{
tmp<volScalarField> tap
(
new volScalarField
(
IOobject
(
this->name() + ":radiation:ap",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimless/dimLength, 0.0)
)
);
if (radiation_)
{
scalarField& ap = tap().internalField();
const scalar dt = this->db().time().deltaTValue();
const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0();
const scalarField& sumAreaP = radAreaP_->field();
ap = sumAreaP*epsilon/V/dt;
}
return tap;
}
template<class CloudType>
inline Foam::tmp<Foam::volScalarField>
Foam::ThermoCloud<CloudType>::sigmap() const
{
tmp<volScalarField> tsigmap
(
new volScalarField
(
IOobject
(
this->name() + ":radiation:sigmap",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimless/dimLength, 0.0)
)
);
if (radiation_)
{
scalarField& sigmap = tsigmap().internalField();
const scalar dt = this->db().time().deltaTValue();
const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0();
const scalar f = constProps_.f0();
const scalarField& sumAreaP = radAreaP_->field();
sigmap *= sumAreaP*(1.0 - f)*(1.0 - epsilon)/V/dt;
}
return tsigmap;
}
template<class CloudType>
inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const
{
scalar T = -GREAT;
scalar n = 0;
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
T = max(T, p.T());
n++;
}
reduce(T, maxOp<scalar>());
reduce(n, sumOp<label>());
if (n > 0)
{
return T;
}
else
{
return 0.0;
}
}
template<class CloudType>
inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const
{
scalar T = GREAT;
scalar n = 0;
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
T = min(T, p.T());
n++;
}
reduce(T, minOp<scalar>());
reduce(n, sumOp<label>());
if (n > 0)
{
return T;
}
else
{
return 0.0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kinematicCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(kinematicCloud, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::kinematicCloud::kinematicCloud()
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::kinematicCloud::~kinematicCloud()
{}
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::kinematicCloud
Description
Virtual abstract base class for templated KinematicCloud
SourceFiles
kinematicCloud.H
\*---------------------------------------------------------------------------*/
#ifndef kinematicCloud_H
#define kinematicCloud_H
#include "typeInfo.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class kinematicCloud Declaration
\*---------------------------------------------------------------------------*/
class kinematicCloud
{
// Private Member Functions
//- Disallow default bitwise copy construct
kinematicCloud(const kinematicCloud&);
//- Disallow default bitwise assignment
void operator=(const kinematicCloud&);
public:
//- Runtime type information
TypeName("kinematicCloud");
// Constructors
//- Null constructor
kinematicCloud();
// Member functions
// Check
//- Number of parcels
virtual label nParcels() const = 0;
//- Total mass in system
virtual scalar massInSystem() const = 0;
//- Total linear momentum of the system
virtual vector linearMomentumOfSystem() const = 0;
//- Total linear kinetic energy in the system
virtual scalar linearKineticEnergyOfSystem() const = 0;
//- Total rotational kinetic energy in the system
// virtual scalar rotationalKineticEnergyOfSystem() const = 0;
//- Penetration for percentage of the current total mass
// virtual scalar penetration(const scalar& fraction) const = 0;
//- Mean diameter Dij
virtual scalar Dij(const label i, const label j) const = 0;
//- Max diameter
virtual scalar Dmax() const = 0;
// Fields
//- Volume swept rate of parcels per cell
virtual const tmp<volScalarField> vDotSweep() const = 0;
//- Return the particle volume fraction field
// Note: for particles belonging to this cloud only
virtual const tmp<volScalarField> theta() const = 0;
//- Return the particle mass fraction field
// Note: for particles belonging to this cloud only
virtual const tmp<volScalarField> alpha() const = 0;
//- Return the particle effective density field
// Note: for particles belonging to this cloud only
virtual const tmp<volScalarField> rhoEff() const = 0;
//- Destructor
virtual ~kinematicCloud();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "reactingCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(reactingCloud, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::reactingCloud::reactingCloud()
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::reactingCloud::~reactingCloud()
{}
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::reactingCloud
Description
Virtual abstract base class for templated ReactingCloud
SourceFiles
reactingCloud.C
\*---------------------------------------------------------------------------*/
#ifndef reactingCloud_H
#define reactingCloud_H
#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class reactingCloud Declaration
\*---------------------------------------------------------------------------*/
class reactingCloud
{
// Private Member Functions
//- Disallow default bitwise copy construct
reactingCloud(const reactingCloud&);
//- Disallow default bitwise assignment
void operator=(const reactingCloud&);
public:
//- Runtime type information
TypeName("reactingCloud");
// Constructors
//- Null constructor
reactingCloud();
//- Destructor
virtual ~reactingCloud();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "reactingMultiphaseCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(reactingMultiphaseCloud, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::reactingMultiphaseCloud::reactingMultiphaseCloud()
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::reactingMultiphaseCloud::~reactingMultiphaseCloud()
{}
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::reactingMultiphaseCloud
Description
Virtual abstract base class for templated reactingMultiphaseCloud
SourceFiles
reactingMultiphaseCloud.C
\*---------------------------------------------------------------------------*/
#ifndef reactingMultiphaseCloud_H
#define reactingMultiphaseCloud_H
#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class reactingMultiphaseCloud Declaration
\*---------------------------------------------------------------------------*/
class reactingMultiphaseCloud
{
// Private Member Functions
//- Disallow default bitwise copy construct
reactingMultiphaseCloud(const reactingMultiphaseCloud&);
//- Disallow default bitwise assignment
void operator=(const reactingMultiphaseCloud&);
public:
//- Runtime type information
TypeName("reactingMultiphaseCloud");
// Constructors
//- Null constructor
reactingMultiphaseCloud();
//- Destructor
virtual ~reactingMultiphaseCloud();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "thermoCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(thermoCloud, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermoCloud::thermoCloud()
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::thermoCloud::~thermoCloud()
{}
// ************************************************************************* //

View File

@ -0,0 +1,100 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::thermoCloud
Description
Virtual abstract base class for templated ThermoCloud
SourceFiles
thermoCloud.C
\*---------------------------------------------------------------------------*/
#ifndef thermoCloud_H
#define thermoCloud_H
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class thermoCloud Declaration
\*---------------------------------------------------------------------------*/
class thermoCloud
{
// Private Member Functions
//- Disallow default bitwise copy construct
thermoCloud(const thermoCloud&);
//- Disallow default bitwise assignment
void operator=(const thermoCloud&);
public:
//- Runtime type information
TypeName("thermoCloud");
// Constructors
//- Null constructor
thermoCloud();
//- Destructor
virtual ~thermoCloud();
// Member Functions
// Access
// Radiation
//- Return tmp equivalent particulate emission
virtual tmp<volScalarField> Ep() const = 0;
//- Return tmp equivalent particulate absorption
virtual tmp<volScalarField> ap() const = 0;
//- Return tmp equivalent particulate scattering factor
virtual tmp<volScalarField> sigmap() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicKinematicCloud
Description
Cloud class to introduce kinematic parcels
\*---------------------------------------------------------------------------*/
#ifndef basicKinematicCloud_H
#define basicKinematicCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "basicKinematicParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef KinematicCloud<Cloud<basicKinematicParcel> > basicKinematicCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicKinematicCollidingCloud
Description
Cloud class to introduce kinematic colliding parcels
\*---------------------------------------------------------------------------*/
#ifndef basicKinematicCollidingCloud_H
#define basicKinematicCollidingCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "CollidingCloud.H"
#include "basicKinematicCollidingParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef CollidingCloud
<
KinematicCloud
<
Cloud
<
basicKinematicCollidingParcel
>
>
> basicKinematicCollidingCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicKinematicMPPICCloud
Description
Cloud class to introduce kinematic MPPIC parcels
\*---------------------------------------------------------------------------*/
#ifndef basicKinematicMPPICCloud_H
#define basicKinematicMPPICCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "MPPICCloud.H"
#include "basicKinematicMPPICParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef MPPICCloud
<
KinematicCloud
<
Cloud
<
basicKinematicMPPICParcel
>
>
> basicKinematicMPPICCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicReactingCloud
Description
Cloud class to introduce reacting parcels
\*---------------------------------------------------------------------------*/
#ifndef basicReactingCloud_H
#define basicReactingCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "ThermoCloud.H"
#include "ReactingCloud.H"
#include "basicReactingParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef ReactingCloud
<
ThermoCloud
<
KinematicCloud
<
Cloud
<
basicReactingParcel
>
>
>
> basicReactingCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicReactingMultiphaseCloud
Description
Cloud class to introduce multi-phase reacting parcels
\*---------------------------------------------------------------------------*/
#ifndef basicReactingMultiphaseCloud_H
#define basicReactingMultiphaseCloud_H
#include "Cloud.H"
#include "KinematicCloud.H"
#include "ThermoCloud.H"
#include "ReactingCloud.H"
#include "ReactingMultiphaseCloud.H"
#include "basicReactingMultiphaseParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef ReactingMultiphaseCloud
<
ReactingCloud
<
ThermoCloud
<
KinematicCloud
<
Cloud
<
basicReactingMultiphaseParcel
>
>
>
>
> basicReactingMultiphaseCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicThermoCloud
Description
Cloud class to introduce thermodynamic parcels
\*---------------------------------------------------------------------------*/
#ifndef basicThermoCloud_H
#define basicThermoCloud_H
#include "ThermoCloud.H"
#include "basicThermoParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef ThermoCloud
<
KinematicCloud
<
Cloud
<
basicThermoParcel
>
>
> basicThermoCloud;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollidingParcel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const CollidingParcel<ParcelType>& p
)
:
ParcelType(p),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
collisionRecords_(p.collisionRecords_)
{}
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const CollidingParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p, mesh),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
torque_(p.torque_),
collisionRecords_(p.collisionRecords_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
bool Foam::CollidingParcel<ParcelType>::move
(
TrackData& td,
const scalar trackTime
)
{
typename TrackData::cloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this);
switch (td.part())
{
case TrackData::tpVelocityHalfStep:
{
// First and last leapfrog velocity adjust part, required
// before and after tracking and force calculation
p.U() += 0.5*trackTime*p.f()/p.mass();
p.angularMomentum() += 0.5*trackTime*p.torque();
td.keepParticle = true;
break;
}
case TrackData::tpLinearTrack:
{
ParcelType::move(td, trackTime);
break;
}
case TrackData::tpRotationalTrack:
{
notImplemented("TrackData::tpRotationalTrack");
break;
}
default:
{
FatalErrorIn
(
"CollidingParcel<ParcelType>::move(TrackData&, const scalar)"
) << td.part() << " is an invalid part of the tracking method."
<< abort(FatalError);
}
}
return td.keepParticle;
}
template<class ParcelType>
void Foam::CollidingParcel<ParcelType>::transformProperties(const tensor& T)
{
ParcelType::transformProperties(T);
f_ = transform(T, f_);
angularMomentum_ = transform(T, angularMomentum_);
torque_ = transform(T, torque_);
}
template<class ParcelType>
void Foam::CollidingParcel<ParcelType>::transformProperties
(
const vector& separation
)
{
ParcelType::transformProperties(separation);
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "CollidingParcelIO.C"
// ************************************************************************* //

View File

@ -0,0 +1,327 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CollidingParcel
Description
Wrapper around kinematic parcel types to add collision modelling
SourceFiles
CollidingParcelI.H
CollidingParcel.C
CollidingParcelIO.C
\*---------------------------------------------------------------------------*/
#ifndef CollidingParcel_H
#define CollidingParcel_H
#include "particle.H"
#include "CollisionRecordList.H"
#include "labelFieldIOField.H"
#include "vectorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef CollisionRecordList<vector, vector> collisionRecordList;
typedef vectorFieldCompactIOField pairDataFieldCompactIOField;
typedef vectorFieldCompactIOField wallDataFieldCompactIOField;
template<class ParcelType>
class CollidingParcel;
// Forward declaration of friend functions
template<class ParcelType>
Ostream& operator<<
(
Ostream&,
const CollidingParcel<ParcelType>&
);
/*---------------------------------------------------------------------------*\
Class CollidingParcel Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
class CollidingParcel
:
public ParcelType
{
public:
//- Class to hold thermo particle constant properties
class constantProperties
:
public ParcelType::constantProperties
{
// Private data
//- Young's modulus [N/m2]
demandDrivenEntry<scalar> youngsModulus_;
//- Poisson's ratio
demandDrivenEntry<scalar> poissonsRatio_;
public:
// Constructors
//- Null constructor
constantProperties();
//- Copy constructor
constantProperties(const constantProperties& cp);
//- Construct from dictionary
constantProperties(const dictionary& parentDict);
// Member functions
//- Return const access to Young's Modulus
inline scalar youngsModulus() const;
//- Return const access to Poisson's ratio
inline scalar poissonsRatio() const;
};
protected:
// Protected data
//- Force on particle due to collisions [N]
vector f_;
//- Angular momentum of Parcel in global reference frame [kg m2/s]
vector angularMomentum_;
//- Torque on particle due to collisions in global
// reference frame [Nm]
vector torque_;
//- Particle collision records
collisionRecordList collisionRecords_;
public:
// Static data members
//- Runtime type information
TypeName("CollidingParcel");
//- String representation of properties
AddToPropertyList
(
ParcelType,
" (fx fy fz)"
+ " (angularMomentumx angularMomentumy angularMomentumz)"
+ " (torquex torquey torquez)"
+ " collisionRecordsPairAccessed"
+ " collisionRecordsPairOrigProcOfOther"
+ " collisionRecordsPairOrigIdOfOther"
+ " (collisionRecordsPairData)"
+ " collisionRecordsWallAccessed"
+ " collisionRecordsWallPRel"
+ " (collisionRecordsWallData)"
);
// Constructors
//- Construct from owner, position, and cloud owner
// Other properties initialised as null
inline CollidingParcel
(
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
);
//- Construct from components
inline CollidingParcel
(
const polyMesh& mesh,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI,
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
const vector& torque0,
const typename ParcelType::constantProperties& constProps
);
//- Construct from Istream
CollidingParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct as a copy
CollidingParcel(const CollidingParcel& p);
//- Construct as a copy
CollidingParcel(const CollidingParcel& p, const polyMesh& mesh);
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone() const
{
return autoPtr<particle>(new CollidingParcel(*this));
}
//- Construct and return a (basic particle) clone
virtual autoPtr<particle> clone(const polyMesh& mesh) const
{
return autoPtr<particle>(new CollidingParcel(*this, mesh));
}
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<CollidingParcel<ParcelType> > operator()(Istream& is) const
{
return autoPtr<CollidingParcel<ParcelType> >
(
new CollidingParcel<ParcelType>(mesh_, is, true)
);
}
};
// Member Functions
// Access
//- Return const access to force
inline const vector& f() const;
//- Return const access to angular momentum
inline const vector& angularMomentum() const;
//- Return const access to torque
inline const vector& torque() const;
//- Return const access to the collision records
inline const collisionRecordList& collisionRecords() const;
//- Return access to force
inline vector& f();
//- Return access to angular momentum
inline vector& angularMomentum();
//- Return access to torque
inline vector& torque();
//- Return access to collision records
inline collisionRecordList& collisionRecords();
//- Particle angular velocity
inline vector omega() const;
// Tracking
//- Move the parcel
template<class TrackData>
bool move(TrackData& td, const scalar trackTime);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// I-O
//- Read
template<class CloudType>
static void readFields(CloudType& c);
//- Write
template<class CloudType>
static void writeFields(const CloudType& c);
// Ostream Operator
friend Ostream& operator<< <ParcelType>
(
Ostream&,
const CollidingParcel<ParcelType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollidingParcelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CollidingParcel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,206 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::constantProperties::
constantProperties()
:
ParcelType::constantProperties(),
youngsModulus_(this->dict_, 0.0),
poissonsRatio_(this->dict_, 0.0)
{}
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::constantProperties::constantProperties
(
const constantProperties& cp
)
:
ParcelType::constantProperties(cp),
youngsModulus_(cp.youngsModulus_),
poissonsRatio_(cp.poissonsRatio_)
{}
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::constantProperties::constantProperties
(
const dictionary& parentDict
)
:
ParcelType::constantProperties(parentDict),
youngsModulus_(this->dict_, "youngsModulus"),
poissonsRatio_(this->dict_, "poissonsRatio")
{}
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& owner,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI
)
:
ParcelType(owner, position, cellI, tetFaceI, tetPtI),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
collisionRecords_()
{}
template<class ParcelType>
inline Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& owner,
const vector& position,
const label cellI,
const label tetFaceI,
const label tetPtI,
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
const vector& torque0,
const typename ParcelType::constantProperties& constProps
)
:
ParcelType
(
owner,
position,
cellI,
tetFaceI,
tetPtI,
typeId,
nParticle0,
d0,
dTarget0,
torque0,
constProps
),
f_(f0),
angularMomentum_(angularMomentum0),
torque_(torque0),
collisionRecords_()
{}
// * * * * * * * * * constantProperties Member Functions * * * * * * * * * * //
template<class ParcelType>
inline Foam::scalar
Foam::CollidingParcel<ParcelType>::constantProperties::youngsModulus() const
{
return youngsModulus_.value();
}
template<class ParcelType>
inline Foam::scalar
Foam::CollidingParcel<ParcelType>::constantProperties::poissonsRatio() const
{
return poissonsRatio_.value();
}
// * * * * * * * * * * CollidingParcel Member Functions * * * * * * * * * * //
template<class ParcelType>
inline const Foam::vector& Foam::CollidingParcel<ParcelType>::f() const
{
return f_;
}
template<class ParcelType>
inline const Foam::vector&
Foam::CollidingParcel<ParcelType>::angularMomentum() const
{
return angularMomentum_;
}
template<class ParcelType>
inline const Foam::vector& Foam::CollidingParcel<ParcelType>::torque() const
{
return torque_;
}
template<class ParcelType>
inline const Foam::collisionRecordList&
Foam::CollidingParcel<ParcelType>::collisionRecords() const
{
return collisionRecords_;
}
template<class ParcelType>
inline Foam::vector& Foam::CollidingParcel<ParcelType>::f()
{
return f_;
}
template<class ParcelType>
inline Foam::vector& Foam::CollidingParcel<ParcelType>::angularMomentum()
{
return angularMomentum_;
}
template<class ParcelType>
inline Foam::vector& Foam::CollidingParcel<ParcelType>::torque()
{
return torque_;
}
template<class ParcelType>
inline Foam::collisionRecordList&
Foam::CollidingParcel<ParcelType>::collisionRecords()
{
return collisionRecords_;
}
template<class ParcelType>
inline Foam::vector Foam::CollidingParcel<ParcelType>::omega() const
{
return angularMomentum_/this->momentOfInertia();
}
// ************************************************************************* //

View File

@ -0,0 +1,316 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollidingParcel.H"
#include "IOstreams.H"
#include "IOField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParcelType>
Foam::string Foam::CollidingParcel<ParcelType>::propertyList_ =
Foam::CollidingParcel<ParcelType>::propertyList();
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
collisionRecords_()
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> f_;
is >> angularMomentum_;
is >> torque_;
}
else
{
is.read
(
reinterpret_cast<char*>(&f_),
+ sizeof(f_)
+ sizeof(angularMomentum_)
+ sizeof(torque_)
);
}
is >> collisionRecords_;
}
// Check state of Istream
is.check
(
"CollidingParcel<ParcelType>::Collisions"
"(const polyMesh&, Istream&, bool)"
);
}
template<class ParcelType>
template<class CloudType>
void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
{
if (!c.size())
{
return;
}
ParcelType::readFields(c);
IOField<vector> f(c.fieldIOobject("f", IOobject::MUST_READ));
c.checkFieldIOobject(c, f);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::MUST_READ)
);
c.checkFieldIOobject(c, angularMomentum);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::MUST_READ));
c.checkFieldIOobject(c, torque);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed);
labelFieldCompactIOField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
labelFieldCompactIOField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigIdOfOther",
IOobject::MUST_READ
)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
pairDataFieldCompactIOField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsPairData);
labelFieldCompactIOField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed);
vectorFieldCompactIOField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallPRel);
wallDataFieldCompactIOField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ)
);
c.checkFieldFieldIOobject(c, collisionRecordsWallData);
label i = 0;
forAllIter(typename CloudType, c, iter)
{
CollidingParcel<ParcelType>& p = iter();
p.f_ = f[i];
p.angularMomentum_ = angularMomentum[i];
p.torque_ = torque[i];
p.collisionRecords_ = collisionRecordList
(
collisionRecordsPairAccessed[i],
collisionRecordsPairOrigProcOfOther[i],
collisionRecordsPairOrigIdOfOther[i],
collisionRecordsPairData[i],
collisionRecordsWallAccessed[i],
collisionRecordsWallPRel[i],
collisionRecordsWallData[i]
);
i++;
}
}
template<class ParcelType>
template<class CloudType>
void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
{
ParcelType::writeFields(c);
label np = c.size();
IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::NO_READ),
np
);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::NO_READ), np);
labelFieldCompactIOField collisionRecordsPairAccessed
(
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::NO_READ),
np
);
labelFieldCompactIOField collisionRecordsPairOrigProcOfOther
(
c.fieldIOobject
(
"collisionRecordsPairOrigProcOfOther",
IOobject::NO_READ
),
np
);
labelFieldCompactIOField collisionRecordsPairOrigIdOfOther
(
c.fieldIOobject("collisionRecordsPairOrigIdOfOther", IOobject::NO_READ),
np
);
pairDataFieldCompactIOField collisionRecordsPairData
(
c.fieldIOobject("collisionRecordsPairData", IOobject::NO_READ),
np
);
labelFieldCompactIOField collisionRecordsWallAccessed
(
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::NO_READ),
np
);
vectorFieldCompactIOField collisionRecordsWallPRel
(
c.fieldIOobject("collisionRecordsWallPRel", IOobject::NO_READ),
np
);
wallDataFieldCompactIOField collisionRecordsWallData
(
c.fieldIOobject("collisionRecordsWallData", IOobject::NO_READ),
np
);
label i = 0;
forAllConstIter(typename CloudType, c, iter)
{
const CollidingParcel<ParcelType>& p = iter();
f[i] = p.f();
angularMomentum[i] = p.angularMomentum();
torque[i] = p.torque();
collisionRecordsPairAccessed[i] = p.collisionRecords().pairAccessed();
collisionRecordsPairOrigProcOfOther[i] =
p.collisionRecords().pairOrigProcOfOther();
collisionRecordsPairOrigIdOfOther[i] =
p.collisionRecords().pairOrigIdOfOther();
collisionRecordsPairData[i] = p.collisionRecords().pairData();
collisionRecordsWallAccessed[i] = p.collisionRecords().wallAccessed();
collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel();
collisionRecordsWallData[i] = p.collisionRecords().wallData();
i++;
}
f.write();
angularMomentum.write();
torque.write();
collisionRecordsPairAccessed.write();
collisionRecordsPairOrigProcOfOther.write();
collisionRecordsPairOrigIdOfOther.write();
collisionRecordsPairData.write();
collisionRecordsWallAccessed.write();
collisionRecordsWallPRel.write();
collisionRecordsWallData.write();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ParcelType>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const CollidingParcel<ParcelType>& p
)
{
if (os.format() == IOstream::ASCII)
{
os << static_cast<const ParcelType&>(p)
<< token::SPACE << p.f()
<< token::SPACE << p.angularMomentum()
<< token::SPACE << p.torque()
<< token::SPACE << p.collisionRecords();
}
else
{
os << static_cast<const ParcelType&>(p);
os.write
(
reinterpret_cast<const char*>(&p.f_),
+ sizeof(p.f())
+ sizeof(p.angularMomentum())
+ sizeof(p.torque())
);
os << p.collisionRecords();
}
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const CollidingParcel<ParcelType>&)"
);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,510 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CollisionRecordList.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class PairType, class WallType>
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList()
:
pairRecords_(),
wallRecords_()
{}
template<class PairType, class WallType>
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList(Istream& is)
:
pairRecords_(is),
wallRecords_(is)
{
// Check state of Istream
is.check
(
"Foam::CollisionRecordList<PairType, WallType>::"
"CollisionRecordList(Foam::Istream&)"
);
}
template<class PairType, class WallType>
Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList
(
const labelField& pairAccessed,
const labelField& pairOrigProcOfOther,
const labelField& pairOrigIdOfOther,
const Field<PairType>& pairData,
const labelField& wallAccessed,
const vectorField& wallPRel,
const Field<WallType>& wallData
)
:
pairRecords_(),
wallRecords_()
{
label nPair = pairAccessed.size();
if
(
pairOrigProcOfOther.size() != nPair
|| pairOrigIdOfOther.size() != nPair
|| pairData.size() != nPair
)
{
FatalErrorIn
(
"Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList"
"("
"const labelField& pairAccessed,"
"const labelField& pairOrigProcOfOther,"
"const labelField& pairOrigIdOfOther,"
"const Field<PairType>& pairData,"
"const labelField& wallAccessed,"
"const vectorField& wallPRel,"
"const Field<WallType>& wallData"
")"
)
<< "Pair field size mismatch." << nl
<< pairAccessed << nl
<< pairOrigProcOfOther << nl
<< pairOrigIdOfOther << nl
<< pairData << nl
<< abort(FatalError);
}
forAll(pairAccessed, i)
{
pairRecords_.append
(
PairCollisionRecord<PairType>
(
pairAccessed[i],
pairOrigProcOfOther[i],
pairOrigIdOfOther[i],
pairData[i]
)
);
}
label nWall = wallAccessed.size();
if (wallPRel.size() != nWall || wallData.size() != nWall)
{
FatalErrorIn
(
"Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList"
"("
"const labelField& pairAccessed,"
"const labelField& pairOrigProcOfOther,"
"const labelField& pairOrigIdOfOther,"
"const Field<PairType>& pairData,"
"const labelField& wallAccessed,"
"const vectorField& wallPRel,"
"const Field<WallType>& wallData"
")"
)
<< "Wall field size mismatch." << nl
<< wallAccessed << nl
<< wallPRel << nl
<< wallData << nl
<< abort(FatalError);
}
forAll(wallAccessed, i)
{
wallRecords_.append
(
WallCollisionRecord<WallType>
(
wallAccessed[i],
wallPRel[i],
wallData[i]
)
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
template<class PairType, class WallType>
Foam::CollisionRecordList<PairType, WallType>::~CollisionRecordList()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::pairAccessed() const
{
labelField f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].accessed();
}
return f;
}
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::pairOrigProcOfOther() const
{
labelField f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].origProcOfOther();
}
return f;
}
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::pairOrigIdOfOther() const
{
labelField f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].origIdOfOther();
}
return f;
}
template<class PairType, class WallType>
Foam::Field<PairType>
Foam::CollisionRecordList<PairType, WallType>::pairData() const
{
Field<PairType> f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].collisionData();
}
return f;
}
template<class PairType, class WallType>
Foam::labelField
Foam::CollisionRecordList<PairType, WallType>::wallAccessed() const
{
labelField f(wallRecords_.size());
forAll(wallRecords_, i)
{
f[i] = wallRecords_[i].accessed();
}
return f;
}
template<class PairType, class WallType>
Foam::vectorField
Foam::CollisionRecordList<PairType, WallType>::wallPRel() const
{
vectorField f(wallRecords_.size());
forAll(wallRecords_, i)
{
f[i] = wallRecords_[i].pRel();
}
return f;
}
template<class PairType, class WallType>
Foam::Field<WallType>
Foam::CollisionRecordList<PairType, WallType>::wallData() const
{
Field<WallType> f(wallRecords_.size());
forAll(wallRecords_, i)
{
f[i] = wallRecords_[i].collisionData();
}
return f;
}
template<class PairType, class WallType>
Foam::PairCollisionRecord<PairType>&
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
(
label origProcOfOther,
label origIdOfOther
)
{
// Returning the first record that matches the particle
// identifiers. Two records with the same identification is not
// supported.
forAll(pairRecords_, i)
{
PairCollisionRecord<PairType>& pCR = pairRecords_[i];
if (pCR.match(origProcOfOther, origIdOfOther))
{
pCR.setAccessed();
return pCR;
}
}
// Record not found, create a new one and return it as the last
// member of the list. Setting the status of the record to be accessed
// on construction.
pairRecords_.append
(
PairCollisionRecord<PairType>(true, origProcOfOther, origIdOfOther)
);
return pairRecords_.last();
}
template<class PairType, class WallType>
bool Foam::CollisionRecordList<PairType, WallType>::checkPairRecord
(
label origProcOfOther,
label origIdOfOther
)
{
forAll(pairRecords_, i)
{
PairCollisionRecord<PairType>& pCR = pairRecords_[i];
if (pCR.match(origProcOfOther, origIdOfOther))
{
return true;
}
}
return false;
}
template<class PairType, class WallType>
Foam::WallCollisionRecord<WallType>&
Foam::CollisionRecordList<PairType, WallType>::matchWallRecord
(
const vector& pRel,
scalar radius
)
{
// Returning the first record that matches the relative position.
// Two records with the same relative position is not supported.
forAll(wallRecords_, i)
{
WallCollisionRecord<WallType>& wCR = wallRecords_[i];
if (wCR.match(pRel, radius))
{
wCR.setAccessed();
return wCR;
}
}
// Record not found, create a new one and return it as the last
// member of the list. Setting the status of the record to be accessed
// on construction.
wallRecords_.append(WallCollisionRecord<WallType>(true, pRel));
return wallRecords_.last();
}
template<class PairType, class WallType>
bool Foam::CollisionRecordList<PairType, WallType>::checkWallRecord
(
const vector& pRel,
scalar radius
)
{
forAll(wallRecords_, i)
{
WallCollisionRecord<WallType>& wCR = wallRecords_[i];
if (wCR.match(pRel, radius))
{
return true;
}
}
return false;
}
template<class PairType, class WallType>
void Foam::CollisionRecordList<PairType, WallType>::update()
{
{
DynamicList<PairCollisionRecord<PairType> > updatedRecords;
forAll(pairRecords_, i)
{
if (pairRecords_[i].accessed())
{
pairRecords_[i].setUnaccessed();
updatedRecords.append(pairRecords_[i]);
}
}
pairRecords_ = updatedRecords;
}
{
DynamicList<WallCollisionRecord<WallType> > updatedRecords;
forAll(wallRecords_, i)
{
if (wallRecords_[i].accessed())
{
wallRecords_[i].setUnaccessed();
updatedRecords.append(wallRecords_[i]);
}
}
wallRecords_ = updatedRecords;
}
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class PairType, class WallType>
void Foam::CollisionRecordList<PairType, WallType>::operator=
(
const CollisionRecordList<PairType, WallType>& rhs
)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"Foam::CollisionRecordList<PairType, WallType>::operator="
"(const Foam::CollisionRecordList<PairType, WallType>&)"
)
<< "Attempted assignment to self"
<< abort(FatalError);
}
pairRecords_ = rhs.pairRecords_;
wallRecords_ = rhs.wallRecords_;
}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
template<class PairType, class WallType>
inline bool Foam::operator==
(
const CollisionRecordList<PairType, WallType>& a,
const CollisionRecordList<PairType, WallType>& b
)
{
return
(
a.pairRecords_ == b.pairRecords_
&& a.wallRecords_ == b.wallRecords_
);
}
template<class PairType, class WallType>
inline bool Foam::operator!=
(
const CollisionRecordList<PairType, WallType>& a,
const CollisionRecordList<PairType, WallType>& b
)
{
return !(a == b);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class PairType, class WallType>
Foam::Istream& Foam::operator>>
(
Istream& is,
CollisionRecordList<PairType, WallType>& cRL
)
{
is >> cRL.pairRecords_ >> cRL.wallRecords_;
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::CollisionRecordList<PairType, WallType>&)"
);
return is;
}
template<class PairType, class WallType>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const CollisionRecordList<PairType, WallType>& cRL
)
{
os << cRL.pairRecords_ << cRL.wallRecords_;
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
"const Foam::CollisionRecordList<PairType, WallType>&)"
);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,251 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CollisionRecordList
Description
SourceFiles
CollisionRecordListI.H
CollisionRecordList.C
CollisionRecordListIO.C
\*---------------------------------------------------------------------------*/
#ifndef CollisionRecordList_H
#define CollisionRecordList_H
#include "DynamicList.H"
#include "PairCollisionRecord.H"
#include "WallCollisionRecord.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class PairType, class WallType>
class CollisionRecordList;
template<class PairType, class WallType>
inline bool operator==
(
const CollisionRecordList<PairType, WallType>&,
const CollisionRecordList<PairType, WallType>&
);
template<class PairType, class WallType>
inline bool operator!=
(
const CollisionRecordList<PairType, WallType>&,
const CollisionRecordList<PairType, WallType>&
);
template<class PairType, class WallType>
Istream& operator>>(Istream&, CollisionRecordList<PairType, WallType>&);
template<class PairType, class WallType>
Ostream& operator<<(Ostream&, const CollisionRecordList<PairType, WallType>&);
/*---------------------------------------------------------------------------*\
Class CollisionRecordList Declaration
\*---------------------------------------------------------------------------*/
template<class PairType, class WallType>
class CollisionRecordList
{
// Private data
//- List of active pair collisions
DynamicList<PairCollisionRecord<PairType> > pairRecords_;
//- List of active wall collisions
DynamicList<WallCollisionRecord<WallType> > wallRecords_;
public:
// Constructors
//- Construct null
CollisionRecordList();
//- Construct from Istream
CollisionRecordList(Istream&);
//- Construct from component fields (for IO)
CollisionRecordList
(
const labelField& pairAccessed,
const labelField& pairOrigProcOfOther,
const labelField& pairOrigIdOfOther,
const Field<PairType>& pairData,
const labelField& wallAccessed,
const vectorField& wallPRel,
const Field<WallType>& wallData
);
//- Destructor
~CollisionRecordList();
// Member Functions
//- Return the active pair collisions
inline const DynamicList<PairCollisionRecord<PairType> >&
pairRecords() const;
//- Return the active wall collisions
inline const DynamicList<WallCollisionRecord<WallType> >&
wallRecords() const;
// Fields representing the data from each record, i.e if the
// records 0-N containing each data members {a, b, c, d...}
// are organised:
//
// a0 b0 c0 d0 ...
// a1 b1 c1 d1 ...
// a2 b2 c2 d2 ...
// ...
// aN bN cN dN ...
//
// Then these field return, for example, (c0, c1, c2,... cN)
//- Return field of pair accessed from each record, used for
// field IO
labelField pairAccessed() const;
//- Return field of pair origProcOfOther from each record,
// used for field IO
labelField pairOrigProcOfOther() const;
//- Return field of pair origIdOfOther from each record, used
// for field IO
labelField pairOrigIdOfOther() const;
//- Return field of pair data from each record, used for field IO
Field<PairType> pairData() const;
//- Return field of wall accessed from each record, used for field IO
labelField wallAccessed() const;
//- Return field of wall pRel from each record, used for field IO
vectorField wallPRel() const;
//- Return field of wall data from each record, used for field IO
Field<WallType> wallData() const;
//- Enquires if the proc and id pair of the other particle are
// present in the records. If so, return non-const access to
// the PairCollisionRecord (hence the data) and mark the
// PairCollisionRecord as accessed this step, if not, create
// the record and return access to it.
PairCollisionRecord<PairType>& matchPairRecord
(
label origProcOfOther,
label origIdOfOther
);
//- Enquire if the specified record exists without modifying
// its accessed status
bool checkPairRecord(label origProcOfOther, label origIdOfOther);
//- Enquires if the position of wall impact relative to the
// particle centre is present in the records. If so, return
// access to the WallCollisionRecord (hence the data) and
// mark the WallCollisionRecord as accesses this step, if
// not, create the record and return access to it.
WallCollisionRecord<WallType>& matchWallRecord
(
const vector& pRel,
scalar radius
);
//- Enquire if the specified record exists without modifying
// its accessed status
bool checkWallRecord(const vector& pRel, scalar radius);
//- Update the collision records, deleting any records not
// marked as having been accessed, then mark all records as
// not accessed ready for the next evaluation
void update();
// Member Operators
void operator=(const CollisionRecordList&);
// Friend Operators
friend bool operator== <PairType, WallType>
(
const CollisionRecordList<PairType, WallType>&,
const CollisionRecordList<PairType, WallType>&
);
friend bool operator!= <PairType, WallType>
(
const CollisionRecordList<PairType, WallType>&,
const CollisionRecordList<PairType, WallType>&
);
// IOstream Operators
friend Istream& operator>> <PairType, WallType>
(
Istream&,
CollisionRecordList<PairType, WallType>&
);
friend Ostream& operator<< <PairType, WallType>
(
Ostream&,
const CollisionRecordList<PairType, WallType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollisionRecordListI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CollisionRecordList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More