Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2008-07-07 08:22:16 +02:00
80 changed files with 4456 additions and 1015 deletions

View File

@ -84,7 +84,8 @@ void Foam::vtkPV3Foam::AddToBlock
output->SetBlock(blockNo, block);
block->Delete();
}
else
if (block)
{
if (debug)
{

View File

@ -28,8 +28,6 @@ License
#include "Time.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
@ -57,8 +55,7 @@ timeVaryingUniformFixedValuePointPatchField
)
:
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
timeSeries_(ptf.timeSeries_)
{}
@ -73,8 +70,7 @@ timeVaryingUniformFixedValuePointPatchField
)
:
fixedValuePointPatchField<Type>(p, iF),
timeDataFile_(dict.lookup("timeDataFile")),
timeSeries_(word(dict.lookup("timeBounding")))
timeSeries_(this->db(), dict)
{
updateCoeffs();
}
@ -89,8 +85,7 @@ timeVaryingUniformFixedValuePointPatchField
)
:
fixedValuePointPatchField<Type>(ptf),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
timeSeries_(ptf.timeSeries_)
{}
@ -104,67 +99,12 @@ timeVaryingUniformFixedValuePointPatchField
)
:
fixedValuePointPatchField<Type>(ptf, iF),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
timeSeries_(ptf.timeSeries_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type
Foam::timeVaryingUniformFixedValuePointPatchField<Type>::
currentValue()
{
if (timeSeries_.size() == 0)
{
fileName fName(timeDataFile_);
fName.expand();
if (fName.size() == 0)
{
FatalErrorIn
(
"timeVaryingUniformFixedValuePointPatchField"
"::currentValue()"
) << "timeDataFile not specified for Patch "
<< this->patch().name()
<< exit(FatalError);
}
else
{
// relative path
if (fName[0] != '/')
{
fName = this->db().path()/fName;
}
// just in case we change the interface to timeSeries
word boundType = timeBounding();
IFstream(fName)() >> timeSeries_;
timeSeries_.bounding(boundType);
// be a bit paranoid and check that the list is okay
timeSeries_.check();
}
if (timeSeries_.size() == 0)
{
FatalErrorIn
(
"timeVaryingUniformFixedValuePointPatchField"
"::currentValue()"
) << "empty time series for Patch "
<< this->patch().name()
<< exit(FatalError);
}
}
return timeSeries_(this->db().time().timeOutputValue());
}
template<class Type>
void Foam::timeVaryingUniformFixedValuePointPatchField<Type>::updateCoeffs()
{
@ -173,7 +113,7 @@ void Foam::timeVaryingUniformFixedValuePointPatchField<Type>::updateCoeffs()
return;
}
this->operator==(currentValue());
this->operator==(timeSeries_(this->db().time().timeOutputValue()));
fixedValuePointPatchField<Type>::updateCoeffs();
}
@ -182,13 +122,8 @@ template<class Type>
void Foam::timeVaryingUniformFixedValuePointPatchField<Type>::write(Ostream& os) const
{
fixedValuePointPatchField<Type>::write(os);
os.writeKeyword("timeDataFile")
<< timeDataFile_ << token::END_STATEMENT << nl;
os.writeKeyword("timeBounding")
<< timeBounding() << token::END_STATEMENT << nl;
timeSeries_.write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -40,7 +40,7 @@ SourceFiles
#define timeVaryingUniformFixedValuePointPatchField_H
#include "fixedValuePointPatchField.H"
#include "timeSeries.H"
#include "interpolationTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,14 +58,9 @@ class timeVaryingUniformFixedValuePointPatchField
{
// Private data
//- file containing time/uniformFixedValue
fileName timeDataFile_;
//- the time series being used, including the bounding treatment
timeSeries<Type> timeSeries_;
interpolationTable<Type> timeSeries_;
//- interpolate the value at the current time
Type currentValue();
public:
@ -138,14 +133,8 @@ public:
// Access
//- Return the out-of-bounds treatment as a word
word timeBounding() const
{
return timeSeries_.bounding();
}
//- Return the time series used
const timeSeries<Type>& timeData() const
const interpolationTable<Type>& timeSeries() const
{
return timeSeries_;
}

View File

@ -0,0 +1,482 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "interpolationTable.H"
#include "IFstream.H"
#include "objectRegistry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::interpolationTable<Type>::interpolationTable()
:
List<Tuple2<scalar, Type> >(),
dict_(dictionary::null),
boundAction_(interpolationTable::WARN),
fileName_("undefined_fileName")
{}
template<class Type>
Foam::interpolationTable<Type>::interpolationTable
(
const objectRegistry& obr,
const dictionary& dict
)
:
List<Tuple2<scalar, Type> >(),
dict_(dict),
boundAction_(wordToBoundAction(dict.lookup("boundAction"))),
fileName_(dict.lookup("fileName"))
{
fileName_.expand();
// Correct for relative path
if (fileName_[0] != '/')
{
fileName_ = obr.db().path()/fileName_;
}
// Read data from file
IFstream(fileName_)() >> *this;
// Check that the data is okay
check();
if (this->size() == 0)
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::interpolationTable"
"(const dictionary& dict)"
) << "table is empty" << nl
<< exit(FatalError);
}
}
template<class Type>
Foam::interpolationTable<Type>::interpolationTable
(
const interpolationTable& interpTable
)
:
List<Tuple2<scalar, Type> >(interpTable),
dict_(interpTable.dict_),
boundAction_(interpTable.boundAction_),
fileName_(interpTable.fileName_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::interpolationTable<Type>::~interpolationTable()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::word Foam::interpolationTable<Type>::boundActionToWord
(
const boundActions& bound
) const
{
word enumName("warn");
switch (bound)
{
case interpolationTable::ERROR:
{
enumName = "error";
break;
}
case interpolationTable::WARN:
{
enumName = "warn";
break;
}
case interpolationTable::CLAMP:
{
enumName = "clamp";
break;
}
case interpolationTable::REPEAT:
{
enumName = "repeat";
break;
}
}
return enumName;
}
template<class Type>
typename Foam::interpolationTable<Type>::boundActions
Foam::interpolationTable<Type>::wordToBoundAction
(
const word& bound
) const
{
if (bound == "error")
{
return interpolationTable::ERROR;
}
else if (bound == "warn")
{
return interpolationTable::WARN;
}
else if (bound == "clamp")
{
return interpolationTable::CLAMP;
}
else if (bound == "repeat")
{
return interpolationTable::REPEAT;
}
else
{
WarningIn
(
"Foam::interpolationTable<Type>::wordToBoundAction(const word&)"
) << "bad bounding specifier " << bound << " using 'warn'" << endl;
return interpolationTable::WARN;
}
}
template<class Type>
void Foam::interpolationTable<Type>::check() const
{
label n = size();
scalar prevValue = List<Tuple2<scalar, Type> >::operator[](0).first();
for (label i=1; i<n; ++i)
{
const scalar currValue =
List<Tuple2<scalar, Type> >::operator[](i).first();
// avoid duplicate values (divide-by-zero error)
if (currValue <= prevValue)
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::checkOrder() const"
) << "out-of-order value: "
<< currValue << " at index " << i << nl
<< exit(FatalError);
}
prevValue = currValue;
}
}
template<class Type>
typename Foam::interpolationTable<Type>::boundActions
Foam::interpolationTable<Type>::boundAction
(
const boundActions& bound
)
{
boundActions prev = boundAction_;
boundAction_ = bound;
return prev;
}
template<class Type>
void Foam::interpolationTable<Type>::write(Ostream& os) const
{
os.writeKeyword("fileName")
<< fileName_ << token::END_STATEMENT << nl;
os.writeKeyword("boundAction")
<< boundActionToWord(boundAction_) << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
const Foam::Tuple2<Foam::scalar, Type>&
Foam::interpolationTable<Type>::operator[](const label i) const
{
label ii = i;
label n = size();
if (n <= 1)
{
ii = 0;
}
else if (ii < 0)
{
switch (boundAction_)
{
case interpolationTable::ERROR:
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const label) const"
) << "index (" << ii << ") underflow" << nl
<< exit(FatalError);
break;
}
case interpolationTable::WARN:
{
WarningIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const label) const"
) << "index (" << ii << ") underflow" << nl
<< " Continuing with the first entry"
<< endl;
// fall-through to 'CLAMP'
}
case interpolationTable::CLAMP:
{
ii = 0;
break;
}
case interpolationTable::REPEAT:
{
while (ii < 0)
{
ii += n;
}
break;
}
}
}
else if (ii >= n)
{
switch (boundAction_)
{
case interpolationTable::ERROR:
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const label) const"
) << "index (" << ii << ") overflow" << nl
<< exit(FatalError);
break;
}
case interpolationTable::WARN:
{
WarningIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const label) const"
) << "index (" << ii << ") overflow" << nl
<< " Continuing with the last entry"
<< endl;
// fall-through to 'CLAMP'
}
case interpolationTable::CLAMP:
{
ii = n - 1;
break;
}
case interpolationTable::REPEAT:
{
while (ii >= n)
{
ii -= n;
}
break;
}
}
}
return List<Tuple2<scalar, Type> >::operator[](ii);
}
template<class Type>
Type Foam::interpolationTable<Type>::operator()(const scalar value) const
{
label n = size();
if (n <= 1)
{
return List<Tuple2<scalar, Type> >::operator[](0).second();
}
scalar minLimit = List<Tuple2<scalar, Type> >::operator[](0).first();
scalar maxLimit = List<Tuple2<scalar, Type> >::operator[](n-1).first();
scalar lookupValue = value;
if (lookupValue < minLimit)
{
switch (boundAction_)
{
case interpolationTable::ERROR:
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const scalar) const"
) << "value (" << lookupValue << ") underflow" << nl
<< exit(FatalError);
break;
}
case interpolationTable::WARN:
{
WarningIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const scalar) const"
) << "value (" << lookupValue << ") underflow" << nl
<< " Continuing with the first entry"
<< endl;
// fall-through to 'CLAMP'
}
case interpolationTable::CLAMP:
{
return List<Tuple2<scalar, Type> >::operator[](0).second();
break;
}
case interpolationTable::REPEAT:
{
// adjust lookupValue to >= 0
while (lookupValue < 0)
{
lookupValue += maxLimit;
}
break;
}
}
}
else if (lookupValue >= maxLimit)
{
switch (boundAction_)
{
case interpolationTable::ERROR:
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const label) const"
) << "value (" << lookupValue << ") overflow" << nl
<< exit(FatalError);
break;
}
case interpolationTable::WARN:
{
WarningIn
(
"Foam::interpolationTable<Type>::operator[]"
"(const label) const"
) << "value (" << lookupValue << ") overflow" << nl
<< " Continuing with the last entry"
<< endl;
// fall-through to 'CLAMP'
}
case interpolationTable::CLAMP:
{
return List<Tuple2<scalar, Type> >::operator[](n-1).second();
break;
}
case interpolationTable::REPEAT:
{
// adjust lookupValue <= maxLimit
while (lookupValue > maxLimit)
{
lookupValue -= maxLimit;
}
break;
}
}
}
label lo = 0;
label hi = 0;
// look for the correct range
for (label i = 0; i < n; ++i)
{
if (lookupValue >= List<Tuple2<scalar, Type> >::operator[](i).first())
{
lo = hi = i;
}
else
{
hi = i;
break;
}
}
if (lo == hi)
{
// we are at the end of the table - or there is only a single entry
return List<Tuple2<scalar, Type> >::operator[](hi).second();
}
else if (hi == 0)
{
// this treatment should should only occur under these conditions:
// -> the 'REPEAT' treatment
// -> (0 <= value <= minLimit)
// -> minLimit > 0
// Use the value at maxLimit as the value for value=0
lo = n - 1;
return
(
List<Tuple2<scalar, Type> >::operator[](lo).second()
+ (
List<Tuple2<scalar, Type> >::operator[](hi).second()
- List<Tuple2<scalar, Type> >::operator[](lo).second()
)
*(lookupValue / minLimit)
);
}
else
{
// normal interpolation
return
(
List<Tuple2<scalar, Type> >::operator[](lo).second()
+ (
List<Tuple2<scalar, Type> >::operator[](hi).second()
- List<Tuple2<scalar, Type> >::operator[](lo).second()
)
*(
lookupValue
- List<Tuple2<scalar, Type> >::operator[](lo).first()
)
/(
List<Tuple2<scalar, Type> >::operator[](hi).first()
- List<Tuple2<scalar, Type> >::operator[](lo).first()
)
);
}
}
// ************************************************************************* //

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeSeries
Foam::interpolationTable
Description
A list of times and values.
@ -40,12 +40,12 @@ Note
- Accessing a list with a single element will always return the same value.
SourceFiles
timeSeries.C
interpolationTable.C
\*---------------------------------------------------------------------------*/
#ifndef timeSeries_H
#define timeSeries_H
#ifndef interpolationTable_H
#define interpolationTable_H
#include "List.H"
#include "Tuple2.H"
@ -55,21 +55,23 @@ SourceFiles
namespace Foam
{
class objectRegistry;
/*---------------------------------------------------------------------------*\
Class timeSeries Declaration
Class interpolationTable Declaration
\*---------------------------------------------------------------------------*/
template<class T>
class timeSeries
template<class Type>
class interpolationTable
:
public List<Tuple2<scalar, T> >
public List<Tuple2<scalar, Type> >
{
public:
// Public data types
//- Enumeration for handling out-of-bound times
enum bounds
//- Enumeration for handling out-of-bound values
enum boundActions
{
ERROR, /*!< Exit with a FatalError */
WARN, /*!< Issue warning and clamp value (default) */
@ -77,32 +79,38 @@ public:
REPEAT /*!< Treat as a repeating list */
};
private:
// Private data
//- Enumeration for handling out-of-bound times
bounds bounding_;
//- Parent dictionary
const dictionary& dict_;
//- Enumeration for handling out-of-bound values
boundActions boundAction_;
//- File name
fileName fileName_;
public:
// Constructors
//- Construct null, optionally with a given bounding
timeSeries(const bounds = timeSeries::WARN);
//- Construct null
interpolationTable();
//- Construct null with a given bounding
timeSeries(const word&);
//- Construct from objectRegistry and dictionary
interpolationTable(const objectRegistry& obr, const dictionary& dict);
//- Construct from Istream, optionally with a given bounding
timeSeries(Istream&, const bounds = timeSeries::WARN);
//- Construct copy
interpolationTable(const interpolationTable& interpTable);
//- Construct from Istream with a given bounding
timeSeries(Istream&, const word&);
// Destructor
//- Destructor
~interpolationTable();
~timeSeries();
// Member Functions
@ -111,11 +119,15 @@ public:
//- Return the size
label size() const
{
return List<Tuple2<scalar, T> >::size();
return List<Tuple2<scalar, Type> >::size();
}
//- Return the out-of-bounds treatment as a word
word bounding() const;
word boundActionToWord(const boundActions& bound) const;
//- Return the out-of-bounds treatment as an enumeration
boundActions wordToBoundAction(const word& bound) const;
// Check
@ -123,40 +135,40 @@ public:
// Exit with a FatalError if there is a problem
void check() const;
// Edit
//- Set the out-of-bounds treatment from enum, return previous setting
bounds bounding(const bounds& bound)
{
bounds prev = bounding_;
bounding_ = bound;
return prev;
}
//- Set the out-of-bounds treatment from enum, return previous
// setting
boundActions boundAction(const boundActions& bound);
//- Set the out-of-bounds treatment from word
void bounding(const word& bound);
// Member Operators
//- Return an element of constant Tuple2<scalar, T>
const Tuple2<scalar, T>& operator[](const label) const;
//- Return an element of constant Tuple2<scalar, Type>
const Tuple2<scalar, Type>& operator[](const label) const;
//- Return an interpolated value
T operator()(const scalar) const;
Type operator()(const scalar) const;
// I-O
//- Write
void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "timeSeries.C"
# include "interpolationTable.C"
#endif
#endif
// ************************************************************************* //

View File

@ -1,402 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeSeries.H"
#include "Istream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<typename T>
Foam::timeSeries<T>::timeSeries(const bounds bound)
:
List<Tuple2<scalar, T> >(),
bounding_(bound)
{}
template<typename T>
Foam::timeSeries<T>::timeSeries(const word& bound)
:
List<Tuple2<scalar, T> >(),
bounding_(timeSeries::WARN)
{
bounding(bound);
}
template<typename T>
Foam::timeSeries<T>::timeSeries(Istream& is, const bounds bound)
:
List<Tuple2<scalar, T> >(is),
bounding_(bound)
{}
template<typename T>
Foam::timeSeries<T>::timeSeries(Istream& is, const word& bound)
:
List<Tuple2<scalar, T> >(is),
bounding_(timeSeries::WARN)
{
bounding(bound);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<typename T>
Foam::timeSeries<T>::~timeSeries()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<typename T>
Foam::word Foam::timeSeries<T>::bounding() const
{
word enumName("warn");
switch (bounding_)
{
case timeSeries::ERROR:
enumName = "error";
break;
case timeSeries::WARN:
enumName = "warn";
break;
case timeSeries::CLAMP:
enumName = "clamp";
break;
case timeSeries::REPEAT:
enumName = "repeat";
break;
}
return enumName;
}
template<typename T>
void Foam::timeSeries<T>::bounding(const word& bound)
{
if (bound == "error")
{
bounding_ = timeSeries::ERROR;
}
else if (bound == "warn")
{
bounding_ = timeSeries::WARN;
}
else if (bound == "clamp")
{
bounding_ = timeSeries::CLAMP;
}
else if (bound == "repeat")
{
bounding_ = timeSeries::REPEAT;
}
else
{
WarningIn("Foam::timeSeries<T>::boundingEnum(const word&)")
<< "bad bounding specifier " << bound << " using 'warn'" << endl;
bounding_ = timeSeries::WARN;
}
}
template<typename T>
void Foam::timeSeries<T>::check() const
{
label n = size();
scalar prevTime = List<Tuple2<scalar, T> >::operator[](0).first();
for (label i = 1; i < n; ++i)
{
const scalar currTime = List<Tuple2<scalar, T> >::operator[](i).first();
// avoid duplicate times (divide-by-zero error)
if (currTime <= prevTime)
{
FatalErrorIn
(
"Foam::timeSeries<T>::checkOrder() const"
) << "out-of-order time: "
<< currTime << " at index " << i << nl
<< exit(FatalError);
}
prevTime = currTime;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<typename T>
const Foam::Tuple2<Foam::scalar, T>&
Foam::timeSeries<T>::operator[](const label i) const
{
label ii = i;
label n = size();
if (n <= 1)
{
ii = 0;
}
else if (ii < 0)
{
switch (bounding_)
{
case timeSeries::ERROR:
FatalErrorIn
(
"Foam::timeSeries<T>::operator[](const label) const"
) << "index (" << ii << ") underflow" << nl
<< exit(FatalError);
break;
case timeSeries::WARN:
WarningIn
(
"Foam::timeSeries<T>::operator[](const label) const"
) << "index (" << ii << ") underflow" << nl
<< " Continuing with the first entry"
<< endl;
// fall-through to 'CLAMP'
case timeSeries::CLAMP:
ii = 0;
break;
case timeSeries::REPEAT:
while (ii < 0)
{
ii += n;
}
break;
}
}
else if (ii >= n)
{
switch (bounding_)
{
case timeSeries::ERROR:
FatalErrorIn
(
"Foam::timeSeries<T>::operator[](const label) const"
) << "index (" << ii << ") overflow" << nl
<< exit(FatalError);
break;
case timeSeries::WARN:
WarningIn
(
"Foam::timeSeries<T>::operator[](const label) const"
) << "index (" << ii << ") overflow" << nl
<< " Continuing with the last entry"
<< endl;
// fall-through to 'CLAMP'
case timeSeries::CLAMP:
ii = n - 1;
break;
case timeSeries::REPEAT:
while (ii >= n)
{
ii -= n;
}
break;
}
}
return List<Tuple2<scalar, T> >::operator[](ii);
}
template<typename T>
T Foam::timeSeries<T>::operator()(const scalar timeValue) const
{
label n = size();
if (n <= 1)
{
return List<Tuple2<scalar, T> >::operator[](0).second();
}
scalar minTime = List<Tuple2<scalar, T> >::operator[](0).first();
scalar maxTime = List<Tuple2<scalar, T> >::operator[](n-1).first();
scalar lookupTime = timeValue;
if (lookupTime < minTime)
{
switch (bounding_)
{
case timeSeries::ERROR:
FatalErrorIn
(
"Foam::timeSeries<T>::operator[](const scalar) const"
) << "time (" << lookupTime << ") underflow" << nl
<< exit(FatalError);
break;
case timeSeries::WARN:
WarningIn
(
"Foam::timeSeries<T>::operator[](const scalar) const"
) << "time (" << lookupTime << ") underflow" << nl
<< " Continuing with the first entry"
<< endl;
// fall-through to 'CLAMP'
case timeSeries::CLAMP:
return List<Tuple2<scalar, T> >::operator[](0).second();
break;
case timeSeries::REPEAT:
// adjust lookupTime to >= 0
while (lookupTime < 0)
{
lookupTime += maxTime;
}
break;
}
}
else if (lookupTime >= maxTime)
{
switch (bounding_)
{
case timeSeries::ERROR:
FatalErrorIn
(
"Foam::timeSeries<T>::operator[](const label) const"
) << "time (" << lookupTime << ") overflow" << nl
<< exit(FatalError);
break;
case timeSeries::WARN:
WarningIn
(
"Foam::timeSeries<T>::operator[](const label) const"
) << "time (" << lookupTime << ") overflow" << nl
<< " Continuing with the last entry"
<< endl;
// fall-through to 'CLAMP'
case timeSeries::CLAMP:
return List<Tuple2<scalar, T> >::operator[](n-1).second();
break;
case timeSeries::REPEAT:
// adjust lookupTime <= maxTime
while (lookupTime > maxTime)
{
lookupTime -= maxTime;
}
break;
}
}
label lo = 0;
label hi = 0;
// look for the correct range
for (label i = 0; i < n; ++i)
{
if (lookupTime >= List<Tuple2<scalar, T> >::operator[](i).first())
{
lo = hi = i;
}
else
{
hi = i;
break;
}
}
if (lo == hi)
{
// we are at the end of the table - or there is only a single entry
return List<Tuple2<scalar, T> >::operator[](hi).second();
}
else if (hi == 0)
{
// this treatment should should only occur under these condition:
// -> the 'REPEAT' treatment
// -> (0 <= time <= minTime)
// -> minTime > 0
// Use the value at maxTime as the value for time=0
lo = n - 1;
return
(
List<Tuple2<scalar, T> >::operator[](lo).second()
+
(
List<Tuple2<scalar, T> >::operator[](hi).second()
- List<Tuple2<scalar, T> >::operator[](lo).second()
)
* (lookupTime / minTime)
);
}
else
{
// normal interpolation
return
(
List<Tuple2<scalar, T> >::operator[](lo).second()
+
(
List<Tuple2<scalar, T> >::operator[](hi).second()
- List<Tuple2<scalar, T> >::operator[](lo).second()
)
*
(
lookupTime
- List<Tuple2<scalar, T> >::operator[](lo).first()
)
/
(
List<Tuple2<scalar, T> >::operator[](hi).first()
- List<Tuple2<scalar, T> >::operator[](lo).first()
)
);
}
}
// ************************************************************************* //

View File

@ -78,7 +78,7 @@ $(derivedFvPatchFields)/freestream/freestreamFvPatchFields.C
$(derivedFvPatchFields)/freestreamPressure/freestreamPressureFvPatchScalarField.C
$(derivedFvPatchFields)/inletOutlet/inletOutletFvPatchFields.C
$(derivedFvPatchFields)/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C
$(derivedFvPatchFields)/massFlowRateInletVelocity/massFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields.C
$(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C
@ -96,7 +96,7 @@ $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVe
$(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C
$(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/timeVaryingMassFlowRateInletVelocity/timeVaryingMassFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/timeVaryingFlowRateInletVelocity/timeVaryingFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
$(derivedFvPatchFields)/timeVaryingUniformTotalPressure/timeVaryingUniformTotalPressureFvPatchScalarField.C

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "massFlowRateInletVelocityFvPatchVectorField.H"
#include "flowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
@ -33,38 +33,40 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
massFlowRateInletVelocityFvPatchVectorField::
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField::
flowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
massFlowRate_(0),
flowRate_(0),
phiName_("phi"),
rhoName_("rho")
{}
Foam::
massFlowRateInletVelocityFvPatchVectorField::
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField::
flowRateInletVelocityFvPatchVectorField
(
const massFlowRateInletVelocityFvPatchVectorField& ptf,
const flowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
massFlowRate_(ptf.massFlowRate_),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::
massFlowRateInletVelocityFvPatchVectorField::
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField::
flowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
@ -72,7 +74,7 @@ massFlowRateInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
massFlowRate_(readScalar(dict.lookup("massFlowRate"))),
flowRate_(readScalar(dict.lookup("flowRate"))),
phiName_("phi"),
rhoName_("rho")
{
@ -87,29 +89,31 @@ massFlowRateInletVelocityFvPatchVectorField
}
}
Foam::
massFlowRateInletVelocityFvPatchVectorField::
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField::
flowRateInletVelocityFvPatchVectorField
(
const massFlowRateInletVelocityFvPatchVectorField& ptf
const flowRateInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
massFlowRate_(ptf.massFlowRate_),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::
massFlowRateInletVelocityFvPatchVectorField::
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField::
flowRateInletVelocityFvPatchVectorField
(
const massFlowRateInletVelocityFvPatchVectorField& ptf,
const flowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
massFlowRate_(ptf.massFlowRate_),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
@ -117,7 +121,7 @@ massFlowRateInletVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::massFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
@ -125,7 +129,7 @@ void Foam::massFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
// a simpler way of doing this would be nice
scalar avgU = -massFlowRate_/gSum(patch().magSf());
scalar avgU = -flowRate_/gSum(patch().magSf());
vectorField n = patch().nf();
@ -151,23 +155,23 @@ void Foam::massFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
FatalErrorIn
(
"massFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
"flowRateInletVelocityFvPatchVectorField::updateCoeffs()"
) << "dimensions of phi are incorrect"
<< "\n on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
<< nl << exit(FatalError);
}
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::massFlowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("massFlowRate") << massFlowRate_
os.writeKeyword("flowRate") << flowRate_
<< token::END_STATEMENT << nl;
if (phiName_ != "phi")
@ -191,7 +195,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField
);
}

View File

@ -23,19 +23,22 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::massFlowRateInletVelocityFvPatchVectorField
Foam::flowRateInletVelocityFvPatchVectorField
Description
Describes an massflow normal vector boundary condition by its magnitude
as an integral over its area.
The current density is used to correct the velocity.
Describes an volumetric/mass flow normal vector boundary condition by its
magnitude as an integral over its area.
The basis of the patch (volumetric or mass) is determined by the
dimensions of the flux, phi.
The current density is used to correct the velocity when applying the mass
basis.
Example of the boundary condition specification:
@verbatim
inlet
{
type massFlowRateInletVelocity;
massFlowRate 0.2; // Mass flow rate [kg/s]
type flowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
}
@endverbatim
@ -46,12 +49,12 @@ Note
- Strange behaviour with potentialFoam since the U equation is not solved
SourceFiles
massFlowRateInletVelocityFvPatchVectorField.C
flowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef massFlowRateInletVelocityFvPatchVectorField_H
#define massFlowRateInletVelocityFvPatchVectorField_H
#ifndef flowRateInletVelocityFvPatchVectorField_H
#define flowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
@ -60,17 +63,17 @@ SourceFiles
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class massFlowRateInletVelocityFvPatch Declaration
Class flowRateInletVelocityFvPatch Declaration
\*---------------------------------------------------------------------------*/
class massFlowRateInletVelocityFvPatchVectorField
class flowRateInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Inlet integral mass flow rate
scalar massFlowRate_;
//- Inlet integral flow rate
scalar flowRate_;
//- Name of the flux transporting the field
word phiName_;
@ -82,20 +85,20 @@ class massFlowRateInletVelocityFvPatchVectorField
public:
//- Runtime type information
TypeName("massFlowRateInletVelocity");
TypeName("flowRateInletVelocity");
// Constructors
//- Construct from patch and internal field
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
@ -103,20 +106,20 @@ public:
);
//- Construct by mapping given
// massFlowRateInletVelocityFvPatchVectorField
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField
(
const massFlowRateInletVelocityFvPatchVectorField&,
const flowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField
(
const massFlowRateInletVelocityFvPatchVectorField&
const flowRateInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
@ -124,14 +127,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new massFlowRateInletVelocityFvPatchVectorField(*this)
new flowRateInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
massFlowRateInletVelocityFvPatchVectorField
flowRateInletVelocityFvPatchVectorField
(
const massFlowRateInletVelocityFvPatchVectorField&,
const flowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -143,7 +146,7 @@ public:
{
return tmp<fvPatchVectorField>
(
new massFlowRateInletVelocityFvPatchVectorField(*this, iF)
new flowRateInletVelocityFvPatchVectorField(*this, iF)
);
}
@ -152,16 +155,16 @@ public:
// Access
//- Return the mass flux
scalar massFlowRate() const
//- Return the flux
scalar flowRate() const
{
return massFlowRate_;
return flowRate_;
}
//- Return reference to the mass flux to allow adjustment
scalar& massFlowRate()
//- Return reference to the flux to allow adjustment
scalar& flowRate()
{
return massFlowRate_;
return flowRate_;
}

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2006-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeVaryingFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
#include "Time.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
flowRateInletVelocityFvPatchVectorField(p, iF),
timeSeries_()
{}
Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
flowRateInletVelocityFvPatchVectorField(ptf, p, iF, mapper),
timeSeries_(ptf.timeSeries_)
{}
Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
flowRateInletVelocityFvPatchVectorField(p, iF, dict),
timeSeries_(this->db(), dict)
{}
Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf
)
:
flowRateInletVelocityFvPatchVectorField(ptf),
timeSeries_(ptf.timeSeries_)
{}
Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingFlowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
flowRateInletVelocityFvPatchVectorField(ptf, iF),
timeSeries_(ptf.timeSeries_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
updateCoeffs()
{
if (updated())
{
return;
}
flowRate() = timeSeries_(this->db().time().timeOutputValue());
flowRateInletVelocityFvPatchVectorField::updateCoeffs();
}
void Foam::
timeVaryingFlowRateInletVelocityFvPatchVectorField::
write(Ostream& os) const
{
flowRateInletVelocityFvPatchVectorField::write(os);
timeSeries_.write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
timeVaryingFlowRateInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -23,20 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeVaryingMassFlowRateInletVelocityFvPatchVectorField
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField
Description
A time-varying form of a massflow normal vector boundary condition.
A time-varying form of a flow normal vector boundary condition.
Example of the boundary condition specification:
@verbatim
inlet
{
type timeVaryingMassFlowRateInletVelocity;
massFlowRate 0.2; // Massflow rate [kg/s]
type timeVaryingFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
timeDataFile "time-series";
timeBounding repeat; // (error|warn|clamp|repeat)
fileName "time-series";
boundAction repeat; // (error|warn|clamp|repeat)
}
@endverbatim
@ -46,58 +46,54 @@ Note
- strange behaviour with potentialFoam since the U equation is not solved
See Also
Foam::timeSeries and Foam::massFlowRateInletVelocityFvPatchVectorField
Foam::timeSeries and Foam::flowRateInletVelocityFvPatchVectorField
SourceFiles
timeVaryingMassFlowRateInletVelocityFvPatchVectorField.C
timeVaryingFlowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef timeVaryingMassFlowRateInletVelocityFvPatchVectorField_H
#define timeVaryingMassFlowRateInletVelocityFvPatchVectorField_H
#ifndef timeVaryingFlowRateInletVelocityFvPatchVectorField_H
#define timeVaryingFlowRateInletVelocityFvPatchVectorField_H
#include "flowRateInletVelocityFvPatchVectorField.H"
#include "interpolationTable.H"
#include "massFlowRateInletVelocityFvPatchVectorField.H"
#include "timeSeries.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeVaryingMassFlowRateInletVelocityFvPatch Declaration
Class timeVaryingFlowRateInletVelocityFvPatch Declaration
\*---------------------------------------------------------------------------*/
class timeVaryingMassFlowRateInletVelocityFvPatchVectorField
class timeVaryingFlowRateInletVelocityFvPatchVectorField
:
public massFlowRateInletVelocityFvPatchVectorField
public flowRateInletVelocityFvPatchVectorField
{
// Private data
//- file containing time/massFlowRate
fileName timeDataFile_;
//- the time series being used, including the bounding treatment
timeSeries<scalar> timeSeries_;
interpolationTable<scalar> timeSeries_;
//- interpolate the value at the current time
scalar currentValue();
public:
//- Runtime type information
TypeName("timeVaryingMassFlowRateInletVelocity");
TypeName("timeVaryingFlowRateInletVelocity");
// Constructors
//- Construct from patch and internal field
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
@ -105,18 +101,18 @@ public:
);
//- Construct by mapping given patch field onto a new patch
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField&,
const timeVaryingFlowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField&
const timeVaryingFlowRateInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
@ -124,14 +120,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new timeVaryingMassFlowRateInletVelocityFvPatchVectorField(*this)
new timeVaryingFlowRateInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
timeVaryingFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField&,
const timeVaryingFlowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -143,34 +139,34 @@ public:
{
return tmp<fvPatchVectorField>
(
new timeVaryingMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
new timeVaryingFlowRateInletVelocityFvPatchVectorField
(
*this,
iF
)
);
}
// Member functions
// Access
//- Return the out-of-bounds treatment as a word
word timeBounding() const
{
return timeSeries_.bounding();
}
//- Return the time series used
const timeSeries<scalar>& timeData() const
const interpolationTable<scalar>& timeSeries() const
{
return timeSeries_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};

View File

@ -1,200 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2006-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeVaryingMassFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
#include "Time.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
massFlowRateInletVelocityFvPatchVectorField(p, iF)
{}
Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
massFlowRateInletVelocityFvPatchVectorField(ptf, p, iF, mapper),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
{}
Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
massFlowRateInletVelocityFvPatchVectorField(p, iF, dict),
timeDataFile_(dict.lookup("timeDataFile")),
timeSeries_(word(dict.lookup("timeBounding")))
{}
Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField& ptf
)
:
massFlowRateInletVelocityFvPatchVectorField(ptf),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
{}
Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
(
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
massFlowRateInletVelocityFvPatchVectorField(ptf, iF),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar
Foam::timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
currentValue()
{
if (timeSeries_.size() == 0)
{
fileName fName(timeDataFile_);
fName.expand();
if (fName.size() == 0)
{
FatalErrorIn
(
"timeVaryingMassFlowRateInletVelocity"
"::currentValue()"
) << "timeDataFile not specified for Patch "
<< this->patch().name()
<< exit(FatalError);
}
else
{
// relative path
if (fName[0] != '/')
{
fName = this->db().path()/fName;
}
// just in case we change the interface to timeSeries
word boundType = timeBounding();
IFstream(fName)() >> timeSeries_;
timeSeries_.bounding(boundType);
// be a bit paranoid and check that the list is okay
timeSeries_.check();
}
if (timeSeries_.size() == 0)
{
FatalErrorIn
(
"timeVaryingMassFlowRateInletVelocity"
"::currentValue()"
) << "empty time series for Patch "
<< this->patch().name()
<< exit(FatalError);
}
}
return timeSeries_(this->db().time().timeOutputValue());
}
void Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
updateCoeffs()
{
if (updated())
{
return;
}
massFlowRate() = currentValue();
massFlowRateInletVelocityFvPatchVectorField::updateCoeffs();
}
void Foam::
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
write(Ostream& os) const
{
massFlowRateInletVelocityFvPatchVectorField::write(os);
os.writeKeyword("timeDataFile")
<< timeDataFile_ << token::END_STATEMENT << nl;
os.writeKeyword("timeBounding")
<< timeBounding() << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -38,7 +38,8 @@ timeVaryingUniformFixedValueFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF)
fixedValueFvPatchField<Type>(p, iF),
timeSeries_()
{}
@ -52,8 +53,7 @@ timeVaryingUniformFixedValueFvPatchField
)
:
fixedValueFvPatchField<Type>(p, iF),
timeDataFile_(dict.lookup("timeDataFile")),
timeSeries_(word(dict.lookup("timeBounding")))
timeSeries_(this->db(), dict)
{
if (dict.found("value"))
{
@ -77,8 +77,7 @@ timeVaryingUniformFixedValueFvPatchField
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
timeSeries_(ptf.timeSeries_)
{}
@ -90,8 +89,7 @@ timeVaryingUniformFixedValueFvPatchField
)
:
fixedValueFvPatchField<Type>(ptf),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
timeSeries_(ptf.timeSeries_)
{}
@ -104,66 +102,12 @@ timeVaryingUniformFixedValueFvPatchField
)
:
fixedValueFvPatchField<Type>(ptf, iF),
timeDataFile_(ptf.timeDataFile_),
timeSeries_(ptf.timeBounding())
timeSeries_(ptf.timeSeries_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
currentValue()
{
if (timeSeries_.size() == 0)
{
fileName fName(timeDataFile_);
fName.expand();
if (fName.size() == 0)
{
FatalErrorIn
(
"timeVaryingUniformFixedValueFvPatchField"
"::currentValue()"
) << "timeDataFile not specified for Patch "
<< this->patch().name()
<< exit(FatalError);
}
else
{
// relative path
if (fName[0] != '/')
{
fName = this->db().path()/fName;
}
// just in case we change the interface to timeSeries
word boundType = timeBounding();
IFstream(fName)() >> timeSeries_;
timeSeries_.bounding(boundType);
// be a bit paranoid and check that the list is okay
timeSeries_.check();
}
if (timeSeries_.size() == 0)
{
FatalErrorIn
(
"timeVaryingUniformFixedValueFvPatchField"
"::currentValue()"
) << "empty time series for Patch "
<< this->patch().name()
<< exit(FatalError);
}
}
return timeSeries_(this->db().time().timeOutputValue());
}
template<class Type>
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()
{
@ -172,7 +116,10 @@ void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()
return;
}
fvPatchField<Type>::operator==(currentValue());
fvPatchField<Type>::operator==
(
timeSeries_(this->db().time().timeOutputValue())
);
fixedValueFvPatchField<Type>::updateCoeffs();
}
@ -184,10 +131,7 @@ void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::write
) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("timeDataFile")
<< timeDataFile_ << token::END_STATEMENT << nl;
os.writeKeyword("timeBounding")
<< timeBounding() << token::END_STATEMENT << nl;
timeSeries_.write(os);
this->writeEntry("value", os);
}

View File

@ -33,8 +33,8 @@ Description
inlet
{
type timeVaryingUniformFixedValue;
timeDataFile "time-series";
timeBounding clamp; // (error|warn|clamp|repeat)
fileName "time-series";
boundAction clamp; // (error|warn|clamp|repeat)
}
@endverbatim
@ -54,7 +54,7 @@ SourceFiles
#define timeVaryingUniformFixedValueFvPatchField_H
#include "fixedValueFvPatchField.H"
#include "timeSeries.H"
#include "interpolationTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,14 +72,8 @@ class timeVaryingUniformFixedValueFvPatchField
{
// Private data
//- File containing time/uniformFixedValue
fileName timeDataFile_;
//- The time series being used, including the bounding treatment
timeSeries<Type> timeSeries_;
//- Interpolate the value at the current time
Type currentValue();
interpolationTable<Type> timeSeries_;
public:
@ -153,14 +147,8 @@ public:
// Access
//- Return the out-of-bounds treatment as a word
word timeBounding() const
{
return timeSeries_.bounding();
}
//- Return the time series used
const timeSeries<Type>& timeData() const
const interpolationTable<Type>& timeSeries() const
{
return timeSeries_;
}

View File

@ -46,8 +46,8 @@ timeVaryingUniformTotalPressureFvPatchScalarField
rhoName_("undefined"),
psiName_("undefined"),
gamma_(0.0),
p0_(0.0)
p0_(0.0),
totalPressureTimeSeries_()
{}
@ -66,8 +66,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(dict.lookup("psi")),
gamma_(readScalar(dict.lookup("gamma"))),
p0_(readScalar(dict.lookup("p0"))),
totalPressureDataFileName_(dict.lookup("totalPressureDataFileName")),
totalPressureTimeSeries_(word(dict.lookup("timeBounding")))
totalPressureTimeSeries_(this->db(), dict)
{
if (dict.found("value"))
{
@ -99,8 +98,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(ptf.psiName_),
gamma_(ptf.gamma_),
p0_(ptf.p0_),
totalPressureDataFileName_(ptf.totalPressureDataFileName_),
totalPressureTimeSeries_(ptf.timeBounding())
totalPressureTimeSeries_(ptf.totalPressureTimeSeries_)
{}
@ -117,8 +115,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_),
p0_(tppsf.p0_),
totalPressureDataFileName_(tppsf.totalPressureDataFileName_),
totalPressureTimeSeries_(tppsf.timeBounding())
totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_)
{}
@ -136,64 +133,12 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_),
p0_(tppsf.p0_),
totalPressureDataFileName_(tppsf.totalPressureDataFileName_),
totalPressureTimeSeries_(tppsf.timeBounding())
totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::timeVaryingUniformTotalPressureFvPatchScalarField::
currentValue()
{
if (totalPressureTimeSeries_.size() == 0)
{
fileName fName(totalPressureDataFileName_);
fName.expand();
if (fName.size() == 0)
{
FatalErrorIn
(
"timeVaryingUniformFixedValueFvPatchField::currentValue()"
) << "timeDataFile not specified for Patch "
<< patch().name()
<< exit(FatalError);
}
else
{
// relative path
if (fName[0] != '/')
{
fName = db().path()/fName;
}
// just in case we change the interface to timeSeries
word boundType = timeBounding();
IFstream(fName)() >> totalPressureTimeSeries_;
totalPressureTimeSeries_.bounding(boundType);
// be a bit paranoid and check that the list is okay
totalPressureTimeSeries_.check();
}
if (totalPressureTimeSeries_.size() == 0)
{
FatalErrorIn
(
"timeVaryingUniformFixedValueFvPatchField"
"::currentValue()"
) << "empty time series for Patch "
<< this->patch().name()
<< exit(FatalError);
}
}
return totalPressureTimeSeries_(this->db().time().timeOutputValue());
}
void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs
(
const vectorField& Up
@ -204,7 +149,7 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs
return;
}
p0_ = currentValue();
p0_ = totalPressureTimeSeries_(this->db().time().timeOutputValue());
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
@ -279,10 +224,7 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::write(Ostream& os)
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
os.writeKeyword("p0") << p0_ << token::END_STATEMENT << endl;
os.writeKeyword("totalPressureDataFileName")
<< totalPressureDataFileName_ << token::END_STATEMENT << nl;
os.writeKeyword("timeBounding")
<< timeBounding() << token::END_STATEMENT << nl;
totalPressureTimeSeries_.write(os);
writeEntry("value", os);
}

View File

@ -38,7 +38,7 @@ SourceFiles
#define timeVaryingUniformTotalPressureFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "timeSeries.H"
#include "interpolationTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,11 +74,8 @@ class timeVaryingUniformTotalPressureFvPatchScalarField
//- Total pressure
scalar p0_;
fileName totalPressureDataFileName_;
timeSeries<scalar> totalPressureTimeSeries_;
//- Interpolate the value at the current time
scalar currentValue();
//- Table of time vs total pressure
interpolationTable<scalar> totalPressureTimeSeries_;
public:
@ -189,14 +186,8 @@ public:
return p0_;
}
//- Return the out-of-bounds treatment as a word
word timeBounding() const
{
return totalPressureTimeSeries_.bounding();
}
//- Return the time series used
const timeSeries<scalar>& totalPressureTimeSeries() const
const interpolationTable<scalar>& totalPressureTimeSeries() const
{
return totalPressureTimeSeries_;
}

View File

@ -54,7 +54,7 @@ bool molecule::move(molecule::trackData& td)
U_ += 0.5*deltaT*A_;
}
while (td.keepParticle && !td.switchProcessor && tEnd > (SMALL*SMALL))
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
{
// set the lagrangian time-step
scalar dt = min(dtMax, tEnd);

19
tutorials/gnemdFoam/Allclean Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cd constrictedChannel
rm -rf 0 > /dev/null 2>&1
rm Ar-Ar Ar-Ne Ne-Ne > /dev/null 2>&1
rm constant/idList
cleanCase
cd ..
cd nanoNozzle
rm -rf processor[0-9] > /dev/null 2>&1
cleanCase
cd ..

25
tutorials/gnemdFoam/Allrun Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application="gnemdFoam"
cd constrictedChannel
runApplication blockMesh
runApplication molConfig
runApplication $application
cd ..
cd nanoNozzle
runApplication blockMesh
runApplication decomposePar
hostname > system/machines
runParallel molConfig 4 system/machines
runParallel $application 4 system/machines
runApplication reconstructPar
cd ..

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -10,6 +10,7 @@ FoamFile
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,7 +27,7 @@ FoamFile
// automatically less valuable than any on the list. For molecules of the
// same type there is no control over which is removed.
removalOrder 1 (Ar);
removalOrder 2 (Ne Ar);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Pair potentials
@ -111,19 +111,10 @@ tether
tetherPotential restrainedHarmonicSpring;
restrainedHarmonicSpringCoeffs
{
springConstant 0.0277;
springConstant 0.1;
rR 1.2e-9;
}
}
Ne
{
tetherPotential harmonicSpring;
harmonicSpringCoeffs
{
springConstant 0.0277;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6
(
sectionAEnd
{
type patch;
nFaces 225;
startFace 48150;
}
sectionCEnd
{
type patch;
nFaces 225;
startFace 48375;
}
front
{
type wall;
nFaces 1125;
startFace 48600;
}
back
{
type wall;
nFaces 1125;
startFace 49725;
}
top
{
type wall;
nFaces 1125;
startFace 50850;
}
bottom
{
type wall;
nFaces 1125;
startFace 51975;
}
)
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object gamma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object pd;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,4 @@
#!/bin/sh
foamCleanTutorials cases
rm -rf 0/gamma.gz probes wallPressure pRefProbe

View File

@ -0,0 +1,9 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
runApplication blockMesh
cp 0/gamma.org 0/gamma
runApplication setFields
runApplication interDyMFoam

View File

@ -0,0 +1,173 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// RASModel kEpsilon;
RASModel laminar;
turbulence off;
laminarCoeffs
{
}
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
RNGkEpsilonCoeffs
{
Cmu 0.0845;
C1 1.42;
C2 1.68;
alphak 1.39;
alphaEps 1.39;
eta0 4.38;
beta 0.012;
}
NonlinearKEShihCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76932;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
LienCubicKECoeffs
{
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
QZetaCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaZeta 0.76923;
anisotropic no;
}
LaunderSharmaKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LamBremhorstKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LienCubicKELowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LienLeschzinerLowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LRRCoeffs
{
Cmu 0.09;
Clrr1 1.8;
Clrr2 0.6;
C1 1.44;
C2 1.92;
Cs 0.25;
Ceps 0.15;
alphaEps 0.76923;
}
LaunderGibsonRSTMCoeffs
{
Cmu 0.09;
Clg1 1.8;
Clg2 0.6;
C1 1.44;
C2 1.92;
C1Ref 0.5;
C2Ref 0.3;
Cs 0.25;
Ceps 0.15;
alphaEps 0.76923;
alphaR 1.22;
}
SpalartAllmarasCoeffs
{
alphaNut 1.5;
Cb1 0.1355;
Cb2 0.622;
Cw2 0.3;
Cw3 2;
Cv1 7.1;
Cv2 5.0;
}
wallFunctionCoeffs
{
kappa 0.4187;
E 9;
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object motionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh;
solidBodyMotionFvMeshCoeffs
{
solidBodyMotionFunction SDA;
SDACoeffs
{
// Centre of gravity
CofG (0 0 0);
// Model scale ratio
lamda 50;
// Max roll amplitude [rad]
rollAmax 0.2;
// Min roll amplitude [rad]
rollAmin 0.1;
// Heave amplitude [m]
heaveA 4;
// Sway amplitude [m]
swayA 2.4;
// Damping Coefficient [-]
Q 2;
// Time Period for liquid [sec]
Tp 14;
// Natural Period of Ship [sec]
Tpn 12;
// Reference time step [sec]
dTi 0.06;
// Incr. in Tp/unit 'dTi'[-]
dTp -0.001;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object environmentalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
g g [0 1 -2 0 0 0 0] (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,145 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
convertToMeters 1;
// Length of tank (x-direction)
// Breadth of tank (y-direction)
// Depth of tank (z-direction)
// Depth to the top (height) of lower chamfer
// Height of upper chamfer
// Angle of lower chamfer to the horizontal
// Angle of upper chamfer to the horizontal
// Centre of gravity in y-direction
// Centre of gravity in z-direction
// Number of cells in the length (1 for 2D)
// Number of cells in the breadth
// Number of cells in the height of the lower champfer
// Number of cells in the height between the chamfers
// Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
// Breadth to the top (height) of lower chamfer
// Breadth of upper chamfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(-0.5 -15 -10.0) // Vertex bllcb = 0
(-0.5 -20 -5) // Vertex bllc = 1
(-0.5 -20 10) // Vertex bluc = 2
(-0.5 -10 20) // Vertex bluct = 3
(-0.5 15 -10.0) // Vertex brlcb = 4
(-0.5 20 -5) // Vertex brlc = 5
(-0.5 20 10) // Vertex bruc = 6
(-0.5 10 20) // Vertex bruct = 7
(0.5 -15 -10.0) // Vertex fllcb = 8
(0.5 -20 -5) // Vertex fllc = 9
(0.5 -20 10) // Vertex fluc = 10
(0.5 -10 20) // Vertex fluct = 11
(0.5 15 -10.0) // Vertex frlcb = 12
(0.5 20 -5) // Vertex frlc = 13
(0.5 20 10) // Vertex fruc = 14
(0.5 10 20) // Vertex fruct = 15
);
blocks
(
// block0
hex (0 4 5 1 8 12 13 9)
(40 6 1)
simpleGrading (1 1 1)
// block1
hex (1 5 6 2 9 13 14 10)
(40 16 1)
simpleGrading (1 1 1)
// block2
hex (2 6 7 3 10 14 15 11)
(40 12 1)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
(0 4 12 8)
(4 5 13 12)
(5 6 14 13)
(6 7 15 14)
(7 3 11 15)
(3 2 10 11)
(2 1 9 10)
(1 0 8 9)
)
empty front
(
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
)
empty back
(
(0 1 5 4)
(1 2 6 5)
(2 3 7 6)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,145 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])
define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4))
define(quad2D, (b$1 b$2 f$2 f$1))
define(frontQuad, (f$1 f$2 f$3 f$4))
define(backQuad, (b$1 b$4 b$3 b$2))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
convertToMeters 1;
define(l, 1.0) // Length of tank (x-direction)
define(b, 40) // Breadth of tank (y-direction)
define(h, 30) // Depth of tank (z-direction)
define(hlc, 5) // Depth to the top (height) of lower chamfer
define(huc, 10) // Height of upper chamfer
define(thetalc, 45) // Angle of lower chamfer to the horizontal
define(thetauc, 45) // Angle of upper chamfer to the horizontal
define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction
define(CofGz, 10.0) // Centre of gravity in z-direction
define(Nl, 1) // Number of cells in the length (1 for 2D)
define(Nb, 40) // Number of cells in the breadth
define(Nhlc, 6) // Number of cells in the height of the lower champfer
define(Nh, 16) // Number of cells in the height between the chamfers
define(Nhuc, 12) // Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer
define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer
define(Yl, -CofGy)
define(Yllc, calc(Yl + blc))
define(Yluc, calc(Yl + buc))
define(Yr, calc(Yl + b))
define(Yrlc, calc(Yr - blc))
define(Yruc, calc(Yr - buc))
define(Zb, -CofGz)
define(Zlc, calc(Zb + hlc))
define(Zt, calc(Zb + h))
define(Zuc, calc(Zt - huc))
define(Xf, calc(l/2.0))
define(Xb, calc(Xf - l))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(Xb Yllc Zb) vlabel(bllcb)
(Xb Yl Zlc) vlabel(bllc)
(Xb Yl Zuc) vlabel(bluc)
(Xb Yluc Zt) vlabel(bluct)
(Xb Yrlc Zb) vlabel(brlcb)
(Xb Yr Zlc) vlabel(brlc)
(Xb Yr Zuc) vlabel(bruc)
(Xb Yruc Zt) vlabel(bruct)
(Xf Yllc Zb) vlabel(fllcb)
(Xf Yl Zlc) vlabel(fllc)
(Xf Yl Zuc) vlabel(fluc)
(Xf Yluc Zt) vlabel(fluct)
(Xf Yrlc Zb) vlabel(frlcb)
(Xf Yr Zlc) vlabel(frlc)
(Xf Yr Zuc) vlabel(fruc)
(Xf Yruc Zt) vlabel(fruct)
);
blocks
(
// block0
hex2D(llcb, rlcb, rlc, llc)
(Nb Nhlc Nl)
simpleGrading (1 1 1)
// block1
hex2D(llc, rlc, ruc, luc)
(Nb Nh Nl)
simpleGrading (1 1 1)
// block2
hex2D(luc, ruc, ruct, luct)
(Nb Nhuc Nl)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
quad2D(llcb, rlcb)
quad2D(rlcb, rlc)
quad2D(rlc, ruc)
quad2D(ruc, ruct)
quad2D(ruct, luct)
quad2D(luct, luc)
quad2D(luc, llc)
quad2D(llc, llcb)
)
empty front
(
frontQuad(llcb, rlcb, rlc, llc)
frontQuad(llc, rlc, ruc, luc)
frontQuad(luc, ruc, ruct, luct)
)
empty back
(
backQuad(llcb, rlcb, rlc, llc)
backQuad(llc, rlc, ruc, luc)
backQuad(luc, ruc, ruct, luct)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
3
(
walls
{
type patch;
nFaces 148;
startFace 2646;
}
front
{
type empty;
nFaces 1360;
startFace 2794;
}
back
{
type empty;
nFaces 1360;
startFace 4154;
}
)
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phase1
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1e-6;
rho rho [1 -3 0 0 0 0 0] 998.2;
}
phase2
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1.48e-05;
rho rho [1 -3 0 0 0 0 0] 1;
}
sigma sigma [1 0 -2 0 0 0 0] 0.0;
// ************************************************************************* //

View File

@ -0,0 +1,107 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application sloshingFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 40;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression compressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.5;
maxDeltaT 1;
functions
(
probes
{
// Type of functionObject
type probes;
// Name of the directory for the probe data
name probes;
// Locations to be probed. runTime modifiable!
probeLocations
(
(0 9.95 19.77)
(0 -9.95 19.77)
);
// Fields to be probed. runTime modifiable!
fields
(
p
);
}
wallPressure
{
// Type of functionObject
type surfaces;
// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");
// Output every 10th time step
interval 10;
surfaceFormat raw;
fields
(
p
);
surfaces
(
walls
{
type patch;
patchName walls;
triangulate false;
}
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 16;
method hierarchical;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (4 2 2);
delta 0.001;
order xyz;
}
metisCoeffs
{
processorWeights
(
1
1
1
1
);
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(gamma) Gauss linear;
}
divSchemes
{
div(rho*phi,U) Gauss vanLeerV;
div(phi,gamma) Gauss vanLeer;
div(phirb,gamma) Gauss vanLeer;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
pd;
pcorr;
gamma;
}
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
pcorr PCG
{
preconditioner GAMG
{
tolerance 1e-5;
relTol 0;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
nBottomSweeps 2;
cacheAgglomeration false;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 1e-5;
relTol 0;
maxIter 100;
};
pd GAMG
{
tolerance 1e-8;
relTol 0.01;
smoother DIC;
nPreSweeps 0;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
pdFinal PCG
{
preconditioner GAMG
{
tolerance 2e-9;
relTol 0;
nVcycles 2;
smoother DICGaussSeidel;
nPreSweeps 2;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 2e-9;
relTol 0;
maxIter 20;
};
U smoothSolver
{
smoother GaussSeidel;
tolerance 1e-6;
relTol 0;
nSweeps 1;
};
}
PISO
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
nGammaCorr 1;
nGammaSubCycles 3;
cGamma 1.5;
correctPhi no;
pRefProbe
{
fields
(
p
);
probeLocations
(
(0 0 0.15)
);
}
pRefValue 1e5;
}
relaxationFactors
{
U 1.0;
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue gamma 0
);
regions
(
boxToCell
{
box (-100 -100 -100) (100 100 0);
fieldValues
(
volScalarFieldValue gamma 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
walls
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object gamma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object pd;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,4 @@
#!/bin/sh
foamCleanTutorials cases
rm -rf 0/gamma.gz probes wallPressure pRefProbe

View File

@ -0,0 +1,9 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
runApplication blockMesh
cp 0/gamma.org 0/gamma
runApplication setFields
runApplication interDyMFoam

View File

@ -0,0 +1,173 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// RASModel kEpsilon;
RASModel laminar;
turbulence off;
laminarCoeffs
{
}
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
RNGkEpsilonCoeffs
{
Cmu 0.0845;
C1 1.42;
C2 1.68;
alphak 1.39;
alphaEps 1.39;
eta0 4.38;
beta 0.012;
}
NonlinearKEShihCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76932;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
LienCubicKECoeffs
{
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
QZetaCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaZeta 0.76923;
anisotropic no;
}
LaunderSharmaKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LamBremhorstKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LienCubicKELowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LienLeschzinerLowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LRRCoeffs
{
Cmu 0.09;
Clrr1 1.8;
Clrr2 0.6;
C1 1.44;
C2 1.92;
Cs 0.25;
Ceps 0.15;
alphaEps 0.76923;
}
LaunderGibsonRSTMCoeffs
{
Cmu 0.09;
Clg1 1.8;
Clg2 0.6;
C1 1.44;
C2 1.92;
C1Ref 0.5;
C2Ref 0.3;
Cs 0.25;
Ceps 0.15;
alphaEps 0.76923;
alphaR 1.22;
}
SpalartAllmarasCoeffs
{
alphaNut 1.5;
Cb1 0.1355;
Cb2 0.622;
Cw2 0.3;
Cw3 2;
Cv1 7.1;
Cv2 5.0;
}
wallFunctionCoeffs
{
kappa 0.4187;
E 9;
}
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object motionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh;
solidBodyMotionFvMeshCoeffs
{
solidBodyMotionFunction SDA;
SDACoeffs
{
// Centre of gravity
CofG (0 0 0);
// Model scale ratio
lamda 50;
// Max roll amplitude [rad]
rollAmax 0.2;
// Min roll amplitude [rad]
rollAmin 0.1;
// Heave amplitude [m]
heaveA 4;
// Sway amplitude [m]
swayA 2.4;
// Damping Coefficient [-]
Q 2;
// Time Period for liquid [sec]
Tp 14;
// Natural Period of Ship [sec]
Tpn 12;
// Reference time step [sec]
dTi 0.06;
// Incr. in Tp/unit 'dTi'[-]
dTp -0.001;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object environmentalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
g g [0 1 -2 0 0 0 0] (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
convertToMeters 1;
// Length of tank (x-direction)
// Breadth of tank (y-direction)
// Depth of tank (z-direction)
// Depth to the top (height) of lower chamfer
// Height of upper chamfer
// Angle of lower chamfer to the horizontal
// Angle of upper chamfer to the horizontal
// Centre of gravity in y-direction
// Centre of gravity in z-direction
// Number of cells in the length (1 for 2D)
// Number of cells in the breadth
// Number of cells in the height of the lower champfer
// Number of cells in the height between the chamfers
// Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
// Breadth to the top (height) of lower chamfer
// Breadth of upper chamfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(-10 -15 -10.0) // Vertex bllcb = 0
(-10 -20 -5) // Vertex bllc = 1
(-10 -20 10) // Vertex bluc = 2
(-10 -10 20) // Vertex bluct = 3
(-10 15 -10.0) // Vertex brlcb = 4
(-10 20 -5) // Vertex brlc = 5
(-10 20 10) // Vertex bruc = 6
(-10 10 20) // Vertex bruct = 7
(10 -15 -10.0) // Vertex fllcb = 8
(10 -20 -5) // Vertex fllc = 9
(10 -20 10) // Vertex fluc = 10
(10 -10 20) // Vertex fluct = 11
(10 15 -10.0) // Vertex frlcb = 12
(10 20 -5) // Vertex frlc = 13
(10 20 10) // Vertex fruc = 14
(10 10 20) // Vertex fruct = 15
);
blocks
(
// block0
hex (0 4 5 1 8 12 13 9)
(40 6 19)
simpleGrading (1 1 1)
// block1
hex (1 5 6 2 9 13 14 10)
(40 16 19)
simpleGrading (1 1 1)
// block2
hex (2 6 7 3 10 14 15 11)
(40 12 19)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
(0 4 12 8)
(4 5 13 12)
(5 6 14 13)
(6 7 15 14)
(7 3 11 15)
(3 2 10 11)
(2 1 9 10)
(1 0 8 9)
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(0 1 5 4)
(1 2 6 5)
(2 3 7 6)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])
define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4))
define(quad2D, (b$1 b$2 f$2 f$1))
define(frontQuad, (f$1 f$2 f$3 f$4))
define(backQuad, (b$1 b$4 b$3 b$2))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
convertToMeters 1;
define(l, 20) // Length of tank (x-direction)
define(b, 40) // Breadth of tank (y-direction)
define(h, 30) // Depth of tank (z-direction)
define(hlc, 5) // Depth to the top (height) of lower chamfer
define(huc, 10) // Height of upper chamfer
define(thetalc, 45) // Angle of lower chamfer to the horizontal
define(thetauc, 45) // Angle of upper chamfer to the horizontal
define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction
define(CofGz, 10.0) // Centre of gravity in z-direction
define(Nl, 19) // Number of cells in the length (1 for 2D)
define(Nb, 40) // Number of cells in the breadth
define(Nhlc, 6) // Number of cells in the height of the lower champfer
define(Nh, 16) // Number of cells in the height between the chamfers
define(Nhuc, 12) // Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer
define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer
define(Yl, -CofGy)
define(Yllc, calc(Yl + blc))
define(Yluc, calc(Yl + buc))
define(Yr, calc(Yl + b))
define(Yrlc, calc(Yr - blc))
define(Yruc, calc(Yr - buc))
define(Zb, -CofGz)
define(Zlc, calc(Zb + hlc))
define(Zt, calc(Zb + h))
define(Zuc, calc(Zt - huc))
define(Xf, calc(l/2.0))
define(Xb, calc(Xf - l))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(Xb Yllc Zb) vlabel(bllcb)
(Xb Yl Zlc) vlabel(bllc)
(Xb Yl Zuc) vlabel(bluc)
(Xb Yluc Zt) vlabel(bluct)
(Xb Yrlc Zb) vlabel(brlcb)
(Xb Yr Zlc) vlabel(brlc)
(Xb Yr Zuc) vlabel(bruc)
(Xb Yruc Zt) vlabel(bruct)
(Xf Yllc Zb) vlabel(fllcb)
(Xf Yl Zlc) vlabel(fllc)
(Xf Yl Zuc) vlabel(fluc)
(Xf Yluc Zt) vlabel(fluct)
(Xf Yrlc Zb) vlabel(frlcb)
(Xf Yr Zlc) vlabel(frlc)
(Xf Yr Zuc) vlabel(fruc)
(Xf Yruc Zt) vlabel(fruct)
);
blocks
(
// block0
hex2D(llcb, rlcb, rlc, llc)
(Nb Nhlc Nl)
simpleGrading (1 1 1)
// block1
hex2D(llc, rlc, ruc, luc)
(Nb Nh Nl)
simpleGrading (1 1 1)
// block2
hex2D(luc, ruc, ruct, luct)
(Nb Nhuc Nl)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
quad2D(llcb, rlcb)
quad2D(rlcb, rlc)
quad2D(rlc, ruc)
quad2D(ruc, ruct)
quad2D(ruct, luct)
quad2D(luct, luc)
quad2D(luc, llc)
quad2D(llc, llcb)
frontQuad(llcb, rlcb, rlc, llc)
frontQuad(llc, rlc, ruc, luc)
frontQuad(luc, ruc, ruct, luct)
backQuad(llcb, rlcb, rlc, llc)
backQuad(llc, rlc, ruc, luc)
backQuad(luc, ruc, ruct, luct)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1
(
walls
{
type patch;
nFaces 5532;
startFace 74754;
}
)
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phase1
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1e-6;
rho rho [1 -3 0 0 0 0 0] 998.2;
}
phase2
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1.48e-05;
rho rho [1 -3 0 0 0 0 0] 1;
}
sigma sigma [1 0 -2 0 0 0 0] 0.0;
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application sloshingFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 40;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression compressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.5;
maxDeltaT 1;
functions
(
probes
{
// Type of functionObject
type probes;
// Name of the directory for the probe data
name probes;
// Locations to be probed. runTime modifiable!
probeLocations
(
(0 9.95 19.77)
(0 -9.95 19.77)
);
// Fields to be probed. runTime modifiable!
fields
(
p
);
}
/*
wallPressure
{
// Type of functionObject
type surfaces;
// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");
// Output every 10th time step
interval 10;
surfaceFormat raw;
fields
(
p
);
surfaces
(
walls
{
type patch;
patchName walls;
triangulate false;
}
);
}
*/
);
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 16;
method hierarchical;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (4 2 2);
delta 0.001;
order xyz;
}
metisCoeffs
{
processorWeights
(
1
1
1
1
);
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(gamma) Gauss linear;
}
divSchemes
{
div(rho*phi,U) Gauss vanLeerV;
div(phi,gamma) Gauss vanLeer;
div(phirb,gamma) Gauss vanLeer;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
pd;
pcorr;
gamma;
}
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
pcorr PCG
{
preconditioner GAMG
{
tolerance 1e-5;
relTol 0;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
nBottomSweeps 2;
cacheAgglomeration false;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 1e-5;
relTol 0;
maxIter 100;
};
pd GAMG
{
tolerance 1e-8;
relTol 0.01;
smoother DIC;
nPreSweeps 0;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
pdFinal PCG
{
preconditioner GAMG
{
tolerance 2e-9;
relTol 0;
nVcycles 2;
smoother DICGaussSeidel;
nPreSweeps 2;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 2e-9;
relTol 0;
maxIter 20;
};
U smoothSolver
{
smoother GaussSeidel;
tolerance 1e-6;
relTol 0;
nSweeps 1;
};
}
PISO
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
nGammaCorr 1;
nGammaSubCycles 3;
cGamma 1.5;
correctPhi no;
pRefProbe
{
fields
(
p
);
probeLocations
(
(0 0 0.15)
);
}
pRefValue 1e5;
}
relaxationFactors
{
U 1.0;
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue gamma 0
);
regions
(
boxToCell
{
box (-100 -100 -100) (100 100 0);
fieldValues
(
volScalarFieldValue gamma 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
walls
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object gamma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object pd;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
walls
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,4 @@
#!/bin/sh
foamCleanTutorials cases
rm -rf 0/gamma.gz probes wallPressure pRefProbe

View File

@ -0,0 +1,9 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
runApplication blockMesh
cp 0/gamma.org 0/gamma
runApplication setFields
runApplication interDyMFoam

View File

@ -0,0 +1,105 @@
100
(
(0 ((0 0 0) (0 0 0)))
(0.40404 ((0.401298 0.952899 0.321827) (4.82741 2.79073 2.00649)))
(0.808081 ((0.786273 1.8071 0.635266) (9.52899 5.3597 3.93137)))
(1.21212 ((1.13927 2.47414 0.932149) (13.9822 7.5028 5.69634)))
(1.61616 ((1.44593 2.88493 1.20474) (18.071 9.04972 7.22963)))
(2.0202 ((1.69377 2.99691 1.44593) (21.6889 9.87755 8.46886)))
(2.42424 ((1.87273 2.7985 1.64943) (24.7414 9.92051 9.36363)))
(2.82828 ((1.97551 2.31024 1.80994) (27.1492 9.17518 9.87755)))
(3.23232 ((1.99794 1.5827 1.92329) (28.8493 7.7008 9.98971)))
(3.63636 ((1.93911 0.691238 1.9865) (29.7975 5.61451 9.69556)))
(4.0404 ((1.80141 -0.271818 1.99794) (29.9691 3.08209 9.00705)))
(4.44444 ((1.59044 -1.20672 1.95731) (29.3597 0.304768 7.9522)))
(4.84848 ((1.31478 -2.01664 1.86567) (27.985 -2.49677 6.5739)))
(5.25253 ((0.985644 -2.61769 1.7254) (25.881 -5.09992 4.92822)))
(5.65657 ((0.616418 -2.94762 1.54016) (23.1024 -7.29782 3.08209)))
(6.06061 ((0.22212 -2.97226 1.31478) (19.7217 -8.91584 1.1106)))
(6.46465 ((-0.181212 -2.68905 1.05513) (15.827 -9.82541 -0.906061)))
(6.86869 ((-0.577174 -2.12733 0.767988) (11.5198 -9.95425 -2.88587)))
(7.27273 ((-0.94966 -1.34528 0.460825) (6.91238 -9.29213 -4.7483)))
(7.67677 ((-1.28352 -0.42389 0.141652) (2.12479 -7.89165 -6.4176)))
(8.08081 ((-1.56518 0.541401 -0.181212) (-2.71818 -5.8641 -7.82588)))
(8.48485 ((-1.78317 1.45062 -0.499354) (-7.49031 -3.37059 -8.91584)))
(8.88889 ((-1.92863 2.20959 -0.804481) (-12.0672 -0.609253 -9.64317)))
(9.29293 ((-1.99566 2.73971 -1.08864) (-16.3296 2.20049 -9.97828)))
(9.69697 ((-1.98151 2.98607 -1.34443) (-20.1664 4.83539 -9.90753)))
(10.101 ((-1.88676 2.92315 -1.56518) (-23.4776 7.08607 -9.43381)))
(10.5051 ((-1.71528 2.55748 -1.74513) (-26.1769 8.77369 -8.57639)))
(10.9091 ((-1.47403 1.92692 -1.8796) (-28.194 9.76415 -7.37013)))
(11.3131 ((-1.17282 1.09679 -1.96508) (-29.4762 9.97875 -5.8641)))
(11.7172 ((-0.823912 0.153055 -1.99935) (-29.9902 9.40043 -4.11956)))
(12.1212 ((-0.441492 -0.806529 -1.98151) (-29.7226 8.07517 -2.20746)))
(12.5253 ((-0.0411152 -1.68258 -1.91202) (-28.6803 6.10824 -0.205576)))
(12.9293 ((0.360934 -2.38436 -1.7927) (-26.8905 3.65596 1.80467)))
(13.3333 ((0.748302 -2.83919 -1.62666) (-24.3999 0.913172 3.74151)))
(13.7374 ((1.10523 -2.99995 -1.41822) (-21.2733 -1.90217 5.52617)))
(14.1414 ((1.41721 -2.85 -1.17282) (-17.5923 -4.56637 7.08607)))
(14.5455 ((1.67155 -2.40487 -0.896852) (-13.4528 -6.86773 8.35775)))
(14.9495 ((1.8579 -1.71066 -0.597509) (-8.96264 -8.62338 9.28948)))
(15.3535 ((1.96868 -0.839275 -0.282593) (-4.2389 -9.69381 9.84339)))
(15.7576 ((1.99938 0.119039 0.0396874) (0.595311 -9.99397 9.99692)))
(16.1616 ((1.94877 1.06502 0.360934) (5.41401 -9.50001 9.74385)))
(16.5657 ((1.81889 1.9007 0.672773) (10.0916 -8.25118 9.09446)))
(16.9697 ((1.61503 2.53952 0.967078) (14.5062 -6.34671 8.07517)))
(17.3737 ((1.34549 2.91531 1.23618) (18.5427 -3.93793 6.72743)))
(17.7778 ((1.02121 2.98915 1.47306) (22.0959 -1.21624 5.10606)))
(18.1818 ((0.655401 2.75341 1.67155) (25.0732 1.60209 3.27701)))
(18.5859 ((0.262934 2.23248 1.82647) (27.3971 4.29312 1.31467)))
(18.9899 ((-0.140228 1.48033 1.93379) (29.0069 6.64301 -0.70114)))
(19.3939 ((-0.537686 0.574858 1.99071) (29.8607 8.46506 -2.68843)))
(19.798 ((-0.913275 -0.390153 1.99575) (29.9362 9.61447 -4.56637)))
(20.202 ((-1.25172 -1.31476 1.94877) (29.2315 9.99991 -6.25859)))
(20.6061 ((-1.53925 -2.10319 1.851) (27.765 9.59076 -7.69624)))
(21.0101 ((-1.76417 -2.67378 1.70499) (25.5748 8.41953 -8.82086)))
(21.4141 ((-1.91734 -2.96745 1.51454) (22.7181 6.57928 -9.58671)))
(21.8182 ((-1.99253 -2.95377 1.28462) (19.2692 4.21624 -9.96263)))
(22.2222 ((-1.98667 -2.63416 1.02121) (15.3182 1.51818 -9.93333)))
(22.6263 ((-1.9 -2.04172 0.731192) (10.9679 -1.30051 -9.50001)))
(23.0303 ((-1.73606 -1.23782 0.422115) (6.33173 -4.01587 -8.68029)))
(23.4343 ((-1.5015 -0.305712 0.102037) (1.53055 -6.41212 -7.50751)))
(23.8384 ((-1.20588 0.658059 -0.220701) (-3.31051 -8.29887 -6.02938)))
(24.2424 ((-0.861202 1.55367 -0.537686) (-8.06529 -9.52619 -4.30601)))
(24.6465 ((-0.4815 2.28837 -0.840658) (-12.6099 -9.99656 -2.4075)))
(25.0505 ((-0.082213 2.78605 -1.12172) (-16.8258 -9.6726 -0.411065)))
(25.4545 ((0.320417 2.99518 -1.37355) (-20.6032 -8.58006 1.60209)))
(25.8586 ((0.710015 2.89408 -1.58957) (-23.8436 -6.80574 3.55008)))
(26.2626 ((1.07073 2.49324 -1.76417) (-26.4626 -4.49064 5.35367)))
(26.6667 ((1.3879 1.83417 -1.89279) (-28.3919 -1.81871 6.93952)))
(27.0707 ((1.64862 0.985126 -1.97208) (-29.5812 0.997727 8.2431)))
(27.4747 ((1.84228 0.0340511 -1.99997) (-29.9995 3.73489 9.21142)))
(27.8788 ((1.96101 -0.92055 -1.97573) (-29.636 6.17528 9.80507)))
(28.2828 ((1.99998 -1.77981 -1.9) (-28.5 8.12498 9.99991)))
(28.6869 ((1.9576 -2.45473 -1.77475) (-26.6213 9.42907 9.78802)))
(29.0909 ((1.8356 -2.8754 -1.60325) (-24.0487 9.98392 9.17802)))
(29.4949 ((1.63894 -2.99826 -1.38996) (-20.8494 9.74545 8.19472)))
(29.899 ((1.37562 -2.81059 -1.14044) (-17.1066 8.73261 6.8781)))
(30.303 ((1.05635 -2.33181 -0.861202) (-12.918 7.02588 5.28174)))
(30.7071 ((0.694108 -1.61153 -0.559517) (-8.39275 4.76086 3.47054)))
(31.1111 ((0.303637 -0.724328 -0.243249) (-3.64873 2.11755 1.51818)))
(31.5152 ((-0.0991843 0.23789 0.0793591) (1.19039 -0.694017 -0.495921)))
(31.9192 ((-0.497971 1.17547 0.399899) (5.99848 -3.45044 -2.48986)))
(32.3232 ((-0.876504 1.9913 0.710015) (10.6502 -5.93269 -4.38252)))
(32.7273 ((-1.21939 2.60089 1.00163) (15.0244 -7.94353 -6.09693)))
(33.1313 ((-1.51267 2.9411 1.26713) (19.007 -9.32318 -7.56336)))
(33.5354 ((-1.74443 2.97669 1.49961) (22.4942 -9.96201 -8.72215)))
(33.9394 ((-1.90524 2.70397 1.69301) (25.3952 -9.80925 -9.52619)))
(34.3434 ((-1.98855 2.1512 1.84228) (27.6342 -8.87705 -9.94276)))
(34.7475 ((-1.99099 1.37563 1.94354) (29.1531 -7.23948 -9.95493)))
(35.1515 ((-1.91244 0.457572 1.99414) (29.9121 -5.02667 -9.56219)))
(35.5556 ((-1.75611 -0.507874 1.99277) (29.8915 -2.41443 -8.78053)))
(35.9596 ((-1.52835 -1.42072 1.93946) (29.0919 0.389661 -7.64173)))
(36.3636 ((-1.23842 -2.18642 1.8356) (27.5341 3.16279 -6.19211)))
(36.7677 ((-0.898128 -2.72566 1.68391) (25.2586 5.6846 -4.49064)))
(37.1717 ((-0.521304 -2.9826 1.48832) (22.3248 7.75471 -2.60652)))
(37.5758 ((-0.123276 -2.93062 1.25394) (18.8092 9.20863 -0.61638)))
(37.9798 ((0.279766 -2.57512 0.986886) (14.8033 9.93084 1.39883)))
(38.3838 ((0.671428 -1.9529 0.694108) (10.4116 9.86394 3.35714)))
(38.7879 ((1.03578 -1.12841 0.383239) (5.74858 9.01325 5.17891)))
(39.1919 ((1.35801 -0.187052 0.0623811) (0.935716 7.44637 6.79003)))
(39.596 ((1.625 0.77368 -0.260102) (-3.90153 5.2878 8.12498)))
(40 ((1.82589 1.65428 -0.575807) (-8.6371 2.70906 9.12945)))
)

View File

@ -0,0 +1,173 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// RASModel kEpsilon;
RASModel laminar;
turbulence off;
laminarCoeffs
{
}
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
RNGkEpsilonCoeffs
{
Cmu 0.0845;
C1 1.42;
C2 1.68;
alphak 1.39;
alphaEps 1.39;
eta0 4.38;
beta 0.012;
}
NonlinearKEShihCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76932;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
LienCubicKECoeffs
{
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
}
QZetaCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaZeta 0.76923;
anisotropic no;
}
LaunderSharmaKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LamBremhorstKECoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
}
LienCubicKELowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
A1 1.25;
A2 1000;
Ctau1 -4;
Ctau2 13;
Ctau3 -2;
alphaKsi 0.9;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LienLeschzinerLowReCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphak 1;
alphaEps 0.76923;
Am 0.016;
Aepsilon 0.263;
Amu 0.00222;
}
LRRCoeffs
{
Cmu 0.09;
Clrr1 1.8;
Clrr2 0.6;
C1 1.44;
C2 1.92;
Cs 0.25;
Ceps 0.15;
alphaEps 0.76923;
}
LaunderGibsonRSTMCoeffs
{
Cmu 0.09;
Clg1 1.8;
Clg2 0.6;
C1 1.44;
C2 1.92;
C1Ref 0.5;
C2Ref 0.3;
Cs 0.25;
Ceps 0.15;
alphaEps 0.76923;
alphaR 1.22;
}
SpalartAllmarasCoeffs
{
alphaNut 1.5;
Cb1 0.1355;
Cb2 0.622;
Cw2 0.3;
Cw3 2;
Cv1 7.1;
Cv2 5.0;
}
wallFunctionCoeffs
{
kappa 0.4187;
E 9;
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class dictionary;
object motionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh;
solidBodyMotionFvMeshCoeffs
{
solidBodyMotionFunction SKA;
SKACoeffs
{
// Centre of gravity
CofG (0 0 0);
// Time data file name
timeDataFileName "constant/6DoF.dat";
}
}
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object environmentalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
g g [0 1 -2 0 0 0 0] (0 0 -9.81);
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
convertToMeters 1;
// Length of tank (x-direction)
// Breadth of tank (y-direction)
// Depth of tank (z-direction)
// Depth to the top (height) of lower chamfer
// Height of upper chamfer
// Angle of lower chamfer to the horizontal
// Angle of upper chamfer to the horizontal
// Centre of gravity in y-direction
// Centre of gravity in z-direction
// Number of cells in the length (1 for 2D)
// Number of cells in the breadth
// Number of cells in the height of the lower champfer
// Number of cells in the height between the chamfers
// Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
// Breadth to the top (height) of lower chamfer
// Breadth of upper chamfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(-10 -15 -10.0) // Vertex bllcb = 0
(-10 -20 -5) // Vertex bllc = 1
(-10 -20 10) // Vertex bluc = 2
(-10 -10 20) // Vertex bluct = 3
(-10 15 -10.0) // Vertex brlcb = 4
(-10 20 -5) // Vertex brlc = 5
(-10 20 10) // Vertex bruc = 6
(-10 10 20) // Vertex bruct = 7
(10 -15 -10.0) // Vertex fllcb = 8
(10 -20 -5) // Vertex fllc = 9
(10 -20 10) // Vertex fluc = 10
(10 -10 20) // Vertex fluct = 11
(10 15 -10.0) // Vertex frlcb = 12
(10 20 -5) // Vertex frlc = 13
(10 20 10) // Vertex fruc = 14
(10 10 20) // Vertex fruct = 15
);
blocks
(
// block0
hex (0 4 5 1 8 12 13 9)
(40 6 19)
simpleGrading (1 1 1)
// block1
hex (1 5 6 2 9 13 14 10)
(40 16 19)
simpleGrading (1 1 1)
// block2
hex (2 6 7 3 10 14 15 11)
(40 12 19)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
(0 4 12 8)
(4 5 13 12)
(5 6 14 13)
(6 7 15 14)
(7 3 11 15)
(3 2 10 11)
(2 1 9 10)
(1 0 8 9)
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(0 1 5 4)
(1 2 6 5)
(2 3 7 6)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])
define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4))
define(quad2D, (b$1 b$2 f$2 f$1))
define(frontQuad, (f$1 f$2 f$3 f$4))
define(backQuad, (b$1 b$4 b$3 b$2))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
convertToMeters 1;
define(l, 20) // Length of tank (x-direction)
define(b, 40) // Breadth of tank (y-direction)
define(h, 30) // Depth of tank (z-direction)
define(hlc, 5) // Depth to the top (height) of lower chamfer
define(huc, 10) // Height of upper chamfer
define(thetalc, 45) // Angle of lower chamfer to the horizontal
define(thetauc, 45) // Angle of upper chamfer to the horizontal
define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction
define(CofGz, 10.0) // Centre of gravity in z-direction
define(Nl, 19) // Number of cells in the length (1 for 2D)
define(Nb, 40) // Number of cells in the breadth
define(Nhlc, 6) // Number of cells in the height of the lower champfer
define(Nh, 16) // Number of cells in the height between the chamfers
define(Nhuc, 12) // Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer
define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer
define(Yl, -CofGy)
define(Yllc, calc(Yl + blc))
define(Yluc, calc(Yl + buc))
define(Yr, calc(Yl + b))
define(Yrlc, calc(Yr - blc))
define(Yruc, calc(Yr - buc))
define(Zb, -CofGz)
define(Zlc, calc(Zb + hlc))
define(Zt, calc(Zb + h))
define(Zuc, calc(Zt - huc))
define(Xf, calc(l/2.0))
define(Xb, calc(Xf - l))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(Xb Yllc Zb) vlabel(bllcb)
(Xb Yl Zlc) vlabel(bllc)
(Xb Yl Zuc) vlabel(bluc)
(Xb Yluc Zt) vlabel(bluct)
(Xb Yrlc Zb) vlabel(brlcb)
(Xb Yr Zlc) vlabel(brlc)
(Xb Yr Zuc) vlabel(bruc)
(Xb Yruc Zt) vlabel(bruct)
(Xf Yllc Zb) vlabel(fllcb)
(Xf Yl Zlc) vlabel(fllc)
(Xf Yl Zuc) vlabel(fluc)
(Xf Yluc Zt) vlabel(fluct)
(Xf Yrlc Zb) vlabel(frlcb)
(Xf Yr Zlc) vlabel(frlc)
(Xf Yr Zuc) vlabel(fruc)
(Xf Yruc Zt) vlabel(fruct)
);
blocks
(
// block0
hex2D(llcb, rlcb, rlc, llc)
(Nb Nhlc Nl)
simpleGrading (1 1 1)
// block1
hex2D(llc, rlc, ruc, luc)
(Nb Nh Nl)
simpleGrading (1 1 1)
// block2
hex2D(luc, ruc, ruct, luct)
(Nb Nhuc Nl)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
quad2D(llcb, rlcb)
quad2D(rlcb, rlc)
quad2D(rlc, ruc)
quad2D(ruc, ruct)
quad2D(ruct, luct)
quad2D(luct, luc)
quad2D(luc, llc)
quad2D(llc, llcb)
frontQuad(llcb, rlcb, rlc, llc)
frontQuad(llc, rlc, ruc, luc)
frontQuad(luc, ruc, ruct, luct)
backQuad(llcb, rlcb, rlc, llc)
backQuad(llc, rlc, ruc, luc)
backQuad(luc, ruc, ruct, luct)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1
(
walls
{
type patch;
nFaces 5532;
startFace 74754;
}
)
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phase1
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1e-6;
rho rho [1 -3 0 0 0 0 0] 998.2;
}
phase2
{
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1.48e-05;
rho rho [1 -3 0 0 0 0 0] 1;
}
sigma sigma [1 0 -2 0 0 0 0] 0.0;
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
gen6DoF.C
EXE = $(FOAM_USER_APPBIN)/gen6DoF

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
gen6DoF
Description
Generate simple sinusoidal 6-DoF motion control-file.
\*---------------------------------------------------------------------------*/
#include "List.H"
#include "vector.H"
#include "Vector2D.H"
#include "Tuple2.H"
#include "OFstream.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
// End-time of the table
const scalar endTime = 40;
// Number of entries in the table
const label nTimes = 100;
// Amplitude of the translation [m]
const vector transAmp(2, 3, 2);
// Frequency of the translation [rad/s]
const vector transOmega(0.5, 0.8, 0.4);
// Amplitude of the rotation [deg]
const vector rotAmp(30, 10, 10);
// Frequency of the rotation [rad/s]
const vector rotOmega(0.4, 0.7, 0.5);
List<Tuple2<scalar, Vector2D<vector> > > timeValues(nTimes);
forAll(timeValues, i)
{
scalar t = (endTime*i)/(nTimes - 1);
timeValues[i].first() = t;
timeValues[i].second()[0] = vector
(
transAmp.x()*Foam::sin(transOmega.x()*t),
transAmp.y()*Foam::sin(transOmega.y()*t),
transAmp.z()*Foam::sin(transOmega.z()*t)
);
timeValues[i].second()[1] = vector
(
rotAmp.x()*Foam::sin(rotOmega.x()*t),
rotAmp.y()*Foam::sin(rotOmega.y()*t),
rotAmp.z()*Foam::sin(rotOmega.z()*t)
);
}
{
OFstream dataFile("6DoF.dat");
dataFile << timeValues << endl;
}
Info << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application sloshingFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 40;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression compressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.5;
maxDeltaT 1;
functions
(
probes
{
// Type of functionObject
type probes;
// Name of the directory for the probe data
name probes;
// Locations to be probed. runTime modifiable!
probeLocations
(
(0 9.95 19.77)
(0 -9.95 19.77)
);
// Fields to be probed. runTime modifiable!
fields
(
p
);
}
/*
wallPressure
{
// Type of functionObject
type surfaces;
// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");
// Output every 10th time step
interval 10;
surfaceFormat raw;
fields
(
p
);
surfaces
(
walls
{
type patch;
patchName walls;
triangulate false;
}
);
}
*/
);
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 16;
method hierarchical;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (4 2 2);
delta 0.001;
order xyz;
}
metisCoeffs
{
processorWeights
(
1
1
1
1
);
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots
(
);
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(gamma) Gauss linear;
}
divSchemes
{
div(rho*phi,U) Gauss vanLeerV;
div(phi,gamma) Gauss vanLeer;
div(phirb,gamma) Gauss vanLeer;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
pd;
pcorr;
gamma;
}
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
pcorr PCG
{
preconditioner GAMG
{
tolerance 1e-5;
relTol 0;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
nBottomSweeps 2;
cacheAgglomeration false;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 1e-5;
relTol 0;
maxIter 100;
};
pd GAMG
{
tolerance 1e-8;
relTol 0.01;
smoother DIC;
nPreSweeps 0;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
pdFinal PCG
{
preconditioner GAMG
{
tolerance 2e-9;
relTol 0;
nVcycles 2;
smoother DICGaussSeidel;
nPreSweeps 2;
nPostSweeps 2;
nFinestSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
};
tolerance 2e-9;
relTol 0;
maxIter 20;
};
U smoothSolver
{
smoother GaussSeidel;
tolerance 1e-6;
relTol 0;
nSweeps 1;
};
}
PISO
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
nGammaCorr 1;
nGammaSubCycles 3;
cGamma 1.5;
correctPhi no;
pRefProbe
{
fields
(
p
);
probeLocations
(
(0 0 0.15)
);
}
pRefValue 1e5;
}
relaxationFactors
{
U 1.0;
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue gamma 0
);
regions
(
boxToCell
{
box (-100 -100 -100) (100 100 0);
fieldValues
(
volScalarFieldValue gamma 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
#!/bin/sh
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cd periodicCube
rm -rf 0 > /dev/null 2>&1
rm Ar-Ar > /dev/null 2>&1
rm constant/idList
cleanCase
cd ..

View File

@ -0,0 +1,13 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application="mdEquilibrationFoam"
cd periodicCube
runApplication blockMesh
runApplication molConfig
runApplication $application
cd ..

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
3
(
periodicX
{
type cyclic;
nFaces 288;
startFace 4752;
featureCos 0.9;
}
periodicY
{
type cyclic;
nFaces 288;
startFace 5040;
featureCos 0.9;
}
periodicZ
{
type cyclic;
nFaces 288;
startFace 5328;
featureCos 0.9;
}
)
// ************************************************************************* //