mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make PDRsetField ground, outer patch names configurable
- previously hard-coded, now adjustable within PDRsetFieldsDict
// Change some predefined patch names
patchNames
{
ground ground;
outer outer;
}
ENH: additions to PDRutils, improve comments
- expose enumerated expansion names and gridControl (PDRblock).
Not commonly needed, but useful to have access when defining
other grid generators
TUT: update PDRsetFieldsDict and tutorials to use "ground"
- remove tutorial references to unused types and legacy obstacles
- use "ground" for the boundary conditions instead of "seaGround".
Consistent with PDRblockMesh
This commit is contained in:
@ -1149,9 +1149,9 @@ static void tail_field
|
||||
const UList<PDRpatchDef>& patches
|
||||
)
|
||||
{
|
||||
// seaGround
|
||||
// ground
|
||||
{
|
||||
os.beginBlock("seaGround");
|
||||
os.beginBlock(pars.groundPatchName);
|
||||
os.writeKeyword("type") << wall_bc << token::END_STATEMENT << nl;
|
||||
putUniform(os, "value", deflt);
|
||||
os.endBlock();
|
||||
@ -1222,13 +1222,14 @@ static void tail_field
|
||||
os.endBlock();
|
||||
}
|
||||
|
||||
if ( pars.two_d )
|
||||
if (pars.two_d)
|
||||
{
|
||||
os.beginBlock("z_boundaries");
|
||||
os.writeEntry("type", "empty");
|
||||
os.endBlock();
|
||||
}
|
||||
if ( pars.outer_orthog )
|
||||
|
||||
if (pars.outer_orthog)
|
||||
{
|
||||
os.beginBlock("outer_inner");
|
||||
os.writeEntry("type", "cyclicAMI");
|
||||
@ -1285,9 +1286,10 @@ void write_scalarField
|
||||
os << nl;
|
||||
os.beginBlock("boundaryField");
|
||||
|
||||
|
||||
// outer
|
||||
{
|
||||
os.beginBlock("outer");
|
||||
os.beginBlock(pars.outerPatchName);
|
||||
|
||||
os.writeEntry("type", "inletOutlet");
|
||||
putUniform(os, "inletValue", deflt);
|
||||
@ -1329,7 +1331,8 @@ void write_uniformField
|
||||
|
||||
// outer
|
||||
{
|
||||
os.beginBlock("outer");
|
||||
os.beginBlock(pars.outerPatchName);
|
||||
|
||||
if (fieldName == "alphat" || fieldName == "nut")
|
||||
{
|
||||
// Different b.c. for alphat & nut
|
||||
@ -1377,17 +1380,17 @@ void write_pU_fields
|
||||
os << nl;
|
||||
os.beginBlock("boundaryField");
|
||||
|
||||
// "outer"
|
||||
// outer
|
||||
{
|
||||
os.beginBlock("outer");
|
||||
os.beginBlock(pars.outerPatchName);
|
||||
os.writeEntry("type", "inletOutlet");
|
||||
putUniform(os, "inletValue", vector::zero);
|
||||
os.endBlock();
|
||||
}
|
||||
|
||||
// seaGround
|
||||
// ground
|
||||
{
|
||||
os.beginBlock("seaGround");
|
||||
os.beginBlock(pars.groundPatchName);
|
||||
os.writeEntry("type", "zeroGradient");
|
||||
os.endBlock();
|
||||
}
|
||||
@ -1497,9 +1500,10 @@ void write_pU_fields
|
||||
os << nl;
|
||||
os.beginBlock("boundaryField");
|
||||
|
||||
// "outer"
|
||||
// outer
|
||||
{
|
||||
os.beginBlock("outer");
|
||||
os.beginBlock(pars.outerPatchName);
|
||||
|
||||
os.writeEntry("type", "waveTransmissive");
|
||||
os.writeEntry("gamma", 1.3);
|
||||
os.writeEntry("fieldInf", deflt);
|
||||
@ -1560,7 +1564,7 @@ void write_symmTensorField
|
||||
|
||||
// outer
|
||||
{
|
||||
os.beginBlock("outer");
|
||||
os.beginBlock(pars.outerPatchName);
|
||||
|
||||
os.writeEntry("type", "inletOutlet");
|
||||
putUniform(os, "inletValue", deflt);
|
||||
@ -1628,7 +1632,7 @@ void write_symmTensorFieldV
|
||||
|
||||
// outer
|
||||
{
|
||||
os.beginBlock("outer");
|
||||
os.beginBlock(pars.outerPatchName);
|
||||
|
||||
os.writeEntry("type", "inletOutlet");
|
||||
putUniform(os, "inletValue", deflt);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -84,6 +84,20 @@ void Foam::PDRparams::readDefaults(const dictionary& dict)
|
||||
dict.readIfPresent("blockageNoCT", blockageNoCT);
|
||||
dict.readIfPresent("scale", scale);
|
||||
|
||||
|
||||
const dictionary* dictptr;
|
||||
|
||||
groundPatchName = "ground";
|
||||
outerPatchName = "outer";
|
||||
|
||||
if ((dictptr = dict.findDict("patchNames")) != nullptr)
|
||||
{
|
||||
const dictionary& d = *dictptr;
|
||||
|
||||
d.readIfPresent("ground", groundPatchName);
|
||||
d.readIfPresent("outer", outerPatchName);
|
||||
}
|
||||
|
||||
UPatchBc = "fixedValue;value uniform (0 0 0)";
|
||||
if (dict.readIfPresent("UPatchBc", UPatchBc))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 Shell Research Ltd.
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,6 +62,13 @@ public:
|
||||
fileName obsfile_dir;
|
||||
wordList obsfile_names;
|
||||
word timeName;
|
||||
|
||||
//- The name for the "ground" patch
|
||||
word groundPatchName;
|
||||
|
||||
//- The name for the "outer" patch
|
||||
word outerPatchName;
|
||||
|
||||
string UPatchBc; //!< "fixedValue;value uniform (0 0 0)"
|
||||
|
||||
bool legacyMeshSpec{false};
|
||||
@ -136,7 +143,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
PDRparams() = default;
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,9 +29,6 @@ Namespace
|
||||
Description
|
||||
Utilities for PDR (eg, for setFields)
|
||||
|
||||
SourceFiles
|
||||
PDRUtils.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PDRutils_H
|
||||
@ -48,11 +45,17 @@ namespace Foam
|
||||
// Forward Declarations
|
||||
class PDRobstacle;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace PDRutils
|
||||
{
|
||||
|
||||
|
||||
} // End namespace PDRutils
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -264,6 +264,8 @@ public:
|
||||
);
|
||||
|
||||
//- Trim obstacle to ensure it is within the specified bounding box
|
||||
//- and return the intersection type.
|
||||
// Returns UNKNOWN for unknown types and invalid bounding boxes
|
||||
volumeType trim(const boundBox& bb);
|
||||
|
||||
//- Surface (points, faces) representation
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -199,8 +199,8 @@ Foam::scalar Foam::PDRobstacle::readFiles
|
||||
obs.dia() -= floatSMALL;
|
||||
|
||||
|
||||
// Trim against the mesh bounds
|
||||
// - ignore if it doesn't overlap
|
||||
// Trim against the mesh bounds.
|
||||
// Ignore if it doesn't overlap, or bounds are invalid
|
||||
const volumeType vt = obs.trim(meshBb);
|
||||
|
||||
switch (vt)
|
||||
@ -288,8 +288,8 @@ Foam::scalar Foam::PDRobstacle::readFiles
|
||||
obs.span += point::uniform(shift2);
|
||||
|
||||
|
||||
// Trim against the mesh bounds
|
||||
// - ignore if it doesn't overlap
|
||||
// Trim against the mesh bounds.
|
||||
// Ignore if it doesn't overlap, or bounds are invalid
|
||||
const volumeType vt = obs.trim(meshBb);
|
||||
|
||||
switch (vt)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 Shell Research Ltd.
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -385,8 +385,8 @@ Foam::scalar Foam::PDRlegacy::readObstacleFiles
|
||||
obs.dia() -= floatSMALL;
|
||||
|
||||
|
||||
// Trim against the mesh bounds
|
||||
// - ignore if it doesn't overlap
|
||||
// Trim against the mesh bounds.
|
||||
// Ignore if it doesn't overlap, or bounds are invalid
|
||||
const volumeType vt = obs.trim(meshBb);
|
||||
|
||||
switch (vt)
|
||||
@ -474,8 +474,8 @@ Foam::scalar Foam::PDRlegacy::readObstacleFiles
|
||||
obs.span += point::uniform(shift2);
|
||||
|
||||
|
||||
// Trim against the mesh bounds
|
||||
// - ignore if it doesn't overlap
|
||||
// Trim against the mesh bounds.
|
||||
// Ignore if it doesn't overlap, or bounds are invalid
|
||||
const volumeType vt = obs.trim(meshBb);
|
||||
|
||||
switch (vt)
|
||||
|
||||
@ -0,0 +1,171 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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::optionalData
|
||||
|
||||
Description
|
||||
A simplified version of std::optional (c++17), with much simpler
|
||||
construction semantics.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef optionalData_H
|
||||
#define optionalData_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class optionalData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class optionalData
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Validity of the value
|
||||
bool good_;
|
||||
|
||||
//- The value
|
||||
T value_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
optionalData(const optionalData<T>&) = default;
|
||||
|
||||
//- Move construct
|
||||
optionalData(optionalData<T>&&) = default;
|
||||
|
||||
//- Copy assignment
|
||||
optionalData<T>& operator=(const optionalData<T>&) = default;
|
||||
|
||||
//- Move assignment
|
||||
optionalData<T>& operator=(optionalData<T>&&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
optionalData()
|
||||
:
|
||||
good_(false),
|
||||
value_()
|
||||
{}
|
||||
|
||||
//- Copy construct from value
|
||||
optionalData(const T& val)
|
||||
:
|
||||
good_(true),
|
||||
value_(val)
|
||||
{}
|
||||
|
||||
//- Move construct from value
|
||||
optionalData(T&& val)
|
||||
:
|
||||
good_(true),
|
||||
value_(std::move(val))
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- True if it has a value
|
||||
bool has_value() const noexcept
|
||||
{
|
||||
return good_;
|
||||
}
|
||||
|
||||
//- Access to the value
|
||||
T& value() noexcept
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
//- Access to the value
|
||||
const T& value() const noexcept
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
//- Return value or default
|
||||
const T& value_or(const T& deflt) const
|
||||
{
|
||||
return good_ ? value_ : deflt;
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- True if it has a value
|
||||
explicit operator bool() const noexcept
|
||||
{
|
||||
return good_;
|
||||
}
|
||||
|
||||
//- Access the value
|
||||
const T& operator*() const noexcept
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
//- Access the value
|
||||
T& operator*() noexcept
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
//- Copy assignment from value
|
||||
void operator=(const T& val)
|
||||
{
|
||||
good_ = true;
|
||||
value_ = val;
|
||||
}
|
||||
|
||||
//- Move assignment from value
|
||||
void operator=(T&& val)
|
||||
{
|
||||
good_ = true;
|
||||
value_ = std::move(val);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user