From d6abdefe51b720f32cb2ef4a2260980c21323fec Mon Sep 17 00:00:00 2001 From: puigmontella Date: Tue, 25 Jul 2023 15:53:03 +0200 Subject: [PATCH 1/5] corrections 2DpipelineScour --- .../overSedDymFoam/createTwoPhaseTurbulence.H | 216 ++++++++++++++++++ tutorials/Py/plot_depth2DPipelineScour.py | 13 +- tutorials/Py/plot_profiles2DPipelineScour.py | 2 +- .../constant/kineticTheoryProperties | 2 +- 4 files changed, 225 insertions(+), 8 deletions(-) create mode 100644 solver/overSedDymFoam/createTwoPhaseTurbulence.H diff --git a/solver/overSedDymFoam/createTwoPhaseTurbulence.H b/solver/overSedDymFoam/createTwoPhaseTurbulence.H new file mode 100644 index 000000000..15f3b1546 --- /dev/null +++ b/solver/overSedDymFoam/createTwoPhaseTurbulence.H @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------*\ +Copyright (C) 2015 Cyrille Bonamy, Julien Chauchat, Tian-Jian Hsu + and contributors + +License + This file is part of SedFOAM. + + SedFOAM 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. + + SedFOAM 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 SedFOAM. If not, see . +\*---------------------------------------------------------------------------*/ + +dimensionedScalar SUSread +( + twophaseRASProperties.getOrDefault + ( + "SUS", + dimensionedScalar("SUS", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) + ) +); +dimensionedScalar SUS_I +( + twophaseRASProperties.getOrDefault + ( + "SUS_I", + dimensionedScalar("SUS_I", dimensionSet(0, 0, 0, 0, 0, 0, 0), 1) + ) +); +dimensionedScalar SUS_A +( + twophaseRASProperties.getOrDefault + ( + "SUS_A", + dimensionedScalar("SUS_A", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) + ) +); +// Tensor for anistropic drift velocity model +dimensionedTensor iso +( + "iso", + dimensionSet(0, 0, 0, 0, 0, 0, 0), + tensor(1e0, 0e0, 0e0, 0e0, 1e0, 0e0, 0e0, 0e0, 1e0) + // XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ +); + +dimensionedTensor aniso +( + "aniso", + dimensionSet(0, 0, 0, 0, 0, 0, 0), + tensor(0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0) + // XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ +); + +volScalarField SUS +( + IOobject + ( + "SUS", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + SUSread +); + +Switch SUSlocal +( + twophaseRASProperties.getOrDefault("SUSlocal", false) +); + +Switch SUSaniso +( + twophaseRASProperties.getOrDefault("SUSaniso", false) +); + +dimensionedScalar Usmall +( + transportProperties.getOrDefault + ( + "Usmall", + dimensionedScalar("Usmall", dimensionSet(0, 1, -1, 0, 0, 0, 0), 1e-6) + ) +); + +dimensionedScalar B +( + twophaseRASProperties.getOrDefault + ( + "B", + dimensionedScalar("B", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.25) + ) +); + +dimensionedScalar KE1 +( + twophaseRASProperties.getOrDefault + ( + "KE1", + dimensionedScalar("KE1", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) + ) +); +dimensionedScalar Tpsmall +( + twophaseRASProperties.getOrDefault + ( + "Tpsmall", + dimensionedScalar("Tpsmall", dimensionSet(0, 0, 1, 0, 0, 0, 0), 1e-6) + ) +); +dimensionedScalar KE3 +( + twophaseRASProperties.getOrDefault + ( + "KE3", + dimensionedScalar("KE3", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) + ) +); +dimensionedScalar KE6 +( + twophaseRASProperties.getOrDefault + ( + "KE6", + dimensionedScalar("KE6", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) + ) +); + +volScalarField tmfexp +( + IOobject + ( + "tmfexp", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -B*rhoa*6.0/(max(beta*K, Tpsmall)) +); + +volScalarField rtemp((Ub-Ua) & gravity); +volVectorField Urtemp(Ub-Ua); +if (Foam::mag(gravity).value() != 0) +{ + Urtemp = rtemp*gravity/magSqr(gravity); +} + +volVectorField Urh((Ub-Ua) - Urtemp); +volScalarField ESD1((K/rhob)*(fvc::grad(alpha)) & Urh); + +volScalarField ESD3 +( + IOobject + ( + "ESD3", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -2.0*K*alpha/rhob +); + +volScalarField ESD4 +( + IOobject + ( + "ESD4", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + (-(SUS/beta)*(rhoa/rhob-1.0)*gravity & fvc::grad(alpha)) + KE1*ESD1 +); + +volScalarField ESD5 +( + IOobject + ( + "ESD5", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + max + ( + -(SUS/beta)*(rhoa/rhob-1.0)*gravity & fvc::grad(alpha), + scalar(0.0)*ESD1 + ) + + KE1*ESD1 +); + +volScalarField ESD +( + IOobject + ( + "ESD", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + KE3*ESD3 +); diff --git a/tutorials/Py/plot_depth2DPipelineScour.py b/tutorials/Py/plot_depth2DPipelineScour.py index e201fc389..c93ee63dc 100644 --- a/tutorials/Py/plot_depth2DPipelineScour.py +++ b/tutorials/Py/plot_depth2DPipelineScour.py @@ -2,7 +2,7 @@ from pylab import mlab import matplotlib.pyplot as plt import fluidfoam - +from scipy.interpolate import griddata # Function reading the mesh dimensions def readxy(case): @@ -12,7 +12,7 @@ def readxy(case): # Function returning the bed profile def max_depth(case, t0, tfinal, dt, xi, yi): - ybed = np.zeros(len(xi)) + ybed = np.zeros(ngridx) arr_size = int((tfinal - t0) / dt + 0.01) yscour = np.zeros(arr_size) time = np.zeros(arr_size) @@ -26,10 +26,10 @@ def max_depth(case, t0, tfinal, dt, xi, yi): timename = str(int(t)) + "/" else: timename = str(t) + "/" - a = fluidfoam.readscalar(case, timename, "alpha_a") - ai = mlab.griddata(x, y, a, xi, yi, interp="linear") + a = fluidfoam.readscalar(case, timename, "alpha.a") + ai = griddata((x, y), a, (xi, yi), method="linear") for j in range(ngridx): - ybed[j] = yi[np.max((np.where(ai[:, j] > 0.5)))] + ybed[j] = np.max(yi[(np.where(ai[:, j] > 0.5))]) yscour[i] = np.min(ybed[:]) time[i] = t return yscour, time @@ -51,13 +51,14 @@ def max_depth(case, t0, tfinal, dt, xi, yi): # Interpolation grid xi = np.linspace(xinterpmin, xinterpmax, ngridx) yi = np.linspace(yinterpmin, yinterpmax, ngridy) +xinterp, yinterp = np.meshgrid(xi, yi) # Maximum depth calculation x, y = readxy(case) t0 = 0 tfinal = 30 dt = 0.5 -max_depth, time = max_depth(case, t0, tfinal, dt, xi, yi) +max_depth, time = max_depth(case, t0, tfinal, dt, xinterp, yinterp) # Experimental data collection expe = "DATA/Mao_depth_expe.txt" diff --git a/tutorials/Py/plot_profiles2DPipelineScour.py b/tutorials/Py/plot_profiles2DPipelineScour.py index 18dcdda17..a9ea85fc5 100644 --- a/tutorials/Py/plot_profiles2DPipelineScour.py +++ b/tutorials/Py/plot_profiles2DPipelineScour.py @@ -19,7 +19,7 @@ def depth(sol, t, x, y, xi, yi): timename = str(int(t)) + "/" else: timename = str(t) + "/" - alpha = fluidfoam.readscalar(sol, timename, "alpha_a") + alpha = fluidfoam.readscalar(sol, timename, "alpha.a") alphai = griddata((x, y), alpha, (xi, yi)) for j in range(Nx - 1): tab = np.where(alphai[:, j + 1] > 0.5) diff --git a/tutorials/RAS/2DPipelineScour/constant/kineticTheoryProperties b/tutorials/RAS/2DPipelineScour/constant/kineticTheoryProperties index d1153bada..1385a1fd1 100644 --- a/tutorials/RAS/2DPipelineScour/constant/kineticTheoryProperties +++ b/tutorials/RAS/2DPipelineScour/constant/kineticTheoryProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -kineticTheory on; +kineticTheory off; limitProduction off; From 345d9a939eae9d88e55c686677227cb709ecac8a Mon Sep 17 00:00:00 2001 From: puigmontella Date: Tue, 25 Jul 2023 15:55:31 +0200 Subject: [PATCH 2/5] corrections 2DpipelineScour --- .../overSedDymFoam/createTwoPhaseTurbulence.H | 216 ------------------ 1 file changed, 216 deletions(-) delete mode 100644 solver/overSedDymFoam/createTwoPhaseTurbulence.H diff --git a/solver/overSedDymFoam/createTwoPhaseTurbulence.H b/solver/overSedDymFoam/createTwoPhaseTurbulence.H deleted file mode 100644 index 15f3b1546..000000000 --- a/solver/overSedDymFoam/createTwoPhaseTurbulence.H +++ /dev/null @@ -1,216 +0,0 @@ -/*---------------------------------------------------------------------------*\ -Copyright (C) 2015 Cyrille Bonamy, Julien Chauchat, Tian-Jian Hsu - and contributors - -License - This file is part of SedFOAM. - - SedFOAM 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. - - SedFOAM 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 SedFOAM. If not, see . -\*---------------------------------------------------------------------------*/ - -dimensionedScalar SUSread -( - twophaseRASProperties.getOrDefault - ( - "SUS", - dimensionedScalar("SUS", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) - ) -); -dimensionedScalar SUS_I -( - twophaseRASProperties.getOrDefault - ( - "SUS_I", - dimensionedScalar("SUS_I", dimensionSet(0, 0, 0, 0, 0, 0, 0), 1) - ) -); -dimensionedScalar SUS_A -( - twophaseRASProperties.getOrDefault - ( - "SUS_A", - dimensionedScalar("SUS_A", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) - ) -); -// Tensor for anistropic drift velocity model -dimensionedTensor iso -( - "iso", - dimensionSet(0, 0, 0, 0, 0, 0, 0), - tensor(1e0, 0e0, 0e0, 0e0, 1e0, 0e0, 0e0, 0e0, 1e0) - // XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ -); - -dimensionedTensor aniso -( - "aniso", - dimensionSet(0, 0, 0, 0, 0, 0, 0), - tensor(0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0) - // XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ -); - -volScalarField SUS -( - IOobject - ( - "SUS", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - SUSread -); - -Switch SUSlocal -( - twophaseRASProperties.getOrDefault("SUSlocal", false) -); - -Switch SUSaniso -( - twophaseRASProperties.getOrDefault("SUSaniso", false) -); - -dimensionedScalar Usmall -( - transportProperties.getOrDefault - ( - "Usmall", - dimensionedScalar("Usmall", dimensionSet(0, 1, -1, 0, 0, 0, 0), 1e-6) - ) -); - -dimensionedScalar B -( - twophaseRASProperties.getOrDefault - ( - "B", - dimensionedScalar("B", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.25) - ) -); - -dimensionedScalar KE1 -( - twophaseRASProperties.getOrDefault - ( - "KE1", - dimensionedScalar("KE1", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) - ) -); -dimensionedScalar Tpsmall -( - twophaseRASProperties.getOrDefault - ( - "Tpsmall", - dimensionedScalar("Tpsmall", dimensionSet(0, 0, 1, 0, 0, 0, 0), 1e-6) - ) -); -dimensionedScalar KE3 -( - twophaseRASProperties.getOrDefault - ( - "KE3", - dimensionedScalar("KE3", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) - ) -); -dimensionedScalar KE6 -( - twophaseRASProperties.getOrDefault - ( - "KE6", - dimensionedScalar("KE6", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0) - ) -); - -volScalarField tmfexp -( - IOobject - ( - "tmfexp", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -B*rhoa*6.0/(max(beta*K, Tpsmall)) -); - -volScalarField rtemp((Ub-Ua) & gravity); -volVectorField Urtemp(Ub-Ua); -if (Foam::mag(gravity).value() != 0) -{ - Urtemp = rtemp*gravity/magSqr(gravity); -} - -volVectorField Urh((Ub-Ua) - Urtemp); -volScalarField ESD1((K/rhob)*(fvc::grad(alpha)) & Urh); - -volScalarField ESD3 -( - IOobject - ( - "ESD3", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -2.0*K*alpha/rhob -); - -volScalarField ESD4 -( - IOobject - ( - "ESD4", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - (-(SUS/beta)*(rhoa/rhob-1.0)*gravity & fvc::grad(alpha)) + KE1*ESD1 -); - -volScalarField ESD5 -( - IOobject - ( - "ESD5", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - max - ( - -(SUS/beta)*(rhoa/rhob-1.0)*gravity & fvc::grad(alpha), - scalar(0.0)*ESD1 - ) - + KE1*ESD1 -); - -volScalarField ESD -( - IOobject - ( - "ESD", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - KE3*ESD3 -); From 707348eadda3ee8699ca060a259f1f3ffd9c19ee Mon Sep 17 00:00:00 2001 From: puigmontella Date: Thu, 15 Feb 2024 12:42:03 +0000 Subject: [PATCH 3/5] changes --- TurbulenceModels/wallFunctions | 2 +- foamStyleCheck | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TurbulenceModels/wallFunctions b/TurbulenceModels/wallFunctions index b12e4d362..1c40c4454 160000 --- a/TurbulenceModels/wallFunctions +++ b/TurbulenceModels/wallFunctions @@ -1 +1 @@ -Subproject commit b12e4d3621915cf12b2636a8f18ceebd82417e7b +Subproject commit 1c40c4454050e5502993213d1dcf1c142119e48f diff --git a/foamStyleCheck b/foamStyleCheck index 0a560d26a..7c60cef51 160000 --- a/foamStyleCheck +++ b/foamStyleCheck @@ -1 +1 @@ -Subproject commit 0a560d26a0b5a87f95be55265d167aae3255b6c0 +Subproject commit 7c60cef5186b8d9b34c5aab7634bb4bd593f1384 From dba290ed6beccdd6430665d08be96258ae87153c Mon Sep 17 00:00:00 2001 From: puigmontella Date: Sun, 18 Feb 2024 23:26:39 +0000 Subject: [PATCH 4/5] checkstyle --- tutorials/Py/plot_depth2DPipelineScour.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tutorials/Py/plot_depth2DPipelineScour.py b/tutorials/Py/plot_depth2DPipelineScour.py index c93ee63dc..659e26d24 100644 --- a/tutorials/Py/plot_depth2DPipelineScour.py +++ b/tutorials/Py/plot_depth2DPipelineScour.py @@ -4,6 +4,7 @@ import fluidfoam from scipy.interpolate import griddata + # Function reading the mesh dimensions def readxy(case): x, y, z = fluidfoam.readmesh(case) From 5b2b201e5c1c4f3ae8478d6df923b5cbf3f0047e Mon Sep 17 00:00:00 2001 From: puigmontella Date: Tue, 20 Feb 2024 12:03:31 +0100 Subject: [PATCH 5/5] submodules update --- TurbulenceModels/wallFunctions | 2 +- docker/docker-stacks | 2 +- foamStyleCheck | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TurbulenceModels/wallFunctions b/TurbulenceModels/wallFunctions index 1c40c4454..a1e33e27a 160000 --- a/TurbulenceModels/wallFunctions +++ b/TurbulenceModels/wallFunctions @@ -1 +1 @@ -Subproject commit 1c40c4454050e5502993213d1dcf1c142119e48f +Subproject commit a1e33e27ae86196294c692f5f207bfe33023716e diff --git a/docker/docker-stacks b/docker/docker-stacks index 9abc77b95..c2159f411 160000 --- a/docker/docker-stacks +++ b/docker/docker-stacks @@ -1 +1 @@ -Subproject commit 9abc77b951c45a293a7d9b747163ff682e38bed5 +Subproject commit c2159f4118f39e7201282628131dad3b25d40ba6 diff --git a/foamStyleCheck b/foamStyleCheck index 7c60cef51..0a560d26a 160000 --- a/foamStyleCheck +++ b/foamStyleCheck @@ -1 +1 @@ -Subproject commit 7c60cef5186b8d9b34c5aab7634bb4bd593f1384 +Subproject commit 0a560d26a0b5a87f95be55265d167aae3255b6c0