[asl] 69/177: Adding comments
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Aug 27 09:22:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository asl.
commit aee263c932f1bfbe3548d3114b94d041400c7091
Author: Avtech Scientific <AvtechScientific at users.noreply.github.com>
Date: Mon Jul 6 13:24:44 2015 +0300
Adding comments
---
README.md | 7 ++--
examples/flow/locomotive_in_tunnel.cc | 62 ++++++++++++++++++++++++++---------
src/doxygenDefinitions.h | 2 +-
3 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
index 8db8b4e..ab536d2 100644
--- a/README.md
+++ b/README.md
@@ -32,9 +32,10 @@ ASL is distributed under the free GNU Affero General Public License (AGPLv3) wit
### Writing your own code using ASL
-1. Take a look on examples, e.g. `examples/flow/locomotive_in_tunnel.cc`
-2. To build your program using `cmake` see e.g. `examples/flow/CMakeLists.txt`
-3. To build your program with tools others than `cmake` run `make VERBOSE=1` and/or consult `CMakeCache.txt` to get better understanding of the compiler flags, library paths and dependencies involved. The output of `make install` shows the location of installed public include headers and libraries (by default: `/usr/local/include/asl-X.Y.Z` and `/usr/local/lib`).
+1. Take a look on examples, e.g. [examples/flow/locomotive_in_tunnel.cc](http://asl.org.il/doc/Developer-Guide/locomotive_in_tunnel_8cc-example.html)
+2. ASL installation supplies `ASLConfig.cmake` and `ASL.pc` files. To build your program using
+ - `cmake`: `examples/flow/CMakeLists.txt`
+ - `pkg-config`: `c++ ``pkg-config --cflags --libs ASL`` -o flow flow.cc`
## Further information
diff --git a/examples/flow/locomotive_in_tunnel.cc b/examples/flow/locomotive_in_tunnel.cc
index 7f35017..2588f84 100644
--- a/examples/flow/locomotive_in_tunnel.cc
+++ b/examples/flow/locomotive_in_tunnel.cc
@@ -49,66 +49,96 @@ using asl::makeAVec;
asl::SPDistanceFunction generateTunnel(asl::Block & bl)
{
+ // Set length of the tunnel to the length (X size) of the block
double l(bl.getBPosition()[0] - bl.position[0] + bl.dx);
+ // Set radius of the tunnel to the ca. half of the block's height (Z size)
double rTunnel((bl.getBPosition()[2] - bl.position[2]) / 2.1);
- double dx(bl.dx);
-
- asl::AVec<int> size(bl.getSize());
-
- asl::AVec<> center(.5 * (bl.getBPosition() + bl.position));
+ // Center of the tunnel (described as cylinder cutted by a plane)
+ asl::AVec<> center(.5 * (bl.getBPosition() + bl.position));
center[1] = bl.position[1] + .25 * rTunnel;
+
+ // Center of the ground plane (that cuts the cylinder)
asl::AVec<> centerG(center);
centerG[1] = bl.position[1];
+ /* DF = DistanceFunction (part of the geometrical module of ASL)
+ 1. Genarate cylinder
+ 2. Generate ground plane
+ 3. Conjunction of the cylinder and the plane ('&' - operator)
+ 4. Space inversion ('-' - operator) */
auto tunnel(-(generateDFCylinder(rTunnel, makeAVec(l, 0., 0.), center) &
generateDFPlane(makeAVec(0., -1., 0.), centerG)));
- return normalize(tunnel, dx);
+ // Normalize DistanceFunction to the range [-1; 1]
+ return normalize(tunnel, bl.dx);
}
int main(int argc, char* argv[])
{
/* Convenience facility to manage simulation parameters (and also
- hardware parameters - platform/device to run the application on)
- through command line and/or parameters file.
- See `locomotive_in_tunnel -h` for more information */
+ hardware parameters defining platform and device for computations)
+ through command line and/or parameters file.
+ See `locomotive_in_tunnel -h` for more information */
asl::ApplicationParametersManager appParamsManager("locomotive_in_tunnel",
"1.0");
/* Important: declare Parameters only after declaring
- ApplicationParametersManager instance because each Parameter adds itself
- to it automatically */
+ ApplicationParametersManager instance because each Parameter adds itself
+ to it automatically!
+ 0.08 - default value; will be used if nothing else is provided during
+ runtime through command line or parameters file.
+ "dx" - option key; is used to specify this parameter through command line
+ and/or parameters file, like `locomotive_in_tunnel --dx 0.05`
+ "space step" - option description; is used in the help output:
+ `locomotive_in_tunnel -h` and as comment on parameters file generation:
+ `locomotive_in_tunnel -g ./defaultParameters.ini`
+ "m" - parameter units; is used as part of the option description mentioned
+ above. Might be used for automatic unit conversion in future (to this end
+ it is recommended to use the notation of the Boost::Units library). */
asl::Parameter<FlT> dx(0.08, "dx", "space step", "m");
asl::Parameter<FlT> dt(1., "dt", "time step", "s");
- asl::Parameter<FlT> nu(.001, "nu", "viscosity", "Pa*s");
+ asl::Parameter<FlT> nu(.001, "nu", "kinematic viscosity", "m^2 s^-1");
/* Load previously declared Parameters from command line and/or
parameters file. Use default values if neither is provided. */
appParamsManager.load(argc, argv);
+ /* Set the size of the block to 40x10x15 m (in accordance with the
+ locomotive size read later on from the input file) */
AVec<int> size(makeAVec(40., 10., 15.) * (1. / dx.v()));
+
+ /* Create block and shift it in accordance with the
+ position of the locomotive in the input file */
asl::Block bl(size, dx.v(), makeAVec(-30., 8.58, 1.53));
-
- asl::UValue<FlT> nuNum(nu.v() * dt.v() / dx.v() / dx.v());
+
+ // Define dimensionless viscosity value
+ FlT nuNum(nu.v() * dt.v() / dx.v() / dx.v());
std::cout << "Data initialization... ";
+ // Read geometry of the locomotive from the file
auto locomotive(asl::readSurface("locomotive.stl", bl));
-
+
+ // Create block for further use
asl::Block block(locomotive->getInternalBlock());
+ // Generate memory data container for the tunnel
auto tunnelMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+ // Place generated geometry of the tunnel into the tunnel data container
asl::initData(tunnelMap, generateTunnel(block));
+ // Data container for air friction field
auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
+ // Initialization
asl::initData(forceField, makeAVec(0., 0., 0.));
std::cout << "Finished" << endl;
std::cout << "Numerics initialization... ";
+ // Generate numerical method for air flow - LBGK (lattice Bhatnagar–Gross–Krook)
asl::SPLBGK lbgk(new asl::LBGKTurbulence(block,
acl::generateVEConstant(FlT(nu.v())),
&asl::d3q15()));
@@ -182,4 +212,4 @@ int main(int argc, char* argv[])
std::cout << "Ok" << endl;
return 0;
-}
\ No newline at end of file
+}
diff --git a/src/doxygenDefinitions.h b/src/doxygenDefinitions.h
index c67e605..3f4c3ec 100644
--- a/src/doxygenDefinitions.h
+++ b/src/doxygenDefinitions.h
@@ -183,7 +183,7 @@
/// \ingroup Numerics
-/// \defgroup Geom Geometric Objects and manipulations
+/// \defgroup Geom Geometric primitives and their manipulations
/// \defgroup LDI Library Design Issues
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git
More information about the debian-science-commits
mailing list