FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

mdInitialise.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  =========                   |
00003  \\      /   F ield          | OpenFOAM: The Open Source CFD Toolbox
00004   \\    /    O peration      |
00005    \\  /     A nd            | Copyright (C) 2008-2010 OpenCFD Ltd.
00006     \\/      M anipulation   |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Application
00025     mdInitialise
00026 
00027 Description
00028     Initialises fields for a molecular dynamics (MD) simulation.
00029 
00030 Usage
00031     - mdInitialise [OPTION]
00032 
00033     @param -case <dir> \n
00034     Specify the case directory
00035 
00036     @param -parallel \n
00037     Run the case in parallel
00038 
00039     @param -help \n
00040     Display short usage message
00041 
00042     @param -doc \n
00043     Display Doxygen documentation page
00044 
00045     @param -srcDoc \n
00046     Display source code
00047 
00048 \*---------------------------------------------------------------------------*/
00049 
00050 #include <molecule/md.H>
00051 #include <finiteVolume/fvCFD.H>
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 int main(int argc, char *argv[])
00056 {
00057 #   include <OpenFOAM/setRootCase.H>
00058 #   include <OpenFOAM/createTime.H>
00059 #   include <OpenFOAM/createMesh.H>
00060 
00061     IOdictionary mdInitialiseDict
00062     (
00063         IOobject
00064         (
00065             "mdInitialiseDict",
00066             runTime.system(),
00067             runTime,
00068             IOobject::MUST_READ,
00069             IOobject::NO_WRITE,
00070             false
00071         )
00072     );
00073 
00074     IOdictionary idListDict
00075     (
00076         IOobject
00077         (
00078             "idList",
00079             mesh.time().constant(),
00080             mesh,
00081             IOobject::NO_READ,
00082             IOobject::AUTO_WRITE
00083         )
00084     );
00085 
00086     potential pot(mesh, mdInitialiseDict, idListDict);
00087 
00088     moleculeCloud molecules(mesh, pot, mdInitialiseDict);
00089 
00090     label totalMolecules = molecules.size();
00091 
00092     if (Pstream::parRun())
00093     {
00094         reduce(totalMolecules, sumOp<label>());
00095     }
00096 
00097     Info<< nl << "Total number of molecules added: " << totalMolecules
00098         << nl << endl;
00099 
00100     IOstream::defaultPrecision(15);
00101 
00102     if (!mesh.write())
00103     {
00104         FatalErrorIn(args.executable())
00105             << "Failed writing moleculeCloud."
00106             << nl << exit(FatalError);
00107     }
00108 
00109     Info<< nl << "ClockTime = " << runTime.elapsedClockTime() << " s"
00110         << nl << endl;
00111 
00112     Info << nl << "End\n" << endl;
00113 
00114     return 0;
00115 }
00116 
00117 
00118 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines