FreeFOAM The Cross-Platform CFD Toolkit
motionSolver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "motionSolver.H"
27 #include <OpenFOAM/Time.H>
28 #include <OpenFOAM/polyMesh.H>
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(motionSolver, 0);
36  defineRunTimeSelectionTable(motionSolver, dictionary);
37 }
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 :
44  (
45  IOobject
46  (
47  "dynamicMeshDict",
48  mesh.time().constant(),
49  mesh,
50  IOobject::MUST_READ,
51  IOobject::NO_WRITE
52  )
53  ),
54  mesh_(mesh),
55  twoDPointCorrector_(mesh)
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
60 
62 {
63  IOdictionary solverDict
64  (
65  IOobject
66  (
67  "dynamicMeshDict",
68  mesh.time().constant(),
69  mesh,
72  false
73  )
74  );
75 
76  Istream& msData = solverDict.lookup("solver");
77 
78  word solverTypeName(msData);
79 
80  Info << "Selecting motion solver: " << solverTypeName << endl;
81 
83  (
84  solverDict,
85  "motionSolverLibs",
86  dictionaryConstructorTablePtr_
87  );
88 
89  if (!dictionaryConstructorTablePtr_)
90  {
92  (
93  "motionSolver::New(const polyMesh& mesh)"
94  ) << "solver table is empty"
95  << exit(FatalError);
96  }
97 
98  dictionaryConstructorTable::iterator cstrIter =
99  dictionaryConstructorTablePtr_->find(solverTypeName);
100 
101  if (cstrIter == dictionaryConstructorTablePtr_->end())
102  {
104  (
105  "motionSolver::New(const polyMesh& mesh)"
106  ) << "Unknown solver type " << solverTypeName
107  << endl << endl
108  << "Valid solver types are: " << endl
109  << dictionaryConstructorTablePtr_->sortedToc()
110  << exit(FatalError);
111  }
112 
113  return autoPtr<motionSolver>(cstrIter()(mesh, msData));
114 }
115 
116 
117 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
118 
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 
126 {
127  solve();
128  return curPoints();
129 }
130 
131 
133 {
134  twoDPointCorrector_.correctPoints(p);
135 }
136 
137 
139 {
140  twoDPointCorrector_.updateMesh();
141 }
142 
143 
144 // ************************ vim: set sw=4 sts=4 et: ************************ //