Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "motionSolver.H"
00027 #include <OpenFOAM/Time.H>
00028 #include <OpenFOAM/polyMesh.H>
00029 #include <OpenFOAM/dlLibraryTable.H>
00030
00031
00032
00033 namespace Foam
00034 {
00035 defineTypeNameAndDebug(motionSolver, 0);
00036 defineRunTimeSelectionTable(motionSolver, dictionary);
00037 }
00038
00039
00040
00041 Foam::motionSolver::motionSolver(const polyMesh& mesh)
00042 :
00043 IOdictionary
00044 (
00045 IOobject
00046 (
00047 "dynamicMeshDict",
00048 mesh.time().constant(),
00049 mesh,
00050 IOobject::MUST_READ,
00051 IOobject::NO_WRITE
00052 )
00053 ),
00054 mesh_(mesh),
00055 twoDPointCorrector_(mesh)
00056 {}
00057
00058
00059
00060
00061 Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
00062 {
00063 IOdictionary solverDict
00064 (
00065 IOobject
00066 (
00067 "dynamicMeshDict",
00068 mesh.time().constant(),
00069 mesh,
00070 IOobject::MUST_READ,
00071 IOobject::NO_WRITE,
00072 false
00073 )
00074 );
00075
00076 Istream& msData = solverDict.lookup("solver");
00077
00078 word solverTypeName(msData);
00079
00080 Info << "Selecting motion solver: " << solverTypeName << endl;
00081
00082 dlLibraryTable::open
00083 (
00084 solverDict,
00085 "motionSolverLibs",
00086 dictionaryConstructorTablePtr_
00087 );
00088
00089 if (!dictionaryConstructorTablePtr_)
00090 {
00091 FatalErrorIn
00092 (
00093 "motionSolver::New(const polyMesh& mesh)"
00094 ) << "solver table is empty"
00095 << exit(FatalError);
00096 }
00097
00098 dictionaryConstructorTable::iterator cstrIter =
00099 dictionaryConstructorTablePtr_->find(solverTypeName);
00100
00101 if (cstrIter == dictionaryConstructorTablePtr_->end())
00102 {
00103 FatalErrorIn
00104 (
00105 "motionSolver::New(const polyMesh& mesh)"
00106 ) << "Unknown solver type " << solverTypeName
00107 << endl << endl
00108 << "Valid solver types are: " << endl
00109 << dictionaryConstructorTablePtr_->sortedToc()
00110 << exit(FatalError);
00111 }
00112
00113 return autoPtr<motionSolver>(cstrIter()(mesh, msData));
00114 }
00115
00116
00117
00118
00119 Foam::motionSolver::~motionSolver()
00120 {}
00121
00122
00123
00124
00125 Foam::tmp<Foam::pointField> Foam::motionSolver::newPoints()
00126 {
00127 solve();
00128 return curPoints();
00129 }
00130
00131
00132 void Foam::motionSolver::twoDCorrectPoints(pointField& p) const
00133 {
00134 twoDPointCorrector_.correctPoints(p);
00135 }
00136
00137
00138 void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm)
00139 {
00140 twoDPointCorrector_.updateMesh();
00141 }
00142
00143
00144