Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c77d063
ported to OpenFOAM-13. Function Objects not yet supported.
colemanjs Apr 30, 2026
24a3480
WIP V2.0 refinement model (#92)
colemanjs May 20, 2026
c39cd1e
V2.0 refinement model (#94)
colemanjs Jun 2, 2026
7cdb8b0
Add nLight AFX heat source model
colemanjs Jun 2, 2026
5de83fe
Add tabulated heat source tutorial
colemanjs Jun 2, 2026
ee225ee
Added README.md for nLight tutorial to help users understand usage an…
colemanjs Jun 2, 2026
c7b047d
fix and add tutorials readme
colemanjs Jun 2, 2026
2c6ea65
Function Objects for Dynamic Meshing. Note that the current ExaCA fun…
colemanjs Jun 4, 2026
ea0f2c9
This pre-commit setup enforces the mechanical subset of the OpenFOAM …
colemanjs Jun 4, 2026
0af77f3
fixup for CI using OpenFOAM-13
colemanjs Jun 4, 2026
a6440cf
fixup CI for OpenFOAM-13
colemanjs Jun 4, 2026
61f4c9f
fix type in CI for OpenFOAM-13
colemanjs Jun 4, 2026
9f107ac
clean up CI for OpenFOAM-13
colemanjs Jun 4, 2026
a6a65e5
dynamic mesh refinement and distributor cleaned in tutorials
colemanjs Jun 5, 2026
a76821c
Corrected consistent pressure field reference. However, I am still no…
colemanjs Jun 5, 2026
8aa37f9
clean up tutorials with consistent formatting
colemanjs Jun 5, 2026
842aab7
moved verification and validation to tests
colemanjs Jun 5, 2026
2dbe1c6
clean up includes and source file headers
colemanjs Jun 8, 2026
bad23f0
updated OpenFOAM version to in tutorial headers. This should be made…
colemanjs Jun 8, 2026
6d44c1d
Update ORNL copyright for v2.0.0 (#96)
colemanjs Jun 8, 2026
09b5b06
update heatSourceDict
colemanjs Jun 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
Language: Cpp
BasedOnStyle: LLVM

ColumnLimit: 80
IndentWidth: 4
ContinuationIndentWidth: 4
TabWidth: 4
UseTab: Never

# OpenFOAM-style brace placement.
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

# if (...), for (...), while (...), switch (...)
# but:
# forAll(...), not forAll (...)
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: false
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterIfMacros: false
AfterOverloadedOperator: false
AfterPlacementOperator: false

ForEachMacros:
- forAll
- forAllReverse
- forAllIter
- forAllConstIter
- forAllIters
- forAllConstIters

DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Left

SortIncludes:
Enabled: false
ReflowComments: Never
FixNamespaceComments: false

BreakBeforeBinaryOperators: NonAssignment
AlignOperands: AlignAfterOperator
...
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ jobs:

runs-on: ubuntu-latest
container:
image: docker.io/openfoam/openfoam10-paraview510
image: microfluidica/openfoam:13
options: --user root
steps:
- name: Checkout AdditiveFOAM
uses: actions/checkout@v2
- name: Build AdditiveFOAM
run: |
. /opt/openfoam10/etc/bashrc
. /opt/openfoam13/etc/bashrc || true
test -n "$WM_PROJECT_DIR"
./Allwmake
- name: Test AdditiveFOAM
run: |
. /opt/openfoam10/etc/bashrc
. /opt/openfoam13/etc/bashrc || true
cp -r tutorials/AMB2018-02-B userCase
cd userCase
# FIXME: use built-in "additiveFoam" smaller case when created
blockMesh
decomposePar
mpirun -n 6 --oversubscribe --allow-run-as-root additiveFoam -parallel
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
minimum_pre_commit_version: "3.7.0"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
files: &openfoam_cpp_files '\.(C|H|I|cc|cpp|cxx|hh|hpp|hxx)$'
exclude: &openfoam_excludes '(^|/)(lnInclude|ThirdParty|platforms|build|processor[0-9]+|postProcessing)/'

- id: end-of-file-fixer
files: *openfoam_cpp_files
exclude: *openfoam_excludes

- id: mixed-line-ending
args: [--fix=lf]
files: *openfoam_cpp_files
exclude: *openfoam_excludes

- id: check-merge-conflict

- id: check-yaml

- repo: local
hooks:
- id: openfoam-no-tabs
name: "OpenFOAM style: no tabs"
language: pygrep
entry: '\t'
files: *openfoam_cpp_files
exclude: *openfoam_excludes

# [Manual]: Fixing long C++ lines usually requires judgment.
- id: openfoam-max-80-columns
name: "OpenFOAM style: max 80 characters"
language: pygrep
entry: '^.{81,}$'
files: *openfoam_cpp_files
exclude: *openfoam_excludes
stages: [manual]

- id: openfoam-space-after-control-keyword
name: "OpenFOAM style: use if (...), for (...), while (...), switch (...)"
language: pygrep
entry: '^(?!\s*#).*\b(if|for|while|switch)\('
files: *openfoam_cpp_files
exclude: *openfoam_excludes

- id: openfoam-forall-no-space
name: "OpenFOAM style: use forAll(...), not forAll (...)"
language: pygrep
entry: '\b(forAll|forAllReverse|forAllIter|forAllConstIter|forAllIters|forAllConstIters)\s+\('
files: *openfoam_cpp_files
exclude: *openfoam_excludes

# [Manual]: clang-format is useful as a helper, but it cannot exactly
# represent OpenFOAM stream/math/operator spacing conventions.
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.5
hooks:
- id: clang-format
name: "clang-format: approximate OpenFOAM style, requires manual changes"
args: [--style=file]
files: *openfoam_cpp_files
exclude: *openfoam_excludes
stages: [manual]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The documentation for `AdditiveFOAM` is hosted on [GitHub Pages](https://ornl.gi
| [tutorials](tutorials) | Tutorial cases |

## Installation and Dependencies
[![OpenFOAM-10](https://img.shields.io/badge/OpenFOAM-10-blue.svg)](https://github.com/OpenFOAM/OpenFOAM-10)
[![OpenFOAM-13](https://img.shields.io/badge/OpenFOAM-13-blue.svg)](https://github.com/OpenFOAM/OpenFOAM-13)

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).

Expand Down
1 change: 1 addition & 0 deletions applications/solvers/additiveFoam/Allwclean
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
rm -rf Make/gitInfo.H

wclean libso functionObjects
wmake libso utilities
wclean libso movingHeatSource
wclean

Expand Down
1 change: 1 addition & 0 deletions applications/solvers/additiveFoam/Allwmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export ADDITIVEFOAM_BUILD_FLAGS="-DGIT_MODULE_ENABLED=1"
#------------------------------------------------------------------------------
# Build libraries and solver
wmake $targetType functionObjects
wmake $targetType utilities
wmake $targetType movingHeatSource
wmake $targetType

Expand Down
2 changes: 2 additions & 0 deletions applications/solvers/additiveFoam/Make/options
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ EXE_INC = \
$(ADDITIVEFOAM_BUILD_FLAGS) \
-I. \
-ImovingHeatSource/lnInclude \
-Iutilities/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/randomProcesses/lnInclude

EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-lmovingBeamModels \
-ladditiveFoamUtilities \
-lfiniteVolume \
-lmeshTools \
-lrandomProcesses
70 changes: 50 additions & 20 deletions applications/solvers/additiveFoam/additiveFoam.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 Oak Ridge National Laboratory
Copyright (C) 2023-2026 Oak Ridge National Laboratory
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
Expand All @@ -29,34 +29,57 @@ Application
Description
A transient heat transfer and fluid flow solver for additive manufacturing
simulations.

\*---------------------------------------------------------------------------*/
#include "additiveFoamInfo.H"
#include "fvCFD.H"

#include "argList.H"
#include "timeSelector.H"
#include "zeroGradientFvPatchFields.H"
#include "IFstream.H"
#include "uniformDimensionedFields.H"
#include "pressureReference.H"
#include "findRefCell.H"

#include "fvmDiv.H"
#include "fvmDdt.H"
#include "fvcSurfaceIntegrate.H"
#include "fvcVolumeIntegrate.H"
#include "fvmLaplacian.H"
#include "constrainPressure.H"
#include "constrainHbyA.H"
#include "adjustPhi.H"
#include "pimpleControl.H"
#include "graph.H"
#include "fvCorrectPhi.H"
#include "Polynomial.H"
#include "interpolateXY/interpolateXY.H"
#include "movingHeatSourceModel.H"

#include "EulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"

#include "additiveFoamInfo.H"
#include "movingHeatSourceModel.H"
#include "graph.H"
#include "interpolateXY.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "postProcess.H"
{
using namespace Foam;

#include "postProcess.H"
#include "setRootCase.H"

AdditiveFoamInfo::write();

#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createTimeControls.H"
#include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Initialize time-stepping controls
scalar DiNum = 0.0;
scalar alphaCoNum = 0.0;
movingHeatSourceModel sources(mesh);
Expand All @@ -67,26 +90,33 @@ int main(int argc, char *argv[])
{
#include "updateProperties.H"

#include "readTimeControls.H"
#include "readDyMControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"

sources.update();


mesh.update();

runTime++;

Info<< "Time = " << runTime.timeName() << nl << endl;
Info<< "Time = " << runTime.name() << nl << endl;

#include "solutionControls.H"
while (pimple.loop() && fluidInDomain)

while (pimple.loop())
{
#include "pU/UEqn.H"
#include "pU/pEqn.H"
#include "moveMesh.H"

if (fluidInDomain)
{
#include "pU/UEqn.H"
#include "pU/pEqn.H"
}
}

#include "thermo/TEqn.H"

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
Expand Down
5 changes: 2 additions & 3 deletions applications/solvers/additiveFoam/additiveFoamInfo.H
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------*\
-------------------------------------------------------------------------------
Copyright (C) 2023 Oak Ridge National Laboratory
Copyright (C) 2023 Oak Ridge National Laboratory
-------------------------------------------------------------------------------
Class
Expand All @@ -21,7 +21,7 @@ Description
#endif

// Static version
#define ADDITIVEFOAM_VERSION "1.2.0-dev"
#define ADDITIVEFOAM_VERSION "2.0.0-dev"

namespace Foam
{
Expand Down Expand Up @@ -60,4 +60,3 @@ public:
#endif

// ************************************************************************* //

Loading
Loading