CONT: Addition of compressibleIsoInterFOam and PLIC

1) Implementation of the compressibleIsoInterFOam solver
   2) Implementation of a new PLIC interpolation scheme.
   3) New tutorials associated with the solvers

This implementation was carried out by Henning Scheufler (DLR) and Johan
Roenby (DHI), following :

\verbatim

Henning Scheufler, Johan Roenby,
Accurate and efficient surface reconstruction from volume fraction data
on general meshes, Journal of Computational Physics, 2019, doi
10.1016/j.jcp.2019.01.009

\endverbatim

The integration of the code was carried out by Andy Heather and Sergio
Ferraris from OpenCFD Ltd.
This commit is contained in:
Henning Scheufler
2020-06-05 14:31:15 +02:00
committed by Andrew Heather
parent 237f2e1076
commit 44a84d4778
166 changed files with 16335 additions and 3372 deletions

View File

@ -0,0 +1,207 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "composedFunctionImplicitFunction.H"
#include "scalarField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(composedFunctionImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
composedFunctionImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::Enum
<
Foam::implicitFunctions::composedFunctionImplicitFunction::modeType
>
Foam::implicitFunctions::composedFunctionImplicitFunction::modeTypeNames
({
{ modeType::ADD, "add" },
{ modeType::SUBTRACT, "subtract" },
{ modeType::MINDIST, "minDist" },
{ modeType::INTERSECT, "intersect" },
});
Foam::label
Foam::implicitFunctions::composedFunctionImplicitFunction::selectFunction
(
const scalarField& values
) const
{
switch (mode_)
{
case modeType::MINDIST:
{
scalarField absVal(mag(values));
return findMin(absVal);
}
case modeType::ADD:
{
return findMax(values);
}
case modeType::SUBTRACT:
{
// Note: start at the second entry
const label idx = findMin(values, 1);
if (values[idx] < values[0] && pos(values[0]))
{
return idx;
}
else
{
return 0;
}
}
case modeType::INTERSECT:
{
return findMin(values);
}
default:
{
FatalErrorInFunction
<< "This mode is not supported only " << nl
<< "Supported modes are: " << nl
<< modeTypeNames
<< abort(FatalError);
}
}
return -1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::composedFunctionImplicitFunction::
composedFunctionImplicitFunction
(
const dictionary& dict
)
:
functions_(),
mode_(modeTypeNames.get("mode", dict)),
values_()
{
const dictionary& funcDict = dict.subDict("composedFunction");
functions_.resize(funcDict.size());
values_.resize(funcDict.size(), Zero);
label funci = 0;
for (const entry& dEntry : funcDict)
{
const word& key = dEntry.keyword();
if (!dEntry.isDict())
{
FatalIOErrorInFunction(funcDict)
<< "Entry " << key << " is not a dictionary" << endl
<< exit(FatalError);
}
const dictionary& subdict = dEntry.dict();
functions_.set
(
funci,
implicitFunction::New(subdict.get<word>("type"), subdict)
);
++funci;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::implicitFunctions::composedFunctionImplicitFunction::value
(
const vector& p
) const
{
forAll(values_,i)
{
values_[i] = functions_[i].value(p);
}
const label idx = selectFunction(values_);
return values_[idx];
}
Foam::vector Foam::implicitFunctions::composedFunctionImplicitFunction::grad
(
const vector& p
) const
{
forAll(values_,i)
{
values_[i] = mag(functions_[i].value(p));
}
const label minIdx = findMin(values_);
return functions_[minIdx].grad(p);
}
Foam::scalar
Foam::implicitFunctions::composedFunctionImplicitFunction::distanceToSurfaces
(
const vector& p
) const
{
forAll(values_,i)
{
values_[i] = mag(functions_[i].value(p));
}
const label minIdx = findMin(values_);
return functions_[minIdx].distanceToSurfaces(p);
}
// ************************************************************************* //

View File

@ -0,0 +1,169 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::composedFunctionImplicitFunction
Description
Handles multiple implicit functions and offers multiple ways to combine
them
Usage
Example of function object partial specification:
\verbatim
function composedFunctionImplicitFunction;
mode minDist;
// following mode are available:
// "add" "subtract" "minDist" "intersect"
composedFunctionImplicitFunctions
{
plane
{
function plane;
origin (0 1. 0);
normal (0 1 0);
}
sphere
{
function sphere;
radius 0.4;
origin (0.5 1.5 0.5);
scale 1;
}
sphere2
{
function sphere;
radius 0.4;
origin (0.5 0.5 0.5);
scale -1;
}
}
\endverbatim
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
composedFunctionImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunctions_composedFunctionImplicitFunction_H
#define implicitFunctions_composedFunctionImplicitFunction_H
#include "implicitFunction.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class composedFunctionImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class composedFunctionImplicitFunction
:
public implicitFunction
{
// Private Member Data
//- Enumeration defining the valid actions
enum class modeType
{
ADD,
SUBTRACT,
MINDIST,
INTERSECT
};
//- The setActions text representations
static const Enum<modeType> modeTypeNames;
//- Stores the functions
PtrList<implicitFunction> functions_;
//- Mode
modeType mode_;
//- Needed for finding the closest function.
// Note: avoid creation every call
mutable scalarField values_;
// Private Member Functions
label selectFunction(const scalarField& values) const;
//- No copy construct
composedFunctionImplicitFunction
(
const composedFunctionImplicitFunction&
) = delete;
//- No copy assignment
void operator=(const composedFunctionImplicitFunction&) = delete;
public:
//- Runtime type information
TypeName("composedFunction");
// Constructors
//- Construct from dictionary
explicit composedFunctionImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~composedFunctionImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const;
virtual vector grad(const vector& p) const;
virtual scalar distanceToSurfaces(const vector& p) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,82 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "cylinderImplicitFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(cylinderImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
cylinderImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::cylinderImplicitFunction::cylinderImplicitFunction
(
const point& origin,
const scalar radius,
const scalar scale,
const vector& direction
)
:
origin_(origin),
radius_(radius),
scale_(scale),
direction_(normalised(direction)),
project_(tensor::I - direction_*direction_) // outer product
{}
Foam::implicitFunctions::cylinderImplicitFunction::cylinderImplicitFunction
(
const dictionary& dict
)
:
cylinderImplicitFunction
(
dict.get<point>("origin"),
dict.get<scalar>("radius"),
dict.getOrDefault<scalar>("scale", 1),
dict.get<vector>("direction")
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::cylinderImplicitFunction
Description
creates a infintite long cylinderImplicitFunction
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
cylinderImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_cylinderImplicitFunction_H
#define implicitFunction_cylinderImplicitFunction_H
#include "implicitFunction.H"
#include "point.H"
#include "tensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class cylinderImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class cylinderImplicitFunction
:
public implicitFunction
{
private:
// Private Data
//- Origin point
const point origin_;
//- Radius
const scalar radius_;
const scalar scale_;
const vector direction_;
const tensor project_;
public:
//- Runtime type information
TypeName("cylinder");
// Constructors
//- Construct from components
cylinderImplicitFunction
(
const point& origin,
const scalar radius,
const scalar scale,
const vector& direction
);
//- Construct from dictionary
explicit cylinderImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~cylinderImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
return (-mag(project_ & (p - origin_)) + radius_)*scale_;
}
virtual vector grad(const vector& p) const
{
return -(project_ & (p - origin_))*scale_;
}
virtual scalar distanceToSurfaces(const vector& p) const
{
return mag(mag(project_ & (p - origin_)) - radius_)*scale_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,73 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "ellipsoidImplicitFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(ellipsoidImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
ellipsoidImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::ellipsoidImplicitFunction::ellipsoidImplicitFunction
(
const vector& semiAxis
)
:
semiAxis_(semiAxis),
origin_(Zero)
{}
Foam::implicitFunctions::ellipsoidImplicitFunction::ellipsoidImplicitFunction
(
const dictionary& dict
)
:
ellipsoidImplicitFunction
(
dict.get<vector>("semiAxis")
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,131 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::ellipsoidImplicitFunction
Description
creates an ellipsoidImplicitFunction
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
ellipsoidImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_ellipsoidImplicitFunction_H
#define implicitFunction_ellipsoidImplicitFunction_H
#include "implicitFunction.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class ellipsoidImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class ellipsoidImplicitFunction
:
public implicitFunction
{
// Private Member Data
//- Axis
const vector semiAxis_;
//- Origin point
const vector origin_;
public:
//- Runtime type information
TypeName("ellipsoidImplicitFunction");
// Constructors
//- Construct from components
explicit ellipsoidImplicitFunction(const vector& semiAxis);
//- Construct from dictionary
explicit ellipsoidImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~ellipsoidImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
return
-sqrt
(
sqr((p.x() - origin_.x())/semiAxis_.x())
+ sqr((p.y() - origin_.y())/semiAxis_.y())
+ sqr((p.z() - origin_.z())/semiAxis_.z())
) + 1;
}
virtual vector grad(const vector& p) const
{
// normal_ has the length of one
return vector
(
2*(p.x() - origin_.x())/sqr(semiAxis_.x()),
2*(p.y() - origin_.y())/sqr(semiAxis_.y()),
2*(p.z() - origin_.z())/sqr(semiAxis_.z())
);
}
virtual scalar distanceToSurfaces(const vector& p) const
{
NotImplemented;
return GREAT;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "implicitFunction.H"
#include "error.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(implicitFunction, 0);
defineRunTimeSelectionTable(implicitFunction, dict);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::implicitFunction> Foam::implicitFunction::New
(
const word& implicitFunctionType,
const dictionary& dict
)
{
auto cstrIter = dictConstructorTablePtr_->cfind(implicitFunctionType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"implicitFunction",
implicitFunctionType,
*dictConstructorTablePtr_
) << exit(FatalIOError);
}
return autoPtr<implicitFunction>(cstrIter()(dict));
}
// ************************************************************************* //

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunction
Description
Base class for implicit functions
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
implicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_H
#define implicitFunction_H
#include "autoPtr.H"
#include "dictionary.H"
#include "vector.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class implicitFunction Declaration
\*---------------------------------------------------------------------------*/
class implicitFunction
{
public:
//- Runtime type information
TypeName("implicitFunction");
//- Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
implicitFunction,
dict,
(
const dictionary& dict
),
(dict)
);
// Constructors
//- Default construct
implicitFunction() = default;
//- Return a reference to the selected implicitFunction
static autoPtr<implicitFunction> New
(
const word& implicitFunctionType,
const dictionary& dict
);
//- Destructor
virtual ~implicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
return GREAT;
}
virtual vector grad(const vector& p) const
{
return vector::max;
}
virtual scalar distanceToSurfaces(const vector& p) const
{
return GREAT;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,73 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019 DLR
-------------------------------------------------------------------------------
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 "paraboloidImplicitFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(paraboloidImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
paraboloidImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::paraboloidImplicitFunction::paraboloidImplicitFunction
(
const vector& coeffs
)
:
coeffs_(coeffs)
{}
Foam::implicitFunctions::paraboloidImplicitFunction::paraboloidImplicitFunction
(
const dictionary& dict
)
:
paraboloidImplicitFunction
(
dict.get<vector>("coeffs")
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::paraboloidImplicitFunction
Description
creates a paraboloid
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
paraboloidImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_paraboloidImplicitFunction_H
#define implicitFunction_paraboloidImplicitFunction_H
#include "implicitFunction.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class paraboloidImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class paraboloidImplicitFunction
:
public implicitFunction
{
// Private Data
//- Coefficients of ax^2 + bx*y + cy^2
const vector coeffs_;
public:
//- Runtime type information
TypeName("paraboloid");
// Constructors
//- Construct from components
explicit paraboloidImplicitFunction(const vector& coeffs);
//- Construct from dictionary
explicit paraboloidImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~paraboloidImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
return
coeffs_.x()*sqr(p.x())
+ coeffs_.y()*p.x()*p.y()
+ coeffs_.z()*sqr(p.y())
- p.z();
}
virtual vector grad(const vector& p) const
{
NotImplemented;
return Zero;
}
virtual scalar distanceToSurfaces(const vector& p) const
{
NotImplemented;
return 0;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "planeImplicitFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(planeImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
planeImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::planeImplicitFunction::planeImplicitFunction
(
const vector& origin,
const vector& normal
)
:
origin_(origin),
normal_(normalised(normal))
{}
Foam::implicitFunctions::planeImplicitFunction::planeImplicitFunction
(
const dictionary& dict
)
:
planeImplicitFunction
(
dict.get<vector>("origin"),
dict.get<vector>("normal")
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::planeImplicitFunction
Description
creates a plane
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
planeImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_planeImplicitFunction_H
#define implicitFunction_planeImplicitFunction_H
#include "implicitFunction.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class planeImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class planeImplicitFunction
:
public implicitFunction
{
// Private Data
//- Reference point
const vector origin_;
//- Unit-normal vector
const vector normal_;
public:
//- Runtime type information
TypeName("plane");
// Constructors
//- Construct from components
planeImplicitFunction(const vector& origin, const vector& normal);
//- Construct from dictionary (used by implicitFunctions)
explicit planeImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~planeImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
return -normal_ & (origin_ - p);
}
virtual vector grad(const vector& p) const
{
// normal_ has the length of one
return normal_;
}
virtual scalar distanceToSurfaces(const vector& p) const
{
// normal_ has the length of one
return mag((p - origin_) & -normal_);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "sinImplicitFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(sinImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
sinImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
(
const scalar period,
const scalar phase,
const scalar amplitude,
const vector& direction,
const vector& up,
const vector& origin
)
:
period_(period),
phase_(phase),
amplitude_(amplitude),
up_(normalised(up)),
direction_(normalised(direction)),
origin_(origin)
{}
Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
(
const dictionary& dict
)
:
sinImplicitFunction
(
dict.get<scalar>("period"),
dict.getOrDefault<scalar>("phase", 0),
dict.get<scalar>("amplitude"),
dict.get<vector>("direction"),
dict.get<vector>("up"),
dict.get<vector>("origin")
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::sinImplicitFunction
Description
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
sinImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_sinImplicitFunction_H
#define implicitFunction_sinImplicitFunction_H
#include "implicitFunction.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class sinImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class sinImplicitFunction
:
public implicitFunction
{
private:
// Private Data
//- Origin point
const scalar period_;
//- Radius
const scalar phase_;
const scalar amplitude_;
const vector up_;
const vector direction_;
const vector origin_;
public:
//- Runtime type information
TypeName("sin");
// Constructors
//- Construct from components
sinImplicitFunction
(
const scalar period,
const scalar phase,
const scalar amplitude,
const vector& direction,
const vector& up,
const vector& origin
);
//- Construct from dictionary (used by implicitFunctions)
explicit sinImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~sinImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
const scalar x = (p - origin_) & direction_;
const scalar z = (p - origin_) & -up_;
return
z
- amplitude_
*Foam::sin(2*constant::mathematical::pi*x/period_ + phase_);
}
virtual vector grad(const vector& p) const
{
NotImplemented;
return Zero;
}
virtual scalar distanceToSurfaces(const vector& p) const
{
NotImplemented;
return 0;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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 "sphereImplicitFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
defineTypeNameAndDebug(sphereImplicitFunction, 0);
addToRunTimeSelectionTable
(
implicitFunction,
sphereImplicitFunction,
dict
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::implicitFunctions::sphereImplicitFunction::sphereImplicitFunction
(
const point& origin,
const scalar radius,
const scalar scale
)
:
origin_(origin),
radius_(radius),
scale_(scale)
{}
Foam::implicitFunctions::sphereImplicitFunction::sphereImplicitFunction
(
const dictionary& dict
)
:
sphereImplicitFunction
(
dict.get<point>("origin"),
dict.get<scalar>("radius"),
dict.getOrDefault<scalar>("scale", 1)
)
{}
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
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::implicitFunctions::sphereImplicitFunction
Description
Creates a sphere
Original code supplied by Henning Scheufler, DLR (2019)
SourceFiles
sphereImplicitFunction.C
\*---------------------------------------------------------------------------*/
#ifndef implicitFunction_sphereImplicitFunction_H
#define implicitFunction_sphereImplicitFunction_H
#include "implicitFunction.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace implicitFunctions
{
/*---------------------------------------------------------------------------*\
Class sphereImplicitFunction Declaration
\*---------------------------------------------------------------------------*/
class sphereImplicitFunction
:
public implicitFunction
{
// Private Data
//- Origin point
const point origin_;
//- Radius
const scalar radius_;
const scalar scale_;
public:
//- Runtime type information
TypeName("sphere");
// Constructors
//- Construct from components
sphereImplicitFunction
(
const point&,
const scalar radius,
const scalar scale
);
//- Construct from dictionary
explicit sphereImplicitFunction(const dictionary& dict);
//- Destructor
virtual ~sphereImplicitFunction() = default;
// Member Functions
virtual scalar value(const vector& p) const
{
return (-mag(p - origin_) + radius_)*scale_;
}
virtual vector grad(const vector& p) const
{
return (origin_ - p)*scale_;
}
virtual scalar distanceToSurfaces(const vector& p) const
{
return mag(mag(p - origin_) - radius_)*scale_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace implicitFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //