From b75319982891bc3573508653be41e4b5043b76a4 Mon Sep 17 00:00:00 2001 From: "Kellis Kincaid (khk)" Date: Thu, 8 Feb 2024 10:48:38 -0500 Subject: [PATCH 1/7] Added nLight beam class --- .../additiveFoam/movingHeatSource/Make/files | 1 + .../heatSourceModels/nLight/nLight.C | 221 ++++++++++++++++++ .../heatSourceModels/nLight/nLight.H | 157 +++++++++++++ .../movingHeatSourceModel.C | 3 +- tutorials/AMB2018-02-B-nLight/0/T | 44 ++++ tutorials/AMB2018-02-B-nLight/0/U | 41 ++++ tutorials/AMB2018-02-B-nLight/0/alpha.solid | 39 ++++ tutorials/AMB2018-02-B-nLight/0/p_rgh | 45 ++++ tutorials/AMB2018-02-B-nLight/Allclean | 9 + tutorials/AMB2018-02-B-nLight/Allrun | 15 ++ .../constant/foamToExaCADict | 24 ++ tutorials/AMB2018-02-B-nLight/constant/g | 22 ++ .../constant/heatSourceDict | 59 +++++ .../AMB2018-02-B-nLight/constant/scanPath | 3 + .../AMB2018-02-B-nLight/constant/thermoPath | 4 + .../constant/transportProperties | 43 ++++ .../AMB2018-02-B-nLight/system/blockMeshDict | 80 +++++++ .../AMB2018-02-B-nLight/system/controlDict | 53 +++++ .../system/decomposeParDict | 22 ++ .../AMB2018-02-B-nLight/system/fvSchemes | 50 ++++ .../AMB2018-02-B-nLight/system/fvSolution | 68 ++++++ 21 files changed, 1002 insertions(+), 1 deletion(-) create mode 100644 applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C create mode 100644 applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H create mode 100644 tutorials/AMB2018-02-B-nLight/0/T create mode 100644 tutorials/AMB2018-02-B-nLight/0/U create mode 100644 tutorials/AMB2018-02-B-nLight/0/alpha.solid create mode 100644 tutorials/AMB2018-02-B-nLight/0/p_rgh create mode 100755 tutorials/AMB2018-02-B-nLight/Allclean create mode 100755 tutorials/AMB2018-02-B-nLight/Allrun create mode 100644 tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict create mode 100644 tutorials/AMB2018-02-B-nLight/constant/g create mode 100644 tutorials/AMB2018-02-B-nLight/constant/heatSourceDict create mode 100644 tutorials/AMB2018-02-B-nLight/constant/scanPath create mode 100644 tutorials/AMB2018-02-B-nLight/constant/thermoPath create mode 100644 tutorials/AMB2018-02-B-nLight/constant/transportProperties create mode 100644 tutorials/AMB2018-02-B-nLight/system/blockMeshDict create mode 100644 tutorials/AMB2018-02-B-nLight/system/controlDict create mode 100644 tutorials/AMB2018-02-B-nLight/system/decomposeParDict create mode 100644 tutorials/AMB2018-02-B-nLight/system/fvSchemes create mode 100644 tutorials/AMB2018-02-B-nLight/system/fvSolution diff --git a/applications/solvers/additiveFoam/movingHeatSource/Make/files b/applications/solvers/additiveFoam/movingHeatSource/Make/files index 044edf5..fda4be0 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/Make/files +++ b/applications/solvers/additiveFoam/movingHeatSource/Make/files @@ -11,6 +11,7 @@ heatSourceModels/heatSourceModel/heatSourceModel.C heatSourceModels/heatSourceModel/heatSourceModelNew.C heatSourceModels/superGaussian/superGaussian.C heatSourceModels/modifiedSuperGaussian/modifiedSuperGaussian.C +heatSourceModels/nLight/nLight.C movingHeatSourceModel/movingHeatSourceModel.C diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C new file mode 100644 index 0000000..709e717 --- /dev/null +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C @@ -0,0 +1,221 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 Oak Ridge National Laboratory +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "nLight.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatSourceModels +{ + defineTypeNameAndDebug(nLight, 0); + addToRunTimeSelectionTable(heatSourceModel, nLight, dictionary); +} +} + +using Foam::constant::mathematical::pi; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatSourceModels::nLight::nLight +( + const word& sourceName, + const dictionary& dict, + const fvMesh& mesh +) +: + heatSourceModel(typeName, sourceName, dict, mesh), + mesh_(mesh), + spotCoeffs_(heatSourceModelCoeffs_.optionalSubDict("spotCoeffs")), + ringCoeffs_(heatSourceModelCoeffs_.optionalSubDict("ringCoeffs")) +{ + alpha_ = heatSourceModelCoeffs_.lookup("alpha"); + + //- Spot parameters + ks_ = spotCoeffs_.lookup("k"); + ms_ = spotCoeffs_.lookup("m"); + ds_ = heatSourceModelCoeffs_.lookup("dimensions"); + + //- Ring parameters + kr_ = ringCoeffs_.lookup("k"); + mr_ = ringCoeffs_.lookup("m"); + R_ = ringCoeffs_.lookup("R"); + r_ = ringCoeffs_.lookup("r"); + + //- Overwrite the dimensions used by the base class + dimensions_ = vector(R_ + r_, R_ + r_, ds_.z()); + staticDimensions_ = dimensions_; +} + + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +inline Foam::scalar +Foam::heatSourceModels::nLight::weight(const vector& d) +{ + // Spot parameters + const scalar as = Foam::pow(2.0, 1.0/ks_); + vector ss = + cmptDivide + ( + vector(ds_.x(), ds_.y(), dimensions_.z()), + vector(as, as, 1.0) + ); + + // Ring parameters + const scalar ar = Foam::pow(2.0, 1.0/kr_); + vector sr = + cmptDivide + ( + vector(r_, r_, dimensions_.z()), + vector(ar, ar, 1.0) + ); + + // Check if cell is within heat source depth + if (d.z() < max(ss.z(), sr.z())) + { + // x-y distance from beam center + vector di = vector(d.x(), d.y(), 0.0); + + // Spot calcs + ss *= Foam::pow(1.0 - Foam::pow(d.z() / ss.z(), ms_), 1.0/ms_); + + scalar xs = Foam::pow(magSqr(cmptDivide(di, ss)), ks_/2.0); + + // Ring calcs + const scalar rsz = + sr.x() * Foam::pow + ( + 1.0 - Foam::pow(d.z() / sr.z(), mr_), + 1.0 / mr_ + ); + + scalar xr = + Foam::pow + ( + Foam::sqr((mag(di) - R_) / rsz), + kr_ / 2.0 + ); + + // Return weights with power split and volume factored in + return alpha_ / Vs().value() * Foam::exp(-xs) + + (1.0 - alpha_) / Vr().value() * Foam::exp(-xr); + } + else + { + return 0.0; + } +} + +inline Foam::dimensionedScalar +Foam::heatSourceModels::nLight::V0() +{ + //- Because of linear combination of shapes in nLight, + // volume is integrated into the weight calculation + return dimensionedScalar("V0", dimVolume, 1.0); +} + +inline Foam::dimensionedScalar +Foam::heatSourceModels::nLight::Vs() +{ + const scalar a = Foam::pow(2.0, 1.0/ks_); + + const vector s = + cmptDivide + ( + vector(ds_.x(), ds_.y(), dimensions_.z()), + vector(a, a, 1.0) + ); + + const dimensionedScalar Vs + ( + "Vs", + dimVolume, + s.x()*s.y()*s.z()*pi*Foam::tgamma(1.0 + 2.0/ks_) + * Foam::tgamma(1.0 + 1.0/ms_)*Foam::tgamma(1.0 + 2.0/ms_) + / Foam::tgamma(1.0 + 3.0/ms_) + ); + + return Vs; +} + +inline Foam::dimensionedScalar +Foam::heatSourceModels::nLight::Vr() +{ + const scalar a = Foam::pow(2.0, 1.0/kr_); + + const vector s = + cmptDivide + ( + vector(r_, r_, dimensions_.z()), + vector(a, a, 1.0) + ); + + const dimensionedScalar Vr + ( + "Vr", + dimVolume, + 4.0 * pi * R_ * s.x() * s.z() * pi / kr_ // this kr is in original nLight impl but not sure where it comes from + * Foam::tgamma(1.0 + 1.0 / mr_) * Foam::tgamma(1.0 + 1.0 / mr_) + * Foam::tgamma(1.0 + 1.0 / kr_) / Foam::tgamma(1.0 + 2.0 / mr_) + ); + + return Vr; +} + +bool Foam::heatSourceModels::nLight::read() +{ + if (heatSourceModel::read()) + { + heatSourceModelCoeffs_ = optionalSubDict(type() + "Coeffs"); + + //- General parameters + heatSourceModelCoeffs_.lookup("alpha") >> alpha_; + + //- Spot parameters + spotCoeffs_.lookup("k") >> ks_; + spotCoeffs_.lookup("m") >> ms_; + + //- Ring parameters + ringCoeffs_.lookup("k") >> kr_; + ringCoeffs_.lookup("m") >> kr_; + ringCoeffs_.lookup("R") >> R_; + ringCoeffs_.lookup("r") >> r_; + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H new file mode 100644 index 0000000..dcf4128 --- /dev/null +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 Oak Ridge National Laboratory +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::heatSourceModels::nLight + +Description + Beam profile based on nLight system described in the listed reference. + The article describes a 2D profile which was extended to a generalized 3D + distribution by Jamie Stump and John Coleman for use with additiveFoam. + The exact profiles given in the nLight article may be approximated by + fitting the model coefficients in this class. + + Reference: + Vanmunster, L., Goossens, L., Kinds, Y., van Hooreweder, B., + & Vrancken, B. (2023). Effect of a variable laser beam profile + system on productivity and surface quality of 316L stainless steel + parts produced by Laser Powder Bed Fusion. CIRP Annals. + https://doi.org/10.1016/j.cirp.2023.04.035 + + +SourceFiles + nLight.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nLight_H +#define nLight_H + +#include "heatSourceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatSourceModels +{ + +/*---------------------------------------------------------------------------*\ + Class nLight +\*---------------------------------------------------------------------------*/ + +class nLight +: + public heatSourceModel +{ + // Private Data + + //- Pointer to mesh information + const fvMesh& mesh_; + + //- Spot/beam weight + scalar alpha_; + + //- Dictionary for spot shape parameters + const dictionary& spotCoeffs_; + + //- Spot distribution shape coefficient + scalar ks_; + + //- Spot geometric shape coefficient + scalar ms_; + + //- Spot volume + scalar Vs_; + + //- Spot dimensions + vector ds_; + + //- Dictionary for ring shape parameters + const dictionary& ringCoeffs_; + + //- Ring distribution shape coefficient + scalar kr_; + + //- Ring geometric shape coefficient + scalar mr_; + + //- Ring center radius + scalar R_; + + //- Ring half width + scalar r_; + + //- Ring volume + scalar Vr_; + + +public: + + //- Runtime type information + TypeName("nLight"); + + + // Constructors + + //- Construct from components + nLight + ( + const word& sourceName, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~nLight() + {} + + + // Member Functions + + inline virtual scalar weight(const vector& d); + + inline virtual dimensionedScalar V0(); + + inline virtual dimensionedScalar Vs(); + + inline virtual dimensionedScalar Vr(); + + //- Read the heatSourceProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace heatSourceModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C b/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C index ba998bc..34fc06d 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C +++ b/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C @@ -57,7 +57,8 @@ Foam::movingHeatSourceModel::movingHeatSourceModel mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE + //IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh_, dimensionedScalar(dimPower/dimVolume, 0.0) diff --git a/tutorials/AMB2018-02-B-nLight/0/T b/tutorials/AMB2018-02-B-nLight/0/T new file mode 100644 index 0000000..a3a1dc2 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/0/T @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + bottom + { + type zeroGradient; + value uniform 300; + } + top + { + type mixedTemperature; + h 10.0; + emissivity 0.4; + Tinf uniform 300; + value uniform 300; + } + sides + { + type zeroGradient; + value uniform 300; + } +} + + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/0/U b/tutorials/AMB2018-02-B-nLight/0/U new file mode 100644 index 0000000..4032a32 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/0/U @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + bottom + { + type noSlip; + } + + top + { + type marangoni; + dSigmadT -0.11e-3; + value uniform (0 0 0); + } + + sides + { + type noSlip; + } +} + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/0/alpha.solid b/tutorials/AMB2018-02-B-nLight/0/alpha.solid new file mode 100644 index 0000000..357f400 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/0/alpha.solid @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object alpha.solid; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 1; + +boundaryField +{ + bottom + { + type zeroGradient; + } + top + { + type zeroGradient; + } + sides + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/0/p_rgh b/tutorials/AMB2018-02-B-nLight/0/p_rgh new file mode 100644 index 0000000..58da4a2 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/0/p_rgh @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + bottom + { + type fixedFluxPressure; + rho rhok; + value uniform 0; + } + + top + { + type fixedFluxPressure; + rho rhok; + value uniform 0; + } + + sides + { + type fixedFluxPressure; + rho rhok; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/Allclean b/tutorials/AMB2018-02-B-nLight/Allclean new file mode 100755 index 0000000..6b45f82 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/Allclean @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +#------------------------------------------------------------------------------ diff --git a/tutorials/AMB2018-02-B-nLight/Allrun b/tutorials/AMB2018-02-B-nLight/Allrun new file mode 100755 index 0000000..9c9d763 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +application=`getApplication` + +runApplication blockMesh +runApplication decomposePar +runParallel $application + +runApplication reconstructPar + +#------------------------------------------------------------------------------ diff --git a/tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict b/tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict new file mode 100644 index 0000000..c874ff4 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object foamToExaCADict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +execute on; + +box (0 -0.0001 -0.0002) (0.002 0.0001 0); +dx 5e-6; +isotherm 1620; + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/constant/g b/tutorials/AMB2018-02-B-nLight/constant/g new file mode 100644 index 0000000..7171262 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 -9.81); + + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict b/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict new file mode 100644 index 0000000..9defb95 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object heatSourceProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +sources (beam); + +beam +{ + pathName scanPath; + + absorptionModel constant; + + constantCoeffs + { + eta 0.3; + } + + heatSourceModel nLight; + + // Parameters for nLight VBPP 5 profile + nLightCoeffs + { + // Blending factor + alpha 0.2; + + // Spot parameters + dimensions (50.0e-6 50.0e-6 30e-6); + + spotCoeffs + { + k 2.0; + m 2.0; + } + + // Ring parameters + ringCoeffs + { + R 100e-6; + r 50e-6; + k 2.0; + m 2.0; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/constant/scanPath b/tutorials/AMB2018-02-B-nLight/constant/scanPath new file mode 100644 index 0000000..b89b0ce --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/constant/scanPath @@ -0,0 +1,3 @@ +Mode X Y Z Power Param +1 0.000 0.000 0 0 0 +0 0.002 0.000 0 179.2 0.8 diff --git a/tutorials/AMB2018-02-B-nLight/constant/thermoPath b/tutorials/AMB2018-02-B-nLight/constant/thermoPath new file mode 100644 index 0000000..fdcd4be --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/constant/thermoPath @@ -0,0 +1,4 @@ +( +1410.0000 1.0000 +1620.0000 0.0000 +) diff --git a/tutorials/AMB2018-02-B-nLight/constant/transportProperties b/tutorials/AMB2018-02-B-nLight/constant/transportProperties new file mode 100644 index 0000000..b945315 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/constant/transportProperties @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solid +{ + kappa (8.275 0.01472 0.0); + Cp (579.28 0.0 0.0); +} + +liquid +{ + kappa (4.889 0.014743 0.0); + Cp (750.65 0.0 0.0); +} + +powder +{ + kappa (-0.07707 0.00075 0.0); + Cp (747.568 0.0 0.0); +} + +//- fluid flow properties +rho [1 -3 0 0 0 0 0] 7569.92; +mu [1 -1 -1 0 0 0 0] 0.003032; +beta [0 0 0 -1 0 0 0] 1.2e-4; +DAS [0 1 0 0 0 0 0] 10e-6; +Lf [0 2 -2 0 0 0 0] 2.1754e5; + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/blockMeshDict b/tutorials/AMB2018-02-B-nLight/system/blockMeshDict new file mode 100644 index 0000000..854f5ad --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/system/blockMeshDict @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +xmin -0.0005; +xmax 0.0025; +ymin -0.00025; +ymax 0.00025; +zmin -0.0003; +zmax 0.0; + + +vertices +( + ($xmin $ymin $zmin) //0 + ($xmax $ymin $zmin) //1 + ($xmax $ymax $zmin) //2 + ($xmin $ymax $zmin) //3 + ($xmin $ymin $zmax) //4 + ($xmax $ymin $zmax) //5 + ($xmax $ymax $zmax) //6 + ($xmin $ymax $zmax) //7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (150 25 15) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + bottom + { + type wall; + faces + ( + (0 3 2 1) + ); + } + top + { + type wall; + faces + ( + (4 5 6 7) + ); + } + sides + { + type wall; + faces + ( + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + (3 7 6 2) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/controlDict b/tutorials/AMB2018-02-B-nLight/system/controlDict new file mode 100644 index 0000000..ad97bac --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/system/controlDict @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application additiveFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.004; + +deltaT 1e-7; + +writeControl adjustableRunTime; + +writeInterval 0.001; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 8; + +writeCompression off; + +timeFormat general; + +timePrecision 8; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; +maxDi 1; +maxAlphaCo 1; +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/decomposeParDict b/tutorials/AMB2018-02-B-nLight/system/decomposeParDict new file mode 100644 index 0000000..08d37ba --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/system/decomposeParDict @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 6; + +method scotch; + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/fvSchemes b/tutorials/AMB2018-02-B-nLight/system/fvSchemes new file mode 100644 index 0000000..b3fc7c1 --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/system/fvSchemes @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default Gauss upwind; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(kappa) harmonic; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/fvSolution b/tutorials/AMB2018-02-B-nLight/system/fvSolution new file mode 100644 index 0000000..e5d484e --- /dev/null +++ b/tutorials/AMB2018-02-B-nLight/system/fvSolution @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: 10 + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p_rgh + { + solver GAMG; + tolerance 1e-06; + relTol 0.01; + smoother DIC; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "T.*" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-15; + relTol 0; + minIter 1; + maxIter 20; + } +} + +PIMPLE +{ + momentumPredictor no; + nOuterCorrectors 0; + nCorrectors 1; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; + + + nThermoCorrectors 20; + thermoTolerance 1e-8; + explicitSolve true; +} + +relaxationFactors +{ + equations + { + ".*" 1; + } +} + +// ************************************************************************* // From be853be5c3bb6060b8e1037a34c2c13478943cc8 Mon Sep 17 00:00:00 2001 From: "Kellis Kincaid (khk)" Date: Thu, 8 Feb 2024 15:03:52 -0500 Subject: [PATCH 2/7] Refactored volume calculations and modified tutorial to use sub-grid heat source integration --- .../heatSourceModel/heatSourceModel.C | 2 + .../heatSourceModels/nLight/nLight.C | 40 ++++++++++--------- .../heatSourceModels/nLight/nLight.H | 17 ++++---- tutorials/AMB2018-02-B-nLight/Allclean | 2 + .../constant/heatSourceDict | 5 ++- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C index 02a7d04..5dfcec1 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C @@ -358,6 +358,8 @@ Foam::heatSourceModel::qDot() // stabilize numerical integration errors within 95% of applied power dimensionedScalar sumWeights = fvc::domainIntegrate(weights); scalar residual = (sumWeights / volume).value(); + + Info << "Residual = " << residual << endl; if (mag(1 - residual) < 0.05) { diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C index 709e717..db4deef 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C @@ -61,12 +61,14 @@ Foam::heatSourceModels::nLight::nLight ks_ = spotCoeffs_.lookup("k"); ms_ = spotCoeffs_.lookup("m"); ds_ = heatSourceModelCoeffs_.lookup("dimensions"); + As_ = As().value(); //- Ring parameters kr_ = ringCoeffs_.lookup("k"); mr_ = ringCoeffs_.lookup("m"); R_ = ringCoeffs_.lookup("R"); r_ = ringCoeffs_.lookup("r"); + Ar_ = Ar().value(); //- Overwrite the dimensions used by the base class dimensions_ = vector(R_ + r_, R_ + r_, ds_.z()); @@ -125,8 +127,8 @@ Foam::heatSourceModels::nLight::weight(const vector& d) ); // Return weights with power split and volume factored in - return alpha_ / Vs().value() * Foam::exp(-xs) - + (1.0 - alpha_) / Vr().value() * Foam::exp(-xr); + return alpha_ / As_ / dimensions_.z() * Foam::exp(-xs) + + (1.0 - alpha_) / Ar_ / dimensions_.z() * Foam::exp(-xr); } else { @@ -143,9 +145,9 @@ Foam::heatSourceModels::nLight::V0() } inline Foam::dimensionedScalar -Foam::heatSourceModels::nLight::Vs() +Foam::heatSourceModels::nLight::As() { - const scalar a = Foam::pow(2.0, 1.0/ks_); + const scalar a = Foam::pow(2.0, 1.0 / ks_); const vector s = cmptDivide @@ -154,22 +156,22 @@ Foam::heatSourceModels::nLight::Vs() vector(a, a, 1.0) ); - const dimensionedScalar Vs + const dimensionedScalar As ( - "Vs", - dimVolume, - s.x()*s.y()*s.z()*pi*Foam::tgamma(1.0 + 2.0/ks_) - * Foam::tgamma(1.0 + 1.0/ms_)*Foam::tgamma(1.0 + 2.0/ms_) - / Foam::tgamma(1.0 + 3.0/ms_) + "As", + dimArea, + s.x() * s.y() * pi * Foam::tgamma(1.0 + 2.0 / ks_) + * Foam::tgamma(1.0 + 1.0 / ms_) * Foam::tgamma(1.0 + 2.0 / ms_) + / Foam::tgamma(1.0 + 3.0 / ms_) ); - return Vs; + return As; } inline Foam::dimensionedScalar -Foam::heatSourceModels::nLight::Vr() +Foam::heatSourceModels::nLight::Ar() { - const scalar a = Foam::pow(2.0, 1.0/kr_); + const scalar a = Foam::pow(2.0, 1.0 / kr_); const vector s = cmptDivide @@ -178,16 +180,16 @@ Foam::heatSourceModels::nLight::Vr() vector(a, a, 1.0) ); - const dimensionedScalar Vr + const dimensionedScalar Ar ( - "Vr", - dimVolume, - 4.0 * pi * R_ * s.x() * s.z() * pi / kr_ // this kr is in original nLight impl but not sure where it comes from + "Ar", + dimArea, + 4.0 * pi * R_ * s.x() * Foam::tgamma(1.0 + 1.0 / kr_) * Foam::tgamma(1.0 + 1.0 / mr_) * Foam::tgamma(1.0 + 1.0 / mr_) - * Foam::tgamma(1.0 + 1.0 / kr_) / Foam::tgamma(1.0 + 2.0 / mr_) + / Foam::tgamma(1.0 + 2.0 / mr_) ); - return Vr; + return Ar; } bool Foam::heatSourceModels::nLight::read() diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H index dcf4128..447ff01 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.H @@ -83,12 +83,12 @@ class nLight //- Spot geometric shape coefficient scalar ms_; - //- Spot volume - scalar Vs_; - //- Spot dimensions vector ds_; + //- Spot area + scalar As_; + //- Dictionary for ring shape parameters const dictionary& ringCoeffs_; @@ -104,8 +104,8 @@ class nLight //- Ring half width scalar r_; - //- Ring volume - scalar Vr_; + //- Ring area + scalar Ar_; public: @@ -136,9 +136,10 @@ public: inline virtual dimensionedScalar V0(); - inline virtual dimensionedScalar Vs(); - - inline virtual dimensionedScalar Vr(); + // Normalization factors for spot and ring integration + // NOTE: THESE DO NOT INCLUDE THE BEAM DEPTH! + inline virtual dimensionedScalar As(); + inline virtual dimensionedScalar Ar(); //- Read the heatSourceProperties dictionary virtual bool read(); diff --git a/tutorials/AMB2018-02-B-nLight/Allclean b/tutorials/AMB2018-02-B-nLight/Allclean index 6b45f82..9d5ae72 100755 --- a/tutorials/AMB2018-02-B-nLight/Allclean +++ b/tutorials/AMB2018-02-B-nLight/Allclean @@ -6,4 +6,6 @@ cd ${0%/*} || exit 1 # Run from this directory cleanCase +rm -rf ExaCA + #------------------------------------------------------------------------------ diff --git a/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict b/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict index 9defb95..88199ae 100644 --- a/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict +++ b/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict @@ -33,7 +33,10 @@ beam // Parameters for nLight VBPP 5 profile nLightCoeffs { - // Blending factor + // Points for sub-grid integration of heat source + nPoints (5 5 5); + + // Blending factor (alpha = 1.0 --> 100% spot) alpha 0.2; // Spot parameters From 70f79ef1d4e34c11b987333292b35b27e3aecf55 Mon Sep 17 00:00:00 2001 From: "Kellis Kincaid (khk)" Date: Thu, 8 Feb 2024 15:08:29 -0500 Subject: [PATCH 3/7] Clean unnecessary changes --- .../heatSourceModels/heatSourceModel/heatSourceModel.C | 2 -- .../movingHeatSourceModel/movingHeatSourceModel.C | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C index 5dfcec1..02a7d04 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C @@ -358,8 +358,6 @@ Foam::heatSourceModel::qDot() // stabilize numerical integration errors within 95% of applied power dimensionedScalar sumWeights = fvc::domainIntegrate(weights); scalar residual = (sumWeights / volume).value(); - - Info << "Residual = " << residual << endl; if (mag(1 - residual) < 0.05) { diff --git a/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C b/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C index 34fc06d..ba998bc 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C +++ b/applications/solvers/additiveFoam/movingHeatSource/movingHeatSourceModel/movingHeatSourceModel.C @@ -57,8 +57,7 @@ Foam::movingHeatSourceModel::movingHeatSourceModel mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - //IOobject::NO_WRITE - IOobject::AUTO_WRITE + IOobject::NO_WRITE ), mesh_, dimensionedScalar(dimPower/dimVolume, 0.0) From 8145f1ba7cf01a718918dc639cf11b50f995ef60 Mon Sep 17 00:00:00 2001 From: "Kellis Kincaid (khk)" Date: Mon, 19 Feb 2024 10:58:25 -0500 Subject: [PATCH 4/7] Add nLight option to original AMB2018-02-B tutorial, remove dedicated nLight tutorial --- tutorials/AMB2018-02-B-nLight/0/T | 44 ---------- tutorials/AMB2018-02-B-nLight/0/U | 41 ---------- tutorials/AMB2018-02-B-nLight/0/alpha.solid | 39 --------- tutorials/AMB2018-02-B-nLight/0/p_rgh | 45 ----------- tutorials/AMB2018-02-B-nLight/Allclean | 11 --- tutorials/AMB2018-02-B-nLight/Allrun | 15 ---- .../constant/foamToExaCADict | 24 ------ tutorials/AMB2018-02-B-nLight/constant/g | 22 ----- .../constant/heatSourceDict | 62 -------------- .../AMB2018-02-B-nLight/constant/scanPath | 3 - .../AMB2018-02-B-nLight/constant/thermoPath | 4 - .../constant/transportProperties | 43 ---------- .../AMB2018-02-B-nLight/system/blockMeshDict | 80 ------------------- .../AMB2018-02-B-nLight/system/controlDict | 53 ------------ .../system/decomposeParDict | 22 ----- .../AMB2018-02-B-nLight/system/fvSchemes | 50 ------------ .../AMB2018-02-B-nLight/system/fvSolution | 68 ---------------- .../AMB2018-02-B/constant/heatSourceDict | 30 +++++++ 18 files changed, 30 insertions(+), 626 deletions(-) delete mode 100644 tutorials/AMB2018-02-B-nLight/0/T delete mode 100644 tutorials/AMB2018-02-B-nLight/0/U delete mode 100644 tutorials/AMB2018-02-B-nLight/0/alpha.solid delete mode 100644 tutorials/AMB2018-02-B-nLight/0/p_rgh delete mode 100755 tutorials/AMB2018-02-B-nLight/Allclean delete mode 100755 tutorials/AMB2018-02-B-nLight/Allrun delete mode 100644 tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict delete mode 100644 tutorials/AMB2018-02-B-nLight/constant/g delete mode 100644 tutorials/AMB2018-02-B-nLight/constant/heatSourceDict delete mode 100644 tutorials/AMB2018-02-B-nLight/constant/scanPath delete mode 100644 tutorials/AMB2018-02-B-nLight/constant/thermoPath delete mode 100644 tutorials/AMB2018-02-B-nLight/constant/transportProperties delete mode 100644 tutorials/AMB2018-02-B-nLight/system/blockMeshDict delete mode 100644 tutorials/AMB2018-02-B-nLight/system/controlDict delete mode 100644 tutorials/AMB2018-02-B-nLight/system/decomposeParDict delete mode 100644 tutorials/AMB2018-02-B-nLight/system/fvSchemes delete mode 100644 tutorials/AMB2018-02-B-nLight/system/fvSolution diff --git a/tutorials/AMB2018-02-B-nLight/0/T b/tutorials/AMB2018-02-B-nLight/0/T deleted file mode 100644 index a3a1dc2..0000000 --- a/tutorials/AMB2018-02-B-nLight/0/T +++ /dev/null @@ -1,44 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object T; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 1 0 0 0]; - -internalField uniform 300; - -boundaryField -{ - bottom - { - type zeroGradient; - value uniform 300; - } - top - { - type mixedTemperature; - h 10.0; - emissivity 0.4; - Tinf uniform 300; - value uniform 300; - } - sides - { - type zeroGradient; - value uniform 300; - } -} - - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/0/U b/tutorials/AMB2018-02-B-nLight/0/U deleted file mode 100644 index 4032a32..0000000 --- a/tutorials/AMB2018-02-B-nLight/0/U +++ /dev/null @@ -1,41 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volVectorField; - object U; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -1 0 0 0 0]; - -internalField uniform (0 0 0); - -boundaryField -{ - bottom - { - type noSlip; - } - - top - { - type marangoni; - dSigmadT -0.11e-3; - value uniform (0 0 0); - } - - sides - { - type noSlip; - } -} - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/0/alpha.solid b/tutorials/AMB2018-02-B-nLight/0/alpha.solid deleted file mode 100644 index 357f400..0000000 --- a/tutorials/AMB2018-02-B-nLight/0/alpha.solid +++ /dev/null @@ -1,39 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object alpha.solid; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 1; - -boundaryField -{ - bottom - { - type zeroGradient; - } - top - { - type zeroGradient; - } - sides - { - type zeroGradient; - } -} - - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/0/p_rgh b/tutorials/AMB2018-02-B-nLight/0/p_rgh deleted file mode 100644 index 58da4a2..0000000 --- a/tutorials/AMB2018-02-B-nLight/0/p_rgh +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object p_rgh; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -2 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - bottom - { - type fixedFluxPressure; - rho rhok; - value uniform 0; - } - - top - { - type fixedFluxPressure; - rho rhok; - value uniform 0; - } - - sides - { - type fixedFluxPressure; - rho rhok; - value uniform 0; - } -} - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/Allclean b/tutorials/AMB2018-02-B-nLight/Allclean deleted file mode 100755 index 9d5ae72..0000000 --- a/tutorials/AMB2018-02-B-nLight/Allclean +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Source tutorial clean functions -. $WM_PROJECT_DIR/bin/tools/CleanFunctions - -cleanCase - -rm -rf ExaCA - -#------------------------------------------------------------------------------ diff --git a/tutorials/AMB2018-02-B-nLight/Allrun b/tutorials/AMB2018-02-B-nLight/Allrun deleted file mode 100755 index 9c9d763..0000000 --- a/tutorials/AMB2018-02-B-nLight/Allrun +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Source tutorial run functions -. $WM_PROJECT_DIR/bin/tools/RunFunctions - -application=`getApplication` - -runApplication blockMesh -runApplication decomposePar -runParallel $application - -runApplication reconstructPar - -#------------------------------------------------------------------------------ diff --git a/tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict b/tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict deleted file mode 100644 index c874ff4..0000000 --- a/tutorials/AMB2018-02-B-nLight/constant/foamToExaCADict +++ /dev/null @@ -1,24 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object foamToExaCADict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -execute on; - -box (0 -0.0001 -0.0002) (0.002 0.0001 0); -dx 5e-6; -isotherm 1620; - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/constant/g b/tutorials/AMB2018-02-B-nLight/constant/g deleted file mode 100644 index 7171262..0000000 --- a/tutorials/AMB2018-02-B-nLight/constant/g +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class uniformDimensionedVectorField; - location "constant"; - object g; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -2 0 0 0 0]; -value (0 0 -9.81); - - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict b/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict deleted file mode 100644 index 88199ae..0000000 --- a/tutorials/AMB2018-02-B-nLight/constant/heatSourceDict +++ /dev/null @@ -1,62 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object heatSourceProperties; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -sources (beam); - -beam -{ - pathName scanPath; - - absorptionModel constant; - - constantCoeffs - { - eta 0.3; - } - - heatSourceModel nLight; - - // Parameters for nLight VBPP 5 profile - nLightCoeffs - { - // Points for sub-grid integration of heat source - nPoints (5 5 5); - - // Blending factor (alpha = 1.0 --> 100% spot) - alpha 0.2; - - // Spot parameters - dimensions (50.0e-6 50.0e-6 30e-6); - - spotCoeffs - { - k 2.0; - m 2.0; - } - - // Ring parameters - ringCoeffs - { - R 100e-6; - r 50e-6; - k 2.0; - m 2.0; - } - } -} - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/constant/scanPath b/tutorials/AMB2018-02-B-nLight/constant/scanPath deleted file mode 100644 index b89b0ce..0000000 --- a/tutorials/AMB2018-02-B-nLight/constant/scanPath +++ /dev/null @@ -1,3 +0,0 @@ -Mode X Y Z Power Param -1 0.000 0.000 0 0 0 -0 0.002 0.000 0 179.2 0.8 diff --git a/tutorials/AMB2018-02-B-nLight/constant/thermoPath b/tutorials/AMB2018-02-B-nLight/constant/thermoPath deleted file mode 100644 index fdcd4be..0000000 --- a/tutorials/AMB2018-02-B-nLight/constant/thermoPath +++ /dev/null @@ -1,4 +0,0 @@ -( -1410.0000 1.0000 -1620.0000 0.0000 -) diff --git a/tutorials/AMB2018-02-B-nLight/constant/transportProperties b/tutorials/AMB2018-02-B-nLight/constant/transportProperties deleted file mode 100644 index b945315..0000000 --- a/tutorials/AMB2018-02-B-nLight/constant/transportProperties +++ /dev/null @@ -1,43 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object transportProperties; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -solid -{ - kappa (8.275 0.01472 0.0); - Cp (579.28 0.0 0.0); -} - -liquid -{ - kappa (4.889 0.014743 0.0); - Cp (750.65 0.0 0.0); -} - -powder -{ - kappa (-0.07707 0.00075 0.0); - Cp (747.568 0.0 0.0); -} - -//- fluid flow properties -rho [1 -3 0 0 0 0 0] 7569.92; -mu [1 -1 -1 0 0 0 0] 0.003032; -beta [0 0 0 -1 0 0 0] 1.2e-4; -DAS [0 1 0 0 0 0 0] 10e-6; -Lf [0 2 -2 0 0 0 0] 2.1754e5; - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/blockMeshDict b/tutorials/AMB2018-02-B-nLight/system/blockMeshDict deleted file mode 100644 index 854f5ad..0000000 --- a/tutorials/AMB2018-02-B-nLight/system/blockMeshDict +++ /dev/null @@ -1,80 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -xmin -0.0005; -xmax 0.0025; -ymin -0.00025; -ymax 0.00025; -zmin -0.0003; -zmax 0.0; - - -vertices -( - ($xmin $ymin $zmin) //0 - ($xmax $ymin $zmin) //1 - ($xmax $ymax $zmin) //2 - ($xmin $ymax $zmin) //3 - ($xmin $ymin $zmax) //4 - ($xmax $ymin $zmax) //5 - ($xmax $ymax $zmax) //6 - ($xmin $ymax $zmax) //7 -); - -blocks -( - hex (0 1 2 3 4 5 6 7) (150 25 15) simpleGrading (1 1 1) -); - -edges -( -); - -boundary -( - bottom - { - type wall; - faces - ( - (0 3 2 1) - ); - } - top - { - type wall; - faces - ( - (4 5 6 7) - ); - } - sides - { - type wall; - faces - ( - (0 4 7 3) - (2 6 5 1) - (1 5 4 0) - (3 7 6 2) - ); - } -); - -mergePatchPairs -( -); - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/controlDict b/tutorials/AMB2018-02-B-nLight/system/controlDict deleted file mode 100644 index ad97bac..0000000 --- a/tutorials/AMB2018-02-B-nLight/system/controlDict +++ /dev/null @@ -1,53 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object controlDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -application additiveFoam; - -startFrom startTime; - -startTime 0; - -stopAt endTime; - -endTime 0.004; - -deltaT 1e-7; - -writeControl adjustableRunTime; - -writeInterval 0.001; - -purgeWrite 0; - -writeFormat binary; - -writePrecision 8; - -writeCompression off; - -timeFormat general; - -timePrecision 8; - -runTimeModifiable yes; - -adjustTimeStep yes; - -maxCo 0.5; -maxDi 1; -maxAlphaCo 1; -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/decomposeParDict b/tutorials/AMB2018-02-B-nLight/system/decomposeParDict deleted file mode 100644 index 08d37ba..0000000 --- a/tutorials/AMB2018-02-B-nLight/system/decomposeParDict +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object decomposeParDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -numberOfSubdomains 6; - -method scotch; - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/fvSchemes b/tutorials/AMB2018-02-B-nLight/system/fvSchemes deleted file mode 100644 index b3fc7c1..0000000 --- a/tutorials/AMB2018-02-B-nLight/system/fvSchemes +++ /dev/null @@ -1,50 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object fvSchemes; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -ddtSchemes -{ - default Euler; -} - -gradSchemes -{ - default Gauss linear; -} - -divSchemes -{ - default Gauss upwind; -} - -laplacianSchemes -{ - default Gauss linear corrected; -} - -interpolationSchemes -{ - default linear; - interpolate(kappa) harmonic; -} - -snGradSchemes -{ - default corrected; -} - - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B-nLight/system/fvSolution b/tutorials/AMB2018-02-B-nLight/system/fvSolution deleted file mode 100644 index e5d484e..0000000 --- a/tutorials/AMB2018-02-B-nLight/system/fvSolution +++ /dev/null @@ -1,68 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: 10 - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object fvSolution; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -solvers -{ - p_rgh - { - solver GAMG; - tolerance 1e-06; - relTol 0.01; - smoother DIC; - } - - p_rghFinal - { - $p_rgh; - relTol 0; - } - - "T.*" - { - solver PBiCGStab; - preconditioner DILU; - tolerance 1e-15; - relTol 0; - minIter 1; - maxIter 20; - } -} - -PIMPLE -{ - momentumPredictor no; - nOuterCorrectors 0; - nCorrectors 1; - nNonOrthogonalCorrectors 0; - pRefCell 0; - pRefValue 0; - - - nThermoCorrectors 20; - thermoTolerance 1e-8; - explicitSolve true; -} - -relaxationFactors -{ - equations - { - ".*" 1; - } -} - -// ************************************************************************* // diff --git a/tutorials/AMB2018-02-B/constant/heatSourceDict b/tutorials/AMB2018-02-B/constant/heatSourceDict index 0122d92..583279a 100644 --- a/tutorials/AMB2018-02-B/constant/heatSourceDict +++ b/tutorials/AMB2018-02-B/constant/heatSourceDict @@ -29,13 +29,43 @@ beam } heatSourceModel superGaussian; + //heatSourceModel nLight; + // Standard super-Gaussian spot profile superGaussianCoeffs { k 2.0; dimensions (85.0e-6 85.0e-6 30e-6); nPoints (10 10 10); } + + // Parameters for nLight VBPP5 profile + nLightCoeffs + { + // Points for sub-grid integration of heat source + nPoints (5 5 5); + + // Blending factor (alpha = 1.0 --> 100% spot) + alpha 0.2; + + // Spot parameters + dimensions (50.0e-6 50.0e-6 30e-6); + + spotCoeffs + { + k 2.0; + m 2.0; + } + + // Ring parameters + ringCoeffs + { + R 100e-6; + r 50e-6; + k 2.0; + m 2.0; + } + } } // ************************************************************************* // From 2ed067e06d348232b6865568ed3e5f16a26cb4a5 Mon Sep 17 00:00:00 2001 From: Coleman J S <8s2@narsil-gpu-login3.compute.ornl.gov> Date: Mon, 26 Feb 2024 09:36:43 -0500 Subject: [PATCH 5/7] fixed math error in nLight ring normalization factor and implemented a mode-based selection based on the experimentally measure beam profiles from nLight --- .../solvers/additiveFoam/additiveFoam.C | 10 +++ .../additiveFoam/interface/interface.H | 28 +++++++ .../additiveFoam/interface/interfacePoints.H | 81 +++++++++++++++++++ .../additiveFoam/interface/interfaceWrite.H | 22 +++++ .../heatSourceModel/heatSourceModel.C | 6 +- .../heatSourceModels/nLight/nLight.C | 31 +++++-- .../heatSourceModels/nLight/nLight.H | 5 +- .../movingHeatSourceModel.C | 2 +- 8 files changed, 174 insertions(+), 11 deletions(-) create mode 100644 applications/solvers/additiveFoam/interface/interface.H create mode 100644 applications/solvers/additiveFoam/interface/interfacePoints.H create mode 100644 applications/solvers/additiveFoam/interface/interfaceWrite.H diff --git a/applications/solvers/additiveFoam/additiveFoam.C b/applications/solvers/additiveFoam/additiveFoam.C index 5000591..b1afc92 100644 --- a/applications/solvers/additiveFoam/additiveFoam.C +++ b/applications/solvers/additiveFoam/additiveFoam.C @@ -42,6 +42,8 @@ Description #include "movingHeatSourceModel.H" #include "foamToExaCA/foamToExaCA.H" +#include "interface/interfacePoints.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) @@ -67,12 +69,16 @@ int main(int argc, char *argv[]) movingHeatSourceModel sources(mesh); + DynamicList> interfaceData; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { + volScalarField R("R", mag(fvc::ddt(T))); + #include "updateProperties.H" #include "readTimeControls.H" @@ -94,6 +100,8 @@ int main(int argc, char *argv[]) } #include "thermo/TEqn.H" + + #include "interface/interface.H" ExaCA.update(); @@ -104,6 +112,8 @@ int main(int argc, char *argv[]) << nl << endl; } + #include "interface/interfaceWrite.H" + ExaCA.write(); return 0; diff --git a/applications/solvers/additiveFoam/interface/interface.H b/applications/solvers/additiveFoam/interface/interface.H new file mode 100644 index 0000000..f30460d --- /dev/null +++ b/applications/solvers/additiveFoam/interface/interface.H @@ -0,0 +1,28 @@ +// write out interface dimensions +Info<< "interface span " << "(" << Tliq.value() << "): " + << interfacePoints(T, Tliq.value()) << endl; + +Info<< "interface span " << "(" << Tsol.value() << "): " + << interfacePoints(T, Tsol.value()) << endl; + +// write out the maximum temperature +Info<< "maximum temperature: " << gMax(T.internalField()) << endl; + +volScalarField G("G", mag(fvc::grad(T))); + +forAll(mesh.cells(), celli) +{ + if ( (T[celli] <= Tliq.value()) && (T.oldTime()[celli] > Tliq.value()) ) + { + const point pt = mesh.C()[celli]; + + interfaceData.append( + { + pt[0], + pt[1], + pt[2], + R[celli] / G[celli], + G[celli] + }); + } +} diff --git a/applications/solvers/additiveFoam/interface/interfacePoints.H b/applications/solvers/additiveFoam/interface/interfacePoints.H new file mode 100644 index 0000000..7bb42da --- /dev/null +++ b/applications/solvers/additiveFoam/interface/interfacePoints.H @@ -0,0 +1,81 @@ +vector interfacePoints(const volScalarField& field, const scalar& iso) +{ + const fvMesh& mesh = field.mesh(); + + // set local reference to mesh data + const labelUList& owner = mesh.owner(); + const labelUList& neighbour = mesh.neighbour(); + + const volVectorField& cc = mesh.C(); + + DynamicList positions(mesh.nFaces()); + + // check internal faces + for(label facei=0; facei < mesh.nInternalFaces(); facei++) + { + const label own = owner[facei]; + const label nei = neighbour[facei]; + + scalar minFace = min(field[own], field[nei]); + scalar maxFace = max(field[own], field[nei]); + + if ((minFace < iso) && (maxFace >= iso)) + { + vector d = cc[nei] - cc[own]; + vector p = cc[own] + d*(iso - field[own])/(field[nei] - field[own]); + positions.append(p); + } + } + + // check boundary faces + const volScalarField::Boundary& fieldBf = field.boundaryField(); + + forAll(fieldBf, patchi) + { + const fvPatchScalarField& fieldPf = fieldBf[patchi]; + + const labelUList& faceCells = fieldPf.patch().faceCells(); + + if (fieldPf.coupled()) + { + // processor boundary : interpolate across face + const vectorField ccn(cc.boundaryField()[patchi].patchNeighbourField()); + const scalarField fn(fieldPf.patchNeighbourField()); + + forAll(faceCells, facei) + { + label own = faceCells[facei]; + + scalar minFace = min(field[own], fn[facei]); + scalar maxFace = max(field[own], fn[facei]); + + if ((minFace < iso) && (maxFace >= iso)) + { + vector d = ccn[facei] - cc[own]; + vector p = cc[own] + d*(iso - field[own])/(fn[facei] - field[own]); + positions.append(p); + } + } + } + else + { + // physical boundary : take face centre in liquid + const vectorField fc(mesh.boundaryMesh()[patchi].faceCentres()); + const scalarField pif(fieldPf.patchInternalField()); + + forAll(fc, i) + { + if (pif[i] >= iso) + { + positions.append(fc[i]); + } + } + } + } + + positions.shrink(); + + boundBox isoBb(positions); + + return returnReduce(isoBb.span(), maxOp()); +} diff --git a/applications/solvers/additiveFoam/interface/interfaceWrite.H b/applications/solvers/additiveFoam/interface/interfaceWrite.H new file mode 100644 index 0000000..021d095 --- /dev/null +++ b/applications/solvers/additiveFoam/interface/interfaceWrite.H @@ -0,0 +1,22 @@ +const fileName interfacePath +( + runTime.rootPath()/runTime.globalCaseName()/"solidificationData" +); + +mkDir(interfacePath); + +OFstream os +( + interfacePath + "/" + "data_" + Foam::name(Pstream::myProcNo()) + ".csv" +); + +for(int i=0; i < interfaceData.size(); i++) +{ + int n = interfaceData[i].size()-1; + + for(int j=0; j < n; j++) + { + os << interfaceData[i][j] << ","; + } + os << interfaceData[i][n] << endl; +} diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C index 02a7d04..a9dad5d 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/heatSourceModel/heatSourceModel.C @@ -239,7 +239,7 @@ Foam::heatSourceModel::qDot() ); volScalarField& qDot_ = tqDot.ref(); - // sample gaussian distribution at desired resolution + // sample distribution at desired resolution const scalar power_ = movingBeam_->power(); if (power_ > small) @@ -247,7 +247,7 @@ Foam::heatSourceModel::qDot() const vector position_ = movingBeam_->position(); // udpate the absorbed power and heat source normalization term - const scalar aspectRatio = + const scalar aspectRatio = dimensions_.z() / min(dimensions_.x(), dimensions_.y()); dimensionedScalar absorbedPower @@ -275,7 +275,7 @@ Foam::heatSourceModel::qDot() ); const pointField& points = mesh_.points(); - + treeBoundBox beamBb ( position_ - 1.5*dimensions_, diff --git a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C index db4deef..2ec90d3 100644 --- a/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C +++ b/applications/solvers/additiveFoam/movingHeatSource/heatSourceModels/nLight/nLight.C @@ -55,19 +55,38 @@ Foam::heatSourceModels::nLight::nLight spotCoeffs_(heatSourceModelCoeffs_.optionalSubDict("spotCoeffs")), ringCoeffs_(heatSourceModelCoeffs_.optionalSubDict("ringCoeffs")) { - alpha_ = heatSourceModelCoeffs_.lookup("alpha"); + // Select parameters from specified mode + mode_ = heatSourceModelCoeffs_.lookup