potentialFreeSurfaceDyMFoam.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) 2014-2015 OpenFOAM Foundation
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 Application
25  potentialFreeSurfaceDyMFoam
26 
27 Group
28  grpMultiphaseSolvers grpMovingMeshSolvers
29 
30 Description
31  Incompressible Navier-Stokes solver with inclusion of a wave height field
32  to enable single-phase free-surface approximations.
33 
34  Wave height field, zeta, used by pressure boundary conditions.
35 
36  Optional mesh motion and mesh topology changes including adaptive
37  re-meshing.
38 
39  Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #include "fvCFD.H"
44 #include "dynamicFvMesh.H"
47 #include "pimpleControl.H"
48 #include "fvOptions.H"
49 #include "CorrectPhi.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 int main(int argc, char *argv[])
55 {
56  #include "setRootCase.H"
57  #include "createTime.H"
58  #include "createDynamicFvMesh.H"
59  #include "initContinuityErrs.H"
60 
61  pimpleControl pimple(mesh);
62 
63  #include "createControls.H"
64  #include "createFields.H"
65  #include "createMRF.H"
66  #include "createFvOptions.H"
67 
69  (
70  IOobject
71  (
72  "rAU",
73  runTime.timeName(),
74  mesh,
75  IOobject::READ_IF_PRESENT,
76  IOobject::AUTO_WRITE
77  ),
78  mesh,
79  dimensionedScalar("rAUf", dimTime, 1.0)
80  );
81 
82  #include "correctPhi.H"
83  #include "createUf.H"
84 
85  turbulence->validate();
86 
87  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89  Info<< "\nStarting time loop\n" << endl;
90 
91  while (runTime.run())
92  {
93  #include "readControls.H"
94  #include "CourantNo.H"
95  #include "setDeltaT.H"
96 
97  runTime++;
98 
99  Info<< "Time = " << runTime.timeName() << nl << endl;
100 
101  // --- Pressure-velocity PIMPLE corrector loop
102  while (pimple.loop())
103  {
104  if (pimple.firstIter() || moveMeshOuterCorrectors)
105  {
106  scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
107 
108  mesh.update();
109 
110  if (mesh.changing())
111  {
112  Info<< "Execution time for mesh.update() = "
113  << runTime.elapsedCpuTime() - timeBeforeMeshUpdate
114  << " s" << endl;
115  }
116 
117  if (mesh.changing() && correctPhi)
118  {
119  // Calculate absolute flux from the mapped surface velocity
120  phi = mesh.Sf() & Uf;
121 
122  #include "correctPhi.H"
123 
124  // Make the flux relative to the mesh motion
126  }
127 
128  if (mesh.changing() && checkMeshCourantNo)
129  {
130  #include "meshCourantNo.H"
131  }
132  }
133 
134  #include "UEqn.H"
135 
136  // --- Pressure corrector loop
137  while (pimple.correct())
138  {
139  #include "pEqn.H"
140  }
141 
142  if (pimple.turbCorr())
143  {
144  laminarTransport.correct();
145  turbulence->correct();
146  }
147  }
148 
149  runTime.write();
150 
151  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
152  << " ClockTime = " << runTime.elapsedClockTime() << " s"
153  << nl << endl;
154  }
155 
156  Info<< "End\n" << endl;
157 
158  return 0;
159 }
160 
161 
162 // ************************************************************************* //
fvOptions.H
singlePhaseTransportModel.H
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
turbulentTransportModel.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
moveMeshOuterCorrectors
moveMeshOuterCorrectors
Definition: readControls.H:8
createUf.H
Creates and initialises the velocity velocity field Uf.
pimpleControl.H
U
U
Definition: pEqn.H:46
Foam::fvc::makeRelative
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:74
createFvOptions.H
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
turbulence
autoPtr< compressible::turbulenceModel > turbulence
Definition: createFields.H:23
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
checkMeshCourantNo
bool checkMeshCourantNo
Definition: readControls.H:6
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
main
int main(int argc, char *argv[])
Definition: postCalc.C:54
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
rAU
volScalarField rAU("rAU", 1.0/UEqn().A())
setRootCase.H
laminarTransport
singlePhaseTransportModel laminarTransport(U, phi)
meshCourantNo.H
Calculates and outputs the mean and maximum Courant Numbers.
CorrectPhi.H
createTime.H
dynamicFvMesh.H
fvCFD.H
pimple
const dictionary & pimple
Definition: readFluidMultiRegionPIMPLEControls.H:1
fixedFluxPressureFvPatchScalarField.H
Uf
Uf
Definition: pEqn.H:78
createDynamicFvMesh.H
correctPhi
bool correctPhi
Definition: readControls.H:3