From 41b93e1e0de68a4d1fddc3adcf3a943384370cbb Mon Sep 17 00:00:00 2001 From: Malik Date: Fri, 2 Aug 2024 09:37:57 -0600 Subject: [PATCH] minimal laakk --- .../laakkonen/constant/MRFProperties | 30 + OFsolvers/tutorial_cases/laakkonen/constant/g | 22 + .../laakkonen/constant/globalTransport | 37 ++ .../laakkonen/constant/globalVars | 114 ++++ .../laakkonen/constant/phaseProperties | 449 +++++++++++++++ .../constant/thermophysicalProperties.gas | 79 +++ .../constant/thermophysicalProperties.liquid | 93 +++ .../constant/turbulenceProperties.gas | 29 + .../constant/turbulenceProperties.liquid | 26 + .../tutorial_cases/laakkonen/orig0/CO2.gas | 46 ++ .../tutorial_cases/laakkonen/orig0/CO2.liquid | 46 ++ .../tutorial_cases/laakkonen/orig0/T.gas | 47 ++ .../tutorial_cases/laakkonen/orig0/T.liquid | 46 ++ .../tutorial_cases/laakkonen/orig0/U.gas | 51 ++ .../tutorial_cases/laakkonen/orig0/U.liquid | 64 +++ .../laakkonen/orig0/Ydefault.gas | 46 ++ .../laakkonen/orig0/Ydefault.liquid | 48 ++ .../tutorial_cases/laakkonen/orig0/alpha.gas | 48 ++ .../laakkonen/orig0/alpha.liquid | 48 ++ .../tutorial_cases/laakkonen/orig0/alphat.gas | 55 ++ .../laakkonen/orig0/alphat.liquid | 55 ++ .../laakkonen/orig0/epsilon.gas | 60 ++ .../laakkonen/orig0/epsilon.liquid | 56 ++ .../tutorial_cases/laakkonen/orig0/f.gas | 48 ++ .../tutorial_cases/laakkonen/orig0/k.gas | 60 ++ .../tutorial_cases/laakkonen/orig0/k.liquid | 56 ++ .../laakkonen/orig0/nbut.liquid | 48 ++ .../tutorial_cases/laakkonen/orig0/nut.gas | 53 ++ .../tutorial_cases/laakkonen/orig0/nut.liquid | 52 ++ OFsolvers/tutorial_cases/laakkonen/orig0/p | 45 ++ .../tutorial_cases/laakkonen/orig0/p_rgh | 46 ++ .../tutorial_cases/laakkonen/presteps.sh | 22 + OFsolvers/tutorial_cases/laakkonen/run.sh | 40 ++ OFsolvers/tutorial_cases/laakkonen/sol.foam | 0 .../laakkonen/system/controlDict | 67 +++ .../laakkonen/system/createPatchDict | 44 ++ .../laakkonen/system/createPatchDict_inlet | 44 ++ .../laakkonen/system/decomposeParDict | 45 ++ .../tutorial_cases/laakkonen/system/fvSchemes | 78 +++ .../laakkonen/system/fvSolution | 169 ++++++ .../laakkonen/system/reactor_geom_data.py | 108 ++++ .../laakkonen/system/setFieldsDict | 39 ++ .../laakkonen/system/snappyHexMeshDict | 484 ++++++++++++++++ .../laakkonen/system/snappyHexMeshDict_1 | 344 ++++++++++++ .../laakkonen/system/snappyHexMeshDict_2 | 344 ++++++++++++ .../laakkonen/system/snappyHexMeshDict_3 | 357 ++++++++++++ .../laakkonen/system/topoSetDict | 215 +++++++ .../laakkonen/system/topoSetDict_rm_inlet | 76 +++ .../laakkonen/system/write_bmesh_file.py | 530 ++++++++++++++++++ 49 files changed, 5009 insertions(+) create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/MRFProperties create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/g create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/globalTransport create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/globalVars create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/phaseProperties create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/CO2.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/CO2.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/T.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/T.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/U.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/U.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/alpha.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/alpha.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/alphat.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/alphat.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/f.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/k.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/k.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/nbut.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/nut.gas create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/nut.liquid create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/p create mode 100644 OFsolvers/tutorial_cases/laakkonen/orig0/p_rgh create mode 100755 OFsolvers/tutorial_cases/laakkonen/presteps.sh create mode 100644 OFsolvers/tutorial_cases/laakkonen/run.sh create mode 100644 OFsolvers/tutorial_cases/laakkonen/sol.foam create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/controlDict create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/createPatchDict create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/createPatchDict_inlet create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/decomposeParDict create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/fvSchemes create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/fvSolution create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/reactor_geom_data.py create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/setFieldsDict create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_1 create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_2 create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_3 create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/topoSetDict create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/topoSetDict_rm_inlet create mode 100644 OFsolvers/tutorial_cases/laakkonen/system/write_bmesh_file.py diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/MRFProperties b/OFsolvers/tutorial_cases/laakkonen/constant/MRFProperties new file mode 100644 index 00000000..6770aaa8 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/MRFProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +MRF1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 1 0); + omega 70; // rad/s (1 rad/s = 9.55 rpm) +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/g b/OFsolvers/tutorial_cases/laakkonen/constant/g new file mode 100644 index 00000000..cac96600 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / 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/OFsolvers/tutorial_cases/laakkonen/constant/globalTransport b/OFsolvers/tutorial_cases/laakkonen/constant/globalTransport new file mode 100644 index 00000000..131dfd3c --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/globalTransport @@ -0,0 +1,37 @@ +//****** Temperature ************ +Temp 295.15; // K +//*****Gas transport******************* +muMixGas 1.479e-05; +PrMixGas 0.7; +LeGas 1.0; +dbubGas 0.001; +//****Liquid transport***************** +CpMixLiq 2359.8; +muMixLiq 0.0029; // 1 cP at 20C, 0.467 at 60C +kThermLiq 0.167; // W/m-K +RMixLiq 3000; //NOT SURE +rho0MixLiq 810; // kg/m^3 +sigmaLiq 0.023; //surface tension N/m +ddropLiq 0.003; // NOT SURE +//Wilke-Chang params for diffusivity of aq. O2 +// not currently used, JJS 4/14/16 +WC_psi 2.6; +WC_M 18; // kg/kmol +WC_V 25.6e-3; // m3/kmol / O2=25.6e-3 / H2=14.3e-3 / CO2=34e-3 +//******************************************** +H_O2_298 0.032; +DH_O2 1700; +H_CO2_298 0.83; +DH_CO2 2400; +H_H2_298 0.019; +DH_H2 500; +H_CH4_298 0.032; +DH_CH4 1900; +// ******* Inlet conditions ********* +targetUs 0.02; +inletArea 0.5; +totalArea 1.0; +inletAlphaGas 1.0; +liqHeight 1.5; +presfactor 1.1; // (P1+rho*g*h)/(P1+rho*g*h/2) +O2Liquid 0; // massFrac=C(mol/m3)*MW/rho 3.2e-6=0.1(mol/m3) diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/globalVars b/OFsolvers/tutorial_cases/laakkonen/constant/globalVars new file mode 100644 index 00000000..092f78bc --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/globalVars @@ -0,0 +1,114 @@ +T0 295.15; // initial T(K) which stays constant +// water thermophysical properties +// https://www.iea-amf.org/content/fuel_information/butanol/properties +//*****Gas transport******************* +muMixGas 1.479e-05; +PrMixGas 0.7; +LeGas 1.0; +dbubGas 0.001; + +muMixLiq 0.0029; // Pa.s +CpMixLiq 2359.8; // J/kg-K https://webbook.nist.gov/cgi/cbook.cgi?ID=C71363&Mask=2 +kThermLiq 0.167; // W/m-K // https://www.engineeringtoolbox.com/thermal-conductivity-liquids-d_1260.html +rho0MixLiq 810; // kg/m^3 +RMixLiq 3000; //NOT SURE +sigmaLiq 0.023; //surface tension N/m (laakkonen) +//Wilke-Chang params for diffusion coefficient of a given solute in water (solvent) +WC_psi 1.5; //https://www.egichem.com/tools/calculators/wilke-chang/ +WC_M 74.1; // kg/kmol +WC_V_O2 25.6e-3; // m3/kmol molar volume at normal boiling temperature (Treybal 1968) +WC_V_H2 14.3e-3; +WC_V_CO2 34e-3; +WC_V_CO 30.7e-3; +WC_V_CH4 35e-3; // V_b[cm3/mol]=0.285*V_critical^1.048 (Tyn and Calus; ESTIMATING LIQUID MOLAL VOLUME; Processing, Volume 21, Issue 4, Pages 16 - 17) +//****** diffusion coeff *********** +D_H2 #calc "1.173e-16 * pow($WC_psi * $WC_M,0.5) * $T0 / $muMixLiq / pow($WC_V_H2,0.6)"; +D_CO2 #calc "1.173e-16 * pow($WC_psi * $WC_M,0.5) * $T0 / $muMixLiq / pow($WC_V_CO2,0.6)"; +D_CO #calc "1.173e-16 * pow($WC_psi * $WC_M,0.5) * $T0 / $muMixLiq / pow($WC_V_CO,0.6)"; +D_CH4 #calc "1.173e-16 * pow($WC_psi * $WC_M,0.5) * $T0 / $muMixLiq / pow($WC_V_CH4,0.6)"; +// D_H2=3.4e-9, D_CO2=2e-9, D_CO=2.16e-9 at 25C +// Looks like the H2 diffusion is less than litr reported values ~ 4.5e-9 +// Scale down by a factor 10 +//****** Henry coeff *************** +H_O2_298 0.0032; +DH_O2 1700; +H_CO2_298 0.006916666666666667;//https://www.pure.ed.ac.uk/ws/portalfiles/portal/84258037/Kvam_Sarkisov_Solubility_v12.pdf +DH_CO2 2400; +H_CO_298 0.0023; +DH_CO 1300; +H_H2_298 0.0019; +DH_H2 500; +H_CH4_298 0.0009600960096009601;//https://www.pure.ed.ac.uk/ws/portalfiles/portal/84258037/Kvam_Sarkisov_Solubility_v12.pdf +DH_CH4 1900; + +He_H2 #calc "$H_H2_298 * exp($DH_H2 *(1. / $T0 - 1./298.15))"; +He_CO #calc "$H_CO_298 * exp($DH_CO *(1. / $T0 - 1./298.15))"; +He_CO2 #calc "$H_CO2_298 * exp($DH_CO2 *(1. / $T0 - 1./298.15))"; +He_CH4 #calc "$H_CH4_298 * exp($DH_CH4 *(1. / $T0 - 1./298.15))"; +//*******inlet gas frac************* +f_H2 0.0; +f_CO2 1.0; +f_CO 0.0; +//********************************* +LeLiqH2 #calc "$kThermLiq / $rho0MixLiq / $D_H2 / $CpMixLiq"; +LeLiqCO #calc "$kThermLiq / $rho0MixLiq / $D_CO / $CpMixLiq"; +LeLiqCO2 #calc "$kThermLiq / $rho0MixLiq / $D_CO2 / $CpMixLiq"; // = 74 +LeLiqCH4 #calc "$kThermLiq / $rho0MixLiq / $D_CH4 / $CpMixLiq"; + +LeLiqMix #calc "$f_H2*$LeLiqH2+$f_CO2*$LeLiqCO2+$f_CO*$LeLiqCO"; +PrMixLiq #calc "$CpMixLiq * $muMixLiq / $kThermLiq"; +// Pr number is ~ 7 for water and ~ 0.7 for air +//********************************* +kH2 #calc "$D_H2*$rho0MixLiq*$CpMixLiq*$LeLiqMix"; +PrH2 #calc "$muMixLiq*$CpMixLiq / $kH2"; + +kCO #calc "$D_CO*$rho0MixLiq*$CpMixLiq*$LeLiqMix"; +PrCO #calc "$muMixLiq*$CpMixLiq / $kCO"; + +kCO2 #calc "$D_CO2*$rho0MixLiq*$CpMixLiq*$LeLiqMix"; +PrCO2 #calc "$muMixLiq*$CpMixLiq / $kCO2"; + +kCH4 #calc "$D_CH4*$rho0MixLiq*$CpMixLiq*$LeLiqMix"; +PrCH4 #calc "$muMixLiq*$CpMixLiq / $kCH4"; +//*****Gas transport******************* +muMixGas 1.88e-05; +PrMixGas 0.7; +LeGas 1.0; +//dbubGas 0.001; +//********************************* +HtBcol 0.260; +DiaBcol 0.260; +LiqHt 0.260; +LiqHt_limit #calc "1.0*$HtBcol"; +//********************************* +P0 1.01325E5; +Pbot #calc "$P0+1000.0*$LiqHt*9.8"; +Pmid #calc "$P0+1000.0*0.5*$LiqHt*9.8"; + +//bubble column cross-section divided by sparger area + +NHoles 12; +dHoles 0.001; +S_col #calc "$DiaBcol * $DiaBcol * 3.14159 / 4.0"; +V_col #calc "$S_col * $HtBcol"; +S_sparg #calc "$NHoles * $dHoles * $dHoles * 3.14159 / 4.0"; +uGas #calc "0.0001 * $V_col * 0.7 / ($S_sparg * 60)"; + +V_flowRate #calc "0.7 * $V_col / 60"; + +ArbyAs #calc "$S_col / $S_sparg"; +uSupVel #calc "$uGas * $S_sparg / $S_col"; +A_Bcol #calc "3.14159 * $DiaBcol * $DiaBcol / 4.0"; +rho_gas #calc "$Pmid / 287.0 / $T0"; +mflowRate #calc "$uSupVel * $A_Bcol * $rho_gas"; + +//********************************* +intensity 0.05; +l_scale 0.001; +u_true_gas 17.0825308; +k_inlet_gas #calc "1.5 * Foam::pow(($u_true_gas), 2) * Foam::pow($intensity, 2)"; +k_inlet_liq #calc "1.5 * Foam::pow(($u_true_gas), 2) * Foam::pow($intensity, 2)"; +eps_inlet_gas #calc "pow(0.09,0.75) * Foam::pow($k_inlet_gas, 1.5) / ($l_scale * 0.07)"; +eps_inlet_liq #calc "pow(0.09,0.75) * Foam::pow($k_inlet_liq, 1.5) / ($l_scale * 0.07)"; +omega_inlet_gas #calc "pow(0.09,-0.25) * pow($k_inlet_gas,0.5) / ($l_scale * 0.07)"; +omega_inlet_liq #calc "pow(0.09,-0.25) * pow($k_inlet_liq,0.5) / ($l_scale * 0.07)"; diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/phaseProperties b/OFsolvers/tutorial_cases/laakkonen/constant/phaseProperties new file mode 100644 index 00000000..61943b18 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/phaseProperties @@ -0,0 +1,449 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object phaseProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "$FOAM_CASE/constant/globalVars" + +type interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem; + +phases (gas liquid); + +populationBalances (bubbles); + +D_O2 #codeStream +{ + code + #{ + os<<1.173e-16*pow($WC_psi * $WC_M,0.5)* $T0 / $muMixLiq /pow($WC_V_O2,0.6); + #}; +}; + +LeLiq #codeStream +{ + code + #{ + os<<$kThermLiq / $rho0MixLiq / $D_O2 / $CpMixLiq; + #}; +}; + +H_H2 #codeStream +{ + code + #{ + os<<$H_H2_298 * exp($DH_H2 *(1. / $T0 - 1./298.)); + #}; +}; + + +H_CO2 #codeStream +{ + code + #{ + os<<$H_CO2_298 * exp($DH_CO2 * (1. / $T0 - 1./298.)); + #}; +}; + +H_CH4 #codeStream +{ + code + #{ + os<<$H_CH4_298 * exp($DH_CH4 * (1. / $T0 - 1./298.)); + #}; +}; + +gas +{ + type multiComponentPhaseModel;//pureIsothermalPhaseModel; + diameterModel velocityGroup; + velocityGroupCoeffs + { + populationBalance bubbles; + + shapeModel spherical; + + sizeGroups + ( + f1 {dSph 0.1e-3; value 0.0;} + f2 {dSph 0.4e-3; value 0.0;} + f3 {dSph 0.7e-3; value 0.0;} + f4 {dSph 1.0e-3; value 0.0;} + f5 {dSph 1.3e-3; value 1.0;} + f6 {dSph 1.6e-3; value 0.0;} + f7 {dSph 1.9e-3; value 0.0;} + f8 {dSph 2.2e-3; value 0.0;} + f9 {dSph 2.5e-3; value 0.0;} + f10 {dSph 2.8e-3; value 0.0;} + f11 {dSph 3.1e-3; value 0.0;} + f12 {dSph 3.4e-3; value 0.0;} + f13 {dSph 3.7e-3; value 0.0;} + f14 {dSph 4.0e-3; value 0.0;} + ); + } + + residualAlpha 1e-6; + + Sc 0.7; + +} + +liquid +{ + type multiComponentPhaseModel;//pureIsothermalPhaseModel; + diameterModel constant; + constantCoeffs + { + d 1e-3; //1e-4; helps prevent liquid drops in head space, JJS 4/14/16 + } + Sc #codeStream + { + code + #{ + os << ($LeLiq * $CpMixLiq * $muMixLiq / $kThermLiq); + #}; + }; + + residualAlpha 1e-6; +} + + +populationBalanceCoeffs +{ + bubbles + { + continuousPhase liquid; + + coalescenceModels + ( + LehrMilliesMewes{ + efficiency 4.695; + uCrit 0.08; + alphaMax 0.6; + } + ); + + binaryBreakupModels + (); + + breakupModels + ( + Laakkonen { + efficiency 13.83; + daughterSizeDistributionModel Laakkonen; + } + + ); + + driftModels + ( + densityChange{} + ); + + nucleationModels + (); + } +} + + +blending +{ + default + { + type linear; + minFullyContinuousAlpha.gas 0.7; + minPartlyContinuousAlpha.gas 0.3; + minFullyContinuousAlpha.liquid 0.7; + minPartlyContinuousAlpha.liquid 0.3; + } + + heatTransfer + { + type linear; + minFullyContinuousAlpha.gas 1; + minPartlyContinuousAlpha.gas 0; + minFullyContinuousAlpha.liquid 1; + minPartlyContinuousAlpha.liquid 0; + } + + massTransfer + { + $heatTransfer; + } + +} + +surfaceTension +( + (gas and liquid) + { + type constant; + sigma $sigmaLiq; + } +); + +aspectRatio +( + (gas in liquid) + { + type constant; + E0 1.0; + } + + (liquid in gas) + { + type constant; + E0 1.0; + } +); + +drag +( + (gas in liquid) + { + //type Grace; // Need to install the model available at https://github.com/NREL/BioReactorDesign + type IshiiZuber; + residualRe 1e-3; + swarmCorrection + { + type none; + } + } + + (liquid in gas) + { + type SchillerNaumann; + residualRe 1e-3; + swarmCorrection + { + type none; + } + } +); + + + +virtualMass +( + (gas in liquid) + { + type constantCoefficient; + Cvm 0.5; + } + + (liquid in gas) + { + type constantCoefficient; + Cvm 0.5; + } +); + +/* +From docs: These models describe the composition in phase 1 of the supplied pair +at the interface with phase 2. +DWH: I verified which Le goes where by determining the corresponding rho called by +each model. +*/ +//interfaceComposition +//( +// (gas in liquid) +// { +// type saturated; +// species ( nbut ); +// Le $LeGas; +// saturationPressure +// { +// type ArdenBuck; +// } +// } +// (liquid in gas) +// { +// type Henry; +// species (CO2); +// k ($H_CO2); +// Le $LeLiq; +// } +//); + +interfaceComposition.gas +(); + +interfaceComposition.liquid +( + (liquid and gas) + { + type Henry; + species ( CO2 ); + k ( $H_CO2 ); + Le $LeLiqMix; + } +); + +/* +DWH: As far as I can tell, the Le defined here are whatever shows up in the K/D eqn +in the mass transfer model. (I.e. Le_liq shows up in Frossling and Higbie. +Le does not appear in spherical at all, but the constructor still expects Le +in the input dict.) +When K/D is returned and multiplied by D to compute mass transfer, that D is +obtained from the InterfaceCompositionModel and not this Le. +*/ + +diffusiveMassTransfer.gas +(); + +diffusiveMassTransfer.liquid +( + (gas in liquid) + { + //type Higbie; // Need to install the model available at https://github.com/NREL/BioReactorDesign + type Frossling; + Le $LeLiqMix; + } + + (liquid in gas) + { + type spherical; + Le 1.0; //not used for spherical + } +); + +massTransfer.gas +( + (gas in liquid) + { + type spherical; + Le 1.0; + } + + (liquid in gas) + { + type Higbie; + //type Frossling; + Le $LeLiq; + } +); + +massTransfer.liquid +( + (gas in liquid) + { + type Higbie; + //type Frossling; + Le $LeLiq; + } + + (liquid in gas) + { + type spherical; + Le 1.0; + } +); + +heatTransfer.gas +( + (gas in liquid) + { + type spherical; + residualAlpha 1e-4; + } + + (liquid in gas) + { + type RanzMarshall; + residualAlpha 1e-4; + } +); + + +heatTransfer.liquid +( + (gas in liquid) + { + type RanzMarshall; + residualAlpha 1e-4; + } + + (liquid in gas) + { + type spherical; + residualAlpha 1e-4; + } +); + + +lift +( + (gas in liquid) + { + type wallDamped; + + wallDamping + { + type cosine; + Cd 3.0; + } + + lift + { + type Tomiyama; + + swarmCorrection + { + type none; + } + } + } + +); + +wallLubrication +( + (gas in liquid) + { + type Antal; + Cw1 -0.01; + Cw2 -0.05; + } + + (liquid in gas) + { + type Antal; + Cw1 -0.01; + Cw2 -0.05; + } +); + +turbulentDispersion +( + (gas in liquid) + { + type LopezDeBertodano; + Ctd 0.5; + } + + (liquid in gas) + { + type LopezDeBertodano; + Ctd 0.5; + } +); + +phaseTransfer +( +); + +// Minimum allowable pressure +pMin 10000; + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.gas b/OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.gas new file mode 100644 index 00000000..79904757 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.gas @@ -0,0 +1,79 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "globalVars" + +thermoType +{ + type heRhoThermo; + mixture multiComponentMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleInternalEnergy; +} + +species +( + CO2 + nbut +); + +inertSpecie nbut; + +CO2 +{ + specie + { + nMoles 1; + molWeight 44; + } + thermodynamics + { + Hf -8941418; + Cp 1012.5; + } + transport + { + mu $muMixGas; + Pr $PrMixGas; + } +} + +nbut +{ + specie + { + nMoles 1; + molWeight 74.12; + } + thermodynamics + { + Hf -4419589.85429034; // (J/kg) + Cp 2359.8; + } + transport + { + mu $muMixGas; + Pr $PrMixGas; + } +} + + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.liquid b/OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.liquid new file mode 100644 index 00000000..1d3ff50a --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/thermophysicalProperties.liquid @@ -0,0 +1,93 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "globalVars" + +PrMixLiq #codeStream +{ + code + #{ + os << $CpMixLiq * $muMixLiq / $kThermLiq; + #}; +}; + +thermoType +{ + type heRhoThermo; + mixture multiComponentMixture; + transport const; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleInternalEnergy; +} + +species +( + nbut + CO2 +); + +inertSpecie nbut; + +"(mixture|nbut)" +{ + specie + { + nMoles 1; + molWeight 74.12; + } + equationOfState + { + rho $rho0MixLiq; + } + thermodynamics + { + Hf -15857343; + Cp $CpMixLiq; + } + transport + { + mu $muMixLiq; + Pr $PrMixLiq; + } +} + +CO2 +{ + specie + { + nMoles 1; + molWeight 44; + } + equationOfState + { + rho $rho0MixLiq; + } + thermodynamics + { + Hf -9402451; + Cp $CpMixLiq; + } + transport + { + mu $muMixLiq; + Pr $PrMixLiq; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.gas b/OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.gas new file mode 100644 index 00000000..4f394508 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.gas @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//simulationType laminar; +simulationType RAS; +RAS +{ + RASModel mixtureKEpsilon; + + turbulence on; + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.liquid b/OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.liquid new file mode 100644 index 00000000..5cc9a397 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/constant/turbulenceProperties.liquid @@ -0,0 +1,26 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +//simulationType laminar; +simulationType RAS; +RAS +{ + RASModel mixtureKEpsilon; + turbulence on; + printCoeffs on; +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/CO2.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/CO2.gas new file mode 100644 index 00000000..c443592d --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/CO2.gas @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object CO2.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 1.0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 1.0; + } + outlet + { + type inletOutlet; + phi phi.gas; + inletValue $internalField; + value $internalField; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/CO2.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/CO2.liquid new file mode 100644 index 00000000..128de3e0 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/CO2.liquid @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object CO2.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 0.0; + } + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue $internalField; + value $internalField; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/T.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/T.gas new file mode 100644 index 00000000..abbca14f --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/T.gas @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "../constant/globalVars" + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform $T0; + +boundaryField +{ + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } + outlet + { + type inletOutlet; + phi phi.gas; + inletValue $internalField; + value $internalField; + } + inlet + { + type fixedValue; + value $internalField; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/T.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/T.liquid new file mode 100644 index 00000000..ea5ee075 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/T.liquid @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "../constant/globalVars" + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform $T0; + +boundaryField +{ + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue $internalField; + value $internalField; + } + inlet + { + type zeroGradient; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/U.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/U.gas new file mode 100644 index 00000000..a97da79f --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/U.gas @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volVectorField; + object U.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +#include "../constant/globalVars" + +internalField uniform (0 0 0); + + +boundaryField +{ + inlet + { + type flowRateInletVelocity; + volumetricFlowRate $V_flowRate; + } + outlet + { + type pressureInletOutletVelocity; + phi phi.gas; + value $internalField; + } + walls + { + type slip; + //type fixedValue; + //value uniform (0 0 0); + } + propeller + { + type slip; + //type fixedValue; + //value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/U.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/U.liquid new file mode 100644 index 00000000..955e3e23 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/U.liquid @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volVectorField; + object U.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type pressureInletOutletVelocity; + phi phi.liquid; + value $internalField; + } + walls + { + type noSlip; + //type fixedValue; + //value uniform (0 0 0); + } + propeller + { + type noSlip; + //type fixedValue; + //value uniform (0 0 0); + } + inside_to_hub + { + type empty; + } + inside_to_hub_copy + { + type empty; + } + hub_to_rotor + { + type empty; + } + hub_to_rotor_copy + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.gas new file mode 100644 index 00000000..42d8b25b --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.gas @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nbut.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type inletOutlet; + phi phi.gas; + inletValue $internalField; + value $internalField; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.liquid new file mode 100644 index 00000000..17893ec1 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/Ydefault.liquid @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nbut.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +#include "../constant/globalVars" + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 0; + } + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue $internalField; + value $internalField; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/alpha.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/alpha.gas new file mode 100644 index 00000000..ad8d160b --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/alpha.gas @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 alpha.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +#include "../constant/globalVars" + +internalField uniform 1; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 1.0; + } + outlet + { + type inletOutlet; + phi phi.gas; + inletValue uniform 1.0; + value uniform 1.0; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/alpha.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/alpha.liquid new file mode 100644 index 00000000..95d30a7f --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/alpha.liquid @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 alpha.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +#include "../constant/globalVars" + +internalField uniform 1.0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 0.0; + } + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue uniform 0.0; + value uniform 0.0; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/alphat.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/alphat.gas new file mode 100644 index 00000000..b3ad7730 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/alphat.gas @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alphat.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value $internalField; + } + + outlet + { + type calculated; + value $internalField; + } + + walls + { + type compressible::alphatWallFunction; + Prt 0.85; + value $internalField; + } + + propeller + { + type compressible::alphatWallFunction; + Prt 0.85; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/alphat.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/alphat.liquid new file mode 100644 index 00000000..70122b62 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/alphat.liquid @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alphat.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value $internalField; + } + + outlet + { + type calculated; + value $internalField; + } + + walls + { + type compressible::alphatWallFunction; + Prt 0.85; + value $internalField; + } + + propeller + { + type compressible::alphatWallFunction; + Prt 0.85; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.gas new file mode 100644 index 00000000..dad41899 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.gas @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object epsilon.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +#include "${FOAM_CASE}/constant/globalVars" + +internalField uniform $eps_inlet_gas ; + +boundaryField +{ + inlet + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.00007; //0.07 x Hydraulic Diameter (1mm) + value uniform $eps_inlet_gas; + // Optional entries + k k.gas; + phi phi.gas; + } + + outlet + { + type inletOutlet; + phi phi.gas; + inletValue $internalField; + value $internalField; + } + + walls + { + type epsilonWallFunction; + value $internalField; + } + propeller + { + type epsilonWallFunction; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.liquid new file mode 100644 index 00000000..5d76bdb2 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/epsilon.liquid @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object epsilon.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +#include "${FOAM_CASE}/constant/globalVars" + +internalField uniform $eps_inlet_liq; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform $eps_inlet_liq; + } + + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue $internalField; + value $internalField; + } + + walls + { + type epsilonWallFunction; + value $internalField; + } + propeller + { + type epsilonWallFunction; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/f.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/f.gas new file mode 100644 index 00000000..260cb748 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/f.gas @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object CO2.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 1.0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + inlet + { + type fixedValue; + value uniform 1.0; + } + outlet + { + type inletOutlet; + phi phi.gas; + inletValue $internalField; + value $internalField; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/k.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/k.gas new file mode 100644 index 00000000..69b6fa7d --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/k.gas @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +#include "${FOAM_CASE}/constant/globalVars" + +internalField uniform $k_inlet_gas; + +boundaryField +{ + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; + value uniform $k_inlet_gas; + // Optional entries + U U.gas; + phi phi.gas; + } + + outlet + { + type inletOutlet; + phi phi.gas; + inletValue $internalField; + value $internalField; + } + + walls + { + type kqRWallFunction; + value $internalField; + } + propeller + { + type kqRWallFunction; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/k.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/k.liquid new file mode 100644 index 00000000..23026c73 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/k.liquid @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +#include "${FOAM_CASE}/constant/globalVars" + +internalField uniform $k_inlet_liq; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform $k_inlet_liq; + } + + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue $internalField; + value $internalField; + } + + walls + { + type kqRWallFunction; + value $internalField; + } + propeller + { + type kqRWallFunction; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/nbut.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/nbut.liquid new file mode 100644 index 00000000..888d93d6 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/nbut.liquid @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nbut.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +#include "../constant/globalVars" + +internalField uniform 1.0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 1.0; + } + outlet + { + type inletOutlet; + phi phi.liquid; + inletValue $internalField; + value $internalField; + } + walls + { + type zeroGradient; + } + propeller + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/nut.gas b/OFsolvers/tutorial_cases/laakkonen/orig0/nut.gas new file mode 100644 index 00000000..1b326e88 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/nut.gas @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nut.gas; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 1e-8; + +boundaryField +{ + inlet + { + type calculated; + value $internalField; + } + + outlet + { + type calculated; + value $internalField; + } + + walls + { + type nutkWallFunction; + value $internalField; + } + + propeller + { + type nutkWallFunction; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/nut.liquid b/OFsolvers/tutorial_cases/laakkonen/orig0/nut.liquid new file mode 100644 index 00000000..92ba30d2 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/nut.liquid @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nut.liquid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 1e-8; + +boundaryField +{ + inlet + { + type calculated; + value $internalField; + } + + outlet + { + type calculated; + value $internalField; + } + + walls + { + type nutkWallFunction; + value $internalField; + } + propeller + { + type nutkWallFunction; + value $internalField; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/p b/OFsolvers/tutorial_cases/laakkonen/orig0/p new file mode 100644 index 00000000..63b08417 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/p @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 101325; + +boundaryField +{ + inlet + { + type calculated; + value $internalField; + } + outlet + { + type calculated; + value $internalField; + } + walls + { + type calculated; + value $internalField; + } + propeller + { + type calculated; + value $internalField; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/OFsolvers/tutorial_cases/laakkonen/orig0/p_rgh b/OFsolvers/tutorial_cases/laakkonen/orig0/p_rgh new file mode 100644 index 00000000..0a86d21d --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/orig0/p_rgh @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 101325; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + value $internalField; + } + outlet + { + type prghPressure; + p $internalField; + value $internalField; + } + walls + { + type fixedFluxPressure; + value $internalField; + } + propeller + { + type fixedFluxPressure; + value $internalField; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/OFsolvers/tutorial_cases/laakkonen/presteps.sh b/OFsolvers/tutorial_cases/laakkonen/presteps.sh new file mode 100755 index 00000000..743ef917 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/presteps.sh @@ -0,0 +1,22 @@ +ml anaconda3/2022.05 +conda activate /projects/gas2fuels/conda_env/spargerDesign +python system/write_bmesh_file.py +conda deactivate +ml openfoam/11-craympich +foamCleanCase +rm -r 0 +cp -r orig0 0 +blockMesh -dict ./blockMeshDict_reactor +stitchMesh -perfect -overwrite inside_to_hub inside_to_hub_copy +stitchMesh -perfect -overwrite hub_to_rotor hub_to_rotor_copy +transformPoints "rotate=((0 0 1)(0 1 0))" +snappyHexMesh -overwrite +topoSet -dict system/topoSetDict_rm_inlet +createPatch -dict system/createPatchDict_inlet -overwrite +topoSet +createPatch -overwrite +module purge +source /projects/gas2fuels/load_OF9_pbe +setFields +rm -rf 0/meshPhi +touch sol.foam diff --git a/OFsolvers/tutorial_cases/laakkonen/run.sh b/OFsolvers/tutorial_cases/laakkonen/run.sh new file mode 100644 index 00000000..f512b729 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/run.sh @@ -0,0 +1,40 @@ +if ! type "python" &> /dev/null; then + echo " could not be found" + echo "Skipping Mesh generation" +else + # Generate blockmeshDict + python system/write_bmesh_file.py +fi + + +if ! type "blockMesh" &> /dev/null; then + echo " could not be found" + echo "OpenFoam is likely not installed, skipping run" +else + # Clean case + foamCleanCase + + rm -r 0 + cp -r orig0 0 + + # Mesh gen + blockMesh -dict ./blockMeshDict_reactor + stitchMesh -perfect -overwrite inside_to_hub inside_to_hub_copy + stitchMesh -perfect -overwrite hub_to_rotor hub_to_rotor_copy + transformPoints "rotate=((0 0 1)(0 1 0))" + snappyHexMesh -overwrite + topoSet -dict system/topoSetDict_rm_inlet + createPatch -dict system/createPatchDict_inlet -overwrite + topoSet + createPatch -overwrite + setFields + rm -rf 0/meshPhi + touch sol.foam + + # Run + multiphaseEulerFoam +fi + + + + diff --git a/OFsolvers/tutorial_cases/laakkonen/sol.foam b/OFsolvers/tutorial_cases/laakkonen/sol.foam new file mode 100644 index 00000000..e69de29b diff --git a/OFsolvers/tutorial_cases/laakkonen/system/controlDict b/OFsolvers/tutorial_cases/laakkonen/system/controlDict new file mode 100644 index 00000000..7516933e --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/controlDict @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application reactingTwoPhaseEulerFoam; + +startFrom latestTime; //startTime; //latestTime + +startTime 0; + +stopAt endTime; + +endTime 500; + +deltaT 5e-5; + +writeControl adjustableRunTime; + +writeInterval 0.01; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.9; + +maxDeltaT 1; + +/*functions +{ + writeFields + { + type writeRegisteredObject; + functionObjectLibs ( "libIOFunctionObjects.so" ); + objectNames ("thermo:rho.liquid"); + objectNames ("thermo:rho.gas"); + outputControl outputTime; + } +}*/ + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/createPatchDict b/OFsolvers/tutorial_cases/laakkonen/system/createPatchDict new file mode 100644 index 00000000..00fc573c --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/createPatchDict @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2306 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name inlet; + + // Dictionary to construct new patch from + patchInfo + { + type patch; + } + + // How to construct: either from 'patches' or 'set' + constructFrom set; + + // If constructFrom = patches : names of patches. Wildcards allowed. + //patches (otherSide); + + // If constructFrom = set : name of faceSet + set faceSidePipe; + } +); + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/createPatchDict_inlet b/OFsolvers/tutorial_cases/laakkonen/system/createPatchDict_inlet new file mode 100644 index 00000000..a1f2b821 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/createPatchDict_inlet @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2306 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name walls; + + // Dictionary to construct new patch from + //patchInfo + //{ + // type patch; + //} + + // How to construct: either from 'patches' or 'set' + constructFrom set; + + // If constructFrom = patches : names of patches. Wildcards allowed. + //patches (otherSide); + + // If constructFrom = set : name of faceSet + set inlet2; + } +); + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/decomposeParDict b/OFsolvers/tutorial_cases/laakkonen/system/decomposeParDict new file mode 100644 index 00000000..b406938a --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/decomposeParDict @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.4.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 200; + +method scotch; + +simpleCoeffs +{ + n ( 1 200 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 3 12 2 ); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/fvSchemes b/OFsolvers/tutorial_cases/laakkonen/system/fvSchemes new file mode 100644 index 00000000..d2c981fa --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/fvSchemes @@ -0,0 +1,78 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / 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,alpha.*\)" Gauss upwind; + "div\(phir,alpha.*\)" Gauss upwind; + + "div\(alphaRhoPhi.*,U.*\)" Gauss upwind; + "div\(phi.*,U.*\)" Gauss upwind; + + "div\(alphaRhoPhi.*,Yi\)" Gauss upwind; + "div\(alphaRhoPhi.*,(h|e).*\)" Gauss upwind; + "div\(alphaRhoPhi.*,K.*\)" Gauss upwind; + "div\(alphaPhi.*,p\)" Gauss upwind; + "div\(alphaRhoPhi.*,\(p\|thermo:rho.*\)\)" Gauss upwind; + "div\(alphaPhi.*,f.*\)" Gauss upwind; + + "div\(alphaRhoPhi.*,K.*\)" Gauss upwind; + + "div\(alphaRhoPhi.*,(k|epsilon).*\)" Gauss upwind; + "div\(phim,(k|epsilon)m\)" Gauss upwind; + + "div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default uncorrected; +} + +wallDist +{ + method Poisson; + nRequired true; +} +//wallDist +//{ +// method meshWave; +//} + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/fvSolution b/OFsolvers/tutorial_cases/laakkonen/system/fvSolution new file mode 100644 index 00000000..5c800464 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/fvSolution @@ -0,0 +1,169 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.*" + { + nAlphaCorr 1; + nAlphaSubCycles 6; + } + + bubbles + { + nCorr 1; + tolerance 1e-4; + scale true; + solveOnFinalIterOnly true; + sourceUpdateInterval 1; + } + + p_rgh + { + solver GAMG; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + tolerance 1e-8; + relTol 0.001; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "U.*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; + minIter 1; + } + + "(e|h).*" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-8; + relTol 0; + } + //"(e|h).*" + //{ + // solver smoothSolver; + // smoother symGaussSeidel; + // tolerance 1e-9; + // relTol 0; + // minIter 0; + // maxIter 0; + //} + + "f.*" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + } + + "Yi.*" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-10; + relTol 0; + residualAlpha 1e-8; + //minIter 1; + residualAlpha 1e-8; + } + //"Yi.*" + //{ + // solver smoothSolver; + // smoother symGaussSeidel; + // tolerance 1e-8; + // relTol 0; + // minIter 1; + // residualAlpha 1e-8; + //} + + "(k|epsilon|Theta).*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-7; + relTol 0; + minIter 1; + } + + yPsi + { + solver smoothSolver; + smoother symGaussSeidel; + //solver PCG; + //preconditioner none; + tolerance 1e-6; + relTol 1e-3; + } + //yPsi + //{ + // solver PCG; + // preconditioner none; + // tolerance 1e-10; + // relTol 0; + //} + +} + +PIMPLE +{ + nOuterCorrectors 2; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + faceMomentum true; +} + +relaxationFactors +{ + //equations + //{ + // ".*" 1; + //} +} +//PIMPLE +//{ +// nOuterCorrectors 3; +// nCorrectors 1; +// nNonOrthogonalCorrectors 1; +//} +// +//relaxationFactors +//{ +// equations +// { +// ".*" 1; +// } +//} + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/reactor_geom_data.py b/OFsolvers/tutorial_cases/laakkonen/system/reactor_geom_data.py new file mode 100644 index 00000000..841bcdf0 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/reactor_geom_data.py @@ -0,0 +1,108 @@ +import numpy as np + +#geometry ======== +T = 0.26 +Dt = T # Tank Diameter +Da = T/3 # impeller tip Diameter +H = T * 1.5# height of reactor (includes D/4 with the air phase only) +nimpellers = 1 # NOT SURE +#S_i = 0.381 # 15" impeller spacing +C = [T/3] +#C = [D1.01*S_i,2.0*S_i,3.0*S_i,4.0*S_i,5.0*S_i,6.0*S_i,7.0*S_i,8.0*S_i,9.0*S_i,10.0*S_i] # height of the center of impellers +W = T/10 # NOT SURE estimate # impeller blade width +L = T/20 # NOT SURE estimate # impeller blade length (beyond the hub) W=Da/5, L=Da/4 +Dh =Da-2*L # NOT SURE # Hub Diameter +Lin = L # NOT SURE # impeller blade length (inside the hub) +J = T/10 # Baffle Width +Wh = W/10 #NOT SURE # Hub height (Width) +polyrad=T/30 #NOT SURE # Stem radius (R_shaft) + +Z0 = 0.0 # bottom of reactor +Dmrf = (Da+Dt-2*J)/2 # MRF region Diameter + +#mesh ======== +nr = 180 # mesh points per unit radial length +nz = 240 # mesh points per unit axial length +Npoly = 4 # mesh points in the polygon at the axis +Na = 6 # mesh points in the azimuthal direction + +nbaffles = 6 # number of baffles and impeller fins + +nsplits=2*nbaffles #we need twice the number of splits +dangle=2.0*np.pi/float(nsplits) + +circradii=np.array([Dh/2-Lin,Dh/2,Da/2,Dmrf/2,Dt/2-J,Dt/2]) +ncirc = len(circradii) +hub_circ = 1 +inhub_circ = hub_circ-1 #circle inside hub +rot_circ = hub_circ+1 +mrf_circ = rot_circ+1 +tank_circ = ncirc-1 + +reacthts = [Z0] +baff_sections = [] +baff_volumes = [] +hub_volumes=[] +count=1 +for n_imp in range(nimpellers): + reacthts.append(Z0 + C[n_imp] - W/2) + + baff_sections.append(count) + baff_volumes.append(count) + count=count+1 + + reacthts.append(Z0 + C[n_imp] - Wh/2) + + baff_sections.append(count) + baff_volumes.append(count) + hub_volumes.append(count) + count=count+1 + + reacthts.append(Z0 + C[n_imp] + Wh/2) + + baff_sections.append(count) + baff_volumes.append(count) + count=count+1 + + reacthts.append(Z0 + C[n_imp] + W/2) + baff_sections.append(count) + count=count+1 + +reacthts.append(Z0+H) + + +nsections = len(reacthts) +nvolumes = nsections-1 +meshz = nz*np.diff(reacthts) +meshz = meshz.astype(int)+1 #avoid zero mesh elements + +all_volumes=range(nvolumes) +nonbaff_volumes=[sec for sec in all_volumes if sec not in baff_volumes] +nonstem_volumes=[0,1] #this is 0,1 no matter how many impellers are there + + +#note: stem_volumes include hub volumes also +#these are volumes where we miss out polygon block +stem_volumes=[sec for sec in all_volumes if sec not in nonstem_volumes] + +#removes hub_volumes here for declaring patches +only_stem_volumes=[sec for sec in stem_volumes if sec not in hub_volumes] + +#to define mrf region +#not that [1] is not a stem volume but baffles are there +mrf_volumes=[1]+stem_volumes + +#increase grid points in the impeller section +for i in baff_volumes: + meshz[i] *=2 + +meshr = nr*np.diff(circradii) + +#adding polygon to hub mesh resolution +meshr = np.append(nr*polyrad,meshr) +meshr = meshr.astype(int) +meshr += 1 # to avoid being zero + +centeroffset = 1 #one point on the axis +polyoffset = nsplits #number of points on polygon +npts_per_section = centeroffset + polyoffset + ncirc*nsplits #center+polygon+circles diff --git a/OFsolvers/tutorial_cases/laakkonen/system/setFieldsDict b/OFsolvers/tutorial_cases/laakkonen/system/setFieldsDict new file mode 100644 index 00000000..606c3c4a --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/setFieldsDict @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.gas 1 + volScalarFieldValue alpha.liquid 0 +); + +regions +( + boxToCell + { + box (-2.5 0.0 -2.5) (2.5 0.260 2.5); + fieldValues + ( + volScalarFieldValue alpha.gas 0 + volScalarFieldValue alpha.liquid 1 + //volScalarFieldValue nbut.liquid 3.2e-6 // 8e-6 = 0.25 mol/m^3 + ); + } +); + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict new file mode 100644 index 00000000..fa4f7b58 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict @@ -0,0 +1,484 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap false; +addLayers false; + +X_hole 0.035; +Xm_hole -0.035; +Y_hole 0.022; +Ym_hole -0.022; +R_hole 0.0026; +H_hole 0.01; +level_ref 5; + + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + hole_1 + { + type searchableCylinder; + point1 ($X_hole -0.001 0); + point2 ($X_hole $H_hole 0); + radius $R_hole; + } + hole_2 + { + type searchableCylinder; + point1 ($Xm_hole -0.001 0); + point2 ($Xm_hole $H_hole 0); + radius $R_hole; + } + hole_3 + { + type searchableCylinder; + point1 (0 -0.001 $X_hole); + point2 (0 $H_hole $X_hole); + radius $R_hole; + } + hole_4 + { + type searchableCylinder; + point1 (0 -0.001 $Xm_hole); + point2 (0 $H_hole $Xm_hole); + radius $R_hole; + } + hole_5 + { + type searchableCylinder; + point1 ($Y_hole -0.001 0); + point2 ($Y_hole $H_hole 0); + radius $R_hole; + } + hole_6 + { + type searchableCylinder; + point1 ($Ym_hole -0.001 0); + point2 ($Ym_hole $H_hole 0); + radius $R_hole; + } + hole_7 + { + type searchableCylinder; + point1 (0 -0.001 $Y_hole); + point2 (0 $H_hole $Y_hole); + radius $R_hole; + } + hole_8 + { + type searchableCylinder; + point1 (0 -0.001 $Ym_hole); + point2 (0 $H_hole $Ym_hole); + radius $R_hole; + } + hole_9 + { + type searchableCylinder; + point1 ($Y_hole -0.001 $Y_hole); + point2 ($Y_hole $H_hole $Y_hole); + radius $R_hole; + } + hole_10 + { + type searchableCylinder; + point1 ($Y_hole -0.001 $Ym_hole); + point2 ($Y_hole $H_hole $Ym_hole); + radius $R_hole; + } + hole_11 + { + type searchableCylinder; + point1 ($Ym_hole -0.001 $Y_hole); + point2 ($Ym_hole $H_hole $Y_hole); + radius $R_hole; + } + hole_12 + { + type searchableCylinder; + point1 ($Ym_hole -0.001 $Ym_hole); + point2 ($Ym_hole $H_hole $Ym_hole); + radius $R_hole; + } + +}; + + + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 1000000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just a + // few cells. This setting will cause refinement to stop if <= minimumRefine + // are selected for refinement. Note: it will at least do one iteration + // (unless the number of cells to refine is 0) + minRefinementCells 0; + + // Allow a certain level of imbalance during refining + // (since balancing is quite expensive) + // Expressed as fraction of perfect balance (= overall number of cells / + // nProcs). 0=balance always. + maxLoadUnbalance 0.10; + + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 1; + + + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + //refinementSurfaces + //{ + + // inlet_hole + // { + // level (2 4); + // } + + //} + + // Resolve sharp angles + resolveFeatureAngle 60; + + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + hole_1 + { + mode inside; + level $level_ref; + } + hole_2 + { + mode inside; + level $level_ref; + } + hole_3 + { + mode inside; + level $level_ref; + } + hole_4 + { + mode inside; + level $level_ref; + } + hole_5 + { + mode inside; + level $level_ref; + } + hole_6 + { + mode inside; + level $level_ref; + } + hole_7 + { + mode inside; + level $level_ref; + } + hole_8 + { + mode inside; + level $level_ref; + } + hole_9 + { + mode inside; + level $level_ref; + } + hole_10 + { + mode inside; + level $level_ref; + } + hole_11 + { + mode inside; + level $level_ref; + } + hole_12 + { + mode inside; + level $level_ref; + } + + } + + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (0.05 0.195 0.05); + + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces false; +} + + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 4.0; // 1.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 300; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Feature snapping + + // Number of feature edge snapping iterations. + // Leave out altogether to disable. + nFeatureSnapIter 10; + //nFeatureSnapIter 3; + + // Detect (geometric only) features by sampling the surface + // (default=false). + implicitFeatureSnap true; + + // Use castellatedMeshControls::features (default = true) + explicitFeatureSnap false; + + // Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap true; +} + + + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + } + + // Expansion factor for layer mesh + expansionRatio 1.0; + + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + finalLayerThickness 0.3; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + minThickness 0.1; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 30; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 3; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x. + minMedianAxisAngle 90; + + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + + + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 65; + + //- Max skewness allowed. Set to <0 to disable. + maxBoundarySkewness 20; + maxInternalSkewness 4; + + //- Max concaveness allowed. Is angle (in degrees) below which concavity + // is allowed. 0 is straight face, <0 would be convex face. + // Set to 180 to disable. + maxConcave 80; + + //- Minimum pyramid volume. Is absolute volume of cell pyramid. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. + minVol 1e-13; + + //- Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. This has to be a positive number for tracking + // to work. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet + minTetQuality -1; // 1e-30; + + //- Minimum face area. Set to <0 to disable. + minArea -1; + + //- Minimum face twist. Set to <-1 to disable. dot product of face normal + // and face centre triangles normal + minTwist 0.01; + + //- Minimum normalised cell determinant + // 1 = hex, <= 0 = folded or flattened illegal cell + minDeterminant 0.001; + + //- minFaceWeight (0 -> 0.5) + minFaceWeight 0.05; + + //- minVolRatio (0 -> 1) + minVolRatio 0.01; + + //must be >0 for Fluent compatibility + minTriangleTwist -1; + + + // Advanced + + //- Number of error distribution iterations + nSmoothScale 4; + //- Amount to scale back displacement at error points + errorReduction 0.75; + + // Optional : some meshing phases allow usage of relaxed rules. + // See e.g. addLayersControls::nRelaxedIter. + relaxed + { + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 75; + } +} + + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_1 b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_1 new file mode 100644 index 00000000..70a735be --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_1 @@ -0,0 +1,344 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap false; +addLayers false; + +X_hole 0.035; +dX 0.02; + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + inlet_Cylinder + { + type searchableCylinder; + point1 (0 -0.1 0); + point2 (0 0.1 0); + radius $X_hole; + } +}; + + + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 1000000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just a + // few cells. This setting will cause refinement to stop if <= minimumRefine + // are selected for refinement. Note: it will at least do one iteration + // (unless the number of cells to refine is 0) + minRefinementCells 0; + + // Allow a certain level of imbalance during refining + // (since balancing is quite expensive) + // Expressed as fraction of perfect balance (= overall number of cells / + // nProcs). 0=balance always. + maxLoadUnbalance 0.10; + + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 2; + + + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + //refinementSurfaces + //{ + + // inlet_hole + // { + // level (2 4); + // } + + //} + + // Resolve sharp angles + resolveFeatureAngle 30; + + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + inlet_Cylinder + { + mode distance; + levels (($dX 3)); + } + } + + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (0.05 0.195 0.05); + + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces false; +} + + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 4.0; // 1.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 300; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Feature snapping + + // Number of feature edge snapping iterations. + // Leave out altogether to disable. + nFeatureSnapIter 10; + //nFeatureSnapIter 3; + + // Detect (geometric only) features by sampling the surface + // (default=false). + implicitFeatureSnap true; + + // Use castellatedMeshControls::features (default = true) + explicitFeatureSnap false; + + // Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap true; +} + + + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + } + + // Expansion factor for layer mesh + expansionRatio 1.0; + + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + finalLayerThickness 0.3; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + minThickness 0.1; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 30; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 3; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x. + minMedianAxisAngle 90; + + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + + + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 65; + + //- Max skewness allowed. Set to <0 to disable. + maxBoundarySkewness 20; + maxInternalSkewness 4; + + //- Max concaveness allowed. Is angle (in degrees) below which concavity + // is allowed. 0 is straight face, <0 would be convex face. + // Set to 180 to disable. + maxConcave 80; + + //- Minimum pyramid volume. Is absolute volume of cell pyramid. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. + minVol 1e-13; + + //- Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. This has to be a positive number for tracking + // to work. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet + minTetQuality -1; // 1e-30; + + //- Minimum face area. Set to <0 to disable. + minArea -1; + + //- Minimum face twist. Set to <-1 to disable. dot product of face normal + // and face centre triangles normal + minTwist 0.01; + + //- Minimum normalised cell determinant + // 1 = hex, <= 0 = folded or flattened illegal cell + minDeterminant 0.001; + + //- minFaceWeight (0 -> 0.5) + minFaceWeight 0.05; + + //- minVolRatio (0 -> 1) + minVolRatio 0.01; + + //must be >0 for Fluent compatibility + minTriangleTwist -1; + + + // Advanced + + //- Number of error distribution iterations + nSmoothScale 4; + //- Amount to scale back displacement at error points + errorReduction 0.75; + + // Optional : some meshing phases allow usage of relaxed rules. + // See e.g. addLayersControls::nRelaxedIter. + relaxed + { + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 75; + } +} + + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_2 b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_2 new file mode 100644 index 00000000..1fe15d85 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_2 @@ -0,0 +1,344 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap false; +addLayers false; + +X_hole 0.0285; +dX 0.007; + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + inlet_Cylinder + { + type searchableCylinder; + point1 (0 -0.01 0); + point2 (0 0.5 0); + radius $X_hole; + } +}; + + + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 1000000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just a + // few cells. This setting will cause refinement to stop if <= minimumRefine + // are selected for refinement. Note: it will at least do one iteration + // (unless the number of cells to refine is 0) + minRefinementCells 0; + + // Allow a certain level of imbalance during refining + // (since balancing is quite expensive) + // Expressed as fraction of perfect balance (= overall number of cells / + // nProcs). 0=balance always. + maxLoadUnbalance 0.10; + + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 1; + + + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + //refinementSurfaces + //{ + + // inlet_hole + // { + // level (2 4); + // } + + //} + + // Resolve sharp angles + resolveFeatureAngle 60; + + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + inlet_Cylinder + { + mode distance; + levels (($dX 3)); + } + } + + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (0.05 0.195 0.05); + + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces false; +} + + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 4.0; // 1.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 300; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Feature snapping + + // Number of feature edge snapping iterations. + // Leave out altogether to disable. + nFeatureSnapIter 10; + //nFeatureSnapIter 3; + + // Detect (geometric only) features by sampling the surface + // (default=false). + implicitFeatureSnap true; + + // Use castellatedMeshControls::features (default = true) + explicitFeatureSnap false; + + // Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap true; +} + + + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + } + + // Expansion factor for layer mesh + expansionRatio 1.0; + + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + finalLayerThickness 0.3; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + minThickness 0.1; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 30; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 3; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x. + minMedianAxisAngle 90; + + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + + + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ +// //- Maximum non-orthogonality allowed. Set to 180 to disable. +// maxNonOrtho 65; +// +// //- Max skewness allowed. Set to <0 to disable. +// maxBoundarySkewness 20; +// maxInternalSkewness 4; +// +// //- Max concaveness allowed. Is angle (in degrees) below which concavity +// // is allowed. 0 is straight face, <0 would be convex face. +// // Set to 180 to disable. +// maxConcave 80; +// +// //- Minimum pyramid volume. Is absolute volume of cell pyramid. +// // Set to a sensible fraction of the smallest cell volume expected. +// // Set to very negative number (e.g. -1E30) to disable. +// minVol 1e-13; +// +// //- Minimum quality of the tet formed by the face-centre +// // and variable base point minimum decomposition triangles and +// // the cell centre. This has to be a positive number for tracking +// // to work. Set to very negative number (e.g. -1E30) to +// // disable. +// // <0 = inside out tet, +// // 0 = flat tet +// // 1 = regular tet +// minTetQuality -1; // 1e-30; +// +// //- Minimum face area. Set to <0 to disable. +// minArea -1; +// +// //- Minimum face twist. Set to <-1 to disable. dot product of face normal +// // and face centre triangles normal +// minTwist 0.01; +// +// //- Minimum normalised cell determinant +// // 1 = hex, <= 0 = folded or flattened illegal cell +// minDeterminant 0.001; +// +// //- minFaceWeight (0 -> 0.5) +// minFaceWeight 0.05; +// +// //- minVolRatio (0 -> 1) +// minVolRatio 0.01; +// +// //must be >0 for Fluent compatibility +// minTriangleTwist -1; +// +// +// // Advanced +// +// //- Number of error distribution iterations +// nSmoothScale 4; +// //- Amount to scale back displacement at error points +// errorReduction 0.75; +// +// // Optional : some meshing phases allow usage of relaxed rules. +// // See e.g. addLayersControls::nRelaxedIter. +// relaxed +// { +// //- Maximum non-orthogonality allowed. Set to 180 to disable. +// maxNonOrtho 75; +// } +} + + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_3 b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_3 new file mode 100644 index 00000000..b66370dc --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/snappyHexMeshDict_3 @@ -0,0 +1,357 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 3.0.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap false; +addLayers false; + +X_hole 0.036; +Y_hole 0.021; +H_hole 0.5; + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + inlet_Cylinder_1 + { + type searchableCylinder; + point1 (0 -0.01 0); + point2 (0 $H_hole 0); + radius $X_hole; + } + inlet_Cylinder_2 + { + type searchableCylinder; + point1 (0 -0.01 0); + point2 (0 $H_hole 0); + radius $Y_hole; + } +}; + + + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 1000000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just a + // few cells. This setting will cause refinement to stop if <= minimumRefine + // are selected for refinement. Note: it will at least do one iteration + // (unless the number of cells to refine is 0) + minRefinementCells 0; + + // Allow a certain level of imbalance during refining + // (since balancing is quite expensive) + // Expressed as fraction of perfect balance (= overall number of cells / + // nProcs). 0=balance always. + maxLoadUnbalance 0.10; + + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 1; + + + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + //refinementSurfaces + //{ + + // inlet_hole + // { + // level (2 4); + // } + + //} + + // Resolve sharp angles + resolveFeatureAngle 60; + + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + inlet_Cylinder_1 + { + mode inside; + level 2; + } + inlet_Cylinder_2 + { + mode outside; + level 0; + } + } + + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (0.05 0.195 0.05); + + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces false; +} + + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 4.0; // 1.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 300; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Feature snapping + + // Number of feature edge snapping iterations. + // Leave out altogether to disable. + nFeatureSnapIter 10; + //nFeatureSnapIter 3; + + // Detect (geometric only) features by sampling the surface + // (default=false). + implicitFeatureSnap true; + + // Use castellatedMeshControls::features (default = true) + explicitFeatureSnap false; + + // Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap true; +} + + + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + } + + // Expansion factor for layer mesh + expansionRatio 1.0; + + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. + finalLayerThickness 0.3; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + minThickness 0.1; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 30; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 3; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x. + minMedianAxisAngle 90; + + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + + + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ +// //- Maximum non-orthogonality allowed. Set to 180 to disable. +// maxNonOrtho 65; +// +// //- Max skewness allowed. Set to <0 to disable. +// maxBoundarySkewness 20; +// maxInternalSkewness 4; +// +// //- Max concaveness allowed. Is angle (in degrees) below which concavity +// // is allowed. 0 is straight face, <0 would be convex face. +// // Set to 180 to disable. +// maxConcave 80; +// +// //- Minimum pyramid volume. Is absolute volume of cell pyramid. +// // Set to a sensible fraction of the smallest cell volume expected. +// // Set to very negative number (e.g. -1E30) to disable. +// minVol 1e-13; +// +// //- Minimum quality of the tet formed by the face-centre +// // and variable base point minimum decomposition triangles and +// // the cell centre. This has to be a positive number for tracking +// // to work. Set to very negative number (e.g. -1E30) to +// // disable. +// // <0 = inside out tet, +// // 0 = flat tet +// // 1 = regular tet +// minTetQuality -1; // 1e-30; +// +// //- Minimum face area. Set to <0 to disable. +// minArea -1; +// +// //- Minimum face twist. Set to <-1 to disable. dot product of face normal +// // and face centre triangles normal +// minTwist 0.01; +// +// //- Minimum normalised cell determinant +// // 1 = hex, <= 0 = folded or flattened illegal cell +// minDeterminant 0.001; +// +// //- minFaceWeight (0 -> 0.5) +// minFaceWeight 0.05; +// +// //- minVolRatio (0 -> 1) +// minVolRatio 0.01; +// +// //must be >0 for Fluent compatibility +// minTriangleTwist -1; +// +// +// // Advanced +// +// //- Number of error distribution iterations +// nSmoothScale 4; +// //- Amount to scale back displacement at error points +// errorReduction 0.75; +// +// // Optional : some meshing phases allow usage of relaxed rules. +// // See e.g. addLayersControls::nRelaxedIter. +// relaxed +// { +// //- Maximum non-orthogonality allowed. Set to 180 to disable. +// maxNonOrtho 75; +// } +} + + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/topoSetDict b/OFsolvers/tutorial_cases/laakkonen/system/topoSetDict new file mode 100644 index 00000000..86e6948b --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/topoSetDict @@ -0,0 +1,215 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2306 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +X_hole 0.035; +Xm_hole -0.035; +Y_hole 0.022; +Ym_hole -0.022; +R_hole 0.0005; + +actions +( + { + name faceSidePipe1; + type faceSet; + action new; + source cylinderToFace; + sourceInfo + { + p1 ($X_hole -0.001 0); + p2 ($X_hole 0.001 0); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Xm_hole -0.001 0); + p2 ($Xm_hole 0.001 0); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 (0 -0.001 $X_hole); + p2 (0 0.001 $X_hole); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 (0 -0.001 $Xm_hole); + p2 (0 0.001 $Xm_hole); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Y_hole -0.001 0); + p2 ($Y_hole 0.001 0); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Ym_hole -0.001 0); + p2 ($Ym_hole 0.001 0); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 (0 -0.001 $Y_hole); + p2 (0 0.001 $Y_hole); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 (0 -0.001 $Ym_hole); + p2 (0 0.001 $Ym_hole); + radius $R_hole; + } + } +// diagonal holes + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Y_hole -0.001 $Y_hole); + p2 ($Y_hole 0.001 $Y_hole); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Y_hole -0.001 $Ym_hole); + p2 ($Y_hole 0.001 $Ym_hole); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Ym_hole -0.001 $Y_hole); + p2 ($Ym_hole 0.001 $Y_hole); + radius $R_hole; + } + } + { + name faceSidePipe1; + type faceSet; + action add; + source cylinderToFace; + sourceInfo + { + p1 ($Ym_hole -0.001 $Ym_hole); + p2 ($Ym_hole 0.001 $Ym_hole); + radius $R_hole; + } + } +// + + { + name faceSidePipe; + type faceSet; + action new; + source faceToFace; + sourceInfo + { + set faceSidePipe1; + } + } + { + name faceBoundary; + type faceSet; + action new; + source boundaryToFace; + sourceInfo + { + } + } + { + name faceSidePipe1; + type faceSet; + action delete; + source faceToFace; + sourceInfo + { + set faceBoundary; + } + } + { + name faceSidePipe; + type faceSet; + action delete; + source faceToFace; + sourceInfo + { + set faceSidePipe1; + } + } +); + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/topoSetDict_rm_inlet b/OFsolvers/tutorial_cases/laakkonen/system/topoSetDict_rm_inlet new file mode 100644 index 00000000..3d366e85 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/topoSetDict_rm_inlet @@ -0,0 +1,76 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2306 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +R_hole 0.055; + +actions +( + { + name inlet1; + type faceSet; + action new; + source cylinderToFace; + sourceInfo + { + p1 (0 -0.001 0); + p2 (0 0.001 0); + radius $R_hole; + } + } + { + name inlet2; + type faceSet; + action new; + source faceToFace; + sourceInfo + { + set inlet1; + } + } + { + name faceBoundary; + type faceSet; + action new; + source boundaryToFace; + sourceInfo + { + } + } + { + name inlet1; + type faceSet; + action delete; + source faceToFace; + sourceInfo + { + set faceBoundary; + } + } + { + name inlet2; + type faceSet; + action delete; + source faceToFace; + sourceInfo + { + set inlet1; + } + } +); + + +// ************************************************************************* // diff --git a/OFsolvers/tutorial_cases/laakkonen/system/write_bmesh_file.py b/OFsolvers/tutorial_cases/laakkonen/system/write_bmesh_file.py new file mode 100644 index 00000000..764fc3d3 --- /dev/null +++ b/OFsolvers/tutorial_cases/laakkonen/system/write_bmesh_file.py @@ -0,0 +1,530 @@ +import numpy as np +from reactor_geom_data import * + +def write_ofoam_preamble(outfile): + + outfile.write("/*--------------------------------*- C++ -*----------------------------------*\\\n") + outfile.write("| ========= | |\n") + outfile.write("| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n") + outfile.write("| \\ / O peration | Version: 5 |\n") + outfile.write("| \\ / A nd | Web: www.OpenFOAM.org |\n") + outfile.write("| \\/ M anipulation | |\n") + outfile.write("\*---------------------------------------------------------------------------*/\n") + outfile.write("FoamFile\n") + outfile.write("{\n") + outfile.write("\tversion 2.0;\n") + outfile.write("\tformat ascii;\n") + outfile.write("\tclass dictionary;\n") + outfile.write("\tobject blockMeshDict;\n") + outfile.write("}\n\n") + outfile.write("// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n\n") + outfile.write("convertToMeters 1.0;\n\n") + outfile.write("// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n\n") + +def write_vertices(outfile): + + outfile.write("\n// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n") + outfile.write("vertices\n(\n") + + counter=0 + for repeat in range(2): + for zi in range(nsections): + + outfile.write("\n//section "+str(zi)+"\n") + outfile.write("\n//center\n") + outfile.write("(0.0 0.0 "+str(reacthts[zi])+") // "+str(counter)+"\n") + counter=counter+1 + + #polygon section + outfile.write("\n//polygon\n") + for i in range(nsplits): + ang = i*dangle + x = polyrad*np.cos(ang) + y = polyrad*np.sin(ang) + outfile.write("( "+str(x)+" "+str(y)+" "+str(reacthts[zi])+" ) // "+str(counter)+"\n") + counter=counter+1 + + outfile.write("\n//circles\n") + + for ci in range(ncirc): + outfile.write("\n//circle "+str(ci)+"\n") + + for i in range(nsplits): + ang = i*dangle + x = circradii[ci]*np.cos(ang) + y = circradii[ci]*np.sin(ang) + outfile.write("( "+str(x)+" "+str(y)+" "+str(reacthts[zi])+" ) //"+str(counter)+"\n") + counter=counter+1 + + + outfile.write(");\n") + +def get_globalindex_of(splti,ci,zi): + + #also works for ci=-1 + global_id = zi*npts_per_section + centeroffset + polyoffset + ci*nsplits + splti%nsplits + return(global_id) + +def get_baffle_point_of(splti,ci,zi): + + + baffle_id = get_globalindex_of(splti,ci,zi) + + if(zi in baff_sections): + + if(ci==hub_circ): + + if(splti%2==0): #even number for impeller + baffle_id += nsections*npts_per_section + + if(ci==tank_circ): + + if(splti%2==1): #odd number for baffle + baffle_id += nsections*npts_per_section + + return(baffle_id) + +def write_edges(outfile): + + outfile.write("\n// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n") + outfile.write("edges\n(\n") + + for zi in range(nsections): + + outfile.write("\n//section "+str(zi)+"\n") + + offset=1+nsplits #one for center and nsplits for polygon + + outfile.write("\n//circles\n") + for ci in range(ncirc): + outfile.write("\n//circle "+str(ci)+"\n") + for i in range(nsplits): + ang = i*dangle + midx = circradii[ci]*np.cos(ang+dangle/2) + midy = circradii[ci]*np.sin(ang+dangle/2) + + globalind1 = get_baffle_point_of(i,ci,zi) + globalind2 = get_globalindex_of(i+1,ci,zi) + + outfile.write("arc "+str(globalind1)+" "+str(globalind2)+" ") + outfile.write("( "+str(midx)+" "+str(midy)+" "+str(reacthts[zi])+" )\n") + + + outfile.write(");\n") + +def write_this_block(outfile,comment,ids,mesh,zonename="none"): + + outfile.write("\n //"+comment+"\n") + outfile.write("hex (") + for i in range(len(ids)): + outfile.write(str(ids[i])+" ") + outfile.write(")\n") + + if(zonename != "none"): + outfile.write(zonename+"\n") + + outfile.write("( %d %d %d )\n"%(mesh[0],mesh[1],mesh[2])) + outfile.write("SimpleGrading (1 1 1)\n") + + +def write_blocks(outfile): + + outfile.write("\n// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n") + outfile.write("blocks\n(\n") + + idarray = np.zeros(8,dtype=int) + mesharray = np.zeros(3,dtype=int) + + + for zi in range(nvolumes): + + + outfile.write("\n//section "+str(zi)+"-"+str(zi+1)+"\n") + + offset0=zi*npts_per_section + offset1=(zi+1)*npts_per_section + + #polygon section + center_id0 = offset0 + center_id1 = offset1 + + #skip polygon blocks in stem sections + if(zi in nonstem_volumes): + for i in range(nsplits): + + localind1=centeroffset+i%nsplits + localind2=centeroffset+(i+1)%nsplits + + idarray[0] = offset0+localind1 + idarray[1] = offset1+localind1 + idarray[2] = offset1+localind2 + idarray[3] = offset0+localind2 + idarray[4] = center_id0 + idarray[5] = center_id1 + idarray[6] = center_id1 + idarray[7] = center_id0 + + mesharray[0] = meshz[zi] + mesharray[1] = Na + mesharray[2] = Npoly + + zonename="none" + if((zi in mrf_volumes)): + zonename="rotor" + + write_this_block(outfile,"block %d"%(i),idarray,mesharray,zonename) + + + idarray[:]=0 + mesharray[:]=0 + outfile.write("\n//circles\n") + + for ci in range(ncirc): + + zonename="none" + + #skip blocks inside hub + if( ((ci==inhub_circ) or (ci==hub_circ)) and (zi in hub_volumes)): + continue + + outfile.write("\n//circle "+str(ci)+"\n") + + if((zi in mrf_volumes) and (ci<=mrf_circ)): + zonename="rotor" + + for i in range(nsplits): + + idarray[0] = get_baffle_point_of(i,ci,zi) + idarray[1] = get_baffle_point_of(i,ci,zi+1) + idarray[2] = get_globalindex_of(i+1,ci,zi+1) + idarray[3] = get_globalindex_of(i+1,ci,zi) + idarray[4] = get_baffle_point_of(i,ci-1,zi) + idarray[5] = get_baffle_point_of(i,ci-1,zi+1) + idarray[6] = get_globalindex_of(i+1,ci-1,zi+1) + idarray[7] = get_globalindex_of(i+1,ci-1,zi) + + mesharray[0] = meshz[zi] + mesharray[1] = Na + mesharray[2] = meshr[ci] + write_this_block(outfile,"block %d"%(i),idarray,mesharray,zonename) + + + outfile.write(");\n") + + #print "meshz:",meshz + #print "meshr:",meshr + +def write_patches(outfile): + + inhub_ci = inhub_circ + hub_ci = hub_circ + rot_ci = rot_circ + poly_ci = -1 + + outfile.write("\n// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n") + outfile.write("patches\n(\n") + + #inlet patch + zi=0 + centerid=zi*npts_per_section + + outfile.write("\n\tpatch inlet\n\t(\n") + + #polygon + outfile.write("\n\t\t//polygon\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,poly_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,poly_ci,zi))+" ") + outfile.write(str(centerid)+" ") + outfile.write(str(centerid)+")\n") + + outfile.write("\n\t\t//inhub_circ to polygon\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,inhub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,inhub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,poly_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i,poly_ci,zi))+")\n") + + outfile.write("\n\t\t//hub to inhub_circ\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,hub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,inhub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i,inhub_ci,zi))+")\n") + + outfile.write("\n\t\t//rotor to hub\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,rot_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,rot_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,hub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi))+")\n") + + outfile.write("\t)\n") + + #outlet patch + zi=nsections-1 + centerid=zi*npts_per_section + outfile.write("\n\tpatch outlet\n\t(\n") + + #no polygon patch in outlet when we include stem + #polygon + #outfile.write("\n\t\t//polygon\n") + #for i in range(nsplits): + # outfile.write("\t\t( ") + # outfile.write(str(get_globalindex_of(i,poly_ci,zi))+" ") + # outfile.write(str(get_globalindex_of(i+1,poly_ci,zi))+" ") + # outfile.write(str(centerid)+" ") + # outfile.write(str(centerid)+")\n") + + outfile.write("\n\t\t//circles\n") + for ci in range(ncirc): + outfile.write("\n\t\t//circle "+str(ci)+" - "+str(ci-1)+" \n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,ci-1,zi))+" ") + outfile.write(str(get_globalindex_of(i,ci-1,zi))+")\n") + + outfile.write("\t)\n") + + #propeller patch + outfile.write("\n\twall propeller\n\t(\n") + + #need polygon patch at the first impeller + zi=hub_volumes[0] + outfile.write("\n\t\t//polygon\n") + centerid=zi*npts_per_section + #polygon + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,poly_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,poly_ci,zi))+" ") + outfile.write(str(centerid)+" ") + outfile.write(str(centerid)+")\n") + + for n_imp in range(nimpellers): + zi_bottom = hub_volumes[n_imp] #bottom of impeller section + zi_top = zi_bottom+1 #bottom of impeller section + + for zi in [zi_bottom,zi_top]: + + + outfile.write("\n\t\t//hub to blade circle\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,hub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,inhub_ci,zi))+" ") + outfile.write(str(get_baffle_point_of(i,inhub_ci,zi))+")\n") + + outfile.write("\n\t\t//blade to polygon\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,inhub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,inhub_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,poly_ci,zi))+" ") + outfile.write(str(get_baffle_point_of(i,poly_ci,zi))+")\n") + + #sides + outfile.write("\n\t\t//sides\n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_bottom))+" ") + outfile.write(str(get_globalindex_of(i+1,hub_ci,zi_bottom))+" ") + outfile.write(str(get_globalindex_of(i+1,hub_ci,zi_top))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_top))+")\n") + + #blades + outfile.write("\n\t\t//blades\n") + for zi in baff_volumes: + zi_bottom = zi + zi_top = zi+1 + for i in range(0,nsplits,2): #even numbers + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,hub_ci+1,zi_bottom))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci+1,zi_top))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_top))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_bottom))+")\n") + + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,hub_ci+1,zi_bottom))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci+1,zi_top))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_top))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_bottom))+")\n") + + + #inside hub blades + for n_imp in range(nimpellers): + hub_vol=hub_volumes[n_imp] + zi_pairs=[[hub_vol-1,hub_vol],[hub_vol+1,hub_vol+2]] + + for zi_pair in zi_pairs: + + zi_below=zi_pair[0] + zi_above=zi_pair[1] + + for i in range(0,nsplits,2): #even numbers + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_below))+" ") + outfile.write(str(get_baffle_point_of(i,inhub_ci,zi_below))+" ") + outfile.write(str(get_baffle_point_of(i,inhub_ci,zi_above))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_above))+")\n") + + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_below))+" ") + outfile.write(str(get_globalindex_of(i,inhub_ci,zi_below))+" ") + outfile.write(str(get_globalindex_of(i,inhub_ci,zi_above))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_above))+")\n") + + + #stem + outfile.write("\n\t\t//stem sides\n") + for zi in only_stem_volumes: + zi_bottom = zi + zi_top = zi+1 + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,poly_ci,zi_bottom))+" ") + outfile.write(str(get_globalindex_of(i+1,poly_ci,zi_bottom))+" ") + outfile.write(str(get_globalindex_of(i+1,poly_ci,zi_top))+" ") + outfile.write(str(get_globalindex_of(i,poly_ci,zi_top))+")\n") + + outfile.write("\t)\n") + + #stator and walls patch + tank_ci=ncirc-1 + outfile.write("\n\twall walls\n\t(\n") + + for zi in range(nsections-1): + outfile.write("\n\t\t//tank walls "+str(zi)+" - "+str(zi+1)+"\n") + + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,tank_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,tank_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,tank_ci,zi+1))+" ") + outfile.write(str(get_baffle_point_of(i,tank_ci,zi+1))+")\n") + + #baffles + outfile.write("\n\t\t//baffles\n") + for i in range(1,nsplits,2): #all odd numbers + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,tank_ci,zi))+" ") + outfile.write(str(get_baffle_point_of(i,tank_ci-1,zi))+" ") + outfile.write(str(get_baffle_point_of(i,tank_ci-1,zi+1))+" ") + outfile.write(str(get_baffle_point_of(i,tank_ci,zi+1))+")\n") + + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,tank_ci,zi))+" ") + outfile.write(str(get_globalindex_of(i,tank_ci-1,zi))+" ") + outfile.write(str(get_globalindex_of(i,tank_ci-1,zi+1))+" ") + outfile.write(str(get_globalindex_of(i,tank_ci,zi+1))+")\n") + + #inlet wall patch + #skip rotor to hub to inhub_circ to polygon region + #which is covered in inflow + zi=0 + outfile.write("\n\t\t//circles\n") + for ci in range(rot_ci+1,ncirc): #start from rotor circle + outfile.write("\n\t\t//circle "+str(ci)+" - "+str(ci-1)+" \n") + for i in range(nsplits): + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,ci,zi))+" ") + outfile.write(str(get_globalindex_of(i+1,ci-1,zi))+" ") + outfile.write(str(get_globalindex_of(i,ci-1,zi))+")\n") + + outfile.write("\t)\n") + + #stitch faces patches + outfile.write("\n\tempty inside_to_hub\n\t(\n") + + zi_pairs=[] + for vols in nonbaff_volumes: + zi_pairs.append([vols,vols+1]) + + + for zi_pair in zi_pairs: + + zi_below=zi_pair[0] + zi_above=zi_pair[1] + outfile.write("\n\t\t//pair :"+str(zi_below)+"-"+str(zi_above)+"\n") + + for i in range(0,nsplits,2): #even numbers + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_below))+" ") + outfile.write(str(get_baffle_point_of(i,inhub_ci,zi_below))+" ") + outfile.write(str(get_baffle_point_of(i,inhub_ci,zi_above))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_above))+")\n") + + outfile.write("\t)\n") + + outfile.write("\n\tempty inside_to_hub_copy\n\t(\n") + + for zi_pair in zi_pairs: + + zi_below=zi_pair[0] + zi_above=zi_pair[1] + outfile.write("\n\t\t//pair :"+str(zi_below)+"-"+str(zi_above)+"\n") + + for i in range(0,nsplits,2): #even numbers + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_below))+" ") + outfile.write(str(get_globalindex_of(i,inhub_ci,zi_below))+" ") + outfile.write(str(get_globalindex_of(i,inhub_ci,zi_above))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_above))+")\n") + + + outfile.write("\t)\n") + + #stitch faces patches + outfile.write("\n\tempty hub_to_rotor\n\t(\n") + + for zi_pair in zi_pairs: + + zi_below=zi_pair[0] + zi_above=zi_pair[1] + outfile.write("\n\t\t//pair :"+str(zi_below)+"-"+str(zi_above)+"\n") + + for i in range(0,nsplits,2): #even numbers + outfile.write("\t\t( ") + outfile.write(str(get_baffle_point_of(i,rot_ci,zi_below))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_below))+" ") + outfile.write(str(get_baffle_point_of(i,hub_ci,zi_above))+" ") + outfile.write(str(get_baffle_point_of(i,rot_ci,zi_above))+")\n") + + outfile.write("\t)\n") + outfile.write("\n\tempty hub_to_rotor_copy\n\t(\n") + + for zi_pair in zi_pairs: + + zi_below=zi_pair[0] + zi_above=zi_pair[1] + outfile.write("\n\t\t//pair :"+str(zi_below)+"-"+str(zi_above)+"\n") + + for i in range(0,nsplits,2): #even numbers + outfile.write("\t\t( ") + outfile.write(str(get_globalindex_of(i,rot_ci,zi_below))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_below))+" ") + outfile.write(str(get_globalindex_of(i,hub_ci,zi_above))+" ") + outfile.write(str(get_globalindex_of(i,rot_ci,zi_above))+")\n") + + + outfile.write("\t)\n") + + outfile.write(");\n") + + +#main +outfile=open("blockMeshDict_reactor","w") +write_ofoam_preamble(outfile) +write_vertices(outfile) +write_edges(outfile) +write_blocks(outfile) +write_patches(outfile) +outfile.close()