diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/Allwclean b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Allwclean new file mode 100755 index 0000000000000000000000000000000000000000..f4a6354926ab866678b5800cfac410da4a089f03 --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Allwclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wclean +wclean potentialFreeSurfaceDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/Allwmake b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Allwmake new file mode 100755 index 0000000000000000000000000000000000000000..38f7587aefa172635eb1bcc5b1552702002aafa2 --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake +wmake potentialFreeSurfaceDyMFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H index fac21e8b1c84a0732a8ef0480e0568edfb3fab73..dbdf1ac66cf026493010756970921a37760d9e91 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H @@ -1,5 +1,5 @@ volScalarField rAU(1.0/UEqn().A()); -surfaceScalarField rAUf("Dp", fvc::interpolate(rAU)); +surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn().H(); diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/Make/files b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..b572d7b364043de257cad21c01276c4a347a88c2 --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/Make/files @@ -0,0 +1,3 @@ +potentialFreeSurfaceDyMFoam.C + +EXE = $(FOAM_APPBIN)/potentialFreeSurfaceDyMFoam diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/Make/options b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..6772c7f35a68bea870f0fc61b876e592e1eabfc7 --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/Make/options @@ -0,0 +1,26 @@ +EXE_INC = \ + -I.. \ + -I../../interFoam/interDyMFoam \ + -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + + +EXE_LIBS = \ + -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ + -lincompressibleRASModels \ + -lincompressibleLESModels \ + -lfiniteVolume \ + -ldynamicMesh \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -lmeshTools \ + -lfvOptions \ + -lsampling diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/correctPhi.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/correctPhi.H new file mode 100644 index 0000000000000000000000000000000000000000..b067878377f47b67fb7c04e6132f895aaf02e594 --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/correctPhi.H @@ -0,0 +1,58 @@ +if (mesh.changing()) +{ + forAll(U.boundaryField(), patchI) + { + if (U.boundaryField()[patchI].fixesValue()) + { + U.boundaryField()[patchI].initEvaluate(); + } + } + + forAll(U.boundaryField(), patchI) + { + if (U.boundaryField()[patchI].fixesValue()) + { + U.boundaryField()[patchI].evaluate(); + + phi.boundaryField()[patchI] = + U.boundaryField()[patchI] + & mesh.Sf().boundaryField()[patchI]; + } + } +} + +{ + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("pcorr", p_gh.dimensions(), 0.0), + pcorrTypes + ); + + surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(rAUf, pcorr) == fvc::div(phi) + ); + + pcorrEqn.solve(); + + if (pimple.finalNonOrthogonalIter()) + { + phi -= pcorrEqn.flux(); + } + } + + #include "continuityErrs.H" +} diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/createPghCorrTypes.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/createPghCorrTypes.H new file mode 100644 index 0000000000000000000000000000000000000000..7514369ca28c0864eaa911745b01fbe07e7537be --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/createPghCorrTypes.H @@ -0,0 +1,13 @@ + wordList pcorrTypes + ( + p_gh.boundaryField().size(), + zeroGradientFvPatchScalarField::typeName + ); + + for (label i=0; i<p_gh.boundaryField().size(); i++) + { + if (p_gh.boundaryField()[i].fixesValue()) + { + pcorrTypes[i] = fixedValueFvPatchScalarField::typeName; + } + } diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..c302b1671bbdabe5de65118d880b58694543a889 --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H @@ -0,0 +1,74 @@ +{ + rAU = 1.0/UEqn().A(); + surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + + volVectorField HbyA("HbyA", U); + HbyA = rAU*UEqn().H(); + + if (pimple.nCorrPISO() <= 1) + { + UEqn.clear(); + } + + surfaceScalarField phiHbyA + ( + "phiHbyA", + (fvc::interpolate(HbyA) & mesh.Sf()) + + rAUf*fvc::ddtCorr(U, Uf) + ); + + if (p_gh.needReference()) + { + fvc::makeRelative(phiHbyA, U); + adjustPhi(phiHbyA, U, p_gh); + fvc::makeAbsolute(phiHbyA, U); + } + + // Update the fixedFluxPressure BCs to ensure flux consistency + setSnGrad<fixedFluxPressureFvPatchScalarField> + ( + p_gh.boundaryField(), + ( + phiHbyA.boundaryField() + - (mesh.Sf().boundaryField() & U.boundaryField()) + )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) + ); + + // Non-orthogonal pressure corrector loop + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_ghEqn + ( + fvm::laplacian(rAUf, p_gh) == fvc::div(phiHbyA) + ); + + p_ghEqn.setReference(p_ghRefCell, p_ghRefValue); + + p_ghEqn.solve(mesh.solver(p_gh.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA - p_ghEqn.flux(); + + // Explicitly relax pressure for momentum corrector + p_gh.relax(); + + U = HbyA - rAU*fvc::grad(p_gh); + U.correctBoundaryConditions(); + fvOptions.correct(U); + } + } + + #include "continuityErrs.H" + + { + Uf = fvc::interpolate(U); + surfaceVectorField n(mesh.Sf()/mesh.magSf()); + Uf += n*(phi/mesh.magSf() - (n & Uf)); + } + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); + + p = p_gh + (g & mesh.C()); +} diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..643f4eac442385d67019184602a72ca4f239bc5d --- /dev/null +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/potentialFreeSurfaceDyMFoam.C @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Application + potentialFreeSurfaceDyMFoam + +Description + Incompressible Navier-Stokes solver with inclusion of a wave height field + to enable single-phase free-surface approximations. + + Wave height field, zeta, used by pressure boundary conditions. + + Optional mesh motion and mesh topology changes including adaptive + re-meshing. + + Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "singlePhaseTransportModel.H" +#include "turbulenceModel.H" +#include "pimpleControl.H" +#include "fvIOoptionList.H" +#include "fixedFluxPressureFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "initContinuityErrs.H" + + pimpleControl pimple(mesh); + + #include "createFields.H" + #include "createFvOptions.H" + #include "createPghCorrTypes.H" + + volScalarField rAU + ( + IOobject + ( + "rAU", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("rAUf", dimTime, 1.0) + ); + + #include "correctPhi.H" + #include "createUf.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + if (pimple.firstIter() || moveMeshOuterCorrectors) + { + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); + + mesh.update(); + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + } + + if (mesh.changing() && correctPhi) + { + // Calculate absolute flux from the mapped surface velocity + phi = mesh.Sf() & Uf; + + #include "correctPhi.H" + + // Make the flux relative to the mesh motion + fvc::makeRelative(phi, U); + } + + if (mesh.changing() && checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + + #include "UEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/U b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..338192e7b74496834380ee0a68b4d391aae22c02 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/U @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + freeSurface + { + type pressureInletOutletParSlipVelocity; + value uniform (0 0 0); + } + + ".*Wall" + { + type fixedValue; + value uniform (0 0 0); + } + + "floatingObject.*" + { + type movingWallVelocity; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/p b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/p new file mode 100644 index 0000000000000000000000000000000000000000..10c76ef79faeb0a6b297fb32d4c6f99b4775e5d5 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/p @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + freeSurface + { + type calculated; + value uniform 0; + } + ".*Wall" + { + type calculated; + value uniform 0; + } + "floatingObject.*" + { + type calculated; + value uniform 0; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/p_gh b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/p_gh new file mode 100644 index 0000000000000000000000000000000000000000..428fa3eb3607da910552d86fe1216132d4e0b1db --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/p_gh @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p_gh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + freeSurface + { + type waveSurfacePressure; + value uniform 0; + } + ".*Wall" + { + type zeroGradient; + } + "floatingObject.*" + { + type fixedFluxPressure; + value uniform 0; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/pointDisplacement b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/pointDisplacement new file mode 100644 index 0000000000000000000000000000000000000000..fbbb826a308a47fab7b30a301d00f700d77ab98e --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/0.org/pointDisplacement @@ -0,0 +1,69 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + location "0"; + object pointMotionU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + freeSurface + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + leftWall + { + type fixedNormalSlip; + n (-1 0 0); + } + + rightWall + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + bottomWall + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + floatingObject + { + type fixedNormalSlip; + n (1 0 0); + } + + floatingObjectBottom + { + type oscillatingDisplacement; + amplitude (0 -0.05 0); + omega 6.2831853; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allclean b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..922d2c701e40c31b2d9670a03e1ac05c7c6f5168 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +rm -rf 0 +rm -rf poolHeight poolHeight_vs_time diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..64ef644712a251570515a4e8da0148e81c220fc0 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun @@ -0,0 +1,21 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Set application name +application=`getApplication` + +runApplication blockMesh +runApplication topoSet +mv log.topoSet log.topoSet.1 +runApplication subsetMesh -overwrite c0 -patch floatingObject +runApplication topoSet -dict system/topoSetDict-selectBottom +runApplication createPatch -overwrite + +cp -r 0.org 0 > /dev/null 2>&1 + +runApplication $application + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/dynamicMeshDict b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..54d0e9f9b41ffff24621f5ac8c7d60fd4acff760 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/dynamicMeshDict @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object dynamicMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMotionSolverFvMesh; + +motionSolverLibs ("libfvMotionSolvers.so"); + +solver displacementLaplacian; +//solver velocityComponentLaplacian z; + +displacementLaplacianCoeffs +{ + // diffusivity uniform; + // diffusivity directional (1 200 0); + // diffusivity motionDirectional (1 1000 0); + // diffusivity file motionDiffusivity; + diffusivity inverseDistance 1(floatingObjectBottom); +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/g b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..07c168261b7fcb1c1f2e7a31164669c4f2857cd0 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/polyMesh/blockMeshDict b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..653e8c59e801d2e032ef666752b54457b9f0ba45 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/polyMesh/blockMeshDict @@ -0,0 +1,96 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( 0 0 0) + (10 0 0) + (10 1 0) + ( 0 1 0) + ( 0 0 0.1) + (10 0 0.1) + (10 1 0.1) + ( 0 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (200 20 1) simpleGrading (10 0.1 1) +); + +edges +( +); + +boundary +( + freeSurface + { + type wall; + faces + ( + (3 7 6 2) + ); + } + leftWall + { + type wall; + faces + ( + (0 4 7 3) + ); + } + rightWall + { + type wall; + faces + ( + (2 6 5 1) + ); + } + bottomWall + { + type wall; + faces + ( + (1 5 4 0) + ); + } + floatingObject + { + type wall; + faces + ( + ); + } + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/polyMesh/boundary b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..e7402e7b56cca10cdac43b4e3157cde588eb3189 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/polyMesh/boundary @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +7 +( + freeSurface + { + type wall; + inGroups 1(wall); + nFaces 181; + startFace 7429; + } + leftWall + { + type wall; + inGroups 1(wall); + nFaces 20; + startFace 7610; + } + rightWall + { + type wall; + inGroups 1(wall); + nFaces 20; + startFace 7630; + } + bottomWall + { + type wall; + inGroups 1(wall); + nFaces 200; + startFace 7650; + } + floatingObject + { + type wall; + inGroups 1(wall); + nFaces 18; + startFace 7850; + } + frontAndBack + { + type empty; + inGroups 1(empty); + nFaces 7658; + startFace 7868; + } + floatingObjectBottom + { + type wall; + inGroups 1(wall); + nFaces 19; + startFace 15526; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/transportProperties b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..ea8013dfa7f41c36f82e53fdaf4418330c5e76b3 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [0 2 -1 0 0 0 0] 1e-06; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/turbulenceProperties b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..8e0954f71164cc422e17f963f55e7813f8e8c6a8 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/extractHeightData b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/extractHeightData new file mode 100755 index 0000000000000000000000000000000000000000..bc1a5b586c255ce2640d8047342e93c127c3f0a3 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/extractHeightData @@ -0,0 +1,2 @@ +#!/bin/sh +awk '{print $1 " " $4}' postProcessing/poolHeight/0/faceSource.dat > poolHeight_vs_time diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/controlDict b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..96e4fcb9aa4b85c08f2d07c197f327780decd4bc --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/controlDict @@ -0,0 +1,89 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application potentialFreeSurfaceDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 20; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.02; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.4; + +maxDeltaT 1; + +functions +{ + forces + { + type forces; + functionObjectLibs ("libforces.so"); + outputControl outputTime; + patches (floatingObject); + pName p; + UName U; + rhoName rhoInf; + log yes; + rhoInf 1000; + CofR (0 0 0); + } + + poolHeight + { + type faceSource; + functionObjectLibs ("libfieldFunctionObjects.so"); + enabled yes; + outputControl timeStep; + outputInterval 1; + log yes; + valueOutput no; + source faceZone; + sourceName f0; + operation areaAverage; + fields + ( + zeta + ); + } +}; + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/createPatchDict b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/createPatchDict new file mode 100644 index 0000000000000000000000000000000000000000..65308ff5b202f5b361451567e0bed3b1c7f6d926 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/createPatchDict @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Do a synchronisation of coupled points after creation of any patches. +// Note: this does not work with points that are on multiple coupled patches +// with transformations (i.e. cyclics). +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name floatingObjectBottom; + + // Dictionary to construct new patch from + patchInfo + { + type wall; + } + + // How to construct: either from 'patches' or 'set' + constructFrom set; + + // If constructFrom = set : name of faceSet + set floatingObjectBottom; + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/fvSchemes b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..30b45def0bc71e1b2f6ed769a85180dba38aaa69 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/fvSchemes @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss upwind; + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_gh; + pcorr; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/fvSolution b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..93c92a88d077d86870527afd639eb1865422f6c2 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/fvSolution @@ -0,0 +1,85 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "cellDisplacement.*" + { + solver GAMG; + tolerance 1e-5; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + "pcorr.*" + { + solver GAMG; + tolerance 1e-2; + relTol 0; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + maxIter 100; + } + + p_gh + { + $pcorr; + tolerance 1e-7; + relTol 0.1; + } + + p_ghFinal + { + $p_gh; + relTol 0; + } + + U + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-7; + relTol 0.1; + } + + UFinal + { + $U; + relTol 0; + } +} + +PIMPLE +{ + correctPhi yes; + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..7cb36658987b5ed62096797c079221188713b534 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name c0; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (0.1 0.8 -100) (0.4 100 100); + } + } + + { + name c0; + type cellSet; + action invert; + } + + { + name f0; + type faceSet; + action new; + source patchToFace; + sourceInfo + { + name freeSurface; + } + } + + { + name f0; + type faceSet; + action subset; + source boxToFace; + sourceInfo + { + box (-100 0.9 -100) (0.2 100 100); + } + } + + { + name f0; + type faceZoneSet; + action new; + source setToFaceZone; + sourceInfo + { + faceSet f0; + } + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom new file mode 100644 index 0000000000000000000000000000000000000000..1acb301e24f93c3e75cae4a314b2b8c52e0c7d82 --- /dev/null +++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/system/topoSetDict-selectBottom @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.3.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name floatingObjectBottom; + type faceSet; + action new; + source patchToFace; + sourceInfo + { + name floatingObject; + } + } + + { + name floatingObjectBottom; + type faceSet; + action subset; + source normalToFace; + sourceInfo + { + normal (0 1 0); // Vector + cos 0.01; // Tolerance (max cos of angle) + } + } +); + +// ************************************************************************* //