-
Notifications
You must be signed in to change notification settings - Fork 11
Projected gaussian source #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
colemanjs
wants to merge
6
commits into
main
Choose a base branch
from
projectedGaussianSource
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d5c751a
projectedGaussian heat source for improved dynamic heat source modeling
colemanjs b4529cd
added calibrated SS316L Myna template
colemanjs b7ce274
added calibrated SS316L Myna template
colemanjs 5313755
Update fvSolution for fluid flow in calibrated template
colemanjs 1d05885
Merge remote-tracking branch 'origin/main' into projectedGaussianSource
colemanjs f2e790b
cleanup
colemanjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
...vers/additiveFoam/movingHeatSource/heatSourceModels/projectedGaussian/projectedGaussian.C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / 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 <http://www.gnu.org/licenses/>. | ||
|
||
\*---------------------------------------------------------------------------*/ | ||
|
||
#include "projectedGaussian.H" | ||
#include "addToRunTimeSelectionTable.H" | ||
|
||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
namespace heatSourceModels | ||
{ | ||
defineTypeNameAndDebug(projectedGaussian, 0); | ||
addToRunTimeSelectionTable(heatSourceModel, projectedGaussian, dictionary); | ||
} | ||
} | ||
|
||
using Foam::constant::mathematical::pi; | ||
|
||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
|
||
Foam::heatSourceModels::projectedGaussian::projectedGaussian | ||
( | ||
const word& sourceName, | ||
const dictionary& dict, | ||
const fvMesh& mesh | ||
) | ||
: | ||
heatSourceModel(typeName, sourceName, dict, mesh), | ||
mesh_(mesh) | ||
{ | ||
A_ = heatSourceModelCoeffs_.lookup<scalar>("A"); | ||
B_ = heatSourceModelCoeffs_.lookup<scalar>("B"); | ||
|
||
// set initial shape function | ||
const scalar x_ = | ||
max | ||
( | ||
dimensions_.z() | ||
/ min(staticDimensions_.x(), staticDimensions_.y()), | ||
1.0 | ||
); | ||
const scalar n_ = min(max(A_*std::log2(x_) + B_, 0.0), 9.0); | ||
k_ = std::pow(2.0, n_); | ||
} | ||
|
||
|
||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
|
||
inline Foam::scalar | ||
Foam::heatSourceModels::projectedGaussian::weight(const vector& d) | ||
{ | ||
const scalar f_ = | ||
std::exp | ||
( | ||
-2.0 | ||
* ( | ||
Foam::sqr(d.x() / dimensions_.x()) | ||
+ Foam::sqr(d.y() / dimensions_.y()) | ||
) | ||
); | ||
|
||
const scalar s_ = | ||
std::exp(-3.0 * std::pow(mag(mag(d.z()) / dimensions_.z()), k_)); | ||
|
||
return f_ * s_; | ||
} | ||
|
||
inline Foam::dimensionedScalar | ||
Foam::heatSourceModels::projectedGaussian::V0() | ||
{ | ||
const scalar x_ = | ||
max | ||
( | ||
dimensions_.z() | ||
/ min(staticDimensions_.x(), staticDimensions_.y()), | ||
1.0 | ||
); | ||
|
||
const scalar n_ = min(max(A_*std::log2(x_) + B_, 0.0), 9.0); | ||
|
||
k_ = std::pow(2.0, n_); | ||
|
||
const dimensionedScalar V0 | ||
( | ||
"V0", | ||
dimVolume, | ||
0.5 * pi * dimensions_.x() * dimensions_.y() * dimensions_.z() | ||
* Foam::tgamma(1.0 / k_) | ||
/ ( k_ * std::pow(3.0, 1.0 / k_) ) | ||
); | ||
|
||
return V0; | ||
} | ||
|
||
bool Foam::heatSourceModels::projectedGaussian::read() | ||
{ | ||
if (heatSourceModel::read()) | ||
{ | ||
heatSourceModelCoeffs_ = optionalSubDict(type() + "Coeffs"); | ||
|
||
//- Mandatory entries | ||
heatSourceModelCoeffs_.lookup("A") >> A_; | ||
heatSourceModelCoeffs_.lookup("B") >> B_; | ||
|
||
return true; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
|
||
// ************************************************************************* // |
111 changes: 111 additions & 0 deletions
111
...vers/additiveFoam/movingHeatSource/heatSourceModels/projectedGaussian/projectedGaussian.H
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / 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 <http://www.gnu.org/licenses/>. | ||
|
||
Class | ||
Foam::heatSourceModels::projectedGaussian | ||
|
||
Description | ||
projectedGaussian heat source model for additive manufacting | ||
|
||
SourceFiles | ||
projectedGaussian.C | ||
|
||
\*---------------------------------------------------------------------------*/ | ||
|
||
#ifndef projectedGaussian_H | ||
#define projectedGaussian_H | ||
|
||
#include "heatSourceModel.H" | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
namespace heatSourceModels | ||
{ | ||
|
||
/*---------------------------------------------------------------------------*\ | ||
Class projectedGaussian | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
class projectedGaussian | ||
: | ||
public heatSourceModel | ||
{ | ||
// Private Data | ||
|
||
//- Pointer to mesh information | ||
const fvMesh& mesh_; | ||
|
||
//- weights for axial decay of 2D gaussian distribution in the form: | ||
//- n = Alog2(x) + B | ||
scalar A_; | ||
scalar B_; | ||
|
||
scalar k_; | ||
|
||
public: | ||
|
||
//- Runtime type information | ||
TypeName("projectedGaussian"); | ||
|
||
|
||
// Constructors | ||
|
||
//- Construct from components | ||
projectedGaussian | ||
( | ||
const word& sourceName, | ||
const dictionary& dict, | ||
const fvMesh& mesh | ||
); | ||
|
||
|
||
//- Destructor | ||
virtual ~projectedGaussian() | ||
{} | ||
|
||
|
||
// Member Functions | ||
|
||
inline virtual scalar weight(const vector& d); | ||
|
||
inline virtual dimensionedScalar V0(); | ||
|
||
//- Read the heatSourceProperties dictionary | ||
virtual bool read(); | ||
}; | ||
|
||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
} // End namespace heatSourceModels | ||
} // End namespace Foam | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
#endif | ||
|
||
// ************************************************************************* // |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.