Commit cb250f59 authored by sergio's avatar sergio Committed by Andrew Heather
Browse files

Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

parents 1a13cd27 a01b05b8
......@@ -13,23 +13,6 @@
mesh
);
// Add overset specific interpolations
{
dictionary oversetDict;
oversetDict.add("T", true);
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
......
......@@ -121,21 +121,14 @@ mesh.setFluxRequired(Phi.name());
#include "createMRF.H"
// Add overset specific interpolations
// Add solver-specific interpolations
{
dictionary oversetDict;
oversetDict.add("Phi", true);
oversetDict.add("U", true);
wordHashSet& nonInt =
const_cast<wordHashSet&>(Stencil::New(mesh).nonInterpolatedFields());
nonInt.insert("cellMask");
nonInt.insert("interpolatedCells");
const_cast<dictionary&>
(
mesh.schemesDict()
).add
(
"oversetInterpolationRequired",
oversetDict,
true
);
}
// Mask field for zeroing out contributions on hole cells
......
......@@ -25,12 +25,11 @@ Application
Description
Some tests for complex numbers
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "complex.H"
#include "complexVector.H"
#include "Field.H"
#include "complexFields.H"
using namespace Foam;
......@@ -52,15 +51,26 @@ int main(int argc, char *argv[])
<< "complex(scalar) : " << complex(3.14519) << nl
<< nl;
std::complex<scalar> c1(10, -3);
Info<< "std::complex : " << c1 << nl;
Info<< "sin: " << std::sin(c1) << nl;
Info<< "complexVector::zero : " << complexVector::zero << nl
<< "complexVector::one : " << complexVector::one << nl
<< nl;
// Comparison
for (complex c : { complex{1, 0}, complex{1, 2}} )
for (complex c : { complex{1, 0}, complex{1, 2}} )
{
Info<< nl;
print1(c);
Info<< "sin: " << sin(c) << nl;
Info<< "pow(3): " << pow(c, 3) << nl;
Info<< "pow3: " << pow3(c) << nl;
Info<< "log: " << log(c) << nl;
Info<< "pow025: " << pow025(c) << nl;
// TDB: allow implicit construct from scalar?
//
// if (c == 1.0)
......@@ -69,22 +79,46 @@ int main(int argc, char *argv[])
// }
}
Field<complex> fld1(3, complex(2.0, 1.0));
complexField fld1(3, complex(2.0, 1.0));
complexField fld2(fld1);
for (complex& c : fld2)
{
c = ~c;
}
Info<< "Field " << flatOutput(fld1) << nl;
Info<< "Conjugate: " << flatOutput(fld2) << nl;
// Some arbitrary change
for (complex& c : fld2)
{
c.Im() *= 5;
}
Info<< "sum = " << sum(fld1) << nl;
// Not yet Info<< "min = " << min(fld1) << nl;
fld1 *= 10;
Info<< "Multiply: " << flatOutput(fld1) << nl;
Info<< "scalar multiply: " << flatOutput(fld1) << nl;
for (complex& c : fld1)
{
c = ~c;
}
fld1 /= 10;
Info<< "scalar divide: " << flatOutput(fld1) << nl;
Info<< "sin: " << sin(fld1) << nl;
Info<< "operator + : " << (fld1 + fld2) << nl;
// Some operators are still incomplete
// Info<< "operator * : " << (fld1 * fld2) << nl;
// Info<< "operator / : " << (fld1 / fld2) << nl;
Info<< "operator / : " << (fld1 / 2) << nl;
// Info<< "operator / : " << (fld1 / fld2) << nl;
Info<< "sqrt : " << sqrt(fld1) << nl;
// Info<< "pow(2) : " << pow(fld1, 2) << nl;
Info<< "Conjugate: " << flatOutput(fld1) << nl;
Info<< "\nEnd\n" << endl;
return 0;
......
......@@ -217,6 +217,7 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
argList::addOption("dict", "file", "Use alternative extrudeMeshDict");
#include "setRootCase.H"
#include "createTimeExtruded.H"
......@@ -236,15 +237,19 @@ int main(int argc, char *argv[])
<< runTimeExtruded.timeName() << nl << endl;
}
IOdictionary dict
const IOdictionary dict
(
IOobject
IOobject::selectIO
(
"extrudeMeshDict",
runTimeExtruded.system(),
runTimeExtruded,
IOobject::MUST_READ_IF_MODIFIED
IOobject
(
"extrudeMeshDict",
runTimeExtruded.system(),
runTimeExtruded,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
),
args.opt<fileName>("dict", "")
)
);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -1691,19 +1691,41 @@ int main(int argc, char *argv[])
}
const bool mergePatchFaces
(
meshDict.lookupOrDefault("mergePatchFaces", true)
);
if (!mergePatchFaces)
// How to treat co-planar faces
meshRefinement::FaceMergeType mergeType =
meshRefinement::FaceMergeType::GEOMETRIC;
{
Info<< "Not merging patch-faces of cell to preserve"
<< " (split)hex cell shape."
<< nl << endl;
const bool mergePatchFaces
(
meshDict.lookupOrDefault("mergePatchFaces", true)
);
if (!mergePatchFaces)
{
Info<< "Not merging patch-faces of cell to preserve"
<< " (split)hex cell shape."
<< nl << endl;
mergeType = meshRefinement::FaceMergeType::NONE;
}
else
{
const bool mergeAcrossPatches
(
meshDict.lookupOrDefault("mergeAcrossPatches", false)
);
if (mergeAcrossPatches)
{
Info<< "Merging co-planar patch-faces of cells"
<< ", regardless of patch assignment"
<< nl << endl;
mergeType = meshRefinement::FaceMergeType::IGNOREPATCH;
}
}
}
if (wantRefine)
{
cpuTime timer;
......@@ -1732,7 +1754,7 @@ int main(int argc, char *argv[])
refineParams,
snapParams,
refineParams.handleSnapProblems(),
mergePatchFaces, // merge co-planar faces
mergeType,
motionDict
);
......@@ -1784,7 +1806,7 @@ int main(int argc, char *argv[])
(
snapDict,
motionDict,
mergePatchFaces,
mergeType,
curvature,
planarAngle,
snapParams
......@@ -1851,7 +1873,7 @@ int main(int argc, char *argv[])
layerDict,
motionDict,
layerParams,
mergePatchFaces,
mergeType,
preBalance,
decomposer,
distributor
......
......@@ -55,7 +55,7 @@ Description
#include "faceSet.H"
#include "pointSet.H"
#include "processorMeshes.H"
#include "hexRef8.H"
#include "hexRef8Data.H"
#ifdef HAVE_ZOLTAN
#include "zoltanRenumber.H"
......@@ -1327,8 +1327,24 @@ int main(int argc, char *argv[])
// Remove old procAddressing files
processorMeshes::removeFiles(mesh);
// Remove refinement data
hexRef8::removeFiles(mesh);
// Update refinement data
hexRef8Data refData
(
IOobject
(
"dummy",
mesh.facesInstance(),
polyMesh::meshSubDir,
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
);
refData.updateMesh(map());
refData.write();
// Update sets
topoSet::updateMesh(mesh.facesInstance(), map(), cellSets);
topoSet::updateMesh(mesh.facesInstance(), map(), faceSets);
......
......@@ -672,7 +672,8 @@ $(Fields)/quaternionField/quaternionField.C
$(Fields)/quaternionField/quaternionIOField.C
$(Fields)/triadField/triadField.C
$(Fields)/triadField/triadIOField.C
$(Fields)/complexFields/complexFields.C
$(Fields)/complex/complexField.C
$(Fields)/complex/complexVectorField.C
$(Fields)/transformField/transformField.C
$(Fields)/fieldTypes.C
......
......@@ -513,10 +513,6 @@ public:
//- Move assignment
inline bitSet& operator=(bitSet&& bitset);
//- Complement operator.
// Return a copy of the existing set with all its bits flipped.
inline bitSet operator~() const;
//- Bitwise-AND all the bits in other with the bits in this bitset.
// The operands may have dissimilar sizes without affecting the size
// of the set.
......@@ -555,14 +551,6 @@ public:
{
return *this;
}
// Housekeeping
//- Deprecated(2018-04) compatibility name for PackedBoolList
// \deprecated(2018-04) - use toc() method
inline labelList used() const { return toc(); }
};
......@@ -576,6 +564,9 @@ Ostream& operator<<(Ostream& os, const bitSet& bitset);
Ostream& operator<<(Ostream& os, const InfoProxy<bitSet>& info);
//- Bitset complement, returns a copy of the bitset with all its bits flipped
inline bitSet operator~(const bitSet& bitset);
//- Bitwise-AND of two bitsets.
// See bitSet::operator&= for more details.
inline bitSet operator&(const bitSet& a, const bitSet& b);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -663,14 +663,6 @@ inline Foam::bitSet& Foam::bitSet::operator=(bitSet&& bitset)
}
inline Foam::bitSet Foam::bitSet::operator~() const
{
bitSet result(*this);
result.flip();
return result;
}
inline Foam::bitSet& Foam::bitSet::operator&=(const bitSet& other)
{
return andEq(other);
......@@ -697,6 +689,14 @@ inline Foam::bitSet& Foam::bitSet::operator-=(const bitSet& other)
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline Foam::bitSet Foam::operator~(const bitSet& bitset)
{
bitSet result(bitset);
result.flip();
return result;
}
inline Foam::bitSet Foam::operator&(const bitSet& a, const bitSet& b)
{
bitSet result(a);
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 "complexField.H"
#include "addToRunTimeSelectionTable.H"
#define TEMPLATE
#include "FieldFunctionsM.C"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineCompoundTypeName(List<complex>, complexList);
addCompoundToRunTimeSelectionTable(List<complex>, complexList);
}
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
Foam::complexField Foam::ComplexField
(
const UList<scalar>& re,
const UList<scalar>& im
)
{
complexField cf(re.size());
forAll(cf, i)
{
cf[i].Re() = re[i];
cf[i].Im() = im[i];
}
return cf;
}
Foam::complexField Foam::ReComplexField(const UList<scalar>& re)
{
complexField cf(re.size());
forAll(cf, i)
{
cf[i].Re() = re[i];
cf[i].Im() = 0.0;
}
return cf;
}
Foam::complexField Foam::ImComplexField(const UList<scalar>& im)
{
complexField cf(im.size());
forAll(cf, i)
{
cf[i].Re() = 0.0;
cf[i].Im() = im[i];
}
return cf;
}
Foam::scalarField Foam::ReImSum(const UList<complex>& cf)
{
scalarField sf(cf.size());
forAll(sf, i)
{
sf[i] = cf[i].Re() + cf[i].Im();
}
return sf;
}
Foam::scalarField Foam::Re(const UList<complex>& cf)
{
scalarField sf(cf.size());
forAll(sf, i)
{
sf[i] = cf[i].Re();
}
return sf;
}
Foam::scalarField Foam::Im(const UList<complex>& cf)
{
scalarField sf(cf.size());
forAll(sf, i)
{
sf[i] = cf[i].Im();
}
return sf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
UNARY_FUNCTION(complex, complex, pow3)
UNARY_FUNCTION(complex, complex, pow4)
UNARY_FUNCTION(complex, complex, pow5)
UNARY_FUNCTION(complex, complex, pow6)
UNARY_FUNCTION(complex, complex, pow025)
UNARY_FUNCTION(complex, complex, sqrt)
UNARY_FUNCTION(complex, complex, exp)
UNARY_FUNCTION(complex, complex, log)
UNARY_FUNCTION(complex, complex, log10)
UNARY_FUNCTION(complex, complex, sin)
UNARY_FUNCTION(complex, complex, cos)
UNARY_FUNCTION(complex, complex, tan)
UNARY_FUNCTION(complex, complex, asin)
UNARY_FUNCTION(complex, complex, acos)
UNARY_FUNCTION(complex, complex, atan)
UNARY_FUNCTION(complex, complex, sinh)
UNARY_FUNCTION(complex, complex, cosh)
UNARY_FUNCTION(complex, complex, tanh)
UNARY_FUNCTION(complex, complex, asinh)
UNARY_FUNCTION(complex, complex, acosh)
UNARY_FUNCTION(complex, complex, atanh)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "undefFieldFunctionsM.H"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::complexField
Description
Specialisation of Field\<T\> for complex.
SourceFiles
complexField.C
\*---------------------------------------------------------------------------*/
#ifndef complexField_H
#define complexField_H
#include "complex.H"
#include "scalarField.H"
#define TEMPLATE
</