Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -240,6 +240,51 @@ struct nonConformalCouple
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void evaluateNonConformalProcessorCyclics(const fvMesh& mesh)
|
||||
{
|
||||
UPtrList<VolField<Type>> fields(mesh.fields<VolField<Type>>());
|
||||
|
||||
forAll(fields, i)
|
||||
{
|
||||
const label nReq = Pstream::nRequests();
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
typename VolField<Type>::Patch& pf =
|
||||
fields[i].boundaryFieldRef()[patchi];
|
||||
|
||||
if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().patch()))
|
||||
{
|
||||
pf.initEvaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
|
||||
)
|
||||
{
|
||||
Pstream::waitRequests(nReq);
|
||||
}
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
typename VolField<Type>::Patch& pf =
|
||||
fields[i].boundaryFieldRef()[patchi];
|
||||
|
||||
if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().patch()))
|
||||
{
|
||||
pf.evaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -754,6 +799,21 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// Communicate values across non-conformal processor cyclics so that they
|
||||
// contain valid values that can be written to disk
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
forAll(regionMeshes, regioni)
|
||||
{
|
||||
const fvMesh& mesh = regionMeshes[regioni];
|
||||
|
||||
#define EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS(Type, nullArg) \
|
||||
evaluateNonConformalProcessorCyclics<Type>(mesh);
|
||||
FOR_ALL_FIELD_TYPES(EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS)
|
||||
#undef EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS
|
||||
}
|
||||
}
|
||||
|
||||
// Set the precision of the points data to 10
|
||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||
|
||||
|
||||
326
bin/foamUnits
Executable file
326
bin/foamUnits
Executable file
@ -0,0 +1,326 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# 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/>.
|
||||
#
|
||||
# Script
|
||||
# foamUnits
|
||||
#
|
||||
# Description
|
||||
# Describes units and their conversions for input parameters in OpenFOAM
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
usage () {
|
||||
cat <<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTIONS] [unit/dimension]
|
||||
options:
|
||||
-a | -all write output for all units or dimensions
|
||||
-d | -dimension interrogate dimensional units
|
||||
-h | -help help
|
||||
-l | -list lists available units
|
||||
|
||||
Describes units and their conversions for input parameters in OpenFOAM, e.g.
|
||||
+ to list available units:
|
||||
foamUnits -list
|
||||
+ to provide information about the [mm] unit:
|
||||
foamUnits mm
|
||||
+ to provide information about the [thermalConductivity] dimensions:
|
||||
foamUnits -dimension thermalConductivity
|
||||
+ to provide information about all units:
|
||||
foamUnits -all
|
||||
+ to provide information about all dimensions:
|
||||
foamUnits -all -dimension
|
||||
|
||||
USAGE
|
||||
}
|
||||
|
||||
error() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
usage
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Remove leading and trailing [ ] and spaces
|
||||
cleanArg() {
|
||||
echo "$1" | grep -qE "^\[[^\]*\]$" && \
|
||||
echo "$1" | tr -d '\[\] ' && \
|
||||
return 0
|
||||
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
### DIMENSIONS
|
||||
|
||||
# Global
|
||||
dimDir="/opt/openfoam-dev/src/OpenFOAM/dimensionSet"
|
||||
|
||||
setFile="$dimDir/dimensionSet.C"
|
||||
BASE_DIMS="$(sed -n "/names\[\]/,/}/p" "$setFile" | awk -F\" '{print $2}')"
|
||||
|
||||
SETS_FILE="$dimDir/dimensionSets.C"
|
||||
DRVD_DIMS="$(grep "dimensionsPtr_->insert(\"" "$SETS_FILE" | awk -F\" '{print $2}')"
|
||||
|
||||
# Sort in reverse so longer names appear first
|
||||
extFile="$dimDir/dimensionSets.H"
|
||||
EXT_DIMS="$(grep extern "$extFile"| awk -F'[ ;]' '{print $4}' | sort -r)"
|
||||
|
||||
# Conversions from dimension names to arrays
|
||||
#shellcheck disable=SC2086
|
||||
baseArrayToDim() {
|
||||
_array="$1"
|
||||
|
||||
echo "$_array" | grep -q "[[:alpha:]]" && echo "$1" && return 0
|
||||
|
||||
set -- $BASE_DIMS
|
||||
|
||||
for _i in $_array
|
||||
do
|
||||
[ "$_i" -eq "1" ] && echo "$1" && return 0
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
baseDimToArray() {
|
||||
_array=
|
||||
|
||||
for _d in $BASE_DIMS
|
||||
do
|
||||
[ "$_d" = "$1" ] && _i=1 || _i=0
|
||||
_array="$_array $(printf "%i" "$_i")"
|
||||
done
|
||||
|
||||
echo "$_array"
|
||||
}
|
||||
|
||||
# Listing dimension names
|
||||
# shellcheck disable=SC2086
|
||||
listDims() {
|
||||
printf "\nBase dimensions: "
|
||||
echo $BASE_DIMS | awk '{for(i=1;i<=NF;i++) {printf "[%s] ", $i}}'
|
||||
|
||||
printf "\nDerived dimensions:\n"
|
||||
echo $DRVD_DIMS | awk \
|
||||
'{
|
||||
for(i=1;i<=NF;i++)
|
||||
{
|
||||
if (i%5 == 1) printf " "
|
||||
printf "[%s] ", $i
|
||||
if (i%5 == 0) printf "\n"
|
||||
if (i == NF) printf "\n"
|
||||
}
|
||||
}'
|
||||
}
|
||||
|
||||
# Conversions between dimension names and extern variables in the code
|
||||
# Conversion from derived name to variable, e.g. lookupDimVar area -> dimArea
|
||||
lookupDimVar() {
|
||||
grep "$1" "$SETS_FILE" | sed 's/.*,[\t ]*\([^)]*\).*/\1/' | head -1
|
||||
}
|
||||
|
||||
# Looks up an external variable and finds its definitions
|
||||
lookupExtDim() {
|
||||
sed -n "/Foam::$1/,/)/p" "$SETS_FILE" | \
|
||||
xargs | sed 's/[^(]*(\([^;]*\));.*/\1/'
|
||||
}
|
||||
|
||||
# Looks up a dimension name from the extern variable, e.g.
|
||||
# lookupDimName dimDensity -> density
|
||||
lookupDimName() {
|
||||
case "$1" in
|
||||
dimMass|\
|
||||
dimLength|\
|
||||
dimTime|\
|
||||
dimTemperature|\
|
||||
dimMoles|\
|
||||
dimCurrent|\
|
||||
dimLuminousIntensity)
|
||||
echo "${1#dim*}" | tr '[:upper:]' '[:lower:]'
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
grep "dimensionsPtr_->insert(\".*$1" "$SETS_FILE" | \
|
||||
awk -F\" '{print $2}' | head -1
|
||||
}
|
||||
|
||||
# Replaces extern dimensions with dimension names in expressions, e.g.
|
||||
# writeDim "pow3(dimTime*dimPower/sqr(dimDynamicViscosity))" ->
|
||||
# pow3(time*power/sqr(dynamicViscosity))
|
||||
# shellcheck disable=SC1003,SC2086
|
||||
writeDim() {
|
||||
_dim="$1"
|
||||
|
||||
for _e in $EXT_DIMS
|
||||
do
|
||||
echo "$_dim" | grep -q "$_e" || continue
|
||||
_d="$(lookupDimName "$_e")"
|
||||
_dim="$(echo "$_dim" | sed "s/$_e/$_d/")"
|
||||
done
|
||||
|
||||
echo "$_dim" | head -1 | xargs
|
||||
}
|
||||
|
||||
# Takes a dimension name, looks up the extern variables, then convers back, e.g.
|
||||
# getDim area -> sqr(length)
|
||||
getDim() {
|
||||
_dim="$1"
|
||||
|
||||
# Special cases
|
||||
echo "$BASE_DIMS" | grep -q "$_dim" && \
|
||||
case "$_dim" in
|
||||
mass|length|time|temperature|moles|current|luminousIntensity)
|
||||
echo "[$(baseDimToArray "$_dim")]"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$DRVD_DIMS" | grep -q "$_dim" || return 1
|
||||
|
||||
_dim="$(lookupExtDim "$(lookupDimVar "$_dim")")"
|
||||
|
||||
writeDim "$_dim"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
printDim() {
|
||||
_dim="$1"
|
||||
_entry="$(getDim "$_dim")" || return 1
|
||||
|
||||
printf "Dimension [%s]\n+ Base dimensions = [%s]\n" \
|
||||
"$_dim" \
|
||||
"$(echo "$_entry" | \
|
||||
sed -e "s/\[[\t ]*\([^\]*\)\].*/\1/" -e "s/[\t ]*$//")"
|
||||
}
|
||||
|
||||
### UNITS
|
||||
|
||||
DIMLESS_UNITS="% rad rot deg"
|
||||
|
||||
### Functions for reporting units
|
||||
listUnits() {
|
||||
_start=
|
||||
|
||||
sed -n '/UnitConversions/,/^}/p' "$FOAM_ETC/controlDict" | \
|
||||
sed -n '/SICoeffs/,/}/p' | \
|
||||
while read -r line
|
||||
do
|
||||
echo "$line" | grep -q "//" && \
|
||||
echo "$line" | awk -F"// " '{printf "\n%s: ", $2}' && \
|
||||
_start=on && continue
|
||||
echo "$line" | grep -q "\[" && \
|
||||
echo "$line" | awk '{printf "[%s] ", $1}'
|
||||
done
|
||||
printf "\nDimensionless units: "
|
||||
echo "$DIMLESS_UNITS" | awk '{for(i=1;i<=NF;i++) {printf "[%s] ", $i}}'
|
||||
printf "\n\n"
|
||||
}
|
||||
|
||||
getUnit() {
|
||||
_unit="$1"
|
||||
|
||||
# Special cases
|
||||
case "$_unit" in
|
||||
rad) echo "[] 1" ; return 0 ;;
|
||||
rot) echo "[rad] 2*pi" ; return 0 ;;
|
||||
deg) echo "[rad] pi/180" ; return 0 ;;
|
||||
%) echo "[] 0.01" ; return 0 ;;
|
||||
#kg|m|s|K|kmol|A|Cd) echo "[$_unit] 1" ; return 0 ;;
|
||||
esac
|
||||
|
||||
_entry="UnitConversions/SICoeffs"
|
||||
|
||||
[ "$#" -eq 1 ] && _entry="$_entry/$_unit"
|
||||
|
||||
foamDictionary \
|
||||
-entry "$_entry" \
|
||||
-value \
|
||||
-case "$FOAM_ETC" \
|
||||
controlDict 2> /dev/null
|
||||
}
|
||||
|
||||
printUnit() {
|
||||
_unit="$1"
|
||||
_entry="$(getUnit "$_unit")" || return 1
|
||||
|
||||
_base="$(echo "$_entry" | sed -e "s/\[[\t ]*\([^\]*\)\].*/\1/" -e "s/[\t ]*$//")"
|
||||
|
||||
printf "Unit [%s]\n+ Base unit = [%s]\n+ Conversion factor = %s\n" \
|
||||
"$_unit" \
|
||||
"$(baseArrayToDim "$_base")" \
|
||||
"$(echo "$_entry" | awk -F" " '{print $NF}')"
|
||||
}
|
||||
|
||||
### Run recursively with -a | -all option
|
||||
args=""
|
||||
echo "$@" | grep -q -- "-d" && args="-d"
|
||||
echo "$@" | grep -q -- "-a" && \
|
||||
for u in $($0 -l $args | xargs -n 1 | grep '\[' | tr -d '\[\]')
|
||||
do
|
||||
$0 $args "$u"
|
||||
done && exit
|
||||
|
||||
dimension=
|
||||
list=
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-d | -dimension)
|
||||
dimension="yes"
|
||||
shift
|
||||
;;
|
||||
-h | -help)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
-l | -list)
|
||||
list="yes"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
error "Invalid option '$1'"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$list" ]
|
||||
then
|
||||
[ "$dimension" ] && listDims && exit
|
||||
listUnits
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check number of arguments
|
||||
[ "$#" -eq 1 ] || error "Arguments specified =/= 1 (optional)"
|
||||
|
||||
if [ "$dimension" ]
|
||||
then
|
||||
printDim "$(cleanArg "$1")" || error "dimension '$1' does not exist"
|
||||
else
|
||||
printUnit "$(cleanArg "$1")" || error "unit '$1' does not exist"
|
||||
fi
|
||||
printf "\n"
|
||||
@ -168,6 +168,24 @@ _findArgs () {
|
||||
xargs
|
||||
}
|
||||
|
||||
_unitArgs ()
|
||||
{
|
||||
_opts="-help"
|
||||
|
||||
# If '-dimension' is not selected, it is always an option
|
||||
echo "\$@" | grep -q -- "-d" || _opts="\$_opts -dimension"
|
||||
|
||||
# If '-all' or '-list' is selected, the only other possible option is '-dimension'
|
||||
echo "\$@" | grep -q -- "-[al]" && echo "\$_opts" | xargs -n 1 | sort && return 0
|
||||
|
||||
# If '-all' or '-list' are not selected, they are options
|
||||
_opts="\$_opts -all -list"
|
||||
|
||||
echo "\$@" | grep -q -- "-d" && _args="-d"
|
||||
_opts="\$_opts \$(foamUnits -list \$_args | xargs -n 1 | grep '\\[' | tr -d '\\[\\]')"
|
||||
echo "\$_opts" | xargs -n 1 | sort
|
||||
}
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -370,13 +388,39 @@ complete -o filenames -o nospace -F _foamInfo_ foamInfo
|
||||
EOF
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
_foamUnits () {
|
||||
cat<<EOF
|
||||
_foamUnits_ ()
|
||||
{
|
||||
$(declareLocals)
|
||||
|
||||
opts="\$(_unitArgs "\$used")"
|
||||
extra=""
|
||||
|
||||
$(caseStart)
|
||||
-*) ;;
|
||||
*) opts="" ;;
|
||||
$(caseEnd)
|
||||
}
|
||||
complete -o filenames -o nospace -F _foamUnits_ foamUnits
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
apps="$(ls "$FOAM_APPBIN") \
|
||||
$(find "$WM_PROJECT_DIR/bin" -maxdepth 1 -type f | sort) \
|
||||
$(find "$WM_PROJECT_DIR/wmake" -maxdepth 1 -type f | sort)"
|
||||
|
||||
specialApps="foamFind foamGet foamCloneCase foamInfo surfaceTransformPoints"
|
||||
specialApps="\
|
||||
foamFind \
|
||||
foamGet \
|
||||
foamCloneCase \
|
||||
foamInfo \
|
||||
foamUnits \
|
||||
surfaceTransformPoints"
|
||||
|
||||
banner > "$file"
|
||||
optionFunctions >> "$file"
|
||||
|
||||
@ -98,6 +98,24 @@ _findArgs () {
|
||||
xargs
|
||||
}
|
||||
|
||||
_unitArgs ()
|
||||
{
|
||||
_opts="-help"
|
||||
|
||||
# If '-dimension' is not selected, it is always an option
|
||||
echo "$@" | grep -q -- "-d" || _opts="$_opts -dimension"
|
||||
|
||||
# If '-all' or '-list' is selected, the only other possible option is '-dimension'
|
||||
echo "$@" | grep -q -- "-[al]" && echo "$_opts" | xargs -n 1 | sort && return 0
|
||||
|
||||
# If '-all' or '-list' are not selected, they are options
|
||||
_opts="$_opts -all -list"
|
||||
|
||||
echo "$@" | grep -q -- "-d" && _args="-d"
|
||||
_opts="$_opts $(foamUnits -list $_args | xargs -n 1 | grep '\[' | tr -d '\[\]')"
|
||||
echo "$_opts" | xargs -n 1 | sort
|
||||
}
|
||||
|
||||
_adiabaticFlameT_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@ -547,7 +565,7 @@ _createEngineZones_ ()
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-case -cylinderHead -doc -fileHandler -help -hostRoots -libs -noFunctionObjects -parallel -pistonBowl -region -roots -srcDoc"
|
||||
opts="-case -cylinderHead -doc -fileHandler -help -libs -noFunctionObjects -pistonBowl -region -srcDoc"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
@ -557,7 +575,7 @@ _createEngineZones_ ()
|
||||
opts="" ; extra="-d" ;;
|
||||
-fileHandler)
|
||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
||||
-hostRoots|-libs|-region|-roots)
|
||||
-libs|-region)
|
||||
opts="" ; extra="" ;;
|
||||
*) ;;
|
||||
esac
|
||||
@ -1961,7 +1979,7 @@ _mergeMeshes_ ()
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-addCaseRegions -addCases -addRegions -case -doc -fileHandler -help -libs -noFunctionObjects -overwrite -region -srcDoc"
|
||||
opts="-addCaseRegions -addCases -addRegions -case -constant -doc -fileHandler -help -latestTime -libs -noFunctionObjects -noZero -overwrite -region -srcDoc -time"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
@ -1971,6 +1989,8 @@ _mergeMeshes_ ()
|
||||
opts="" ; extra="-d" ;;
|
||||
-fileHandler)
|
||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
||||
-time)
|
||||
opts="$(foamListTimes -withZero 2> /dev/null)" ; extra="" ;;
|
||||
-libs|-region)
|
||||
opts="" ; extra="" ;;
|
||||
*) ;;
|
||||
@ -2428,7 +2448,7 @@ _reconstructPar_ ()
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="- -allRegions -case -cellProc -constant -doc -fields -fileHandler -help -lagrangianFields -latestTime -libs -newTimes -noFields -noFunctionObjects -noLagrangian -noSets -noZero -region -srcDoc -time -withZero"
|
||||
opts="- -allRegions -case -cellProc -constant -doc -fields -fileHandler -help -lagrangianFields -latestTime -libs -newTimes -noFields -noFunctionObjects -noLagrangian -noSets -noZero -region -rm -srcDoc -time -withZero"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
@ -4815,6 +4835,25 @@ _foamTags_ ()
|
||||
}
|
||||
complete -o filenames -o nospace -F _foamTags_ foamTags
|
||||
|
||||
_foamUnits_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="$(_unitArgs "$used")"
|
||||
extra=""
|
||||
|
||||
[ "$COMP_CWORD" = 1 ] || \
|
||||
case "$prev" in
|
||||
-*) ;;
|
||||
*) opts="" ;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
|
||||
}
|
||||
complete -o filenames -o nospace -F _foamUnits_ foamUnits
|
||||
|
||||
_interFoam_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@ -5269,7 +5308,7 @@ _wclean_ ()
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-help -silent"
|
||||
opts="-help -noLnInclude -silent"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra="-d"
|
||||
|
||||
|
||||
@ -105,6 +105,12 @@ public:
|
||||
//- Construct given size.
|
||||
explicit inline DynamicField(const label);
|
||||
|
||||
//- Construct given size and initial value
|
||||
inline DynamicField(const label, const T&);
|
||||
|
||||
//- Construct given size and initialised to zero
|
||||
inline DynamicField(const label, const zero);
|
||||
|
||||
//- Construct from UList. Size set to UList size.
|
||||
// Also constructs from DynamicField with different sizing parameters.
|
||||
explicit inline DynamicField(const UList<T>&);
|
||||
|
||||
@ -47,6 +47,30 @@ inline Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv>::DynamicField
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv>::DynamicField
|
||||
(
|
||||
const label nElem,
|
||||
const T& t
|
||||
)
|
||||
:
|
||||
Field<T>(nElem, t),
|
||||
capacity_(Field<T>::size())
|
||||
{}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv>::DynamicField
|
||||
(
|
||||
const label nElem,
|
||||
const zero
|
||||
)
|
||||
:
|
||||
Field<T>(nElem, Zero),
|
||||
capacity_(Field<T>::size())
|
||||
{}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline Foam::DynamicField<T, SizeInc, SizeMult, SizeDiv>::DynamicField
|
||||
(
|
||||
|
||||
38
tutorials/incompressibleVoF/damBreakLaminar/0/U
Normal file
38
tutorials/incompressibleVoF/damBreakLaminar/0/U
Normal file
@ -0,0 +1,38 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type noSlip;
|
||||
}
|
||||
|
||||
atmosphere
|
||||
{
|
||||
type pressureInletOutletVelocity;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,39 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object alpha.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
atmosphere
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
39
tutorials/incompressibleVoF/damBreakLaminar/0/p_rgh
Normal file
39
tutorials/incompressibleVoF/damBreakLaminar/0/p_rgh
Normal file
@ -0,0 +1,39 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object p_rgh;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
atmosphere
|
||||
{
|
||||
type prghTotalPressure;
|
||||
p0 $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,12 +6,4 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
cleanVoFCase
|
||||
|
||||
find 0 -type f -not -name tracer.* -delete
|
||||
|
||||
find constant -type f -not \( \
|
||||
-name fvModels -or -name momentumTransport \
|
||||
\) -delete
|
||||
|
||||
rm -f system/blockMeshDict
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -4,12 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
# Copy the case
|
||||
isTest "$@" && path=.. || path=$FOAM_TUTORIALS/incompressibleVoF
|
||||
cp -rn $path/damBreak/0 $path/damBreak/constant $path/damBreak/system .
|
||||
rm -f 0/alpha.water
|
||||
|
||||
# Run
|
||||
runApplication blockMesh
|
||||
runApplication setFields
|
||||
runApplication $(getApplication)
|
||||
|
||||
21
tutorials/incompressibleVoF/damBreakLaminar/constant/g
Normal file
21
tutorials/incompressibleVoF/damBreakLaminar/constant/g
Normal file
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class uniformDimensionedVectorField;
|
||||
location "constant";
|
||||
object g;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -2 0 0 0 0];
|
||||
value (0 -9.81 0);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object phaseProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
phases (water air);
|
||||
|
||||
sigma 0.07;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object physicalProperties.air;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
viscosityModel constant;
|
||||
|
||||
nu 1.48e-05;
|
||||
|
||||
rho 1;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object physicalProperties.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
viscosityModel constant;
|
||||
|
||||
nu 1e-06;
|
||||
|
||||
rho 1000;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
105
tutorials/incompressibleVoF/damBreakLaminar/system/blockMeshDict
Normal file
105
tutorials/incompressibleVoF/damBreakLaminar/system/blockMeshDict
Normal file
@ -0,0 +1,105 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
convertToMeters 0.146;
|
||||
|
||||
vertices
|
||||
(
|
||||
(0 0 0)
|
||||
(2 0 0)
|
||||
(2.16438 0 0)
|
||||
(4 0 0)
|
||||
(0 0.32876 0)
|
||||
(2 0.32876 0)
|
||||
(2.16438 0.32876 0)
|
||||
(4 0.32876 0)
|
||||
(0 4 0)
|
||||
(2 4 0)
|
||||
(2.16438 4 0)
|
||||
(4 4 0)
|
||||
(0 0 0.1)
|
||||
(2 0 0.1)
|
||||
(2.16438 0 0.1)
|
||||
(4 0 0.1)
|
||||
(0 0.32876 0.1)
|
||||
(2 0.32876 0.1)
|
||||
(2.16438 0.32876 0.1)
|
||||
(4 0.32876 0.1)
|
||||
(0 4 0.1)
|
||||
(2 4 0.1)
|
||||
(2.16438 4 0.1)
|
||||
(4 4 0.1)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 5 4 12 13 17 16) (23 8 1) simpleGrading (1 1 1)
|
||||
hex (2 3 7 6 14 15 19 18) (19 8 1) simpleGrading (1 1 1)
|
||||
hex (4 5 9 8 16 17 21 20) (23 42 1) simpleGrading (1 1 1)
|
||||
hex (5 6 10 9 17 18 22 21) (4 42 1) simpleGrading (1 1 1)
|
||||
hex (6 7 11 10 18 19 23 22) (19 42 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
defaultPatch
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
|
||||
boundary
|
||||
(
|
||||
leftWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(0 12 16 4)
|
||||
(4 16 20 8)
|
||||
);
|
||||
}
|
||||
rightWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(7 19 15 3)
|
||||
(11 23 19 7)
|
||||
);
|
||||
}
|
||||
lowerWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(0 1 13 12)
|
||||
(1 5 17 13)
|
||||
(5 6 18 17)
|
||||
(2 14 18 6)
|
||||
(2 3 15 14)
|
||||
);
|
||||
}
|
||||
atmosphere
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(8 20 21 9)
|
||||
(9 21 22 10)
|
||||
(10 22 23 11)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user