├── .github
└── workflows
│ └── CI.yml
├── .gitignore
├── CHANGELOG.md
├── CITATION.bib
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── applications
├── solvers
│ └── additiveFoam
│ │ ├── Allwclean
│ │ ├── Allwmake
│ │ ├── Make
│ │ ├── files
│ │ └── options
│ │ ├── additiveFoam.C
│ │ ├── additiveFoamInfo.H
│ │ ├── createFields.H
│ │ ├── derivedFvPatchFields
│ │ ├── marangoni
│ │ │ ├── marangoniFvPatchVectorField.C
│ │ │ └── marangoniFvPatchVectorField.H
│ │ └── mixedTemperature
│ │ │ ├── mixedTemperatureFvPatchScalarField.C
│ │ │ └── mixedTemperatureFvPatchScalarField.H
│ │ ├── functionObjects
│ │ └── ExaCA
│ │ │ ├── ExaCA.C
│ │ │ ├── ExaCA.H
│ │ │ └── Make
│ │ │ ├── files
│ │ │ └── options
│ │ ├── interpolateXY
│ │ ├── interpolateXY.C
│ │ └── interpolateXY.H
│ │ ├── movingHeatSource
│ │ ├── Make
│ │ │ ├── files
│ │ │ └── options
│ │ ├── absorptionModels
│ │ │ ├── Kelly
│ │ │ │ ├── KellyAbsorption.C
│ │ │ │ └── KellyAbsorption.H
│ │ │ ├── absorptionModel
│ │ │ │ ├── absorptionModel.C
│ │ │ │ ├── absorptionModel.H
│ │ │ │ └── absorptionModelNew.C
│ │ │ └── constant
│ │ │ │ ├── constantAbsorption.C
│ │ │ │ └── constantAbsorption.H
│ │ ├── heatSourceModels
│ │ │ ├── heatSourceModel
│ │ │ │ ├── heatSourceModel.C
│ │ │ │ ├── heatSourceModel.H
│ │ │ │ └── heatSourceModelNew.C
│ │ │ ├── modifiedSuperGaussian
│ │ │ │ ├── modifiedSuperGaussian.C
│ │ │ │ └── modifiedSuperGaussian.H
│ │ │ └── superGaussian
│ │ │ │ ├── superGaussian.C
│ │ │ │ └── superGaussian.H
│ │ ├── movingBeam
│ │ │ ├── movingBeam.C
│ │ │ └── movingBeam.H
│ │ ├── movingHeatSourceModel
│ │ │ ├── movingHeatSourceModel.C
│ │ │ └── movingHeatSourceModel.H
│ │ └── segment
│ │ │ ├── segment.C
│ │ │ └── segment.H
│ │ ├── pU
│ │ ├── UEqn.H
│ │ └── pEqn.H
│ │ ├── readTransportProperties.H
│ │ ├── setDeltaT.H
│ │ ├── solutionControls.H
│ │ ├── thermo
│ │ ├── TEqn.H
│ │ ├── thermoScheme.H
│ │ └── thermoSource.H
│ │ └── updateProperties.H
└── utilities
│ ├── createScanPath
│ ├── Make
│ │ ├── files
│ │ └── options
│ ├── createFields.H
│ ├── createScanPath.C
│ └── createScanPathDict
│ └── multiLayer
│ ├── reconstructLayers
│ └── runLayers
└── tutorials
├── AMB2018-02-B
├── 0
│ ├── T
│ ├── U
│ ├── alpha.solid
│ └── p_rgh
├── Allclean
├── Allrun
├── ExaCA
│ └── input.json
├── constant
│ ├── g
│ ├── heatSourceDict
│ ├── scanPath
│ ├── thermoPath
│ └── transportProperties
└── system
│ ├── ExaCA
│ ├── blockMeshDict
│ ├── controlDict
│ ├── decomposeParDict
│ ├── fvSchemes
│ └── fvSolution
├── multiBeam
├── 0
│ ├── T
│ ├── U
│ ├── alpha.solid
│ └── p_rgh
├── Allclean
├── Allrun
├── ExaCA
│ └── input.json
├── constant
│ ├── g
│ ├── heatSourceDict
│ ├── scanPath_1
│ ├── scanPath_2
│ ├── thermoPath
│ └── transportProperties
└── system
│ ├── ExaCA
│ ├── blockMeshDict
│ ├── controlDict
│ ├── decomposeParDict
│ ├── fvSchemes
│ └── fvSolution
├── multiLayerPBF
├── 0
│ ├── T
│ ├── U
│ ├── alpha.powder
│ ├── alpha.solid
│ └── p_rgh
├── Allclean
├── Allrun
├── ExaCA
│ └── input.json
├── constant
│ ├── g
│ ├── heatSourceDict
│ ├── scanPath
│ ├── thermoPath
│ └── transportProperties
└── system
│ ├── ExaCA
│ ├── blockMeshDict
│ ├── controlDict
│ ├── decomposeParDict
│ ├── extrudeMeshDict
│ ├── fvSchemes
│ ├── fvSolution
│ ├── mapFieldsDict
│ └── setFieldsDict
└── verificationAndValidation
└── marangoni
├── 0
├── T
├── U
├── alpha.solid
└── p_rgh
├── Allclean
├── Allrun
├── constant
├── g
├── heatSourceDict
├── scanPath
├── thermoPath
└── transportProperties
└── system
├── blockMeshDict
├── controlDict
├── decomposeParDict
├── fvSchemes
└── fvSolution
/.github/workflows/CI.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches:
5 | - main
6 | pull_request:
7 | branches:
8 | - main
9 | concurrency:
10 | group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
11 | cancel-in-progress: ${{github.event_name == 'pull_request'}}
12 | jobs:
13 | CI:
14 | defaults:
15 | run:
16 | shell: bash -ileo pipefail {0}
17 | strategy:
18 | matrix:
19 | cxx: ['g++']
20 | cmake_build_type: ['Release']
21 |
22 | runs-on: ubuntu-latest
23 | container:
24 | image: docker.io/openfoam/openfoam10-paraview510
25 | options: --user root
26 | steps:
27 | - name: Checkout AdditiveFOAM
28 | uses: actions/checkout@v2
29 | - name: Build AdditiveFOAM
30 | run: |
31 | . /opt/openfoam10/etc/bashrc
32 | cd applications/solvers/additiveFoam
33 | ./Allwmake
34 | - name: Test AdditiveFOAM
35 | run: |
36 | . /opt/openfoam10/etc/bashrc
37 | cp -r tutorials/AMB2018-02-B userCase
38 | cd userCase
39 | # FIXME: use built-in "additiveFoam" smaller case when created
40 | blockMesh
41 | decomposePar
42 | mpirun -n 6 --oversubscribe --allow-run-as-root additiveFoam -parallel
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Editor and misc backup files - anywhere
2 | *~
3 | .*~
4 | .*.swp
5 | *.bak
6 | *.bak[0-9][0-9]
7 | \#*\#
8 |
9 | # File-browser settings - anywhere
10 | .directory
11 |
12 | # CVS recovered versions - anywhere
13 | .#*
14 |
15 | # Objects and archives - anywhere
16 | *.[oa]
17 | *.la
18 | *.so
19 |
20 | # Derived files
21 | lex.yy.c
22 |
23 | # Corefiles
24 | core
25 |
26 | # Dependency files - anywhere
27 | *.dep
28 |
29 | # lnInclude (symlink) directories - anywhere
30 | lnInclude
31 |
32 | # Build directories - anywhere
33 | linux*Clang*/
34 | linux*Gcc*/
35 | linux*Icc*/
36 | solaris*Gcc*/
37 | SunOS*Gcc*/
38 | platforms/
39 |
40 | # Source packages - anywhere
41 | *.tar.bz2
42 | *.tar.gz
43 | *.tar
44 | *.tgz
45 | *.gtgz
46 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Release 1.1
2 |
3 | ## Features
4 | - **CI setup** [\#4](https://github.com/ORNL/AdditiveFOAM/pull/4)
5 | - **Time-parallel event-based interpolation functionality for ExaCA** [\#14](https://github.com/ORNL/AdditiveFOAM/pull/14)
6 | - **Adaptive heat source integration using Riemann sum** [\#15](https://github.com/ORNL/AdditiveFOAM/pull/15)
7 | - **Utility for creating scan paths** [\#42](https://github.com/ORNL/AdditiveFOAM/pull/42)
8 | - **Function object for ExaCA with improved tutorials** [\#39](https://github.com/ORNL/AdditiveFOAM/pull/39)
9 |
10 | ## Improvements
11 | - **Added SPACK installation details in README** [\#13](https://github.com/ORNL/AdditiveFOAM/pull/13)
12 | - **Version and build info for tracking** [\#50](https://github.com/ORNL/AdditiveFOAM/pull/50) [\#54](https://github.com/ORNL/AdditiveFOAM/pull/54)
13 |
14 | ## Bug Fixes
15 | - **Corrected Marangoni patch evaluation to a slip condition and added tutorial** [\#11](https://github.com/ORNL/AdditiveFOAM/pull/11)
16 | - **Resolved explicit energy solve to only use forward Euler method** [\#37](https://github.com/ORNL/AdditiveFOAM/pull/37)
17 | - **Corrected the normalization factor V0 in the modifiedSuperGaussian heat source model** [\#20](https://github.com/ORNL/AdditiveFOAM/pull/20)
18 |
19 | ## Full Changelog
20 | For a complete list of changes, see the [full changelog](https://github.com/ORNL/AdditiveFOAM/compare/1.0.0...1.1.0).
21 |
22 |
23 | # Release 1.0
24 |
25 | Initial Release
26 |
--------------------------------------------------------------------------------
/CITATION.bib:
--------------------------------------------------------------------------------
1 | @article{Coleman2025,
2 | doi = {10.21105/joss.07770},
3 | url = {https://doi.org/10.21105/joss.07770},
4 | year = {2025},
5 | publisher = {The Open Journal},
6 | volume = {10},
7 | number = {109},
8 | pages = {7770},
9 | author = {John Coleman and Kellis Kincaid and Gerry L. Knapp and Benjamin Stump and Samuel Temple Reeve and Matt Rolchigo and Alex Plotkowski},
10 | title = {AdditiveFOAM: A Continuum Multiphysics Code for Additive Manufacturing},
11 | journal = {Journal of Open Source Software}
12 | }
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Contributing to AdditiveFOAM is easy: just open a
4 | [pull request](https://help.github.com/articles/using-pull-requests/).
5 | Make `main` the destination branch on the [AdditiveFOAM
6 | repository](https://github.com/ORNL/AdditiveFOAM) and allow edits from
7 | maintainers.
8 |
9 | Your pull request must work with all current AdditiveFOAM tutorial examples
10 | and be reviewed by at least one AdditiveFOAM developer.
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ---
4 | `AdditiveFOAM` is a free, open source heat and mass transfer software for simulations of Additive Manufacturing (AM) released by Oak Ridge National Laboratory. It is built upon OpenFOAM, a free, open source computational fluid dynamics (CFD) software package released by the OpenFOAM Foundation.
5 |
6 | ## Documentation
7 | [![Documentation Status][docs-badge]][docs-url]
8 |
9 | The documentation for `AdditiveFOAM` is hosted on [GitHub Pages](https://ornl.github.io/AdditiveFOAM/).
10 |
11 | ### Repository Features
12 | | Link | Description |
13 | |-----------------------------------------------------------|------------------------------------------|
14 | | [solver](applications/solvers/additiveFoam) | Development version of the solver |
15 | | [utilities](applications/utilities) | Utilities for post-processing and code wrappers |
16 | | [tutorials](tutorials) | Tutorial cases |
17 |
18 | ## Installation and Dependencies
19 | [](https://github.com/OpenFOAM/OpenFOAM-10)
20 |
21 | AdditiveFOAM is built on source code released by the OpenFOAM Foundation [openfoam.org](https://openfoam.org/), which is available in public [OpenFOAM repositories](https://github.com/OpenFOAM).
22 |
23 | [](https://github.com/spack/spack)
24 |
25 | The easiest way to install AdditiveFOAM is using [spack](https://spack.readthedocs.io/en/latest/):
26 | ```
27 | spack install additivefoam
28 | ```
29 |
30 | See the [installation instructions](https://ornl.github.io/AdditiveFOAM/docs/installation/#installation) in the [documentation](https://ornl.github.io/AdditiveFOAM/) for other options for building `AdditiveFOAM`.
31 |
32 | ## Citing
33 | [](https://doi.org/10.21105/joss.07770)
34 | [](https://doi.org/10.5281/zenodo.8034097)
35 |
36 | If you use AdditiveFOAM in your work, please cite the JOSS article and
37 | consider citing the Zenodo DOI for the version used.
38 |
39 | ## License
40 | [](https://www.gnu.org/licenses/gpl-3.0.html)
41 |
42 | AdditiveFOAM 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. See the file `LICENSE` in this directory or http://www.gnu.org/licenses/, for a description of the GNU General Public License terms under which you can copy the files.
43 |
44 | ## Contact
45 | For any questions, issues, or suggestions regarding AdditiveFOAM, you can reach out to the project maintainers through the GitHub repository's issue tracker or by contacting the development team directly.
46 |
47 | ## Contributing
48 |
49 | We encourage you to contribute to AdditiveFOAM! Please check the
50 | [guidelines](CONTRIBUTING.md) on how to do so.
51 |
52 | We appreciate your interest in AdditiveFOAM and look forward to your contributions!
53 |
54 | #### Contributors
55 | - [John Coleman](https://www.ornl.gov/staff-profile/john-s-coleman)
56 | - [Kellis Kincaid](https://www.ornl.gov/staff-profile/kellis-c-kincaid)
57 | - [Gerry L. Knapp](https://www.ornl.gov/staff-profile/gerald-l-knapp)
58 | - [Benjamin Stump](https://www.ornl.gov/staff-profile/benjamin-c-stump)
59 | - [Alex Plotkowski](https://www.ornl.gov/staff-profile/alex-j-plotkowski)
60 | - [Sam T. Reeve](https://www.ornl.gov/staff-profile/samuel-t-reeve)
61 | - [Matt Rolchigo](https://www.ornl.gov/staff-profile/matt-rolchigo)
62 |
63 | [docs-badge]: https://img.shields.io/badge/docs-latest-brightgreen.svg
64 | [docs-url]: https://ornl.github.io/AdditiveFOAM/
65 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/Allwclean:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cd ${0%/*} || exit 1 # Run from this directory
3 |
4 | rm -rf Make/gitInfo.H
5 |
6 | wclean libso functionObjects/ExaCA
7 | wclean libso movingHeatSource
8 | wclean
9 |
10 | #------------------------------------------------------------------------------
11 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/Allwmake:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cd ${0%/*} || exit 1 # Run from this directory
3 |
4 | # Parse arguments for library compilation
5 | . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
6 |
7 | #------------------------------------------------------------------------------
8 | # Generate header for git information
9 | HEADER_FILE="${0%/*}/Make/gitInfo.H"
10 | GIT_DESCRIBE=$(git describe --tags --always 2>/dev/null) || GIT_DESCRIBE="undefined"
11 | GIT_SHA1=$(git rev-parse HEAD 2>/dev/null) || GIT_SHA1="undefined"
12 |
13 | cat > "$HEADER_FILE" << EOF
14 | #ifndef gitInfo_H
15 | #define gitInfo_H
16 |
17 | // Git describe
18 | #define ADDITIVEFOAM_GIT_DESCRIBE "$GIT_DESCRIBE"
19 |
20 | // Git hash
21 | #define ADDITIVEFOAM_GIT_SHA1 "$GIT_SHA1"
22 |
23 | #endif
24 | EOF
25 |
26 | export ADDITIVEFOAM_BUILD_FLAGS="-DGIT_MODULE_ENABLED=1"
27 |
28 | #------------------------------------------------------------------------------
29 | # Build libraries and solver
30 | wmake $targetType functionObjects/ExaCA
31 | wmake $targetType movingHeatSource
32 | wmake $targetType
33 |
34 | #------------------------------------------------------------------------------
35 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/Make/files:
--------------------------------------------------------------------------------
1 | derivedFvPatchFields/mixedTemperature/mixedTemperatureFvPatchScalarField.C
2 | derivedFvPatchFields/marangoni/marangoniFvPatchVectorField.C
3 |
4 | additiveFoam.C
5 |
6 | EXE = $(FOAM_USER_APPBIN)/additiveFoam
7 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/Make/options:
--------------------------------------------------------------------------------
1 | EXE_INC = \
2 | $(ADDITIVEFOAM_BUILD_FLAGS) \
3 | -I. \
4 | -ImovingHeatSource/lnInclude \
5 | -I$(LIB_SRC)/finiteVolume/lnInclude \
6 | -I$(LIB_SRC)/meshTools/lnInclude \
7 | -I$(LIB_SRC)/randomProcesses/lnInclude
8 |
9 | EXE_LIBS = \
10 | -L$(FOAM_USER_LIBBIN) \
11 | -lmovingBeamModels \
12 | -lfiniteVolume \
13 | -lmeshTools \
14 | -lrandomProcesses
15 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/additiveFoam.C:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6 | \\/ M anipulation |
7 | -------------------------------------------------------------------------------
8 | Copyright (C) 2023 Oak Ridge National Laboratory
9 | -------------------------------------------------------------------------------
10 | License
11 | This file is part of OpenFOAM.
12 |
13 | OpenFOAM is free software: you can redistribute it and/or modify it
14 | under the terms of the GNU General Public License as published by
15 | the Free Software Foundation, either version 3 of the License, or
16 | (at your option) any later version.
17 |
18 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 | for more details.
22 |
23 | You should have received a copy of the GNU General Public License
24 | along with OpenFOAM. If not, see .
25 |
26 | Application
27 | additiveFoam
28 |
29 | Description
30 | A transient heat transfer and fluid flow solver for additive manufacturing
31 | simulations.
32 |
33 | \*---------------------------------------------------------------------------*/
34 | #include "additiveFoamInfo.H"
35 | #include "fvCFD.H"
36 | #include "pimpleControl.H"
37 | #include "graph.H"
38 | #include "Polynomial.H"
39 | #include "interpolateXY/interpolateXY.H"
40 | #include "movingHeatSourceModel.H"
41 | #include "EulerDdtScheme.H"
42 | #include "CrankNicolsonDdtScheme.H"
43 |
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 |
46 | int main(int argc, char *argv[])
47 | {
48 | #include "postProcess.H"
49 | #include "setRootCase.H"
50 | AdditiveFoamInfo::write();
51 | #include "createTime.H"
52 | #include "createMesh.H"
53 | #include "createControl.H"
54 | #include "createFields.H"
55 | #include "createTimeControls.H"
56 | #include "initContinuityErrs.H"
57 |
58 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 |
60 | scalar DiNum = 0.0;
61 | scalar alphaCoNum = 0.0;
62 | movingHeatSourceModel sources(mesh);
63 |
64 | Info<< "\nStarting time loop\n" << endl;
65 |
66 | while (runTime.run())
67 | {
68 | #include "updateProperties.H"
69 |
70 | #include "readTimeControls.H"
71 | #include "CourantNo.H"
72 | #include "setDeltaT.H"
73 |
74 | sources.update();
75 |
76 | runTime++;
77 |
78 | Info<< "Time = " << runTime.timeName() << nl << endl;
79 |
80 | #include "solutionControls.H"
81 |
82 | while (pimple.loop() && fluidInDomain)
83 | {
84 | #include "pU/UEqn.H"
85 | #include "pU/pEqn.H"
86 | }
87 |
88 | #include "thermo/TEqn.H"
89 |
90 | runTime.write();
91 |
92 | Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
93 | << " ClockTime = " << runTime.elapsedClockTime() << " s"
94 | << nl << endl;
95 | }
96 |
97 | return 0;
98 | }
99 |
100 | // ************************************************************************* //
101 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/additiveFoamInfo.H:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 | -------------------------------------------------------------------------------
3 | Copyright (C) 2023 Oak Ridge National Laboratory
4 | -------------------------------------------------------------------------------
5 |
6 | Class
7 | Foam::AdditiveFoamInfo
8 |
9 | Description
10 | Outputs version and build information for AdditiveFOAM.
11 |
12 | \*---------------------------------------------------------------------------*/
13 |
14 | #ifndef AdditiveFoamInfo_H
15 | #define AdditiveFoamInfo_H
16 |
17 | #include "OSspecific.H"
18 |
19 | #ifdef GIT_MODULE_ENABLED
20 | #include "Make/gitInfo.H"
21 | #endif
22 |
23 | // Static version
24 | #define ADDITIVEFOAM_VERSION "1.2.0-dev"
25 |
26 | namespace Foam
27 | {
28 |
29 | class AdditiveFoamInfo
30 | {
31 | public:
32 |
33 | //- Disallow default construction, copy, assignment, and destruction
34 | AdditiveFoamInfo() = delete;
35 | ~AdditiveFoamInfo() = delete;
36 | AdditiveFoamInfo(const AdditiveFoamInfo&) = delete;
37 | AdditiveFoamInfo& operator=(const AdditiveFoamInfo&) = delete;
38 |
39 | //- Print version/build information to Info stream
40 | static void write()
41 | {
42 | Info<< "AdditiveFOAM Information:" << nl;
43 | Info<< "Version: " << ADDITIVEFOAM_VERSION << nl;
44 |
45 | //- Print git describe and SHA1 (optional)
46 | #ifdef ADDITIVEFOAM_GIT_DESCRIBE
47 | Info<< "Build: " << ADDITIVEFOAM_GIT_DESCRIBE << nl;
48 | #endif
49 |
50 | #ifdef ADDITIVEFOAM_GIT_SHA1
51 | Info<< "Git SHA1: " << ADDITIVEFOAM_GIT_SHA1 << nl;
52 | #endif
53 |
54 | Info<< endl;
55 | }
56 | };
57 |
58 | } // End namespace Foam
59 |
60 | #endif
61 |
62 | // ************************************************************************* //
63 |
64 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/createFields.H:
--------------------------------------------------------------------------------
1 | Info<< "Reading field T\n" << endl;
2 | volScalarField T
3 | (
4 | IOobject
5 | (
6 | "T",
7 | runTime.timeName(),
8 | mesh,
9 | IOobject::MUST_READ,
10 | IOobject::AUTO_WRITE
11 | ),
12 | mesh
13 | );
14 |
15 | Info<< "Setting auxiliary fields for solidification model\n" << endl;
16 | volScalarField alpha3
17 | (
18 | IOobject
19 | (
20 | IOobject::groupName("alpha", "powder"),
21 | runTime.timeName(),
22 | mesh,
23 | IOobject::READ_IF_PRESENT,
24 | IOobject::AUTO_WRITE
25 | ),
26 | mesh,
27 | dimensionedScalar("alpha.powder", dimless, 0.0),
28 | zeroGradientFvPatchScalarField::typeName
29 | );
30 |
31 | volScalarField alpha1
32 | (
33 | IOobject
34 | (
35 | IOobject::groupName("alpha", "solid"),
36 | runTime.timeName(),
37 | mesh,
38 | IOobject::NO_READ,
39 | IOobject::NO_WRITE
40 | ),
41 | mesh,
42 | dimensionedScalar("alpha.solid", dimless, 0.0),
43 | zeroGradientFvPatchScalarField::typeName
44 | );
45 |
46 | IFstream thermoFile(runTime.constant()/"thermoPath");
47 |
48 | graph thermo
49 | (
50 | "thermo",
51 | "T",
52 | "alpha1",
53 | thermoFile
54 | );
55 |
56 | dimensionedScalar Tliq
57 | (
58 | "Tliq",
59 | dimTemperature,
60 | interpolateXY(0.0, thermo.y(), thermo.x())
61 | );
62 |
63 | dimensionedScalar Tsol
64 | (
65 | "Tsol",
66 | dimTemperature,
67 | interpolateXY(1.0, thermo.y(), thermo.x())
68 | );
69 |
70 | // set solid fraction field consistent with temperature
71 | forAll(mesh.cells(), cellI)
72 | {
73 | scalar alpha1_ = interpolateXY(T[cellI], thermo.x(), thermo.y());
74 | alpha1[cellI] = min(max(alpha1_, 0.0), 1.0);
75 | }
76 |
77 | alpha1.correctBoundaryConditions();
78 |
79 | #include "readTransportProperties.H"
80 |
81 | volScalarField Cp
82 | (
83 | IOobject
84 | (
85 | "Cp",
86 | runTime.timeName(),
87 | mesh,
88 | IOobject::NO_READ,
89 | IOobject::NO_WRITE
90 | ),
91 | mesh,
92 | dimensionedScalar("Cp", dimensionSet(0, 2, -2, -1, 0), 0.0),
93 | zeroGradientFvPatchScalarField::typeName
94 | );
95 |
96 | volScalarField kappa
97 | (
98 | IOobject
99 | (
100 | "kappa",
101 | runTime.timeName(),
102 | mesh
103 | ),
104 | mesh,
105 | dimensionedScalar("kappa", dimensionSet(1, 1, -3, -1, 0), 0.0),
106 | zeroGradientFvPatchScalarField::typeName
107 | );
108 |
109 | #include "updateProperties.H"
110 |
111 | Info<< "Reading field p_rgh\n" << endl;
112 | volScalarField p_rgh
113 | (
114 | IOobject
115 | (
116 | "p_rgh",
117 | runTime.timeName(),
118 | mesh,
119 | IOobject::READ_IF_PRESENT,
120 | IOobject::NO_WRITE
121 | ),
122 | mesh,
123 | dimensionedScalar("p_rgh", dimensionSet(0, 2, -2, 0, 0), 0)
124 | );
125 |
126 | Info<< "Reading field U\n" << endl;
127 | volVectorField U
128 | (
129 | IOobject
130 | (
131 | "U",
132 | runTime.timeName(),
133 | mesh,
134 | IOobject::READ_IF_PRESENT,
135 | IOobject::AUTO_WRITE
136 | ),
137 | mesh,
138 | dimensionedVector("U", dimVelocity, Zero)
139 | );
140 |
141 | #include "createPhi.H"
142 |
143 | volScalarField rhok
144 | (
145 | IOobject
146 | (
147 | "rhok",
148 | runTime.timeName(),
149 | mesh
150 | ),
151 | 1.0 - beta*(T - Tliq)
152 | );
153 |
154 | #include "readGravitationalAcceleration.H"
155 | #include "readhRef.H"
156 | #include "gh.H"
157 |
158 | volScalarField p
159 | (
160 | IOobject
161 | (
162 | "p",
163 | runTime.timeName(),
164 | mesh,
165 | IOobject::NO_READ,
166 | IOobject::NO_WRITE
167 | ),
168 | p_rgh + rhok*gh
169 | );
170 |
171 | label pRefCell = 0;
172 | scalar pRefValue = 0.0;
173 | setRefCell
174 | (
175 | p,
176 | p_rgh,
177 | pimple.dict(),
178 | pRefCell,
179 | pRefValue
180 | );
181 |
182 | if (p_rgh.needReference())
183 | {
184 | p += dimensionedScalar
185 | (
186 | "p",
187 | p.dimensions(),
188 | pRefValue - getRefCellValue(p, pRefCell)
189 | );
190 | }
191 |
192 | mesh.schemes().setFluxRequired(p_rgh.name());
193 |
194 | #include "createMRF.H"
195 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/derivedFvPatchFields/marangoni/marangoniFvPatchVectorField.H:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6 | \\/ M anipulation |
7 | -------------------------------------------------------------------------------
8 | Copyright (C) 2023 Oak Ridge National Laboratory
9 | -------------------------------------------------------------------------------
10 | License
11 | This file is part of OpenFOAM.
12 |
13 | OpenFOAM is free software: you can redistribute it and/or modify it
14 | under the terms of the GNU General Public License as published by
15 | the Free Software Foundation, either version 3 of the License, or
16 | (at your option) any later version.
17 |
18 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 | for more details.
22 |
23 | You should have received a copy of the GNU General Public License
24 | along with OpenFOAM. If not, see .
25 |
26 | Class
27 | marangoniFvPatchVectorField
28 |
29 | Description
30 |
31 | SourceFiles
32 | marangoniFvPatchVectorField.C
33 |
34 | \*---------------------------------------------------------------------------*/
35 |
36 | #ifndef BC_H
37 | #define BC_H
38 |
39 | #include "fvPatchFields.H"
40 | #include "transformFvPatchFields.H"
41 |
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 |
44 | namespace Foam
45 | {
46 |
47 | /*---------------------------------------------------------------------------*\
48 | Class marangoniFvPatchVectorField Declaration
49 | \*---------------------------------------------------------------------------*/
50 |
51 | class marangoniFvPatchVectorField
52 | :
53 | public transformFvPatchVectorField
54 | {
55 | // Private Data
56 |
57 | //- slope of surface tension w.r.t. temperature
58 | scalar dSigmadT_;
59 |
60 | //- maximum temperature used in surface tension calculation (optional)
61 | scalar Tmax_;
62 |
63 | public:
64 |
65 | //- Runtime type information
66 | TypeName("marangoni");
67 |
68 |
69 | // Constructors
70 |
71 | //- Construct from patch and internal field
72 | marangoniFvPatchVectorField
73 | (
74 | const fvPatch&,
75 | const DimensionedField&
76 | );
77 |
78 | //- Construct from patch, internal field and dictionary
79 | marangoniFvPatchVectorField
80 | (
81 | const fvPatch&,
82 | const DimensionedField&,
83 | const dictionary&
84 | );
85 |
86 | //- Construct by mapping given mixedTypeFvPatchField
87 | // onto a new patch
88 | marangoniFvPatchVectorField
89 | (
90 | const marangoniFvPatchVectorField&,
91 | const fvPatch&,
92 | const DimensionedField&,
93 | const fvPatchFieldMapper&
94 | );
95 |
96 | //- Disallow copy without setting internal field reference
97 | marangoniFvPatchVectorField
98 | (
99 | const marangoniFvPatchVectorField&
100 | ) = delete;
101 |
102 | //- Copy constructor setting internal field reference
103 | marangoniFvPatchVectorField
104 | (
105 | const marangoniFvPatchVectorField&,
106 | const DimensionedField&
107 | );
108 |
109 | //- Construct and return a clone setting internal field reference
110 | virtual tmp clone
111 | (
112 | const DimensionedField& iF
113 | ) const
114 | {
115 | return tmp
116 | (
117 | new marangoniFvPatchVectorField(*this, iF)
118 | );
119 | }
120 |
121 |
122 | // Member Functions
123 |
124 | // Mapping functions
125 |
126 | //- Map (and resize as needed) from self given a mapping object
127 | // Used to update fields following mesh topology change
128 | virtual void autoMap(const fvPatchFieldMapper&);
129 |
130 | //- Reverse map the given fvPatchField onto this fvPatchField
131 | // Used to reconstruct fields
132 | virtual void rmap(const fvPatchVectorField&, const labelList&);
133 |
134 | //- Reset the fvPatchField to the given fvPatchField
135 | // Used for mesh to mesh mapping
136 | virtual void reset(const fvPatchVectorField&);
137 |
138 |
139 | // Evaluation functions
140 |
141 | //- Return gradient at boundary
142 | virtual tmp snGrad() const;
143 |
144 | //- Evaluate the patch field
145 | virtual void evaluate
146 | (
147 | const Pstream::commsTypes commsType =
148 | Pstream::commsTypes::blocking
149 | );
150 |
151 | //- Return face-gradient transform diagonal
152 | virtual tmp snGradTransformDiag() const;
153 |
154 | //- Write
155 | virtual void write(Ostream&) const;
156 | };
157 |
158 |
159 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 |
161 | } // End namespace Foam
162 |
163 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 |
165 |
166 | #endif
167 |
168 | // ************************************************************************* //
169 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/derivedFvPatchFields/mixedTemperature/mixedTemperatureFvPatchScalarField.H:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6 | \\/ M anipulation |
7 | -------------------------------------------------------------------------------
8 | Copyright (C) 2023 Oak Ridge National Laboratory
9 | -------------------------------------------------------------------------------
10 | License
11 | This file is part of OpenFOAM.
12 |
13 | OpenFOAM is free software: you can redistribute it and/or modify it
14 | under the terms of the GNU General Public License as published by
15 | the Free Software Foundation, either version 3 of the License, or
16 | (at your option) any later version.
17 |
18 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 | for more details.
22 |
23 | You should have received a copy of the GNU General Public License
24 | along with OpenFOAM. If not, see .
25 |
26 | Class
27 | Foam::mixedTemperatureFvPatchScalarField
28 |
29 | Description
30 | This boundary condition provides a mixedTemperature condition,
31 | calculated as:
32 |
33 | SourceFiles
34 | mixedTemperatureFvPatchScalarField.C
35 |
36 | SourceFiles
37 | mixedTemperatureFvPatchScalarField.C
38 |
39 | \*---------------------------------------------------------------------------*/
40 |
41 |
42 | #ifndef BC_H
43 | #define BC_H
44 |
45 | #include "mixedFvPatchFields.H"
46 | #include "Function1.H"
47 |
48 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 |
50 | namespace Foam
51 | {
52 |
53 | /*---------------------------------------------------------------------------*\
54 | Class mixedTemperatureFvPatchScalarField Declaration
55 | \*---------------------------------------------------------------------------*/
56 |
57 | class mixedTemperatureFvPatchScalarField
58 | :
59 | public mixedFvPatchScalarField
60 | {
61 | // Private Data
62 |
63 | //- convective heat transfer coefficient [W/m^2/k]
64 | scalar h_;
65 |
66 | //- effective emissivity of the boundary
67 | scalar emissivity_;
68 |
69 | //- ambient temperature
70 | scalarField Tinf_;
71 |
72 |
73 | public:
74 |
75 | //- Runtime type information
76 | TypeName("mixedTemperature");
77 |
78 |
79 | // Constructors
80 |
81 | //- Construct from patch and internal field
82 | mixedTemperatureFvPatchScalarField
83 | (
84 | const fvPatch&,
85 | const DimensionedField&
86 | );
87 |
88 | //- Construct from patch, internal field and dictionary
89 | mixedTemperatureFvPatchScalarField
90 | (
91 | const fvPatch&,
92 | const DimensionedField&,
93 | const dictionary&
94 | );
95 |
96 | //- Construct by mapping given mixedTypeFvPatchField
97 | // onto a new patch
98 | mixedTemperatureFvPatchScalarField
99 | (
100 | const mixedTemperatureFvPatchScalarField&,
101 | const fvPatch&,
102 | const DimensionedField&,
103 | const fvPatchFieldMapper&
104 | );
105 |
106 | //- Disallow copy without setting internal field reference
107 | mixedTemperatureFvPatchScalarField
108 | (
109 | const mixedTemperatureFvPatchScalarField&
110 | ) = delete;
111 |
112 | //- Copy constructor setting internal field reference
113 | mixedTemperatureFvPatchScalarField
114 | (
115 | const mixedTemperatureFvPatchScalarField&,
116 | const DimensionedField&
117 | );
118 |
119 | //- Construct and return a clone setting internal field reference
120 | virtual tmp clone
121 | (
122 | const DimensionedField& iF
123 | ) const
124 | {
125 | return tmp
126 | (
127 | new mixedTemperatureFvPatchScalarField
128 | (
129 | *this,
130 | iF
131 | )
132 | );
133 | }
134 |
135 |
136 | // Member Functions
137 |
138 | // Mapping functions
139 |
140 | //- Map (and resize as needed) from self given a mapping object
141 | // Used to update fields following mesh topology change
142 | virtual void autoMap(const fvPatchFieldMapper&);
143 |
144 | //- Reverse map the given fvPatchField onto this fvPatchField
145 | // Used to reconstruct fields
146 | virtual void rmap(const fvPatchScalarField&, const labelList&);
147 |
148 | //- Reset the fvPatchField to the given fvPatchField
149 | // Used for mesh to mesh mapping
150 | virtual void reset(const fvPatchScalarField&);
151 |
152 |
153 | // Evaluation functions
154 |
155 | //- Update the coefficients associated with the patch field
156 | virtual void updateCoeffs();
157 |
158 |
159 | //- Write
160 | virtual void write(Ostream&) const;
161 | };
162 |
163 |
164 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 |
166 | } // End namespace Foam
167 |
168 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 |
170 |
171 | #endif
172 |
173 | // ************************************************************************* //
174 |
--------------------------------------------------------------------------------
/applications/solvers/additiveFoam/functionObjects/ExaCA/ExaCA.H:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 | ========= |
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 | \\ / O peration | Website: https://openfoam.org
5 | \\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
6 | \\/ M anipulation |
7 | -------------------------------------------------------------------------------
8 | Copyright (C) 2023 Oak Ridge National Laboratory
9 | -------------------------------------------------------------------------------
10 | License
11 | This file is part of OpenFOAM.
12 |
13 | OpenFOAM is free software: you can redistribute it and/or modify it
14 | under the terms of the GNU General Public License as published by
15 | the Free Software Foundation, either version 3 of the License, or
16 | (at your option) any later version.
17 |
18 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 | for more details.
22 |
23 | You should have received a copy of the GNU General Public License
24 | along with OpenFOAM. If not, see .
25 |
26 | Class
27 | Foam::functionObjects::ExaCA
28 |
29 | SourceFiles
30 | ExaCA.C
31 |
32 | \*---------------------------------------------------------------------------*/
33 |
34 | #ifndef ExaCA_H
35 | #define ExaCA_H
36 |
37 | #include "fvMeshFunctionObject.H"
38 | #include "volPointInterpolation.H"
39 | #include "meshSearch.H"
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 |
42 | namespace Foam
43 | {
44 | namespace functionObjects
45 | {
46 |
47 | /*---------------------------------------------------------------------------*\
48 | Class ExaCA Declaration
49 | \*---------------------------------------------------------------------------*/
50 |
51 | class ExaCA
52 | :
53 | public fvMeshFunctionObject
54 | {
55 | // Private Data
56 |
57 | const volScalarField& T_;
58 |
59 | volPointInterpolation vpi_;
60 |
61 | mutable pointScalarField Tp_;
62 |
63 | DynamicList