Skip to content

Commit

Permalink
Cumulative development by Vuko Vukcevic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrvoje Jasak committed Mar 1, 2018
2 parents c277410 + caedc06 commit eb657a3
Show file tree
Hide file tree
Showing 801 changed files with 796,767 additions and 10,388 deletions.
3 changes: 3 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/Make/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
icoDyMOversetFoam.C

EXE = $(FOAM_APPBIN)/icoDyMOversetFoam
14 changes: 14 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/Make/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
-I$(LIB_SRC)/overset/oversetMesh/lnInclude

EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicFvMesh \
-ldynamicMesh \
-loversetMesh \
-llduSolvers
12 changes: 12 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/UEqn.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Momentum equation
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}
57 changes: 57 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/correctPhi.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
wordList pcorrTypes(p.boundaryField().types());

for (label i = 0; i < p.boundaryField().size(); i++)
{
if (p.boundaryField()[i].fixesValue())
{
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
}
}

volScalarField pcorr
(
IOobject
(
"pcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", p.dimensions(), 0),
pcorrTypes
);

// Initialise flux with interpolated velocity
phi = faceOversetMask*(fvc::interpolate(U) & mesh.Sf());

// Adjust overset fluxes
oversetAdjustPhi(phi, U); // Fringe flux adjustment
globalOversetAdjustPhi(phi, U, pcorr); // Global flux adjustment

while (piso.correctNonOrthogonal())
{
fvScalarMatrix pcorrEqn
(
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
);

// Adjust non-orthogonal fluxes if necessary
om.correctNonOrthoFluxes(pcorrEqn, U);

pcorrEqn.setReference(pRefCell, pRefValue);
pcorrEqn.solve();

if (piso.finalNonOrthogonalIter())
{
phi -= pcorrEqn.flux();
}

// Fluxes are corrected to absolute velocity and further corrected
// later. HJ, 6/Feb/2009
}

# include "oversetContinuityErrs.H"
}
11 changes: 11 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/createControls.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "createTimeControls.H"

bool correctPhi
(
piso.dict().lookupOrDefault("correctPhi", false)
);

bool checkMeshCourantNo
(
piso.dict().lookupOrDefault("checkMeshCourantNo", false)
);
79 changes: 79 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/createFields.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

dimensionedScalar nu
(
transportProperties.lookup("nu")
);

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

# include "createPhi.H"

// Set reference cell taking into account whether implicit or explicit
// overset aglorithm is used for field p.
const oversetMesh& om = oversetMesh::New(mesh);
label pRefCell = 0;
scalar pRefValue = 0.0;
om.setRefCell(p, piso.dict(), pRefCell, pRefValue);

mesh.schemesDict().setFluxRequired(p.name());
if (correctPhi)
{
mesh.schemesDict().setFluxRequired("pcorr");
}

Info<< "Reading field rAU if present\n" << endl;
volScalarField rAU
(
IOobject
(
"rAU",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("dt", dimTime, 1.0),
zeroGradientFvPatchScalarField::typeName
);

# include "writeOversetMasks.H"
167 changes: 167 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/icoDyMOversetFoam.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Application
icoDyMOversetFoam
Description
Transient solver for incompressible, laminar flow of Newtonian fluids
with dynamic mesh and overset mesh support.
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "oversetMesh.H"
#include "oversetFvPatchFields.H"
#include "oversetAdjustPhi.H"
#include "globalOversetAdjustPhi.H"
#include "pisoControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createDynamicFvMesh.H"

pisoControl piso(mesh);

# include "initContinuityErrs.H"
# include "initTotalVolume.H"
# include "createControls.H"
# include "createFields.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.run())
{
# include "readControls.H"
# include "checkTotalVolume.H"

// Make the fluxes absolute
fvc::makeAbsolute(phi, U);

runTime++;

Info<< "Time = " << runTime.timeName() << nl << endl;

bool meshChanged = mesh.update();
reduce(meshChanged, orOp<bool>());

# include "createOversetMasks.H"

if (correctPhi && (mesh.moving() || meshChanged))
{
# include "correctPhi.H"
}

// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);

# include "oversetCourantNo.H"
# include "setDeltaT.H"

if (mesh.moving() && checkMeshCourantNo)
{
# include "meshCourantNo.H"
}

# include "UEqn.H"

// --- PISO loop

while (piso.correct())
{
p.boundaryField().updateCoeffs();

rAU = 1.0/UEqn.A();
oversetFvPatchScalarField::oversetInterpolate(rAU); // Overset update

U = rAU*UEqn.H();
oversetFvPatchVectorField::oversetInterpolate(U); // Overset update

phi = fvc::interpolate(U) & mesh.Sf();

// Adjust overset fluxes
oversetAdjustPhi(phi, U); // Fringe flux adjustment
globalOversetAdjustPhi(phi, U, p); // Global flux adjustment

while (piso.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);

// Adjust non-orthogonal fringe fluxes if necessary
om.correctNonOrthoFluxes(pEqn, U);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve
(
mesh.solutionDict().solver(p.select(piso.finalInnerIter()))
);

if (piso.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}

// Perform overset interpolation (after flux reconstruction)
oversetFvPatchScalarField::oversetInterpolate(p);
}

# include "oversetContinuityErrs.H"

U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
oversetFvPatchVectorField::oversetInterpolate(U); // Overset update
// Note: if implicit fringe is switched on, we are doing the
// interpolation twice (once in correctBoundaryConditions and once
// in oversetInterpolate). Reorganize. VV, 4/Oct/2016.

// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
}

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return(0);
}


// ************************************************************************* //
5 changes: 5 additions & 0 deletions applications/solvers/overset/icoDyMOversetFoam/readControls.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "readTimeControls.H"

correctPhi = piso.dict().lookupOrDefault("correctPhi", false);

checkMeshCourantNo = piso.dict().lookupOrDefault("checkMeshCourantNo", false);
3 changes: 3 additions & 0 deletions applications/solvers/overset/icoOversetFoam/Make/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
icoOversetFoam.C

EXE = $(FOAM_APPBIN)/icoOversetFoam
10 changes: 10 additions & 0 deletions applications/solvers/overset/icoOversetFoam/Make/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/overset/oversetMesh/lnInclude

EXE_LIBS = \
-lfiniteVolume \
-loversetMesh \
-llduSolvers
Loading

0 comments on commit eb657a3

Please sign in to comment.