ENH: support exprField specification for SemiImplicitSource

- this allows more flexibility when defining the location or intensity
  of sources.

  For example,

  {
      type            scalarSemiImplicitSource;
      volumeMode      specific;
      selectionMode   all;

      sources
      {
          tracer0
          {
              explicit
              {
                  type       exprField;

                  functions<scalar>
                  {
                      square
                      {
                          type square;
                          scale 0.0025;
                          level 0.0025;
                          frequency 10;
                      }
                  }

                  expression
                  #{
                      (hypot(pos().x() + 0.025, pos().y()) < 0.01)
                    ? fn:square(time())
                    : 0
                  #};
              }
          }
      }
  }

ENH: SemiImplicitSource: handle "sources" with explicit/implicit entries

- essentially the same as injectionRateSuSp with Su/Sp,
  but potentially clearer in purpose.

ENH: add Function1 good() method to define if function can be evaluated

- for example, provides a programmatic means of avoiding the 'none'
  function
This commit is contained in:
Mark Olesen
2022-05-30 13:27:22 +02:00
parent ef743147ea
commit d2e10bca40
14 changed files with 575 additions and 107 deletions

View File

@ -243,6 +243,9 @@ public:
//- Is value constant (i.e. independent of x)
virtual bool constant() const { return false; }
//- Can function be evaluated?
virtual bool good() const { return true; }
// Evaluation

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,8 +34,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Function1Types_None_H
#define Function1Types_None_H
#ifndef Foam_Function1Types_None_H
#define Foam_Function1Types_None_H
#include "Function1.H"
@ -102,6 +102,9 @@ public:
//- Value is independent of x
virtual inline bool constant() const { return true; }
//- Function cannot be evaluated
virtual inline bool good() const { return false; }
//- Placeholder: generates an error if called
virtual Type value(const scalar x) const;