Commit Graph

46 Commits

Author SHA1 Message Date
Mark Olesen
dcdc9e68f8 STYLE: improved layout and bool vs Switch for some CloudFunctionObjects
- add output verbosity in debug mode
2019-02-22 09:29:08 +01:00
Mark Olesen
181c974b11 ENH: improved sample surfaces and surface writers (#1206)
- The writers have changed from being a generic state-less set of
  routines to more properly conforming to the normal notion of a writer.
  These changes allow us to combine output fields (eg, in a single
  VTK/vtp file for each timestep).

  Parallel data reduction and any associated bookkeeping is now part
  of the surface writers.
  This improves their re-usability and avoids unnecessary
  and premature data reduction at the sampling stage.

  It is now possible to have different output formats on a per-surface
  basis.

- A new feature of the surface sampling is the ability to "store" the
  sampled surfaces and fields onto a registry for reuse by other
  function objects.

  Additionally, the "store" can be triggered at the execution phase
  as well
2019-02-07 18:11:34 +01:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Andrew Heather
e145034a6d STYLE: Code clean-up 2018-12-17 12:02:55 +00:00
Mark Olesen
8eddcc072a ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)
- use the dictionary 'get' methods instead of readScalar for
  additional checking

     Unchecked:  readScalar(dict.lookup("key"));
     Checked:    dict.get<scalar>("key");

- In templated classes that also inherit from a dictionary, an additional
  'template' keyword will be required. Eg,

     this->coeffsDict().template get<scalar>("key");

  For this common use case, the predefined getXXX shortcuts may be
  useful. Eg,

     this->coeffsDict().getScalar("key");
2018-10-12 08:14:47 +02:00
Mark Olesen
6697bb4735 ENH: improve, simplify, rationalize coordinate system handling (issue #863)
Previously the coordinate system functionality was split between
coordinateSystem and coordinateRotation. The coordinateRotation stored
the rotation tensor and handled all tensor transformations.

The functionality has now been revised and consolidated into the
coordinateSystem classes. The sole purpose of coordinateRotation
is now just to provide a selectable mechanism of how to define the
rotation tensor (eg, axis-angle, euler angles, local axes) for user
input, but after providing the appropriate rotation tensor it has
no further influence on the transformations.

--

The coordinateSystem class now contains an origin and a base rotation
tensor directly and various transformation methods.

  - The origin represents the "shift" for a local coordinate system.

  - The base rotation tensor represents the "tilt" or orientation
    of the local coordinate system in general (eg, for mapping
    positions), but may require position-dependent tensors when
    transforming vectors and tensors.

For some coordinate systems (currently the cylindrical coordinate system),
the rotation tensor required for rotating a vector or tensor is
position-dependent.

The new coordinateSystem and its derivates (cartesian, cylindrical,
indirect) now provide a uniform() method to define if the rotation
tensor is position dependent/independent.

The coordinateSystem transform and invTransform methods are now
available in two-parameter forms for obtaining position-dependent
rotation tensors. Eg,

      ... = cs.transform(globalPt, someVector);

In some cases it can be useful to use query uniform() to avoid
storage of redundant values.

      if (cs.uniform())
      {
          vector xx = cs.transform(someVector);
      }
      else
      {
          List<vector> xx = cs.transform(manyPoints, someVector);
      }

Support transform/invTransform for common data types:
   (scalar, vector, sphericalTensor, symmTensor, tensor).

====================
  Breaking Changes
====================

- These changes to coordinate systems and rotations may represent
  a breaking change for existing user coding.

- Relocating the rotation tensor into coordinateSystem itself means
  that the coordinate system 'R()' method now returns the rotation
  directly instead of the coordinateRotation. The method name 'R()'
  was chosen for consistency with other low-level entities (eg,
  quaternion).

  The following changes will be needed in coding:

      Old:  tensor rot = cs.R().R();
      New:  tensor rot = cs.R();

      Old:  cs.R().transform(...);
      New:  cs.transform(...);

  Accessing the runTime selectable coordinateRotation
  has moved to the rotation() method:

      Old:  Info<< "Rotation input: " << cs.R() << nl;
      New:  Info<< "Rotation input: " << cs.rotation() << nl;

- Naming consistency changes may also cause code to break.

      Old:  transformVector()
      New:  transformPrincipal()

  The old method name transformTensor() now simply becomes transform().

====================
  New methods
====================

For operations requiring caching of the coordinate rotations, the
'R()' method can be used with multiple input points:

       tensorField rots(cs.R(somePoints));

   and later

       Foam::transformList(rots, someVectors);

The rotation() method can also be used to change the rotation tensor
via a new coordinateRotation definition (issue #879).

The new methods transformPoint/invTransformPoint provide
transformations with an origin offset using Cartesian for both local
and global points. These can be used to determine the local position
based on the origin/rotation without interpreting it as a r-theta-z
value, for example.

================
  Input format
================

- Streamline dictionary input requirements

  * The default type is cartesian.
  * The default rotation type is the commonly used axes rotation
    specification (with e1/e2/3), which is assumed if the 'rotation'
    sub-dictionary does not exist.

    Example,

    Compact specification:

        coordinateSystem
        {
            origin  (0 0 0);
            e2      (0 1 0);
            e3      (0.5 0 0.866025);
        }

    Full specification (also accepts the longer 'coordinateRotation'
    sub-dictionary name):

        coordinateSystem
        {
            type    cartesian;
            origin  (0 0 0);

            rotation
            {
                type    axes;
                e2      (0 1 0);
                e3      (0.5 0 0.866025);
            }
        }

   This simplifies the input for many cases.

- Additional rotation specification 'none' (an identity rotation):

      coordinateSystem
      {
          origin  (0 0 0);
          rotation { type none; }
      }

- Additional rotation specification 'axisAngle', which is similar
  to the -rotate-angle option for transforming points (issue #660).
  For some cases this can be more intuitive.

  For example,

      rotation
      {
          type    axisAngle;
          axis    (0 1 0);
          angle   30;
      }
  vs.
      rotation
      {
          type    axes;
          e2      (0 1 0);
          e3      (0.5 0 0.866025);
      }

- shorter names (or older longer names) for the coordinate rotation
  specification.

     euler         EulerRotation
     starcd        STARCDRotation
     axes          axesRotation

================
  Coding Style
================
- use Foam::coordSystem namespace for categories of coordinate systems
  (cartesian, cylindrical, indirect). This reduces potential name
  clashes and makes a clearer declaration. Eg,

      coordSystem::cartesian csys_;

  The older names (eg, cartesianCS, etc) remain available via typedefs.

- added coordinateRotations namespace for better organization and
  reduce potential name clashes.
2018-10-01 13:54:10 +02:00
Mark Olesen
dcc1dc1383 ENH: cylindricalCS is now in radians only (issue #863)
- this provides internal consistency and allows direct use of the
  coordinate angle with sin(), cos() functions.
  It eliminates potential issues that could otherwise arise from
  alternative user input.

  Eg, in mixerFvMesh it would have previously been possible to specify
  the coordinate system to use degrees or radians, but these units were
  not checked when determining the tangential sweep positions.

NOTE: this may represent a breaking change if user coding has been
relying on cylindrical coordinate system in degrees.
2018-09-24 11:31:04 +02:00
Mark Olesen
13778f7647 ENH: use dictionary::readEntry for detection of input errors (#762, #1033)
- instead of   dict.lookup(name) >> val;
  can use      dict.readEntry(name, val);

  for checking of input token sizes.
  This helps catch certain types of input errors:

  {

      key1 ;                // <- Missing value
      key2 1234             // <- Missing ';' terminator
      key3 val;
  }

STYLE: readIfPresent() instead of 'if found ...' in a few more places.
2018-10-05 10:15:13 +02:00
Mark Olesen
4d6f0498d6 ENH: use vector::normalise and VectorSpace::normalised for clarity 2018-08-10 15:18:29 +02:00
Mark Olesen
c1964d7807 ENH: distinguish between face areaNormal/unitNormal in the code 2018-08-10 15:43:06 +02:00
Mark Olesen
f959927910 ENH: improve consistency of ListOps and stringListOps
- subsetList, inplaceSubsetList with optional inverted logic.

- use moveable elements where possible.

- allow optional starting offset for the identity global function.
  Eg,  'identity(10, start)' vs 'identity(10) + start'
2018-02-21 12:58:00 +01:00
Will Bainbridge
b78d844cf4 lagrangian: Removed duplicate data from method arguments
A lot of methods were taking argument data which could be referenced or
generated from the parcel class at little or no additional cost. This
was confusing and generated the possibility of inconsistent data states.
2017-08-23 15:14:32 +01:00
Will Bainbridge
c9b3744637 ParticleCollector: Prevented missing and duplicate collections
The particle collector was collecting some particles twice due to a
tolerance extending the tracked path. This has been removed. The new
tracking algorithm does not generate the same sorts of spurious
tolerance-scale motions that the old one did, so this extension of the
tracking path is unnecessary.

Some particles were also not being collected at all as they were hitting
a diagonal of the collection polygon and registering as not having hit
either of the adjacent triangles. The hit criteria has been rewritten. A
hit now occurs when the normals of the triangles created by joining the
intersection point with the polygon edges are all in the same direction
as the overall polygon normal. This calculation is not affected by the
polygon's diagonals.

The issue was raised by, and resolved with support from, Karl Meredith
at FM Global.

This resolves bug-report https://bugs.openfoam.org/view.php?id=2595
2017-07-05 09:26:56 +01:00
Andrew Heather
2e9bead519 MRG: merged develop line back into integration branch 2017-05-18 11:11:12 +01:00
Andrew Heather
7f0cc0045d ENH: Random numbers - updated dependent code from change cachedRandom->Random class 2017-04-28 09:15:52 +01:00
Andrew Heather
b708c23cfc ENH: Clean-up after latest Foundation integrations 2017-03-27 14:34:01 +01:00
Andrew Heather
436ec1cf1f MRG: Integrated Foundation code to commit ba4dbed 2017-03-23 12:11:49 +00:00
Henry Weller
512bfcfd6b CloudFunctionObjects::ParticleCollector: Corrected handling of "concentricCircle" mode
Patch contributed by Karl Meredith, FM Global.
2017-01-13 14:06:45 +00:00
Andrew Heather
c0f44ac4f3 MRG: Integrated foundation code 2016-12-12 12:10:29 +00:00
Henry Weller
f281f77e4a Updated member type comments
Resolves bug-report http://bugs.openfoam.org/view.php?id=2356
2016-11-28 21:23:00 +00:00
Henry Weller
659076c0fa LList, SLList: Added construction from and assignment to initializer_list
SLList: now a C++11 template alias rather than a wrapper-class.
2016-08-12 10:01:41 +01:00
Mark Olesen
1fc2a73213 ENH: use meshedSurf API for surface writers (issue #104)
- Allows passing of additional information (per-face zone ids) or possibly
  other things, while reducing the number of arguments to pass.

- In sampledTriSurfaceMesh, preserve the region information that was
  read in, passing it onwards via the UnsortedMeshSurface content.

  The Nastran surface writer is currently the only writer making use
  of this per-face zone information.
  Passing it through as a PSHELL attribute, which should retain the
  distinction for parts. (issue #204)
2016-08-10 15:41:24 +02:00
Andrew Heather
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +01:00
Henry Weller
6164c2f262 Standardized the naming of functions which control the writing of fields etc.
to have the prefix 'write' rather than 'output'

So outputTime() -> writeTime()

but 'outputTime()' is still supported for backward-compatibility.

Also removed the redundant secondary-writing functionality from Time
which has been superseded by the 'writeRegisteredObject' functionObject.
2016-05-12 17:38:01 +01:00
Henry Weller
450728ea84 Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
andy
fd9d801e2d GIT: Initial commit after latest foundation merge 2016-04-25 11:40:48 +01:00
Henry Weller
43beb06018 Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
Henry Weller
8c6fa81eba vector::zero -> Zero 2016-04-16 18:34:41 +01:00
Henry Weller
56fa7c0906 Update code to use the simpler C++11 template syntax removing spaces between closing ">"s 2016-01-10 22:41:16 +00:00
mattijs
d77f54ab4e BUG: ParticleCollector: handle particle not intersecting triangle 2015-12-15 14:53:16 +00:00
Andrew Heather
8f1d043364 GIT: Resolved conflict 2015-12-09 09:32:38 +00:00
Andrew Heather
b8a5dcc5f7 ENH: Updated lagrangian libraries from internal development line 2015-12-02 12:22:47 +00:00
Henry Weller
c4d5f65a10 Completed update ...ErrorIn -> ...ErrorInFunction
Avoids the clutter and maintenance effort associated with providing the
function signature string.
2015-11-11 09:03:39 +00:00
andy
3b64695d62 BUG: lagrangian function objects - updated postMove() calls 2014-02-18 10:03:24 +00:00
andy
bf8157e444 ENH: partilceCollector cloud function object - added polygonWithNormal option 2014-02-17 16:50:32 +00:00
andy
90bbb9a5b9 ENH: particleCollector - now handle multiple polygons per particle hit 2014-01-23 11:01:49 +00:00
andy
2357b2cd91 ENH: Cloud function objects - updated output folder 2014-01-20 12:15:34 +00:00
andy
1f524ef51b ENH: Updated cloud function objects 2013-12-09 09:37:34 +00:00
andy
b36637443a ENH: Updated particle collector cloud function object output 2013-08-23 10:47:56 +01:00
andy
9ac189015b ENH: updated cloud function objects - particleCollector 2013-08-19 17:55:19 +01:00
andy
81d2dc9235 ENH: Updated cloud particleCollector function object 2013-07-30 10:16:23 +01:00
andy
bbdeaf91bf BUG: Added missing data member in copy constructor 2013-01-14 09:38:13 +00:00
andy
4ffc47415f ENH: Enabled smooth restart for particle collector function object 2013-01-10 14:12:35 +00:00
laurence
4be7afde0a STYLE: Fix some typos 2012-12-11 16:38:39 +00:00
andy
7985724846 ENH: Added option to remove particle in cloud function objects 2012-11-14 17:26:51 +00:00
andy
1bf00a47b8 ENH: Added new particle collector cloud function object 2012-11-14 15:20:53 +00:00