ENH: additional text expansion shortcuts (issue #792)

Support the following expansions when they occur at the start of a
string:

    Short-form       Equivalent
    =========       ===========
      <etc>/          ~OpenFOAM/   (as per foamEtcFile)
      <case>/         $FOAM_CASE/
      <constant>/     $FOAM_CASE/constant/
      <system>/       $FOAM_CASE/system/

These can be used in fileName expansions to improve clarity and reduce
some typing

     "<constant>/reactions"   vs  "$FOAM_CASE/constant/reactions"
This commit is contained in:
Mark Olesen
2018-04-10 13:41:41 +02:00
parent d814bce3ee
commit a9741cea79
67 changed files with 259 additions and 170 deletions

View File

@ -30,6 +30,7 @@ Description
#include "stringOps.H" #include "stringOps.H"
#include "dictionary.H" #include "dictionary.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "OSspecific.H"
#include "int.H" #include "int.H"
#include "uint.H" #include "uint.H"
@ -53,6 +54,8 @@ int main(int argc, char *argv[])
" or with '${__UNKNOWN:+unknown}' empty" " or with '${__UNKNOWN:+unknown}' empty"
); );
setEnv("FOAM_CASE", cwd(), true);
dictionary dict; dictionary dict;
dict.add("HOME", "myHome"); dict.add("HOME", "myHome");
@ -62,6 +65,38 @@ int main(int argc, char *argv[])
dict.add("FOAM_RUN", subDict); dict.add("FOAM_RUN", subDict);
// basic expansions
{
for
(
const auto& cstr
:
{
"~OpenFOAM/controlDict",
"<etc>/controlDict",
"$FOAM_CASE/test",
"<case>/test",
"$FOAM_CASE/constant/test",
"<case>/constant/test",
"<constant>/test",
"$FOAM_CASE/system/test",
"<case>/system/test",
"<system>/test",
}
)
{
string input(cstr);
string output(stringOps::expand(input));
Info<<"input: " << input << nl
<< "expand: " << output << nl << nl;
}
}
// Test Foam::name with formatting string // Test Foam::name with formatting string
{ {
word formatted = word::printf("formatted=<%X>", 0xdeadbeef); word formatted = word::printf("formatted=<%X>", 0xdeadbeef);

View File

@ -34,34 +34,57 @@ License
namespace Foam namespace Foam
{ {
// Standard handling of "~/", "./" etc.
static void standardExpansions(std::string& s) // Expand a leading <tag>/
// Convenient for frequently used directories
//
// <etc>/ => user/group/other OpenFOAM directory
// <case>/ => FOAM_CASE directory
// <constant>/ => FOAM_CASE/constant directory
// <system>/ => FOAM_CASE/system directory
static void expandLeadingTag(std::string& s, const char b, const char e)
{ {
if (s.empty()) if (s[0] != b)
{ {
return; return;
} }
if (s[0] == '.') auto delim = s.find(e);
if (delim == std::string::npos || s[++delim] != '/')
{ {
// Expand a lone '.' and an initial './' into cwd return; // Ignore if there is no '/' after <tag>
if (s.size() == 1)
{
s = cwd();
} }
else if (s[1] == '/')
{
s.std::string::replace(0, 1, cwd());
}
}
else if (s[0] == '~')
{
// Expand initial ~
// ~/ => home directory
// ~OpenFOAM => site/user OpenFOAM configuration directory
// ~user => home directory for specified user
string user; const std::string tag(s, 1, delim-2);
fileName file(s.substr(delim + 1));
if (tag == "etc")
{
s = findEtcFile(file);
}
else if (tag == "case")
{
s = fileName(getEnv("FOAM_CASE"))/file;
}
else if (tag == "constant" || tag == "system")
{
s = fileName(Foam::getEnv("FOAM_CASE"))/tag/file;
}
}
// Expand a leading tilde
// ~/ => home directory
// ~OpenFOAM => user/group/other OpenFOAM directory
// ~user => home directory for specified user
static void expandLeadingTilde(std::string& s)
{
if (s[0] != '~')
{
return;
}
std::string user;
fileName file; fileName file;
const auto slash = s.find('/'); const auto slash = s.find('/');
@ -87,9 +110,39 @@ static void standardExpansions(std::string& s)
{ {
s = home(user)/file; s = home(user)/file;
} }
}
// Expand leading contents: "./", "~..", "<tag>/"
static void expandLeading(std::string& s)
{
if (s.empty())
{
return;
}
else if (s[0] == '.')
{
// Expand a lone '.' and an initial './' into cwd
if (s.size() == 1)
{
s = cwd();
}
else if (s[1] == '/')
{
s.std::string::replace(0, 1, cwd());
}
}
else if (s[0] == '<')
{
expandLeadingTag(s, '<', '>');
}
else if (s[0] == '~')
{
expandLeadingTilde(s);
} }
} }
}
} // end of namespace Foam
//! \cond fileScope //! \cond fileScope
@ -571,8 +624,7 @@ void Foam::stringOps::inplaceExpand
} }
} }
// Standard handling of "~/", "./" etc. expandLeading(s);
standardExpansions(s);
} }
@ -869,8 +921,7 @@ void Foam::stringOps::inplaceExpand
} }
} }
// Standard handling of "~/", "./" etc. expandLeading(s);
standardExpansions(s);
} }

View File

@ -217,10 +217,15 @@ namespace stringOps
// - "$VAR", "${VAR}" // - "$VAR", "${VAR}"
// -# current directory // -# current directory
// - leading "./" : the current directory // - leading "./" : the current directory
// -# leading tag expansion for commonly used directories
// - <etc>/ : user/group/other OpenFOAM directory
// - <case>/ : FOAM_CASE directory
// - <constant>/ : FOAM_CASE/constant directory
// - <system>/ : FOAM_CASE/system directory
// -# tilde expansion // -# tilde expansion
// - leading "~/" : home directory // - leading "~/" : home directory
// - leading "~user" : home directory for specified user // - leading "~user" : home directory for specified user
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory // - leading "~OpenFOAM" : user/group/other OpenFOAM directory
// //
// Supports default and alternative values as per the POSIX shell. // Supports default and alternative values as per the POSIX shell.
// \code // \code
@ -252,10 +257,15 @@ namespace stringOps
// - "$VAR", "${VAR}" // - "$VAR", "${VAR}"
// -# current directory // -# current directory
// - leading "./" : the current directory // - leading "./" : the current directory
// -# leading tag expansion for commonly used directories
// - <etc>/ : user/group/other OpenFOAM directory
// - <case>/ : FOAM_CASE directory
// - <constant>/ : FOAM_CASE/constant directory
// - <system>/ : FOAM_CASE/system directory
// -# tilde expansion // -# tilde expansion
// - leading "~/" : home directory // - leading "~/" : home directory
// - leading "~user" : home directory for specified user // - leading "~user" : home directory for specified user
// - leading "~OpenFOAM" : site/user OpenFOAM configuration directory // - leading "~OpenFOAM" : user/group/other OpenFOAM directory
// //
// Supports default and alternative values as per the POSIX shell. // Supports default and alternative values as per the POSIX shell.
// \code // \code

View File

@ -118,10 +118,10 @@ sigmaRadialCoeffs
offsetSurfaceCoeffs offsetSurfaceCoeffs
{ {
// Surface that mesh has been meshed to // Surface that mesh has been meshed to
baseSurface "$FOAM_CASE/constant/triSurface/DTC-scaled-inflated.obj"; baseSurface "<constant>/triSurface/DTC-scaled-inflated.obj";
// Surface to fill in to // Surface to fill in to
offsetSurface "$FOAM_CASE/constant/triSurface/DTC-scaled.obj"; offsetSurface "<constant>/triSurface/DTC-scaled.obj";
} }

View File

@ -27,7 +27,7 @@ thermoType
} }
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo"; foamChemistryThermoFile "<constant>/thermo";
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,8 +26,8 @@ thermoType
specie specie; specie specie;
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "<case>/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "<case>/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; CHEMKINTransportFile "<case>/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,8 +26,8 @@ thermoType
specie specie; specie specie;
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "<case>/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "<case>/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; CHEMKINTransportFile "<case>/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,8 +26,8 @@ thermoType
specie specie; specie specie;
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "<case>/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "<case>/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; CHEMKINTransportFile "<case>/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,8 +26,8 @@ thermoType
specie specie; specie specie;
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "<case>/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "<case>/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; CHEMKINTransportFile "<case>/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,7 +27,7 @@ boundaryField
massFlowRate tableFile; massFlowRate tableFile;
massFlowRateCoeffs massFlowRateCoeffs
{ {
file "$FOAM_CASE/constant/massLossRate"; file "<constant>/massLossRate";
} }
value uniform (0 0 0); value uniform (0 0 0);
} }

View File

@ -33,9 +33,9 @@ fuel C7H16;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
dpdt no; dpdt no;

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/pyrolysisRegion/reactions"; foamChemistryFile "<constant>/pyrolysisRegion/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/pyrolysisRegion/thermo.solid"; foamChemistryThermoFile "<constant>/pyrolysisRegion/thermo.solid";
gasThermoType gasThermoType
{ {

View File

@ -32,9 +32,9 @@ fuel C3H8;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
liquids liquids
{ {

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/panelRegion/reactions"; foamChemistryFile "<constant>/panelRegion/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/panelRegion/thermo.solid"; foamChemistryThermoFile "<constant>/panelRegion/thermo.solid";
gasThermoType gasThermoType
{ {

View File

@ -32,9 +32,9 @@ fuel C3H8;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/panelRegion/reactions"; foamChemistryFile "<constant>/panelRegion/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/panelRegion/thermo.solid"; foamChemistryThermoFile "<constant>/panelRegion/thermo.solid";
gasThermoType gasThermoType
{ {

View File

@ -33,8 +33,8 @@ fuel CH4;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -32,9 +32,9 @@ fuel CH4;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -32,9 +32,9 @@ fuel CH4;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -32,9 +32,9 @@ fuel CH4;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,7 +30,7 @@ thermoType
inertSpecie N2; inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactionsGRI"; foamChemistryFile "<constant>/reactionsGRI";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGasGRI"; foamChemistryThermoFile "<constant>/thermo.compressibleGasGRI";
// ************************************************************************* // // ************************************************************************* //

View File

@ -29,7 +29,7 @@ thermoType
inertSpecie N2; inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactionsGRI"; foamChemistryFile "<constant>/reactionsGRI";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGasGRI"; foamChemistryThermoFile "<constant>/thermo.compressibleGasGRI";
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,7 +31,7 @@ boundaryField
componentColumns ( 2 ); componentColumns ( 2 );
separator ","; separator ",";
mergeSeparators no; mergeSeparators no;
file "$FOAM_CASE/constant/inlet.csv"; file "<constant>/inlet.csv";
} }
} }
outlet outlet

View File

@ -30,7 +30,7 @@ boundaryField
componentColumns ( 1 ); componentColumns ( 1 );
separator ","; separator ",";
mergeSeparators no; mergeSeparators no;
file "$FOAM_CASE/constant/inlet.csv"; file "<constant>/inlet.csv";
} }

View File

@ -30,8 +30,8 @@ thermoType
inertSpecie N2; inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactionsGRI"; foamChemistryFile "<constant>/reactionsGRI";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGasGRI"; foamChemistryThermoFile "<constant>/thermo.compressibleGasGRI";
dpdt false; dpdt false;

View File

@ -30,9 +30,9 @@ inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,9 +30,9 @@ inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -29,8 +29,8 @@ thermoType
inertSpecie N2; inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactionsGRI"; foamChemistryFile "<constant>/reactionsGRI";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGasGRI"; foamChemistryThermoFile "<constant>/thermo.compressibleGasGRI";
// ************************************************************************* // // ************************************************************************* //

View File

@ -29,8 +29,8 @@ thermoType
inertSpecie N2; inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactionsGRI"; foamChemistryFile "<constant>/reactionsGRI";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGasGRI"; foamChemistryThermoFile "<constant>/thermo.compressibleGasGRI";
// ************************************************************************* // // ************************************************************************* //

View File

@ -29,8 +29,8 @@ thermoType
inertSpecie N2; inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactionsGRI"; foamChemistryFile "<constant>/reactionsGRI";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGasGRI"; foamChemistryThermoFile "<constant>/thermo.compressibleGasGRI";
// ************************************************************************* // // ************************************************************************* //

View File

@ -91,10 +91,10 @@ sigmaRadialCoeffs
offsetSurfaceCoeffs offsetSurfaceCoeffs
{ {
// Surface that mesh has been meshed to // Surface that mesh has been meshed to
baseSurface "$FOAM_CASE/constant/triSurface/DTC-scaled-inflated.obj"; baseSurface "<constant>/triSurface/DTC-scaled-inflated.obj";
// Surface to fill in to // Surface to fill in to
offsetSurface "$FOAM_CASE/constant/triSurface/DTC-scaled.obj"; offsetSurface "<constant>/triSurface/DTC-scaled.obj";
} }

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [0 0 0 1 0 0 0]; dimensions [0 0 0 1 0 0 0];

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [0 1 -1 0 0 0 0]; dimensions [0 1 -1 0 0 0 0];

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [1 -1 -1 0 0 0 0]; dimensions [1 -1 -1 0 0 0 0];

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [0 2 -3 0 0 0 0]; dimensions [0 2 -3 0 0 0 0];

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [0 2 -2 0 0 0 0]; dimensions [0 2 -2 0 0 0 0];

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [0 2 -1 0 0 0 0]; dimensions [0 2 -1 0 0 0 0];

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dimensions [1 -1 -2 0 0 0 0]; dimensions [1 -1 -2 0 0 0 0];

View File

@ -36,6 +36,6 @@ meshMotionProperties
omega 25; // rad/s omega 25; // rad/s
} }
#include "${FOAM_CASE}/constant/boundaryConditions" #include "<constant>/boundaryConditions"
// ************************************************************************* // // ************************************************************************* //

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "${FOAM_CASE}/constant/caseSettings" #include "<constant>/caseSettings"
dynamicFvMesh dynamicMotionSolverFvMesh; dynamicFvMesh dynamicMotionSolverFvMesh;

View File

@ -4,7 +4,7 @@ ABORT
{ {
type abort; type abort;
libs ("libutilityFunctionObjects.so"); libs ("libutilityFunctionObjects.so");
//file "$FOAM_CASE/ABORT"; // default name //file "<case>/ABORT"; // default name
// action writeNow; // action writeNow;
action nextWrite; action nextWrite;
} }

View File

@ -1,22 +1,18 @@
// -*- C++ -*- // -*- C++ -*-
// control for external coupled simulation // Control for external coupled simulation
externalCoupled externalCoupled
{ {
// Where to load it from (if not already in solver)
libs ("libfieldFunctionObjects.so");
type externalCoupled; type externalCoupled;
libs ("libfieldFunctionObjects.so");
log true;
// Directory to use for communication // Directory to use for communication
commsDir "${FOAM_CASE}/comms"; commsDir "<case>/comms";
// Does external process start first // Does external process start first
initByExternal true; initByExternal true;
// Additional output
log true;
regions regions
{ {
// Region name (wildcards allowed) // Region name (wildcards allowed)

View File

@ -73,14 +73,14 @@ functions
writeControl timeStep; writeControl timeStep;
writeInterval 1; writeInterval 1;
region cabin; region cabin;
fileToUpdate "$FOAM_CASE/system/solverControls"; fileToUpdate "<system>/solverControls";
timeVsFile timeVsFile
( (
( 1 "$FOAM_CASE/system/solverControls.0" ) ( 1 "<system>/solverControls.0" )
( 5 "$FOAM_CASE/system/solverControls.5") ( 5 "<system>/solverControls.5" )
( 20 "$FOAM_CASE/system/solverControls.20") ( 20 "<system>/solverControls.20")
( 60 "$FOAM_CASE/system/solverControls.60") ( 60 "<system>/solverControls.60")
); );
} }
} }

View File

@ -1,14 +1,14 @@
// -*- C++ -*- // -*- C++ -*-
// control for external coupled simulation // Control for external coupled simulation
externalCoupled externalCoupled
{ {
libs ("libfieldFunctionObjects.so");
type externalCoupled; type externalCoupled;
libs ("libfieldFunctionObjects.so");
log true;
// Directory to use for communication // Directory to use for communication
commsDir "${FOAM_CASE}/comms"; commsDir "<case>/comms";
// Does external process start first // Does external process start first
initByExternal true; initByExternal true;
@ -16,9 +16,6 @@ externalCoupled
// Frequency of coupling // Frequency of coupling
calcFrequency 4; calcFrequency 4;
// Additional output
log true;
regions regions
{ {
// Region name (wildcards allowed) // Region name (wildcards allowed)

View File

@ -69,7 +69,7 @@ communication
inputFormat dictionary; inputFormat dictionary;
outputFormat dictionary; outputFormat dictionary;
debugTable "$FOAM_CASE/output.txt"; debugTable "<case>/output.txt";
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -118,10 +118,10 @@ sigmaRadialCoeffs
offsetSurfaceCoeffs offsetSurfaceCoeffs
{ {
// Surface that mesh has been meshed to // Surface that mesh has been meshed to
baseSurface "$FOAM_CASE/constant/triSurface/DTC-scaled-inflated.obj"; baseSurface "<constant>/triSurface/DTC-scaled-inflated.obj";
// Surface to fill in to // Surface to fill in to
offsetSurface "$FOAM_CASE/constant/triSurface/DTC-scaled.obj"; offsetSurface "<constant>/triSurface/DTC-scaled.obj";
} }

View File

@ -28,7 +28,7 @@ boundaryField
direction in; direction in;
readerType openFoam; readerType openFoam;
hasHeaderLine true; hasHeaderLine true;
file "$FOAM_CASE/constant/FluxVsdP.dat"; file "<constant>/FluxVsdP.dat";
//nonDimensional true; //nonDimensional true;
//rpm 300; //rpm 300;
//dm 2e-2; //dm 2e-2;

View File

@ -73,7 +73,7 @@ postPro1
surface1 surface1
{ {
type geometry; type geometry;
files ("$FOAM_CASE/constant/triSurface/motorBike.obj.gz"); files ("<constant>/triSurface/motorBike.obj.gz");
renderMode phong; renderMode phong;
representation surface; representation surface;
edgeColour (0 0 0); edgeColour (0 0 0);

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryThermoFile "$FOAM_CASE/constant/foam.dat"; foamChemistryThermoFile "<constant>/foam.dat";
foamChemistryFile "$FOAM_CASE/constant/foam.inp"; foamChemistryFile "<constant>/foam.inp";
inertSpecie N2; inertSpecie N2;

View File

@ -30,9 +30,9 @@ inertSpecie N2;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.compressibleGas"; foamChemistryThermoFile "<constant>/thermo.compressibleGas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/foam.inp"; foamChemistryFile "<constant>/foam.inp";
foamChemistryThermoFile "$FOAM_CASE/constant/foam.dat"; foamChemistryThermoFile "<constant>/foam.dat";
inertSpecie N2; inertSpecie N2;

View File

@ -30,9 +30,9 @@ dpdt no;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; foamChemistryThermoFile "<constant>/thermo.incompressiblePoly";
liquids liquids
{ {

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/foam.inp"; foamChemistryFile "<constant>/foam.inp";
foamChemistryThermoFile "$FOAM_CASE/constant/foam.dat"; foamChemistryThermoFile "<constant>/foam.dat";
inertSpecie N2; inertSpecie N2;

View File

@ -30,9 +30,9 @@ dpdt no;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; foamChemistryThermoFile "<constant>/thermo.incompressiblePoly";
inertSpecie air; inertSpecie air;

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/foam.inp"; foamChemistryFile "<constant>/foam.inp";
foamChemistryThermoFile "$FOAM_CASE/constant/foam.dat"; foamChemistryThermoFile "<constant>/foam.dat";
inertSpecie N2; inertSpecie N2;

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/foam.inp"; foamChemistryFile "<constant>/foam.inp";
foamChemistryThermoFile "$FOAM_CASE/constant/foam.dat"; foamChemistryThermoFile "<constant>/foam.dat";
inertSpecie N2; inertSpecie N2;

View File

@ -30,9 +30,9 @@ dpdt no;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; foamChemistryThermoFile "<constant>/thermo.incompressiblePoly";
inertSpecie air; inertSpecie air;

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; foamChemistryThermoFile "<constant>/thermo.incompressiblePoly";
inertSpecie air; inertSpecie air;

View File

@ -28,9 +28,9 @@ thermoType
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; foamChemistryThermoFile "<constant>/thermo.incompressiblePoly";
inertSpecie air; inertSpecie air;

View File

@ -26,9 +26,9 @@ thermoType
specie specie; specie specie;
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "<case>/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "<case>/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; CHEMKINTransportFile "<case>/chemkin/transportProperties";
newFormat yes; newFormat yes;

View File

@ -30,9 +30,9 @@ dpdt no;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions"; foamChemistryFile "<constant>/reactions";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; foamChemistryThermoFile "<constant>/thermo.incompressiblePoly";
liquids liquids
{ {

View File

@ -15,8 +15,8 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "$FOAM_CASE/constant/dynamicMeshDict" #include "<constant>/dynamicMeshDict"
#include "$FOAM_CASE/system/blockMeshDict" #include "<system>/blockMeshDict"
dimensions [0 1 0 0 0 0 0]; dimensions [0 1 0 0 0 0 0];

View File

@ -20,7 +20,7 @@ FoamFile
pointSync false; pointSync false;
// Patches to create. An empty patch list just removes patches with zero // Patches to create. An empty patch list just removes patches with zero
// faces from $FOAM_CASE/constant/polyMesh/boundary. // faces from <constant>/polyMesh/boundary.
patches patches
( (
); );

View File

@ -22,7 +22,7 @@ motionSolver solidBody;
solidBodyMotionFunction tabulated6DoFMotion; solidBodyMotionFunction tabulated6DoFMotion;
CofG (0 0 0); CofG (0 0 0);
timeDataFileName "$FOAM_CASE/constant/6DoF.dat"; timeDataFileName "<constant>/6DoF.dat";
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,9 +30,9 @@ inertSpecie AIR;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions.gas"; foamChemistryFile "<constant>/reactions.gas";
foamChemistryThermoFile "$FOAM_CASE/constant/thermo.gas"; foamChemistryThermoFile "<constant>/thermo.gas";
// ************************************************************************* // // ************************************************************************* //

View File

@ -37,7 +37,7 @@ inertSpecie water;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions.gas"; foamChemistryFile "<constant>/reactions.gas";
water water
{ {

View File

@ -37,7 +37,7 @@ inertSpecie water;
chemistryReader foamChemistryReader; chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/reactions.gas"; foamChemistryFile "<constant>/reactions.gas";
water water
{ {