Commit Graph

14446 Commits

Author SHA1 Message Date
2cd2732fed ENH: avoid change when setting UPtrList twice (issue #1035)
UPtrList::set(const label i, T* ptr);

No-op if the new pointer value is identical to the current content.
This avoid memory management issues.
2018-10-09 08:27:50 +02:00
d2b32fcc84 Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop 2018-10-08 15:42:19 -07:00
ba40eeec53 BUG: Correct initialization for psi and mu for solid thermo 2018-10-08 15:41:36 -07:00
6eb1f6fefc ENH: searchableSurface: handle multiple surfaces. Fixes #1034 2018-10-08 17:11:37 +01:00
3b77493abc ENH: wordRes matcher method that distinguishes literal vs. regex
- useful for customizing the behaviour of white/black lists depending
  on the type of the match.
2018-10-07 18:30:33 +02:00
8d6f83e666 ENH: isLiteral() method for keyType and wordRe
- same as !isPattern(), but can be more readable.

- add wordRe enum state 'UNKNOWN', which has the identical value as
  'DETECT' but used for a return value.
2018-10-07 17:28:11 +02:00
87cc19de82 STYLE: typo in comment 2018-10-07 17:23:45 +02:00
496e1cd0d2 STYLE: enforce Cartesian transform (issue #1027)
- searchable surfaces
- pointToPointPlanarInterpolation
- sampled planes
- surfaceMeshConvert, surfaceMeshExport, surfaceMeshImport
2018-10-01 22:55:59 +02:00
b17bcd67b7 ENH: correct suspicious coordinate system conversions (issue #1027)
- arraySet :
     was translate + transform
     now use globalPosition (== transform + translate).

     Explicitly limit to Cartesian coordinate system for clarity.
2018-10-01 17:10:35 +02:00
501326b27a ENH: additional constructor and methods for regionProperties
- can now construct with READ_IF_PRESENT and use count() to determine
  if it was loaded. names() and sortedNames() for a collected overview.
2018-10-01 16:01:02 +02:00
e6a60f2de6 ENH: use intermediate constants for sin/cos in coordinate rotations
- makes an easier overview of the rotation matrix coefficients
  (issue #863).

  Provided as a distinct commit for easier examination of the lines changed.
2018-10-05 00:58:23 +02:00
b9c738dd10 ENH: expose calculation of coordinate rotations as static methods
- improve handling of degenerate cases for the two-axes specification.
2018-10-05 00:49:55 +02:00
95b95d7201 GIT: relocation of coordinate systems/rotation files 2018-10-04 23:46:57 +02:00
baf3e931de ENH: add GeometricField constructor for movable internal field
- the movable type is List&& or Field&&
2018-10-04 11:14:04 +02:00
8548009eee ENH: generalize instant to be templated, movable, etc
- allows reuse for other purposes
2018-10-03 14:05:45 +02:00
6c91048e8b ENH: fileName hasPath(), removePath() methods
- improved move constructors/assignments for fileName, string, etc
2018-10-03 14:05:45 +02:00
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
e7a6095aaf ENH: avoid duplicate bookkeeping of rotation tensors in rotorDiskSource 2018-09-24 17:55:37 +02:00
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
201fdf87d1 STYLE: relocate some vtk part handling from conversion to fileFormats
- these parts work with a polyMesh (don't need fvMesh)
2018-09-17 10:12:48 +02:00
f4ae4f7b2c ENH: snappyHexMesh. Added leak-path detection.
Detects connections (during refinement) between
locationsInsideMesh and locationsOutsideMesh and
writes a sampledSet for postprocessing.
2018-08-02 16:39:06 +01:00
5e7a766159 BUG: cubicEqn, quadraticEqn: Correction to repeated roots
Also extended the cubic equation test routine and modified the error
methods so that they more accurately generate the round of error of
evaluation.

This resolves bug report https://bugs.openfoam.org/view.php?id=3015
2018-07-24 15:54:32 +01:00
4396caaa39 BUG: double read when updating ensight fieldsDict 2018-07-30 16:07:49 +02:00
3963cd95d9 STYLE: code cleanup in fileFormats, conversion 2018-07-24 16:12:32 +02:00
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
7d88075842 ENH: dictionary lookup with detection of zero tokens (#1033)
- the opposite problem from issue #762. Now we also test if the input
  token stream had any tokens at all.

- called by the dictionary get<> and readEntry() methods.
2018-10-05 09:56:17 +02:00
77753021df Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop 2018-10-04 09:14:08 -07:00
073770ddf2 ENH: dynamicOversetMesh: added debug writing. See #1028. 2018-10-04 14:27:46 +01:00
789d261f0e Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop 2018-10-01 17:14:39 -07:00
d0c39b0e27 ENH: Changing non-interpolation field in versetFvPatchField
for correct run time reading.
Setting up twoSimpleRotors tutorial for smooth pressure
fluctuations
2018-10-01 17:11:39 -07:00
69f6f63810 ENH: add globalPath() to argList and TimePaths
- simply combines (rootPath()/globalCaseName())
2018-09-28 15:24:59 +02:00
911ea1087d meshSearch: Prevent hang in calculation of line-boundary intersections
This fix changes how the intersections loop ignores previously
intersected faces. It now marks them by their index so that subsequent
iterations ignore them.

Before this change, after an intersection was found the start point was
advanced by a small amount to move the past the intersection. The
problem with this was if multiple boundary faces or the end point were
in close proximity to the intersection then the move forward might span
them. This could lead to intersections being missed or counted multiple
times, in some cases indefinitely.

Based on a patch contributed by Mattijs Janssens
Resolves bug report https://bugs.openfoam.org/view.php?id=1147
2018-09-28 12:26:17 +01:00
c0460d3015 Merge remote-tracking branch 'Customer-VWG/wp3-directional-refinement' into develop 2018-10-04 13:43:33 +01:00
8076963c68 ENH: snappyHexMesh: directional smoothing. See #1031 2018-10-04 12:03:53 +01:00
6627515838 ENH: fieldMinMax function object - updated for case where there are no cells on a local processor, e.g. CHT 2018-10-03 13:06:31 +01:00
6141575532 BUG: cellCellStencil: use before mesh.update. Fixes #1028. 2018-10-03 09:35:13 +01:00
d92d77cc84 Merge remote-tracking branch 'origin/master' into develop 2018-09-28 13:20:41 +02:00
4a61042f3f ENH: add column access and other methods for Tensor
- Can now retrieve or set a column/row of a tensor.
  Either compile-time or run-time checks.

  Get
     t.col<1>();   t.col(1);
     t.row<1>();   t.row(1);

  Set
     t.col<1>(vec);   t.col(1,vec);
     t.row<1>(vec);   t.row(1,vec);

  The templated versions are compile-time checked

     t.col<3>();
     t.col<3>(vec);

  The parameter versions are run-time checked

     t.col(3);
     t.col(3,vec);

ENH: provide named access to tensor/tensor inner product as inner()
2018-09-28 11:20:31 +02:00
2d5f77f2dd ENH: add invTransform in transform.H 2018-09-28 09:53:45 +02:00
a6473dca33 STYLE: minor coding/comments cleanup for transform, transformList 2018-09-28 09:29:12 +02:00
dde9ef4712 BUG: bad transform for transformList (fixes #1024) 2018-09-28 08:47:08 +02:00
64c3e484bb STYLE: add nBoundaryFaces() method to primitiveMesh
- nBoundaryFaces() is often used and is identical to
  (nFaces() - nInternalFaces()).

- forward the mesh nInternalFaces() and nBoundaryFaces() to
  polyBoundaryMesh as nFaces() and start() respectively,
  for use when operating on a polyBoundaryMesh.

STYLE:

- use identity() function with starting offset when creating boundary maps.

     labelList map
     (
         identity(mesh.nBoundaryFaces(), mesh.nInternalFaces())
     );

  vs.

     labelList map(mesh.nBoundaryFaces());
     forAll(map, i)
     {
         map[i] = mesh.nInternalFaces() + i;
     }
2018-09-27 10:17:30 +02:00
3a641275d3 COMP: Allwmake: pass through targetType 2018-09-26 14:32:32 +01:00
aa0f8da54b COMP: mapDistribute: do not make explicit 2018-09-20 15:07:04 +01:00
d0da21fe90 ENH: allow new patch names in subsetMesh (issue #1019)
Previously had 3 possibilities for handling exposed internal faces

  1. use default "oldInternalFaces"
  2. specify -patch, to use the specified (existing) patch
  3. specify -patches, to use the geometrically closest patches

Now relaxed the restriction on -patch to allow specification of a new
(not yet existing) patch name. This improves flexibility, but won't
catch typing mistakes.

Harmonize behaviour of -patches and -patch. When -patches is used to
specify a single, non-regex patch name, it now behaves identically to
-patch. Since the getList handling for options already allows special
treatment for single parameter lists, the following will work
identically:

      subsetMesh -patch  patch0
      subsetMesh -patches patch0
      subsetMesh -patches '( patch0 )'

In the future it might be reasonable to fully combine the behaviour of
'-patch' and '-patches' and treat them as aliases for each other.

ENH: support subsetMesh on a cellZone.

- when the '-zone' option is specified, the command argument is treated
  as the name (or names) of cellZones to be selected instead of as the
  name of the cellSet.

  The command argument can be a single word, regex, or list of
  word/regex.
  Eg,

      subsetMesh -zone -patch mypatch  mixer
      subsetMesh -zone -patch mypatch  '(mixer "moving.*" )'

STYLE: simplify set handling and other code cleanup in subsetMesh
2018-09-25 17:18:27 +02:00
54457c68b6 Merge remote-tracking branch 'origin/master' into develop 2018-09-21 16:01:16 +01:00
eda13117e4 STYLE: explicitly use degrees in arcEdge coordinate system (#1015)
- safeguard against any change in the default in cylindricalCS
2018-09-19 22:32:29 +02:00
6cd953ff99 STYLE: report API number with the build information
Using: OpenFOAM-plus (see www.OpenFOAM.com)
    Build: plus-7ab57cc5d014 (OPENFOAM=1807)
    Arch:  LSB;label=32;scalar=64

- This can be useful for development versions, or when the version
  at build time uses some other naming scheme (#1010)
2018-09-19 21:51:37 +02:00
7ab57cc5d0 DEFEATURE: remove CloudToVTK function object (issue #985)
- superseded by the vtkCloud function object, which provides
  significantly more functionality and more versatile output
  (using the vtp format).
2018-09-19 21:13:13 +02:00
0c0bc572e4 ENH: mapDistribute: extra constructor. Used in #284. 2018-09-19 17:16:29 +01:00