diff --git a/applications/utilities/preProcessing/mdInitialise/mdInitialise.C b/applications/utilities/preProcessing/mdInitialise/mdInitialise.C
index 5d06f35fb6..10a6602181 100644
--- a/applications/utilities/preProcessing/mdInitialise/mdInitialise.C
+++ b/applications/utilities/preProcessing/mdInitialise/mdInitialise.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
diff --git a/src/lagrangian/molecularDynamics/molecule/Make/files b/src/lagrangian/molecularDynamics/molecule/Make/files
index 7f8abcb0f3..94c3ffd8e8 100644
--- a/src/lagrangian/molecularDynamics/molecule/Make/files
+++ b/src/lagrangian/molecularDynamics/molecule/Make/files
@@ -5,4 +5,8 @@ polyatomic/polyatomic/polyatomicIO.C
polyatomic/polyatomicCloud/polyatomicCloud.C
+/* controllers/basic/controllers/controllers.C
+controllers/basic/stateController/stateController.C
+controllers/basic/fluxController/fluxController.C */
+
LIB = $(FOAM_LIBBIN)/libmolecule
diff --git a/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.C b/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.C
index 5647869233..08ea263dd6 100644
--- a/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.C
+++ b/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.C
@@ -21,12 +21,7 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-Class
- constPropSite
-
-Description
-
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
#include "constPropSite.H"
diff --git a/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.H b/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.H
index c53eba2ee8..910c0ccaef 100644
--- a/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.H
+++ b/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSite.H
@@ -20,11 +20,13 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
+
Class
Description
+
SourceFiles
constPropSiteI.H
constPropSite.C
diff --git a/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSiteI.H b/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSiteI.H
index b4f1ad9177..9c648c94c8 100644
--- a/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSiteI.H
+++ b/src/lagrangian/molecularDynamics/molecule/constPropSite/constPropSiteI.H
@@ -21,11 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-Class
-
-
-Description
-
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
diff --git a/src/lagrangian/molecularDynamics/molecule/controllers/basic/controllers/controllers.C b/src/lagrangian/molecularDynamics/molecule/controllers/basic/controllers/controllers.C
new file mode 100644
index 0000000000..f0bad336ee
--- /dev/null
+++ b/src/lagrangian/molecularDynamics/molecule/controllers/basic/controllers/controllers.C
@@ -0,0 +1,573 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 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 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "controllers.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::controllers::controllers
+(
+ const polyMesh& mesh
+)
+:
+ time_(mesh.time()),
+ controllersDict_
+ (
+ IOobject
+ (
+ "controllersDict",
+ time_.system(),
+ mesh,
+ IOobject::NO_READ,
+ IOobject::NO_WRITE
+ )
+ ),
+ stateControllersList_(),
+ sCNames_(),
+ sCIds_(),
+ sCFixedPathNames_(),
+ stateControllers_(),
+ fluxControllersList_(),
+ fCNames_(),
+ fCIds_(),
+ fCFixedPathNames_(),
+ fluxControllers_()
+{}
+
+
+Foam::controllers::controllers
+(
+ const polyMesh& mesh,
+ polyatomicCloud& cloud
+)
+:
+ time_(mesh.time()),
+ controllersDict_
+ (
+ IOobject
+ (
+ "controllersDict",
+ time_.system(),
+ mesh,
+ IOobject::MUST_READ,
+ IOobject::NO_WRITE
+ )
+ ),
+ stateControllersList_(controllersDict_.lookup("stateControllers")),
+ sCNames_(stateControllersList_.size()),
+ sCIds_(stateControllersList_.size()),
+ sCFixedPathNames_(stateControllersList_.size()),
+ stateControllers_(stateControllersList_.size()),
+ fluxControllersList_(controllersDict_.lookup("fluxControllers")),
+ fCNames_(fluxControllersList_.size()),
+ fCIds_(fluxControllersList_.size()),
+ fCFixedPathNames_(fluxControllersList_.size()),
+ fluxControllers_(fluxControllersList_.size())
+{
+
+ Info << nl << "Creating controllers" << nl << endl;
+
+ // state controllers
+
+ if (!stateControllers_.empty())
+ {
+ forAll(stateControllers_, sC)
+ {
+ const entry& controllersI = stateControllersList_[sC];
+
+ const dictionary& controllersIDict = controllersI.dict();
+
+ stateControllers_[sC] = autoPtr
+ (
+ stateController::New(time_, cloud, controllersIDict)
+ );
+
+ sCNames_[sC] = stateControllers_[sC]->type();
+
+ sCIds_[sC] = sC;
+ }
+ }
+
+ //- flux controllers
+
+ if (!fluxControllers_.empty())
+ {
+ forAll(fluxControllers_, fC)
+ {
+ const entry& controllersI = fluxControllersList_[fC];
+
+ const dictionary& controllersIDict = controllersI.dict();
+
+ fluxControllers_[fC] = autoPtr
+ (
+ fluxController::New(time_, cloud, controllersIDict)
+ );
+
+ fCNames_[fC] = fluxControllers_[fC]->type();
+ fCIds_[fC] = fC;
+ }
+ }
+
+ // creating directories for state controllers
+ if (!nStateControllers_.empty())
+ {
+ // case/controllers
+ fileName controllersPath(time_.path()/"controllers");
+
+ if (!isDir(controllersPath))
+ {
+ mkDir(controllersPath);
+ }
+
+ // case/controllers/
+ fileName controllersPath(controllersPath/cloud.name());
+
+ if (!isDir(controllersPath))
+ {
+ mkDir(controllersPath);
+ }
+
+ // case/controllers//stateControllers
+ fileName stateControllersPath(controllersPath/"stateControllers");
+
+ if (!isDir(stateControllersPath))
+ {
+ mkDir(stateControllersPath);
+ }
+
+ forAll(stateControllers_, sC)
+ {
+ if (stateControllers_[sC]->writeInCase())
+ {
+ // case/controllers//
+ // stateControllers/
+ fileName stateControllerPath(stateControllersPath/sCNames_[sC]);
+
+ if (!isDir(stateControllerPath))
+ {
+ mkDir(stateControllerPath);
+ }
+
+ const word& regionName = stateControllers_[sC]->regionName();
+
+ // case/controllers//
+ // stateControllers//
+ fileName zonePath(stateControllerPath/regionName);
+
+ if (!isDir(zonePath))
+ {
+ mkDir(zonePath);
+ }
+
+ sCFixedPathNames_[sC] = zonePath;
+ }
+ }
+ }
+
+ // creating directories for flux controllers
+ if (nFluxControllers_ > 0)
+ {
+ // case/controllers
+ fileName controllersPath(time_.path()/"controllers");
+
+ if ( !isDir(controllersPath) )
+ {
+ mkDir(controllersPath);
+ }
+
+ // case/controllers/
+ fileName controllersPath(time_.path()/cloud.name());
+
+ if ( !isDir(controllersPath) )
+ {
+ mkDir(controllersPath);
+ }
+
+ // case/controllers//fluxControllers
+ fileName fluxControllersPath(controllersPath/"fluxControllers");
+
+ if (!isDir(fluxControllersPath))
+ {
+ mkDir(fluxControllersPath);
+ }
+
+ forAll(fluxControllers_, fC)
+ {
+ if (fluxControllers_[fC]->writeInCase())
+ {
+ // case/controllers//
+ // fluxControllers/
+ fileName fluxControllerPath(fluxControllersPath/fCNames_[fC]);
+
+ if (!isDir(fluxControllerPath))
+ {
+ mkDir(fluxControllerPath);
+ }
+
+ const word& regionName = fluxControllers_[fC]->regionName();
+
+ // case/controllers//
+ // fluxControllers//
+ fileName zonePath(fluxControllerPath/regionName);
+
+ if (!isDir(zonePath))
+ {
+ mkDir(zonePath);
+ }
+
+ fCFixedPathNames_[fC] = zonePath;
+ }
+ }
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+controllers::~controllers()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void controllers::initialConfig()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->initialConfiguration();
+ }
+
+ forAll(fluxControllers_, fC)
+ {
+ fluxControllers_[fC]->initialConfiguration();
+ }
+}
+
+
+void controllers::updateTimeInfo()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->updateTime();
+ }
+
+ forAll(fluxControllers_, fC)
+ {
+ fluxControllers_[fC]->updateTime();
+ }
+}
+
+
+void controllers::controlState()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->controlMols();
+ }
+}
+
+
+void controllers::controlVelocitiesI()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->controlMolsBeg();
+ }
+}
+
+void controllers::controlVelocitiesII()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->controlMolsEnd();
+ }
+}
+
+
+void controllers::controlPriorToForces()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->controlBeforeForces();
+ }
+}
+
+
+void controllers::calculateStateProps()
+{
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->calculateProperties();
+ }
+
+ forAll(fluxControllers_, fC)
+ {
+ fluxControllers_[fC]->calculateProperties();
+ }
+}
+
+
+void controllers::outputStateResults()
+{
+ const Time& runTime = time_;
+
+ if (runTime.outputTime())
+ {
+ // creating a set of directories in the current time directory
+ {
+ List timePathNames(sCFixedPathNames_.size());
+
+ if (nStateControllers_ > 0)
+ {
+ if (Pstream::master())
+ {
+ // case//uniform
+ fileName uniformTimePath
+ (
+ runTime.path()/runTime.timeName()/"uniform"
+ );
+
+ if (!isDir(uniformTimePath))
+ {
+ mkDir(uniformTimePath);
+ }
+
+ if (!stateControllers_.empty())
+ {
+ // case//uniform/controllers
+ fileName controllersTimePath
+ (
+ uniformTimePath/"controllers"
+ );
+
+ if (!isDir(controllersTimePath))
+ {
+ mkDir(controllersTimePath);
+ }
+
+ // case//uniform/controllers/
+ fileName cloudTimePath
+ (
+ controllersTimePath/cloud.name()
+ );
+
+ if (!isDir(cloudTimePath))
+ {
+ mkDir(cloudTimePath);
+ }
+
+ // case//uniform/controllers//
+ fileName stateControllersTimePath
+ (
+ cloudTimePath/"stateControllers"
+ );
+
+ if (!isDir(stateControllersTimePath))
+ {
+ mkDir(stateControllersTimePath);
+ }
+
+ forAll(stateControllers_, sC)
+ {
+ if (stateControllers_[sC]->writeInTimeDir())
+ {
+ // case//uniform/controllers/
+ // /
+ fileName sCTimePath
+ (
+ stateControllersTimePath/sCNames_[sC]
+ );
+
+ if (!isDir(sCTimePath))
+ {
+ mkDir(sCTimePath);
+ }
+
+ // Creating directory for different zones but
+ // of the same model
+ const word& regionName =
+ stateControllers_[sC]->regionName();
+
+ // case//uniform/controllers/
+ // //
+ //
+ fileName zoneTimePath(sCTimePath/regionName);
+
+ if (!isDir(zoneTimePath))
+ {
+ mkDir(zoneTimePath);
+ }
+
+ timePathNames[sC] = zoneTimePath;
+ }
+ }
+ }
+ }
+ }
+
+ // write out data
+ forAll(stateControllers_, sC)
+ {
+ stateControllers_[sC]->output
+ (
+ sCFixedPathNames_[sC],
+ timePathNames[sC]
+ );
+ }
+ }
+
+ {
+ List timePathNames(fCFixedPathNames_.size());
+
+ if (nFluxControllers_ > 0)
+ {
+ if (Pstream::master())
+ {
+ // case//uniform
+ fileName uniformTimePath
+ (
+ runTime.path()/runTime.timeName()/"uniform"
+ );
+
+ if (!isDir(uniformTimePath))
+ {
+ mkDir(uniformTimePath);
+ }
+
+ if (!fluxControllers_.empty())
+ {
+ // case//uniform/controllers
+ fileName controllersTimePath
+ (
+ uniformTimePath/"controllers"
+ );
+
+ if (!isDir(controllersTimePath))
+ {
+ mkDir(controllersTimePath);
+ }
+
+ // case//uniform/controllers/
+ fileName cloudTimePath
+ (
+ controllersTimePath/cloud.name()
+ );
+
+ if (!isDir(cloudTimePath))
+ {
+ mkDir(cloudTimePath);
+ }
+
+ // case//uniform/fluxControllers
+ fileName controllersTimePath
+ (
+ cloudTimePath/"fluxControllers"
+ );
+
+ if (!isDir(controllersTimePath))
+ {
+ mkDir(controllersTimePath);
+ }
+
+ forAll(fluxControllers_, fC)
+ {
+ if (stateControllers_[fC]->writeInTimeDir())
+ {
+ // case//uniform/controllers/
+ // /
+ fileName fCTimePath
+ (
+ controllersTimePath/fCNames_[fC]
+ );
+
+ if (!isDir(fCTimePath))
+ {
+ mkDir(fCTimePath);
+ }
+
+ const word& regionName =
+ fluxControllers_[fC]->regionName();
+
+ // case//uniform/controllers/
+ // //
+ //
+ fileName zoneTimePath(fCTimePath/regionName);
+
+ if (!isDir(zoneTimePath))
+ {
+ mkDir(zoneTimePath);
+ }
+
+ timePathNames[fC] = zoneTimePath;
+ }
+ }
+ }
+ }
+ }
+
+ // write out data
+ forAll(fluxControllers_, fC)
+ {
+ fluxControllers_[fC]->output
+ (
+ fCFixedPathNames_[fC],
+ timePathNames[fC]
+ );
+ }
+ }
+
+ // Re-read dictionaries for modified properties (run-time selection)
+ {
+ stateControllersList_.clear();
+
+ stateControllersList_ = controllersDict_.lookup("stateControllers");
+
+ forAll(stateControllers_, sC)
+ {
+ const entry& controllersI = stateControllersList_[sC];
+ const dictionary& controllersIDict = controllersI.dict();
+
+ stateControllers_[sC]->updateProperties(controllersIDict);
+ }
+ }
+
+ {
+ fluxControllersList_.clear();
+
+ fluxControllersList_ = controllersDict_.lookup("fluxControllers");
+
+ forAll(fluxControllers_, fC)
+ {
+ const entry& controllersI = fluxControllersList_[fC];
+ const dictionary& controllersIDict = controllersI.dict();
+
+ fluxControllers_[fC]->updateProperties(controllersIDict);
+ }
+ }
+ }
+}
+
+
+// ************************************************************************* //
diff --git a/src/lagrangian/molecularDynamics/molecule/controllers/basic/controllers/controllers.H b/src/lagrangian/molecularDynamics/molecule/controllers/basic/controllers/controllers.H
new file mode 100644
index 0000000000..22e9ca7cca
--- /dev/null
+++ b/src/lagrangian/molecularDynamics/molecule/controllers/basic/controllers/controllers.H
@@ -0,0 +1,163 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2008-2011 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 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+
+ controllers
+
+Description
+
+ Stores all the information for the controllers models defined within
+ the controllersDict, and selects & builds the models automatically.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef controllers_H
+#define controllers_H
+
+#include "List.H"
+#include "IOdictionary.H"
+#include "autoPtr.H"
+#include "polyMesh.H"
+#include "timeData.H"
+#include "stateController.H"
+#include "fluxController.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class controllers Declaration
+\*---------------------------------------------------------------------------*/
+
+class controllers
+{
+ // Private data
+
+ Time& time_;
+
+ //- The entire dictionary (containing multiple subDictionaries)
+ IOdictionary controllersDict_;
+
+ //- state controllers
+ PtrList stateControllersList_;
+ List sCNames_;
+ List