Commit e733eabc authored by sergio's avatar sergio
Browse files
parents a701c9a6 94531ff6
......@@ -278,3 +278,7 @@
+ multipleBoxes, hotBoxes, panel, evaporationTest
+ =interDyMFoam= tutorials:
+ testTubeMixer: showcases =solidBodyMotionFunction=
* Other
+ compilable with =clang=
In your prefs.sh set the WM_COMPILER to Clang
......@@ -44,7 +44,7 @@ Description
Note:
Only the pair h, Ta or q can be specified in the dictionary.
SourceFiles
externalWallHeatFluxTemperatureFvPatchScalarField.C
......
......@@ -172,7 +172,7 @@
i,
radiation::radiationModel::New(thermoFluid[i].T())
);
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
Info<< " Adding to DpDtFluid\n" << endl;
......
......@@ -13,9 +13,9 @@
hEqn.solve(mesh.solver(h.select(finalIter)));
thermo.correct();
rad.correct();
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
<< max(thermo.T()).value() << endl;
}
......@@ -18,7 +18,7 @@
const surfaceScalarField& ghf = ghfFluid[i];
radiation::radiationModel& rad = radiation[i];
const dimensionedScalar initialMass
(
"initialMass",
......
Test-codeStream.C
EXE = $(FOAM_USER_APPBIN)/Test-codeStream
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -21,60 +21,55 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::functionEntries::calcEntryInternal
Application
Test-codeStream
Description
Contains global functions and classes for the calcEntry.
SourceFiles
calcEntryInternal.C
\*---------------------------------------------------------------------------*/
#ifndef calcEntryInternal_H
#define calcEntryInternal_H
#include "argList.H"
#include "IOstreams.H"
#include "IOobject.H"
#include "IFstream.H"
#include "dictionary.H"
#include "error.H"
#include "scalar.H"
#include "DynamicList.H"
#include "globalFunctionSelectionTables.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
namespace Foam
{
namespace functionEntries
int main(int argc, char *argv[])
{
namespace calcEntryInternal
{
// Global Function Selectors
declareGlobalFunctionSelectionTable
(
scalar,
dispatch,
ParamList,
(
const UList<scalar>& param
),
(param)
);
//- Dispatch calculation to the named function
scalar dispatch(const word&, const UList<scalar>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace calcEntryInternal
} // End namespace functionEntries
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
argList::noParallel();
argList::validArgs.insert("dict .. dictN");
argList args(argc, argv, false, true);
Info<< nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
<< endl;
if (args.size() <= 1)
{
Info<<"specify dictionaries to test\n";
}
else
{
IOobject::writeDivider(Info);
for (label argI=1; argI < args.size(); ++argI)
{
const string& dictFile = args[argI];
IFstream is(dictFile);
dictionary dict(is);
Info<< dict << endl;
}
}
return 0;
}
#endif
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// #include "codeStreamDefaults"
writeInterval #codeStream
{
codeInclude
#{
#include "fvCFD.H"
#};
codeOptions
#{
-I$(LIB_SRC)/finiteVolume/lnInclude
#};
code
#{
scalar start = 0;
scalar end = 100;
label nDumps = 5;
label interval = end - start;
Info<<"on-the-fly: " << ((interval)/nDumps) << endl;
os << ((interval)/nDumps);
#};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -26,6 +26,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "string.H"
#include "stringOps.H"
#include "IOstreams.H"
using namespace Foam;
......@@ -35,11 +36,19 @@ using namespace Foam;
int main(int argc, char *argv[])
{
string test("$HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$");
string test
(
" $HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$ "
);
Info<< "string:" << test << nl << "hash:"
<< unsigned(string::hash()(test)) << endl;
Info<<"trimLeft: " << stringOps::trimLeft(test) << endl;
Info<<"trimRight: " << stringOps::trimRight(test) << endl;
Info<<"trim: " << stringOps::trim(test) << endl;
// test sub-strings via iterators
string::const_iterator iter = test.end();
string::const_iterator iter2 = test.end();
......
......@@ -499,7 +499,7 @@ int main(int argc, char *argv[])
// Layers per point
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
// Displacement for first layer
vectorField firstLayerDisp = displacement*model().sumThickness(1);
vectorField firstLayerDisp(displacement*model().sumThickness(1));
// Expansion ratio not used.
scalarField ratio(extrudePatch.nPoints(), 1.0);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -45,6 +45,7 @@ Description
#include "IOPtrList.H"
#include "polyTopoChange.H"
#include "polyModifyFace.H"
#include "wordReList.H"
using namespace Foam;
......@@ -669,7 +670,13 @@ int main(int argc, char *argv[])
if (sourceType == "patches")
{
labelHashSet patchSources(patches.patchSet(dict.lookup("patches")));
labelHashSet patchSources
(
patches.patchSet
(
wordReList(dict.lookup("patches"))
)
);
// Repatch faces of the patches.
forAllConstIter(labelHashSet, patchSources, iter)
......
......@@ -18,7 +18,6 @@ LINK_DIRECTORIES(
)
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV3Foam
......
......@@ -60,6 +60,8 @@ Usage
\param -literalRE \n
Do not interpret regular expressions; treat them as any other keyword.
\param -enableFunctionEntries \n
By default all dictionary preprocessing of fields is disabled
\*---------------------------------------------------------------------------*/
......@@ -255,6 +257,11 @@ int main(int argc, char *argv[])
"literalRE",
"treat regular expressions literally (ie, as a keyword)"
);
argList::addBoolOption
(
"enableFunctionEntries",
"enable expansion of dictionary directives - #include, #codeStream etc"
);
#include "addRegionOption.H"
#include "setRootCase.H"
......@@ -271,6 +278,20 @@ int main(int argc, char *argv[])
<< " not present." << endl;
}
const bool enableEntries = args.optionFound("enableFunctionEntries");
if (enableEntries)
{
Info<< "Allowing dictionary preprocessing ('#include', '#codeStream')."
<< endl;
}
int oldFlag = entry::disableFunctionEntries;
if (!enableEntries)
{
// By default disable dictionary expansion for fields
entry::disableFunctionEntries = 1;
}
fileName regionPrefix = "";
if (regionName != fvMesh::defaultRegion)
......@@ -410,6 +431,7 @@ int main(int argc, char *argv[])
false
)
);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
......@@ -429,6 +451,8 @@ int main(int argc, char *argv[])
}
}
entry::disableFunctionEntries = oldFlag;
Info<< endl;
Info<< "End\n" << endl;
......
......@@ -34,6 +34,9 @@ Usage
\param -test \n
Suppress writing the updated files with split cyclics
\param -enableFunctionEntries \n
By default all dictionary preprocessing of fields is disabled
\*---------------------------------------------------------------------------*/
#include "argList.H"
......@@ -391,7 +394,12 @@ int main(int argc, char *argv[])
{
timeSelector::addOptions();
argList::addBoolOption("test");
argList::addBoolOption("test", "test only; do not change any files");
argList::addBoolOption
(
"enableFunctionEntries",
"enable expansion of dictionary directives - #include, #codeStream etc"
);
# include "addRegionOption.H"
# include "setRootCase.H"
......@@ -404,6 +412,7 @@ int main(int argc, char *argv[])
{
Info<< "-test option: no changes made" << nl << endl;
}
const bool enableEntries = args.optionFound("enableFunctionEntries");
Foam::word regionName = polyMesh::defaultRegion;
......@@ -482,6 +491,13 @@ int main(int argc, char *argv[])
IOobjectList objects(runTime, runTime.timeName());
int oldFlag = entry::disableFunctionEntries;
if (!enableEntries)
{
// By default disable dictionary expansion for fields
entry::disableFunctionEntries = 1;
}
// volFields
// ~~~~~~~~~
......@@ -615,6 +631,8 @@ int main(int argc, char *argv[])
thisNames,
nbrNames
);
entry::disableFunctionEntries = oldFlag;
}
return 0;
......
......@@ -13,4 +13,3 @@ EXE_LIBS = \
-ltriSurface \
-ldistributed \
-lradiationModels
......@@ -34,9 +34,11 @@
# - elements whose start matches a wildcard
# - inaccessible directories (with the -strip (at your option)
#
# Note:
# - this routine will fail when directories have embedded spaces
# - false matches possible if a wildcard contains '.' (sed regex)
# Note
# - this routine will fail when directories have embedded spaces
# - false matches possible if a wildcard contains '.' (sed regex)
# - the wildcards can themselves can be written together and separated
# by colons or whitespace
#------------------------------------------------------------------------------
usage() {
cat <<USAGE 1>&2
......@@ -81,11 +83,12 @@ shift
##DEBUG echo "input>$dirList<" 1>&2
# preserve current IFS and split on whitespace
# preserve current IFS and split on colon or whitespace
oldIFS="$IFS"
IFS=' '
IFS=': '
# "wildcard1 ... wildcardN" may have been passed as a single parameter
# or may contain ':' separators
set -- $*
# strip out wildcards via sed
......@@ -94,7 +97,10 @@ do
wildcard=$1
shift
##DEBUG echo "remove>$wildcard<" 1>&2
dirList=$(echo "$dirList:" | sed -e "s@${wildcard}[^:]*:@@g")
if [ -n "$wildcard" ]
then
dirList=$(echo "$dirList:" | sed -e "s@${wildcard}[^:]*:@@g")
fi
done
# split on ':' (and on space as well to avoid any surprises)
......
......@@ -32,7 +32,7 @@
# Not normally called directly by the user
#------------------------------------------------------------------------------
tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$
toolsDir="${0%/*}" # this script is already located in the tools/ directory
toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir
[ $# -eq 2 ] || {
cat <<USAGE 1>&2
......
......@@ -30,15 +30,14 @@
#cleanTimeDirectories()
#{
# echo "Cleaning $case case of $application application"
# TIME_DIRS=`foamInfoExec . $1 -times | sed '1,/constant/d'`
# for T in $TIME_DIRS
# echo "Cleaning $PWD case"
# for time in $(foamInfoExec -times)
# do
# if [ $T != "0" ]
# then
# echo "Deleting directory $T"
# rm -rf ${T} > /dev/null 2>&1
# fi
# # keep 0 and constant directories
# [ "$time" = "0" -o "$time" = constant ] || {
# echo "Deleting directory $time"
# rm -rf $time > /dev/null 2>&1
# }
# done
# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
#}
......@@ -56,15 +55,32 @@ cleanTimeDirectories()
rm -rf ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* ./.fxLock ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM > /dev/null 2>&1
}
#
# Remove codeStream subdirectory if it looks appropriate
#
cleanCodeStream()
{
if [ -d system -a -d codeStream ]
then
rm -rf codeStream > /dev/null 2>&1
fi
}
cleanCase()
{
cleanTimeDirectories
cleanCodeStream
rm -rf processor* > /dev/null 2>&1
rm -rf probes* > /dev/null 2>&1
rm -rf forces* > /dev/null 2>&1
rm -rf sets > /dev/null 2>&1
rm -rf system/machines > /dev/null 2>&1
if [ -d "constant/polyMesh" ]; then
if [ -d constant/polyMesh ]
then
(cd constant/polyMesh && \
rm -rf \
allOwner* cell* face* meshModifiers* \
......@@ -94,7 +110,7 @@ cleanCase()
removeCase()
{
echo "Removing $case case"
echo "Removing ${1:-unknown} case"
rm -rf $1
}
......
......@@ -47,7 +47,7 @@
=code=, =codeInclude=, =codeOptions= sections (these are just strings) and
calculates the SHA1 checksum of the contents.
- it copies a template file
=($FOAM_CODESTREAM_TEMPLATE_DIR/codeStreamTemplate.C)=, substituting all
=($FOAM_CODESTREAM_TEMPLATES/codeStreamTemplate.C)=, substituting all
occurences of =code=, =codeInclude=, =codeOptions=.
- it writes library source files to =constant/codeStream/<sha1>= and compiles
it using =wmake libso=.
......@@ -76,6 +76,21 @@
It by default always includes =fvCFD.H= and adds the =finiteVolume= library to
the include search path.
A special form is where the code is not supplied in-line but instead comes
from the =codeDict= dictionary in the =system= directory. It should contain
a =fixedValue10= entry:
#+BEGIN_SRC c++
fixedValue10
{
code
#{
operator==(min(10, 0.1*this->db().time().value()));
#};
}
#+END_SRC
The advantage of using this indirect way is that it supports
runTimeModifiable so any change of the code will be picked up next iteration.
* Security
Allowing the case to execute C++ code does introduce security risks. A
third-party case might have a =#codeStream{#code system("rm -rf .");};= hidden
......@@ -121,7 +136,8 @@
- =foamFormatConvert=
- =changeDictionaryDict=
- =foamUpgradeCyclics=
- =fieldToCell=
These applications will usually switch off all '#' processing.
Note: above field initialisation has the problem that the boundary conditions
are not evaluated so e.g. processor boundaries will not hold the opposite cell
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment