Skip to content

Commit

Permalink
multiValveEngine: New fvMeshMover for multi-valve IC engine mesh motion
Browse files Browse the repository at this point in the history
This mesh mover facilitates explicit node translation based on scaled distance
functions for the providing smooth deformation of the mesh to accommodate the
motion piston and multiple valves present in IC engines.   and run-time mesh-to-mesh mapping used to avoid
extreme mesh distortion and support the necessary topology changes that occur at
valve closure.

Highlighted features include:

* Piston motion based on user-defined functions, with options for standard crank
  and connecting rod motion.
* Valve motion based on user-provided lift data or table.
* Support for linerPatches, slidingPatches, and frozenZones.
* Non-conformal coupled (NCC) interfaces can be used to provide better control
  of the mesh-motion around valves
* Run-time mesh-to-mesh mapping used to avoid extreme mesh distortion and
  support the necessary topology changes that occur at valve closure
* Control over mesh motion per moving object including motion parameters and layer
  thickness.

Description from the multiValveEngine.H file:

    A mesh mover using explicit node translation based on scaled distance
    functions per moving object. The mover supports any number of valves
    together with piston motion and following features:

    - Piston motion: Function1 of user-time, may be set to
      crankConnectingRodMotion for standard crank and connecting rod motion.

    - Valve motion: Function1, may be set to table if the valve lift date is
      provided in the form of a table.

    - Smooth mesh motion between a moving object and other patches.

    - linerPatches: the set of patches corresponding to the cylinder liner
      Used by createEngineZones

    - slidingPatches: a set of patches along which mesh is allowed
      to deform. For example, on the cylinder liner, it is desired to
      slide mesh nodes while piston is moving.

    - frozenZones: list of pointZones the points of which are frozen,
      i.e. do not move.

    - Run-time clearance estimation based on patch-to-patch distances printed.

    - Supports cellSet and cellZone definitions to restrict mesh motion.

    - Supports domains with nonConformalCoupling (NCC) interfaces,
      enabling e.g. nodes to slide along with the interface.

    - Closing the valve can be achieved by meshToMesh mapping onto a new
      grid with closed valve geometry at user given time.

    - Mesh motion can be controlled per moving object by setting:

        - patches: list of patches defining the object.

        - motion: a Function1 which returns the object position
          as a function of time.

        - movingZones: list of pointZones the points of which move with the
          object.

        - maxMotionDistance: a distance away from the moving object
          after nodes are not allowed to move. (Default inf.)

        - movingFrozenLayerThickness: thickness of layer in which points move
          with the moving object. (Default 0)

        - staticFrozenLayerThickness: thickness of layer in which points
          are fixed with respect to static patches (e.g. walls). (Default 0)

        - cosineScaling: a switch whether nodal translation is weighted by
          its distance from the moving object. The objective is to yield less
          deformation near the moving object and sustain e.g. boundary layer.
          (Default no, i.e. linear weighting)

        - fractionalTravelInterval: fraction of the stroke travelled after
          which the cached motion scaling weights are recalculated

        For valve object only:

            - minLift: a minimum valve lift value after considered closed.

    Some of the above parameters are highlighted in a given schematic
    piston-valve configuration w.r.t entries used to control piston motion.
    Furthermore, an example dictionary entries are provided below.

                      |             |         |             |
                      |             |         |             |
                      |             |    S    |             |
                      |             |    T    |             |
                      |             |    E    |             |
                      |             |    M    |             |
                     /              |         |              \
                    /               |         |               \
                   /                |         |                \
     _____________/                 |         |                 \_____________
    |        :                      |         |                      :        |
    |        :      /```````````````           ```````````````\      :        |
    |        :     /                VALVE HEAD                 \     :        |
    | L      :    /_____________________________________________\    :        |
    | I      :                         /\                            :        |
    | N      :                         || staticFrozenLayerThickness :        |
    | E      : NCC (optional)          \/ (w.r.t. piston motion)     :        |
    | R      :                      ``````````                       :        |
    |        :                                                       :        |
    |        :                                                       :        |
    |........:.......................................................:........|
    |        :                         /\                            :        |
    |        :                         || movingFrozenLayerThickness :        |
    |________:_________________________\/____________________________:________|
                                       PISTON

    \verbatim
    mover
    {
        type                multiValveEngine;
        libs                ("libfvMeshMoversMultiValveEngine.so");

        frozenZones         (frozenZone1 frozenZone2);

        slidingPatches
        (
            liner
            valveStem
            "nonCouple.*"
        );

        linerPatches        (liner);

        piston
        {
            patches             (piston);
            axis                (0 0 1);

            motion
            {
                type                crankConnectingRodMotion;

                conRodLength        1e3;
                stroke              1.0;
            }

            // Move the points in the piston bowl with the piston
            movingZones         (pistonBowl);

            // Optional
            maxMotionDistance    1e30;
            movingFrozenLayerThickness  0;
            staticFrozenLayerThickness  0;

            fractionalTravelInterval    0.1;

            cosineScaling       yes;
        }

        valves
        {
            iv
            {
                patches     (valveHead);
                axis        (0 0 1);

                // Optional
                maxMotionDistance   1e30;
                movingFrozenLayerThickness  0;
                staticFrozenLayerThickness  0;

                fractionalTravelInterval    0.1;

                cosineScaling       yes;

                minLift     0.001;

                motion
                {
                    type    table;
                    values
                    (
                        (0      0)
                        (480    0.1)
                        (720    0)
                    );
                    // For multi-cycle simulations, use repeat
                    outOfBounds     repeat;
                    interpolationScheme linear;
                }
            }
        }
    }
    \endverbatim

    Note:
      The implementation utilises pointDist objects for distance computation,
      resulting distance fields do not propagate through NCC interfaces.  Hence,
      there should be no horizontal NCC interface separating piston from
      cylinder head as it would result in potentially ill defined mesh
      deformation. Due to same feature, in a schematic case setup above, valve
      motion affects only cells between NCC patches even though no cellSet is
      explicitly defined.

SourceFiles
    multiValveEngine.C

Patch contributed by:
* Heikki Kahila, Wärtsilä Finland: Original implementation
* Bulut Tekgül, Wärtsilä Finland: Testing, cleanup, help with refactoring
* Henry Weller, CFD Direct: Refactoring, generalisation, optimisation and
  merging into OpenFOAM
  • Loading branch information
Henry Weller committed Feb 13, 2024
1 parent c84e216 commit 7d65e66
Show file tree
Hide file tree
Showing 44 changed files with 4,307 additions and 152 deletions.
59 changes: 0 additions & 59 deletions bin/XiEngineFoam

This file was deleted.

62 changes: 0 additions & 62 deletions bin/coldEngineFoam

This file was deleted.

9 changes: 9 additions & 0 deletions src/fvMeshMovers/multiValveEngine/Make/files
@@ -0,0 +1,9 @@
multiValveEngine.C
movingObject.C
piston.C
valve.C
valveList.C
crankConnectingRodMotion/crankConnectingRodMotion.C
pistonPointEdgeData/pistonPointEdgeData.C

LIB = $(FOAM_LIBBIN)/libfvMeshMoversMultiValveEngine
7 changes: 7 additions & 0 deletions src/fvMeshMovers/multiValveEngine/Make/options
@@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

LIB_LIBS = \
-lfiniteVolume \
-lmeshTools
@@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2024 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 "crankConnectingRodMotion.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace Function1s
{
addScalarFunction1(crankConnectingRodMotion);
}
}


// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //

void Foam::Function1s::crankConnectingRodMotion::read(const dictionary& dict)
{
conRodLength_ = dict.lookup<scalar>("conRodLength");
stroke_ = dict.lookup<scalar>("stroke");
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::Function1s::crankConnectingRodMotion::crankConnectingRodMotion
(
const word& name,
const dictionary& dict
)
:
Function1<scalar>(name)
{
read(dict);
}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

Foam::Function1s::crankConnectingRodMotion::~crankConnectingRodMotion()
{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

void Foam::Function1s::crankConnectingRodMotion::write(Ostream& os) const
{
writeEntry(os, "conRodLength", conRodLength_);
writeEntry(os, "stroke", stroke_);
}


// ************************************************************************* //
@@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2024 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::Function1s::crankConnectingRodMotion
Description
Crank and connecting-rod motion function for piston engines etc.
\c value returns the current piston position as a function of
the crank-angle in degrees.
Usage:
\verbatim
<name>
{
type crankConnectingRodMotion;
conRodLength 0.2;
stroke 0.12;
}
\endverbatim
See also
Foam::Function1
SourceFiles
crankConnectingRodMotionI.H
crankConnectingRodMotion.C
\*---------------------------------------------------------------------------*/

#ifndef crankConnectingRodMotion_H
#define crankConnectingRodMotion_H

#include "Function1.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace Function1s
{

/*---------------------------------------------------------------------------*\
Class crankConnectingRodMotion Declaration
\*---------------------------------------------------------------------------*/

class crankConnectingRodMotion
:
public Function1<scalar>
{
// Private data

//- Connecting-rod length
scalar conRodLength_;

//- Stroke
scalar stroke_;


// Private Member Functions

//- Read the coefficients from the given dictionary
void read(const dictionary& dict);


public:

// Runtime type information
TypeName("crankConnectingRodMotion");


// Constructors

//- Construct from name and dictionary
crankConnectingRodMotion
(
const word& name,
const dictionary& dict
);

//- Construct and return a clone
virtual tmp<Function1<scalar>> clone() const
{
return tmp<Function1<scalar>>
(
new crankConnectingRodMotion(*this)
);
}


//- Destructor
virtual ~crankConnectingRodMotion();


// Member Functions

//- Return position for crank-angle theta in deg
virtual inline scalar value(const scalar theta) const;

//- Not implemented
virtual inline tmp<Field<scalar>> value(const scalarField&) const;

//- Not implemented
virtual inline scalar integral
(
const scalar,
const scalar
) const;

//- Not implemented
virtual inline tmp<Field<scalar>> integral
(
const scalarField&,
const scalarField&
) const;


//- Write data to dictionary stream
virtual void write(Ostream& os) const;


// Member Operators

//- Disallow default bitwise assignment
void operator=(const crankConnectingRodMotion&) = delete;
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Function1s
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#ifdef NoRepository
#include "crankConnectingRodMotionI.H"
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //

0 comments on commit 7d65e66

Please sign in to comment.