├── src ├── fvDVM │ ├── fvDVM │ │ ├── fvDVM │ │ └── fvDVMI.H │ ├── fieldMPIreducer │ │ ├── fieldMPIreducerI.H │ │ ├── fieldMPIreducer.H │ │ └── fieldMPIreducer.C │ ├── zeroBoundaryGrad │ │ ├── options │ │ ├── zeroBoundaryGrads.C │ │ ├── zeroBoundaryVectors.H │ │ ├── zeroBoundaryGrad.H │ │ ├── zeroBoundaryGrad.C │ │ └── unweightedLeastSquaresVectors.C │ ├── Make │ │ ├── options │ │ └── files │ ├── pwlInterp2 │ │ ├── pwlInterp2_test.C │ │ └── pwlInterp2.C │ ├── BCs │ │ ├── mixedFvsPatchField │ │ │ ├── mixedFvsPatchFields.C │ │ │ ├── mixedFvsPatchFields.H │ │ │ ├── mixedFvsPatchFieldsFwd.H │ │ │ └── mixedFvsPatchField.C │ │ ├── farFieldFvPatchField │ │ │ ├── farFieldFvPatchFields.C │ │ │ ├── farFieldFvPatchFields.H │ │ │ ├── farFieldFvPatchFieldsFwd.H │ │ │ └── farFieldFvPatchField.C │ │ ├── pressureInFvPatchField │ │ │ ├── pressureInFvPatchFields.C │ │ │ ├── pressureInFvPatchFields.H │ │ │ ├── pressureInFvPatchFieldsFwd.H │ │ │ └── pressureInFvPatchField.C │ │ ├── farFieldFvsPatchField │ │ │ ├── farFieldFvsPatchFields.C │ │ │ ├── farFieldFvsPatchFields.H │ │ │ ├── farFieldFvsPatchFieldsFwd.H │ │ │ └── farFieldFvsPatchField.C │ │ ├── pressureOutFvPatchField │ │ │ ├── pressureOutFvPatchFields.C │ │ │ ├── pressureOutFvPatchFields.H │ │ │ ├── pressureOutFvPatchFieldsFwd.H │ │ │ └── pressureOutFvPatchField.C │ │ ├── symmetryModFvPatchField │ │ │ ├── symmetryModFvPatchFields.C │ │ │ ├── symmetryModFvPatchFields.H │ │ │ ├── symmetryModFvPatchFieldsFwd.H │ │ │ └── symmetryModFvPatchField.C │ │ ├── DVMsymmetryFvsPatchField │ │ │ ├── DVMsymmetryFvsPatchFields.C │ │ │ ├── DVMsymmetryFvsPatchFields.H │ │ │ ├── DVMsymmetryFvsPatchFieldsFwd.H │ │ │ └── DVMsymmetryFvsPatchField.C │ │ ├── maxwellWallFvsPatchField │ │ │ ├── maxwellWallFvsPatchFields.C │ │ │ ├── maxwellWallFvsPatchFields.H │ │ │ ├── maxwellWallFvsPatchFieldsFwd.H │ │ │ └── maxwellWallFvsPatchField.C │ │ ├── zeroGradientFvsPatchField │ │ │ ├── zeroGradientFvsPatchFields.C │ │ │ ├── zeroGradientFvsPatchFields.H │ │ │ ├── zeroGradientFvsPatchFieldsFwd.H │ │ │ └── zeroGradientFvsPatchField.C │ │ └── calculatedMaxwellFvPatchField │ │ │ ├── calculatedMaxwellFvPatchFields.C │ │ │ ├── calculatedMaxwellFvPatchFields.H │ │ │ ├── calculatedMaxwellFvPatchFieldsFwd.H │ │ │ └── calculatedMaxwellFvPatchField.C │ ├── discreteVelocity │ │ └── discreteVelocityI.H │ └── Venkatakrishnan │ │ └── VenkatakrishnanLimitedGrad │ │ └── VenkatakrishnanLimitedGrad.H ├── Make │ ├── files │ └── options ├── Allwclean ├── Allwmake ├── scripts │ ├── plotLog.sh │ └── setDV.py ├── PatchMeshToolIssue ├── createFields.H ├── CourantNo.H ├── setDeltaTvar.H └── readTimeControlsExplicit.H ├── doc ├── appendix.tex ├── img │ ├── U.png │ ├── ldc.pdf │ ├── temperature.png │ └── ldc-eps-converted-to.pdf ├── dugksFoam.pdf ├── dugksFoam.tex ├── changelog.tex ├── Makefile ├── biblio.tex ├── contrib.tex ├── title.tex ├── preamble.tex ├── lshort-base.tex ├── installation.tex ├── demo.tex ├── overview.tex └── fancyhea.sty ├── inc └── FoamDefs │ ├── 6 │ └── foam_defs.h │ ├── foam_defs.h │ ├── 4.0 │ └── foam_defs.h │ ├── 4.1 │ └── foam_defs.h │ ├── 5.0 │ └── foam_defs.h │ ├── 2.4.0 │ └── foam_defs.h │ ├── 3.0.1 │ └── foam_defs.h │ └── 3.0.0 │ └── foam_defs.h ├── .gitignore ├── demo └── cavity0.1 │ ├── 0 │ ├── T │ ├── U │ └── rho │ ├── constant │ ├── vMesh │ │ ├── cellZones │ │ ├── faceZones │ │ └── boundary │ ├── polyMesh │ │ ├── boundary │ │ └── blockMeshDict │ └── DVMProperties │ ├── system │ ├── fvSolution │ ├── fvSchemes │ ├── decomposeParDict │ └── controlDict │ ├── 0.0339621151 │ ├── uniform │ │ └── time │ ├── stressWall │ └── stressSurf │ ├── para.py │ └── multidecompose.py └── multidecompose.py /src/fvDVM/fvDVM/fvDVM: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/appendix.tex: -------------------------------------------------------------------------------- 1 | \appendix 2 | \chapter{Installing OpenFOAM} 3 | -------------------------------------------------------------------------------- /inc/FoamDefs/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 2 | #define FOAM_MINOR 3 | -------------------------------------------------------------------------------- /inc/FoamDefs/4.0/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 4 2 | #define FOAM_MINOR 0 3 | -------------------------------------------------------------------------------- /inc/FoamDefs/4.1/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 4 2 | #define FOAM_MINOR 1 3 | -------------------------------------------------------------------------------- /inc/FoamDefs/5.0/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 5 2 | #define FOAM_MINOR 0 3 | -------------------------------------------------------------------------------- /inc/FoamDefs/6/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 6 2 | #define FOAM_MINOR 3 | -------------------------------------------------------------------------------- /src/Make/files: -------------------------------------------------------------------------------- 1 | dugksFoam.C 2 | 3 | EXE = $(FOAM_USER_APPBIN)/dugksFoam 4 | -------------------------------------------------------------------------------- /inc/FoamDefs/2.4.0/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 2 2 | #define FOAM_MINOR 4 3 | -------------------------------------------------------------------------------- /inc/FoamDefs/3.0.1/foam_defs.h: -------------------------------------------------------------------------------- 1 | #define FOAM_MAJOR 3 2 | #define FOAM_MINOR 0 3 | -------------------------------------------------------------------------------- /doc/img/U.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzhang777/paralleled_cdugksFoam/HEAD/doc/img/U.png -------------------------------------------------------------------------------- /doc/img/ldc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzhang777/paralleled_cdugksFoam/HEAD/doc/img/ldc.pdf -------------------------------------------------------------------------------- /inc/FoamDefs/3.0.0/foam_defs.h: -------------------------------------------------------------------------------- 1 | #error PEDO 2 | #define FOAM_MAJOR 3 3 | #define FOAM_MINOR 0 4 | -------------------------------------------------------------------------------- /doc/dugksFoam.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzhang777/paralleled_cdugksFoam/HEAD/doc/dugksFoam.pdf -------------------------------------------------------------------------------- /doc/img/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzhang777/paralleled_cdugksFoam/HEAD/doc/img/temperature.png -------------------------------------------------------------------------------- /src/fvDVM/fieldMPIreducer/fieldMPIreducerI.H: -------------------------------------------------------------------------------- 1 | inline nproc() const {return nproc_} ; 2 | inline rank() const {return rank_}; 3 | -------------------------------------------------------------------------------- /doc/img/ldc-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzhang777/paralleled_cdugksFoam/HEAD/doc/img/ldc-eps-converted-to.pdf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | **/linux** 4 | *.dep 5 | *.swp 6 | src/Make/linux** 7 | src/fvDVM/lnInclude/ 8 | src/fvDVM/Make/linux** 9 | src/wmake 10 | .vscode -------------------------------------------------------------------------------- /src/Allwclean: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ${0%/*} || exit 1 # run from this directory 3 | set -x 4 | 5 | wclean libso fvDVM 6 | wclean 7 | wclean dugskFoam 8 | 9 | # ----------------------------------------------------------------- end-of-file 10 | -------------------------------------------------------------------------------- /doc/dugksFoam.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt,a4paper]{book} 2 | \usepackage{mylayout} 3 | \input{preamble} 4 | \input{title} 5 | \input{lshort-base} 6 | % Local Variables: 7 | % TeX-master: "dugksFoam" 8 | % mode: latex 9 | % mode: flyspell 10 | % End: 11 | -------------------------------------------------------------------------------- /demo/cavity0.1/constant/vMesh/cellZones: -------------------------------------------------------------------------------- 1 | FoamFile 2 | { 3 | version 2.0; 4 | format ascii; 5 | class regIOobject; 6 | location "constant/polyMesh"; 7 | object cellZones; 8 | } 9 | 10 | 0 11 | ( 12 | ) 13 | -------------------------------------------------------------------------------- /demo/cavity0.1/constant/vMesh/faceZones: -------------------------------------------------------------------------------- 1 | FoamFile 2 | { 3 | version 2.0; 4 | format ascii; 5 | class regIOobject; 6 | location "constant/polyMesh"; 7 | object faceZones; 8 | } 9 | 10 | 0 11 | ( 12 | ) 13 | -------------------------------------------------------------------------------- /src/fvDVM/zeroBoundaryGrad/options: -------------------------------------------------------------------------------- 1 | EXE_INC = \ 2 | -I$(LIB_SRC)/triSurface/lnInclude \ 3 | -I$(LIB_SRC)/meshTools/lnInclude \ 4 | -I../../../inc/FoamDefs/$(WM_PROJECT_VERSION) 5 | 6 | LIB_LIBS = \ 7 | -lOpenFOAM \ 8 | -ltriSurface \ 9 | -lmeshTools 10 | -------------------------------------------------------------------------------- /src/fvDVM/Make/options: -------------------------------------------------------------------------------- 1 | sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) 2 | sinclude $(RULES)/mplib$(WM_MPLIB) 3 | 4 | EXE_INC = \ 5 | -Wno-unused-variable -Wno-old-style-cast \ 6 | $(PFLAGS) $(PINC) \ 7 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 8 | -I$(LIB_SRC)/OpenFOAM/lnInclude \ 9 | -I$(LIB_SRC)/meshTools/lnInclude \ 10 | -I../../inc/FoamDefs/$(WM_PROJECT_VERSION) 11 | 12 | LIB_LIBS = \ 13 | $(PLIBS) \ 14 | -lfiniteVolume \ 15 | -lmeshTools 16 | -------------------------------------------------------------------------------- /demo/cavity0.1/constant/vMesh/boundary: -------------------------------------------------------------------------------- 1 | FoamFile 2 | { 3 | version 2.0; 4 | format ascii; 5 | class polyBoundaryMesh; 6 | location "constant/polyMesh"; 7 | object boundary; 8 | } 9 | 10 | 2 11 | ( 12 | fixedWalls 13 | { 14 | type wall; 15 | nFaces 36; 16 | startFace 2448; 17 | } 18 | BaseAndTop 19 | { 20 | type empty; 21 | nFaces 3288; 22 | startFace 2484; 23 | } 24 | ) 25 | -------------------------------------------------------------------------------- /doc/changelog.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: changed log 3 | % $Id: changelog.tex 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | \begin{itemize} 6 | \item 2016/6/20, Ver.~1.0, update installation and velocity space decomposition based parallel computing. 7 | \item 2018/10/4, Ver.~1.1, update installation method 8 | \end{itemize} 9 | % 10 | 11 | % Local Variables: 12 | % TeX-master: "dugksFoam" 13 | % mode: latex 14 | % mode: flyspell 15 | % End: 16 | -------------------------------------------------------------------------------- /src/Make/options: -------------------------------------------------------------------------------- 1 | sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) 2 | sinclude $(RULES)/mplib$(WM_MPLIB) 3 | 4 | EXE_INC = \ 5 | -Wno-unused-variable -Wno-old-style-cast \ 6 | $(PFLAGS) $(PINC) \ 7 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 8 | -I$(LIB_SRC)/OpenFOAM/lnInclude \ 9 | -I$(LIB_SRC)/meshTools/lnInclude \ 10 | -IfvDVM/lnInclude \ 11 | -I../inc/FoamDefs/$(WM_PROJECT_VERSION) 12 | 13 | EXE_LIBS = \ 14 | $(PLIBS) \ 15 | -L$(FOAM_USER_LIBBIN) \ 16 | -lfiniteVolume \ 17 | -ldugksFoam \ 18 | -lmeshTools 19 | -------------------------------------------------------------------------------- /src/Allwmake: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ${0%/*} || exit 1 # run from this directory 3 | set -x 4 | 5 | # Create a foam version header file 6 | HEADERFOLDER=../inc/FoamDefs/$WM_PROJECT_VERSION 7 | mkdir -p $HEADERFOLDER 8 | HEADERPATH=$HEADERFOLDER/foam_defs.h 9 | IFS='.' read -ra FOAM_VERSION <<< "$WM_PROJECT_VERSION" 10 | 11 | if [ ! -f $HEADERPATH ] 12 | then 13 | touch $HEADERPATH 14 | echo "#define FOAM_MAJOR ${FOAM_VERSION[0]}" > $HEADERPATH 15 | echo "#define FOAM_MINOR ${FOAM_VERSION[1]}" >> $HEADERPATH 16 | fi 17 | 18 | (wmake libso fvDVM && wmake) 19 | 20 | # ----------------------------------------------------------------- end-of-file 21 | -------------------------------------------------------------------------------- /src/scripts/plotLog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep -e 'Temperature' log |cut -d '=' -f 2 |nl >tlog.dat 3 | grep -e '^Density' log |cut -d '=' -f 2 |nl >rlog.dat 4 | grep -e '^Velocity' log |cut -d '=' -f 2 |nl >ulog.dat 5 | gnuplot <<- EOF 6 | set xlabel "t" 7 | set ylabel "log(Error)" 8 | set logscale y 9 | #set format y "%s*10^{%S}" 10 | set format y "%.2e" 11 | set term png 12 | set output "log.png" 13 | plot "tlog.dat" using 1:2 with l title "rho Convergence rate", \ 14 | "rlog.dat" using 1:2 with l title "T Convergence rate", \ 15 | "ulog.dat" using 1:2 with l title "U Convergence rate" 16 | EOF 17 | rm *log.dat 18 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | VERS = 1.1 2 | FILES = biblio.tex installation.tex demo.tex contrib.tex lshort.sty mylayout.sty title.tex \ 3 | dugksFoam.tex overview.tex fancyhea.sty changelog.tex\ 4 | lshort-base.tex appendix.tex 5 | 6 | # Define some variables 7 | PDFLATEX=pdflatex 8 | MAKEINDEX=makeindex 9 | 10 | # The default targets 11 | all: dugksFoam.pdf 12 | 13 | dugksFoam.pdf: $(FILES) 14 | -mkdir pdfbuild 15 | (T1FONTS=.:`pwd`/eurofont: && export T1FONTS && TEXINPUTS=.:`pwd`:`pwd`/euro:`pwd`/oberdiek:${TEXINPUTS:-:}&&export TEXINPUTS&& cd pdfbuild&& \ 16 | $(PDFLATEX) dugksFoam&& $(PDFLATEX) dugksFoam&& \ 17 | #$(MAKEINDEX) -s dugksFoam.ist dugksFoam&&$(PDFLATEX) dugksFoam&& \ 18 | (thumbpdf --resolution 10 dugksFoam.pdf && $(PDFLATEX) dugksFoam)&& \ 19 | mv dugksFoam.pdf .. ) 20 | rm pdfbuild/* 21 | 22 | clean: 23 | rm -rf texbuild pdfbuild 24 | -------------------------------------------------------------------------------- /src/PatchMeshToolIssue: -------------------------------------------------------------------------------- 1 | diff --git a/Make/options b/Make/options 2 | index 662f52d..61b432d 100644 3 | --- a/Make/options 4 | +++ b/Make/options 5 | @@ -1,11 +1,9 @@ 6 | EXE_INC = \ 7 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 8 | -I$(LIB_SRC)/OpenFOAM/lnInclude \ 9 | - -I$(LIB_SRC)/meshTools/lnInclude \ 10 | -IfvDVM/lnInclude 11 | 12 | EXE_LIBS = \ 13 | -L$(FOAM_USER_LIBBIN) \ 14 | -lfiniteVolume \ 15 | - -ldugksFoam \ 16 | - -lmeshTools 17 | + -ldugksFoam 18 | diff --git a/fvDVM/Make/options b/fvDVM/Make/options 19 | index d88a3bd..007993b 100644 20 | --- a/fvDVM/Make/options 21 | +++ b/fvDVM/Make/options 22 | @@ -1,8 +1,6 @@ 23 | EXE_INC = \ 24 | -I$(LIB_SRC)/finiteVolume/lnInclude \ 25 | - -I$(LIB_SRC)/OpenFoam/lnInclude \ 26 | - -I$(LIB_SRC)/meshTools/lnInclude 27 | + -I$(LIB_SRC)/OpenFoam/lnInclude 28 | 29 | LIB_LIBS = \ 30 | - -lfiniteVolume \ 31 | - -lmeshTools 32 | + -lfiniteVolume 33 | -------------------------------------------------------------------------------- /src/fvDVM/Make/files: -------------------------------------------------------------------------------- 1 | BCs/calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchFields.C 2 | BCs/maxwellWallFvsPatchField/maxwellWallFvsPatchFields.C 3 | BCs/mixedFvsPatchField/mixedFvsPatchFields.C 4 | BCs/farFieldFvsPatchField/farFieldFvsPatchFields.C 5 | BCs/farFieldFvPatchField/farFieldFvPatchFields.C 6 | BCs/symmetryModFvPatchField/symmetryModFvPatchFields.C 7 | BCs/DVMsymmetryFvsPatchField/DVMsymmetryFvsPatchFields.C 8 | BCs/zeroGradientFvsPatchField/zeroGradientFvsPatchFields.C 9 | BCs/pressureInFvPatchField/pressureInFvPatchFields.C 10 | BCs/pressureOutFvPatchField/pressureOutFvPatchFields.C 11 | discreteVelocity/discreteVelocity.C 12 | zeroBoundaryGrad/zeroBoundaryVectors.C 13 | zeroBoundaryGrad/zeroBoundaryGrads.C 14 | Venkatakrishnan/VenkatakrishnanSlopeMulti/VenkatakrishnanSlopeMulti.C 15 | Venkatakrishnan/VenkatakrishnanLimitedGrad/VenkatakrishnanLimitedGrads.C 16 | fvDVM/fvDVM.C 17 | fieldMPIreducer/fieldMPIreducer.C 18 | 19 | LIB = $(FOAM_USER_LIBBIN)/libdugksFoam 20 | -------------------------------------------------------------------------------- /demo/cavity0.1/system/fvSolution: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 2.2.1 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | location "system"; 14 | object fvSolution; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | solvers 19 | { 20 | } 21 | // ************************************************************************* // 22 | -------------------------------------------------------------------------------- /doc/biblio.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: The Bibliography 3 | % File: biblio.tex (lshort2e.tex) 4 | % $Id: biblio.tex 449 2010-12-14 16:53:51Z oetiker $ 5 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 | \begin{thebibliography}{99} 7 | \addcontentsline{toc}{chapter}{\bibname} 8 | \bibitem{guozl13} Z.L. Guo, K. Xu, R.J. Wang, Discrete unified gas kinetic scheme for all Knudsen number flows: low-speed isothermal case, Phys. Rev. E, 88 (2013) 033305. 9 | \bibitem{guozl15} Z.L. Guo, R.J. Wang, K. Xu, Discrete unified gas kinetic scheme for all Knudsen number flows. II. Thermal compressible case, Phys. Rev. E, 91(2015) 033313. 10 | \bibitem{zhulh15} L.H. Zhu, Z.L. Guo, K. Xu, Discrete unified gas kinetic scheme on unstructured meshes, Comput. \& Fluid, 127 (2016) 211-225 11 | \end{thebibliography} 12 | 13 | 14 | % 15 | 16 | % Local Variables: 17 | % TeX-master: "lshort2e" 18 | % mode: latex 19 | % mode: flyspell 20 | % End: 21 | -------------------------------------------------------------------------------- /demo/cavity0.1/0.0339621151/uniform/time: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 6 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | location "0.0339621151/uniform"; 14 | object time; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | value 0.0339621151251041364; 19 | 20 | name "0.0339621151"; 21 | 22 | index 7000; 23 | 24 | deltaT 4.85218859935e-06; 25 | 26 | deltaT0 4.85218859935e-06; 27 | 28 | 29 | // ************************************************************************* // 30 | -------------------------------------------------------------------------------- /doc/contrib.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: Who contributed to this Document 3 | % $Id: contrib.tex 533 2015-04-09 13:00:40Z oetiker $ 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | \begin{small} 6 | \noindent Copyright \copyright 2014-2015 Lianhua Zhu. All rights reserved. 7 | 8 | This document is free; you can redistribute it and/or modify it 9 | under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 2 of the License, or 11 | (at your option) any later version. 12 | This document is distributed in the hope that it will be useful, but 13 | \emph{without any warranty}; without even the implied warranty of 14 | \emph{merchantability} or \emph{fitness for a particular purpose}\@. See the GNU 15 | General Public License for more details. 16 | You should have received a copy of the GNU General Public License 17 | along with this document; if not, write to the Free Software 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | \end{small} 20 | 21 | 22 | \pagebreak 23 | \endinput 24 | % 25 | 26 | % Local Variables: 27 | % TeX-master: "dugksFoam" 28 | % mode: latex 29 | % mode: flyspell 30 | % End: 31 | -------------------------------------------------------------------------------- /doc/title.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: The title page 3 | % $Id: title.tex 533 2015-04-09 13:00:40Z oetiker $ 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | 6 | \ifpdf 7 | \pdfbookmark{Title Page}{title} 8 | \fi 9 | \newlength{\centeroffset} 10 | \setlength{\centeroffset}{-0.5\oddsidemargin} 11 | \addtolength{\centeroffset}{0.5\evensidemargin} 12 | %\addtolength{\textwidth}{-\centeroffset} 13 | \thispagestyle{empty} 14 | \vspace*{\stretch{1}} 15 | \noindent\hspace*{\centeroffset}\makebox[0pt][l]{\begin{minipage}{\textwidth} 16 | \flushright 17 | {\Huge\bfseries User's Guide for dugksFoam 18 | } 19 | \noindent\rule[-1ex]{\textwidth}{5pt}\\[2.5ex] 20 | \hfill\emph{ An OpenFOAM solver for Boltzmann model equation } 21 | \end{minipage}} 22 | 23 | \vspace{\stretch{1}} 24 | \noindent\hspace*{\centeroffset}\makebox[0pt][l]{\begin{minipage}{\textwidth} 25 | \flushright 26 | {\bfseries 27 | by Lianhua Zhu\\[3ex]} 28 | Document Version~1.1 \\[2ex]\today 29 | \end{minipage}} 30 | 31 | %\addtolength{\textwidth}{\centeroffset} 32 | \vspace{\stretch{2}} 33 | 34 | \pagebreak 35 | 36 | \endinput 37 | 38 | % 39 | 40 | % Local Variables: 41 | % TeX-master: "dugksFoam" 42 | % mode: latex 43 | % mode: flyspell 44 | % End: 45 | -------------------------------------------------------------------------------- /demo/cavity0.1/0.0339621151/stressWall: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 6 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class volTensorField; 13 | location "0.0339621151"; 14 | object stressWall; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | dimensions [1 -1 -2 0 0 0 0]; 19 | 20 | internalField uniform (0 0 0 0 0 0 0 0 0); 21 | 22 | boundaryField 23 | { 24 | movingWall 25 | { 26 | type calculated; 27 | value uniform (0 0 0 0 0 0 0 0 0); 28 | } 29 | fixedWalls 30 | { 31 | type calculated; 32 | value uniform (0 0 0 0 0 0 0 0 0); 33 | } 34 | frontAndBackPlanes 35 | { 36 | type empty; 37 | } 38 | } 39 | 40 | 41 | // ************************************************************************* // 42 | -------------------------------------------------------------------------------- /demo/cavity0.1/system/fvSchemes: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 2.2.1 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | location "system"; 14 | object fvSchemes; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | ddtSchemes 19 | { 20 | default Euler; 21 | } 22 | 23 | gradSchemes 24 | { 25 | default leastSquares; 26 | // default cellLimited Gauss linear 1.0; 27 | // default cellLimited leastSquares 0.5; 28 | } 29 | 30 | divSchemes 31 | { 32 | default none; 33 | } 34 | 35 | laplacianSchemes 36 | { 37 | default none; 38 | } 39 | // ************************************************************************* // 40 | -------------------------------------------------------------------------------- /demo/cavity0.1/0.0339621151/stressSurf: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | Website: https://openfoam.org 5 | \\ / A nd | Version: 6 6 | \\/ M anipulation | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class surfaceTensorField; 13 | location "0.0339621151"; 14 | object stressSurf; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | dimensions [1 -1 -2 0 0 0 0]; 19 | 20 | internalField uniform (0 0 0 0 0 0 0 0 0); 21 | 22 | boundaryField 23 | { 24 | movingWall 25 | { 26 | type calculated; 27 | value uniform (0 0 0 0 0 0 0 0 0); 28 | } 29 | fixedWalls 30 | { 31 | type calculated; 32 | value uniform (0 0 0 0 0 0 0 0 0); 33 | } 34 | frontAndBackPlanes 35 | { 36 | type empty; 37 | value nonuniform 0(); 38 | } 39 | } 40 | 41 | 42 | // ************************************************************************* // 43 | -------------------------------------------------------------------------------- /demo/cavity0.1/0/T: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 2.3.0 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class volScalarField; 13 | location "0"; 14 | object T; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | dimensions [0 0 0 1 0 0 0]; 19 | 20 | internalField uniform 273; 21 | 22 | boundaryField 23 | { 24 | fixedWalls 25 | { 26 | type fixedValue; 27 | value uniform 273; 28 | } 29 | movingWall 30 | { 31 | type fixedValue; 32 | value uniform 273; 33 | } 34 | frontAndBackPlanes 35 | { 36 | type empty; 37 | } 38 | } 39 | 40 | 41 | // ************************************************************************* // 42 | -------------------------------------------------------------------------------- /demo/cavity0.1/0/U: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 2.3.0 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class volVectorField; 13 | location "0"; 14 | object U; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | dimensions [0 1 -1 0 0 0 0]; 19 | 20 | internalField uniform (0 0 0); 21 | 22 | boundaryField 23 | { 24 | fixedWalls 25 | { 26 | type fixedValue; 27 | value uniform (0 0 0); 28 | } 29 | movingWall 30 | { 31 | type fixedValue; 32 | value uniform (50 0 0); 33 | } 34 | frontAndBackPlanes 35 | { 36 | type empty; 37 | } 38 | } 39 | 40 | // ************************************************************************* // 41 | -------------------------------------------------------------------------------- /demo/cavity0.1/system/decomposeParDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 2.2.1 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | location "system"; 14 | object decomposeParDict; 15 | } 16 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 17 | 18 | numberOfSubdomains 32; 19 | 20 | method scotch; 21 | 22 | simpleCoeffs 23 | { 24 | n ( 1 1 1 ); 25 | delta 0.001; 26 | } 27 | 28 | hierarchicalCoeffs 29 | { 30 | n ( 1 1 1 ); 31 | delta 0.001; 32 | order xyz; 33 | } 34 | 35 | manualCoeffs 36 | { 37 | dataFile ""; 38 | } 39 | 40 | distributed no; 41 | 42 | roots ( ); 43 | 44 | 45 | // ************************************************************************* // 46 | -------------------------------------------------------------------------------- /demo/cavity0.1/para.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from numpy import * 4 | 5 | ## molecular collision model constant 6 | alpha = 1.0 7 | omega_HS = 0.5 8 | omega_VHS = 0.81 9 | 10 | ## Boltzmann constant 11 | k = 1.38066e-23 12 | 13 | ## Argon molecular mass, kg 14 | m = 6.63e-26 15 | ## Argon molecular hard sphere diameter, m 16 | d = 4.17e-10 17 | ## Argon gas specific gas constant 18 | R = k/m 19 | 20 | ## Characteristic length, m 21 | L = 1 22 | ## Knudsen number 23 | Kn = 1.0 24 | 25 | 26 | ## Characteristic Velocity, m/2 27 | U = 50 28 | 29 | ## Characteristic temperature, K 30 | T = 273.0 31 | 32 | ## dimensionless viscosity 33 | muBar = 5.0*(alpha+1.0)*(alpha+2.0)*sqrt(pi)*Kn \ 34 | /(4.0*alpha*(5.0-2*omega_VHS)*(7.0-2.0*omega_VHS)) 35 | 36 | ## mean free path, m 37 | mfp = L*Kn 38 | 39 | ## initial density field, Kg/m^3 40 | rho = m/(mfp*sqrt(2.0)*pi*d*d) 41 | 42 | ## Most probable speed of molecular, m/2 43 | C = sqrt(2*R*T) 44 | 45 | ## viscosity 46 | mu = rho*C*L*muBar 47 | 48 | ## Adiabatic constant 49 | g = 5.0/3 50 | 51 | Ma = U/sqrt(g*R*T) 52 | 53 | print "Refer Temperature (T ) = ", T 54 | print "Knudsen number (Kn) = ", Kn 55 | print "Mach number (Ma) = ", Ma 56 | print "Reynolds number (Re) = ", rho*U*L/mu 57 | print "Viscosity (mu) = ", mu 58 | print "Density (rho) = ", rho 59 | print "Spefic gas constant (R) = ", R 60 | print "Most probable speed (C) = ", C 61 | -------------------------------------------------------------------------------- /src/fvDVM/pwlInterp2/pwlInterp2_test.C: -------------------------------------------------------------------------------- 1 | #include "pwlInterp2.C" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | int main(int argc, char* argv[]) 11 | { 12 | int nx, ny; 13 | nx = atoi(argv[1]); 14 | ny = nx; 15 | vector xd(nx); 16 | vector yd(ny); 17 | vector zd(nx*ny); 18 | 19 | vector xi(4); 20 | vector yi(4); 21 | 22 | for(int i=0; i zi = itp.interp(xi,yi); 42 | 43 | //cout << "zi[0] = " << zi[0] << endl; 44 | //cout << "za[0] = " << sin(xi[0])*cos(yi[0]) << endl; 45 | // 46 | cout.precision(6); 47 | cout<. 23 | 24 | Global 25 | compressibleCourantNo 26 | 27 | Description 28 | Calculates the mean and maximum wave speed based Courant Numbers. 29 | 30 | \*---------------------------------------------------------------------------*/ 31 | 32 | scalar CoNum = 0.0; 33 | scalar meanCoNum = 0.0; 34 | 35 | dvm.getCoNum(CoNum, meanCoNum); 36 | 37 | //Info<< "Mean and max Courant Numbers = " 38 | //<< meanCoNum << " " << CoNum << endl; 39 | 40 | // ************************************************************************* // 41 | -------------------------------------------------------------------------------- /src/fvDVM/zeroBoundaryGrad/zeroBoundaryGrads.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "foam_defs.h" 27 | #include "fvMesh.H" 28 | #include "zeroBoundaryGrad.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | #if FOAM_MAJOR <= 2 33 | namespace Foam 34 | { 35 | namespace fv 36 | { 37 | #endif 38 | 39 | makeFvGradScheme(zeroBoundaryGrad) 40 | 41 | #if FOAM_MAJOR <= 2 42 | } 43 | } 44 | #endif 45 | 46 | // ************************************************************************* // 47 | -------------------------------------------------------------------------------- /doc/lshort-base.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: Main Input File of the LaTeX2e Introduction 3 | % $Id: lshort-base.tex 447 2010-12-14 14:32:00Z oetiker $ 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | % lshort.tex - The not so short introduction to LaTeX 6 | % by Tobias Oetiker 7 | % oetiker@ee.ethz.ch 8 | % 9 | % based on LKURTZ.TEX Uni Graz & TU Wien, 1987 10 | %----------------------------------------------------------------------- 11 | % 12 | % To compile lshort, you need TeX 3.x, LaTeX and makeindex 13 | % 14 | % The sources files of the Intro are: 15 | % lshort.tex (this file), 16 | % titel.tex, contrib.tex, biblio.tex 17 | % things.tex, typeset.tex, math.tex, lssym.tex, spec.tex, 18 | % lshort.sty, fancyheadings.sty 19 | % 20 | % Further the verbatim.sty and the layout.sty 21 | % from the LaTeX Tools distribution is 22 | % required. 23 | % 24 | % 25 | % To print the AMS symbols you need the AMS fonts and the packages 26 | % amsfonts, eufrak and eucal from (AMS LaTeX 1.2) 27 | % 28 | % --------------------------------------------------------------------- 29 | 30 | \include{contrib} 31 | \include{changelog} 32 | \include{overview} 33 | \tableofcontents 34 | %\listoffigures 35 | %\listoftables 36 | \enlargethispage{\baselineskip} 37 | \mainmatter 38 | \include{installation} 39 | \include{usage} 40 | \include{demo} 41 | \backmatter 42 | \include{biblio} 43 | %\include{appendix} 44 | \refstepcounter{chapter} 45 | \addcontentsline{toc}{chapter}{Index} 46 | \printindex 47 | \end{document} 48 | 49 | 50 | % Local Variables: 51 | % TeX-master: "dugksFoam" 52 | % mode: latex 53 | % mode: flyspell 54 | % End: 55 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/mixedFvsPatchField/mixedFvsPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "mixedFvsPatchFields.H" 27 | #include "surfaceFields.H" 28 | #include "addToRunTimeSelectionTable.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makeFvsPatchFields(mixed); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvPatchField/farFieldFvPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "farFieldFvPatchFields.H" 27 | #include "volFields.H" 28 | #include "addToRunTimeSelectionTable.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makePatchFields(farField); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureInFvPatchField/pressureInFvPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "pressureInFvPatchFields.H" 27 | #include "addToRunTimeSelectionTable.H" 28 | #include "volFields.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makePatchFields(pressureIn); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvsPatchField/farFieldFvsPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "farFieldFvsPatchFields.H" 27 | #include "surfaceFields.H" 28 | #include "addToRunTimeSelectionTable.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makeFvsPatchFields(farField); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureOutFvPatchField/pressureOutFvPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "pressureOutFvPatchFields.H" 27 | #include "addToRunTimeSelectionTable.H" 28 | #include "volFields.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makePatchFields(pressureOut); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/symmetryModFvPatchField/symmetryModFvPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "symmetryModFvPatchFields.H" 27 | #include "addToRunTimeSelectionTable.H" 28 | #include "volFields.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makePatchFields(symmetryMod); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/DVMsymmetryFvsPatchField/DVMsymmetryFvsPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "DVMsymmetryFvsPatchFields.H" 27 | #include "surfaceFields.H" 28 | #include "addToRunTimeSelectionTable.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makeFvsPatchFields(DVMsymmetry); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/maxwellWallFvsPatchField/maxwellWallFvsPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "maxwellWallFvsPatchFields.H" 27 | #include "surfaceFields.H" 28 | #include "addToRunTimeSelectionTable.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makeFvsPatchFields(maxwellWall); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/zeroGradientFvsPatchField/zeroGradientFvsPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "zeroGradientFvsPatchFields.H" 27 | #include "surfaceFields.H" 28 | #include "addToRunTimeSelectionTable.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makeFvsPatchFields(zeroGradient); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchFields.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "calculatedMaxwellFvPatchFields.H" 27 | #include "addToRunTimeSelectionTable.H" 28 | #include "volFields.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 36 | 37 | makePatchFields(calculatedMaxwell); 38 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 40 | 41 | } // End namespace Foam 42 | 43 | // ************************************************************************* // 44 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/mixedFvsPatchField/mixedFvsPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef mixedFvsPatchFields_H 27 | #define mixedFvsPatchFields_H 28 | 29 | #include "mixedFvsPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makeFvsPatchTypeFieldTypedefs(mixed); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvPatchField/farFieldFvPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef farFieldFvPatchFields_H 27 | #define farFieldFvPatchFields_H 28 | 29 | #include "farFieldFvPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makePatchTypeFieldTypedefs(farField); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvsPatchField/farFieldFvsPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef farFieldFvsPatchFields_H 27 | #define farFieldFvsPatchFields_H 28 | 29 | #include "farFieldFvsPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makeFvsPatchTypeFieldTypedefs(farField); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureInFvPatchField/pressureInFvPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef pressureInFvPatchFields_H 27 | #define pressureInFvPatchFields_H 28 | 29 | #include "pressureInFvPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makePatchTypeFieldTypedefs(pressureIn); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureOutFvPatchField/pressureOutFvPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef pressureOutFvPatchFields_H 27 | #define pressureOutFvPatchFields_H 28 | 29 | #include "pressureOutFvPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makePatchTypeFieldTypedefs(pressureOut); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/symmetryModFvPatchField/symmetryModFvPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef symmetryModFvPatchFields_H 27 | #define symmetryModFvPatchFields_H 28 | 29 | #include "symmetryModFvPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makePatchTypeFieldTypedefs(symmetryMod); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/mixedFvsPatchField/mixedFvsPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef mixedFvsPatchFieldsFwd_H 27 | #define mixedFvsPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class mixedFvsPatchField; 39 | 40 | makeFvsPatchTypeFieldTypedefs(mixed); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/DVMsymmetryFvsPatchField/DVMsymmetryFvsPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef DVMsymmetryFvsPatchFields_H 27 | #define DVMsymmetryFvsPatchFields_H 28 | 29 | #include "DVMsymmetryFvsPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makeFvsPatchTypeFieldTypedefs(DVMsymmetry); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/maxwellWallFvsPatchField/maxwellWallFvsPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef maxwellWallFvsPatchFields_H 27 | #define maxwellWallFvsPatchFields_H 28 | 29 | #include "maxwellWallFvsPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makeFvsPatchTypeFieldTypedefs(maxwellWall); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvPatchField/farFieldFvPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef farFieldFvPatchFieldsFwd_H 27 | #define farFieldFvPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class farFieldFvPatchField; 39 | 40 | makePatchTypeFieldTypedefs(farField); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/zeroGradientFvsPatchField/zeroGradientFvsPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef zeroGradientFvsPatchFields_H 27 | #define zeroGradientFvsPatchFields_H 28 | 29 | #include "zeroGradientFvsPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makeFvsPatchTypeFieldTypedefs(zeroGradient); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/setDeltaTvar.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | Global 25 | setDeltaT 26 | 27 | Description 28 | Reset the timestep to maintain a constant maximum courant Number. 29 | Reduction of time-step is immediate, but increase is damped to avoid 30 | unstable oscillations. 31 | 32 | \*---------------------------------------------------------------------------*/ 33 | 34 | if (adjustTimeStep) 35 | { 36 | scalar maxDeltaTFact = maxCo/(CoNum + SMALL); 37 | scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); 38 | 39 | runTime.setDeltaT 40 | ( 41 | min 42 | ( 43 | deltaTFact*runTime.deltaTValue(), 44 | maxDeltaT 45 | ) 46 | ); 47 | 48 | if(dvm.mpiReducer().rank() == 0) 49 | Info<< "deltaT = " << runTime.deltaTValue() << endl; 50 | } 51 | 52 | // ************************************************************************* // 53 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvsPatchField/farFieldFvsPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef farFieldFvsPatchFieldsFwd_H 27 | #define farFieldFvsPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class farFieldFvsPatchField; 39 | 40 | makeFvsPatchTypeFieldTypedefs(farField); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureInFvPatchField/pressureInFvPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef pressureInFvPatchFieldsFwd_H 27 | #define pressureInFvPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class pressureInFvPatchField; 39 | 40 | makePatchTypeFieldTypedefs(pressureIn); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureOutFvPatchField/pressureOutFvPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef pressureOutFvPatchFieldsFwd_H 27 | #define pressureOutFvPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class pressureOutFvPatchField; 39 | 40 | makePatchTypeFieldTypedefs(pressureOut); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/symmetryModFvPatchField/symmetryModFvPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef symmetryModFvPatchFieldsFwd_H 27 | #define symmetryModFvPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class symmetryModFvPatchField; 39 | 40 | makePatchTypeFieldTypedefs(symmetryMod); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/DVMsymmetryFvsPatchField/DVMsymmetryFvsPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef DVMsymmetryFvsPatchFieldsFwd_H 27 | #define DVMsymmetryFvsPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class DVMsymmetryFvsPatchField; 39 | 40 | makeFvsPatchTypeFieldTypedefs(DVMsymmetry); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchFields.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef calculatedMaxwellFvPatchFields_H 27 | #define calculatedMaxwellFvPatchFields_H 28 | 29 | #include "calculatedMaxwellFvPatchField.H" 30 | #include "fieldTypes.H" 31 | 32 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 33 | 34 | namespace Foam 35 | { 36 | 37 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 38 | 39 | makePatchTypeFieldTypedefs(calculatedMaxwell); 40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 42 | 43 | } // End namespace Foam 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | #endif 48 | 49 | // ************************************************************************* // 50 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/maxwellWallFvsPatchField/maxwellWallFvsPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef maxwellWallFvsPatchFieldsFwd_H 27 | #define maxwellWallFvsPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class maxwellWallFvsPatchField; 39 | 40 | makeFvsPatchTypeFieldTypedefs(maxwellWall); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/zeroGradientFvsPatchField/zeroGradientFvsPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef zeroGradientFvsPatchFieldsFwd_H 27 | #define zeroGradientFvsPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class zeroGradientFvsPatchField; 39 | 40 | makeFvsPatchTypeFieldTypedefs(zeroGradient); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchFieldsFwd.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #ifndef calculatedMaxwellFvPatchFieldsFwd_H 27 | #define calculatedMaxwellFvPatchFieldsFwd_H 28 | 29 | #include "fieldTypes.H" 30 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 32 | 33 | namespace Foam 34 | { 35 | 36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 37 | 38 | template class calculatedMaxwellFvPatchField; 39 | 40 | makePatchTypeFieldTypedefs(calculatedMaxwell); 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | } // End namespace Foam 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | #endif 49 | 50 | // ************************************************************************* // 51 | -------------------------------------------------------------------------------- /src/fvDVM/fieldMPIreducer/fieldMPIreducer.H: -------------------------------------------------------------------------------- 1 | #ifndef FIELDMPIREDUCER_H 2 | #define FIELDMPIREDUCER_H 3 | #define fvDVM_H 4 | #include 5 | #include "fvCFD.H" 6 | 7 | class fieldMPIreducer 8 | { 9 | private: 10 | label pd; 11 | //- number of MPI process 12 | label nproc_; 13 | //- own MPI rank 14 | label rank_; 15 | 16 | //each column is a communicator, has the whole velocity space 17 | label col_size; 18 | label col_rank; 19 | MPI_Comm vel_comm; 20 | 21 | //- user defined MPI_Operator 22 | MPI_Op opSumVec_; 23 | //- user defined MPI_Datatype for OpenFOAM vector data 24 | MPI_Datatype vecType_; 25 | //- user defined MPI_Operator 26 | MPI_Op opSumTensor_; 27 | //- user defined MPI_Datatype for OpenFOAM vector data 28 | MPI_Datatype tensorType_; 29 | 30 | //- dvParallel ? 31 | bool dvParallel_; 32 | 33 | public: 34 | //- Constructors 35 | fieldMPIreducer(Foam::argList &args, int *argc, char ***argv); 36 | //- Destructor 37 | ~fieldMPIreducer(); 38 | 39 | //- Memper functions 40 | 41 | //- MPI trnasfer 42 | void reduceField(volScalarField &vsf); 43 | void reduceField(volVectorField &vvf); 44 | void reduceField(surfaceVectorField &svf); 45 | void reduceField(surfaceScalarField &ssf); 46 | void reduceField(Field &sf); 47 | void reduceField(Field &vf); 48 | void reduceField(Field &vf); 49 | 50 | void spilt_comm(MPI_Comm &vel_comm); 51 | 52 | //- Access 53 | inline int nproc() const { return nproc_; }; 54 | inline int rank() const { return rank_; }; 55 | inline int csize() const { return col_size; }; 56 | inline int crank() const { return col_rank; }; 57 | inline MPI_Comm getcomm() const { return vel_comm; }; 58 | inline bool dvParallel() const {return dvParallel_;}; 59 | inline int npd() const {return pd;}; 60 | //- Static member function 61 | static void vectorSum(vector *in, vector *inout, int *len, MPI_Datatype *dptr); 62 | static void tensorSum(tensor *in, tensor *inout, int *len, MPI_Datatype *dptr); 63 | }; 64 | #endif 65 | -------------------------------------------------------------------------------- /src/fvDVM/discreteVelocity/discreteVelocityI.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | inline const dimensionedVector Foam::discreteVelocity::xi() const 27 | { 28 | return xi_; 29 | } 30 | 31 | inline scalar Foam::discreteVelocity::weight() const 32 | { 33 | return weight_; 34 | } 35 | 36 | inline const volScalarField& Foam::discreteVelocity::gTildeVol() const 37 | { 38 | return gTildeVol_; 39 | } 40 | 41 | inline const volScalarField& Foam::discreteVelocity::hTildeVol() const 42 | { 43 | return hTildeVol_; 44 | } 45 | 46 | inline const volScalarField& Foam::discreteVelocity::gBarPvol() const 47 | { 48 | return gBarPvol_; 49 | } 50 | 51 | inline const volScalarField& Foam::discreteVelocity::hBarPvol() const 52 | { 53 | return hBarPvol_; 54 | } 55 | 56 | inline const surfaceScalarField& Foam::discreteVelocity::gSurf() const 57 | { 58 | return gSurf_; 59 | } 60 | 61 | inline const surfaceScalarField& Foam::discreteVelocity::hSurf() const 62 | { 63 | return hSurf_; 64 | } 65 | 66 | 67 | // ************************************************************************* // 68 | -------------------------------------------------------------------------------- /src/readTimeControlsExplicit.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | Global 25 | readTimeControls 26 | 27 | Author 28 | lhzhu 29 | Description 30 | Read the control parameters used by setDeltaT, 31 | Add a convergence check interval: e.g., 32 | convergeCheckSteps 100` 33 | and a convergence criteria, e.g, 34 | convergeTol 1.0e-3 35 | The convergence is check by the temperature field 36 | 37 | \*---------------------------------------------------------------------------*/ 38 | 39 | const bool adjustTimeStep = 40 | runTime.controlDict().lookupOrDefault("adjustTimeStep", false); 41 | 42 | scalar maxCo = 43 | runTime.controlDict().lookupOrDefault("maxCo", 1.0); 44 | 45 | scalar maxDeltaT = 46 | runTime.controlDict().lookupOrDefault("maxDeltaT", GREAT); 47 | 48 | scalar convergeTol = 49 | runTime.controlDict().lookupOrDefault("convergeTol", 1.0e-9); 50 | 51 | label convergeCheckSteps = 52 | runTime.controlDict().lookupOrDefault("convergeCheckSteps", 1); 53 | 54 | //TemperatureChange = 1.0; 55 | //rhoChange = 1.0; 56 | //Uchange = 1.0; 57 | // ************************************************************************* // 58 | // 59 | -------------------------------------------------------------------------------- /demo/cavity0.1/constant/polyMesh/blockMeshDict: -------------------------------------------------------------------------------- 1 | /*--------------------------------*- C++ -*----------------------------------*\ 2 | | ========= | | 3 | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 4 | | \\ / O peration | Version: 2.2.1 | 5 | | \\ / A nd | Web: www.OpenFOAM.org | 6 | | \\/ M anipulation | | 7 | \*---------------------------------------------------------------------------*/ 8 | FoamFile 9 | { 10 | version 2.0; 11 | format ascii; 12 | class dictionary; 13 | object blockMeshDict; 14 | } 15 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 16 | 17 | convertToMeters 1.0; 18 | 19 | vertices 20 | ( 21 | (0 0 0) 22 | (0.5 0 0) 23 | (1 0 0) 24 | (0 0.5 0) 25 | (0.5 0.5 0) 26 | (1 0.5 0) 27 | (0 1 0) 28 | (0.5 1 0) 29 | (1 1 0) 30 | (0 0 0.1) 31 | (0.5 0 0.1) 32 | (1 0 0.1) 33 | (0 0.5 0.1) 34 | (0.5 0.5 0.1) 35 | (1 0.5 0.1) 36 | (0 1 0.1) 37 | (0.5 1 0.1) 38 | (1 1 0.1) 39 | ); 40 | 41 | blocks 42 | ( 43 | hex (0 1 4 3 9 10 13 12) (30 30 1) simpleGrading (1 1 1) 44 | hex (1 2 5 4 10 11 14 13) (30 30 1) simpleGrading (1 1 1) 45 | hex (3 4 7 6 12 13 16 15) (30 30 1) simpleGrading (1 1 1) 46 | hex (4 5 8 7 13 14 17 16) (30 30 1) simpleGrading (1 1 1) 47 | ); 48 | 49 | edges 50 | ( 51 | ); 52 | 53 | boundary 54 | ( 55 | movingWall 56 | { 57 | type wall; 58 | faces 59 | ( 60 | (6 15 16 7) 61 | (7 16 17 8) 62 | ); 63 | } 64 | fixedWalls 65 | { 66 | type wall; 67 | faces 68 | ( 69 | (3 12 15 6) 70 | (0 9 12 3) 71 | (0 1 10 9) 72 | (1 2 11 10) 73 | (2 5 14 11) 74 | (5 8 17 14) 75 | ); 76 | } 77 | frontAndBackPlanes 78 | { 79 | type empty; 80 | faces 81 | ( 82 | (0 3 4 1) 83 | (1 4 5 2) 84 | (3 6 7 4) 85 | (4 7 8 5) 86 | (9 10 13 12) 87 | (10 11 14 13) 88 | (12 13 16 15) 89 | (13 14 17 16) 90 | ); 91 | } 92 | ); 93 | 94 | mergePatchPairs 95 | ( 96 | ); 97 | 98 | // ************************************************************************* // 99 | -------------------------------------------------------------------------------- /doc/installation.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: Things you need to know 3 | % $Id: things.tex 536 2015-06-26 06:41:33Z oetiker $ 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | 6 | \chapter{Installation} 7 | 8 | \label{inst} 9 | Before the installation of dugksFoam, you should have installed the OpenFOAM together with the ThirdParty tools on your Linux machine. 10 | The download address of OpenFOAM and the detailed installation instructions can found in the 11 | \href{http://openfoam.org/download/}{official web site of OpenFOAM} and the ~\href{https://openfoamwiki.net/index.php/Main_Page}{OpenFOAM wiki}. 12 | 13 | The detailed installation instructions are as follows. 14 | \begin{enumerate} 15 | \item Load the OpenFOAM environment: 16 | Type the command \texttt{ofxxx} where \texttt{xxx} is the three digits of the OpenFOAM version you installed, 17 | if you have followed the official installation instructions of OpenFOAM. For example, \texttt{of240} or \texttt{of230}. 18 | \item Create your own solvers installation location, and cd to it : 19 | \begin{verbatim} 20 | mkdir -p $FOAM_RUN/../applications 21 | cd $FOAM_RUN/../applications 22 | \end{verbatim} 23 | \item Get the source code using git (see below) from \href{https://github.com/zhulianhua/dugksFoam}{dugksFoam repository} 24 | or download it as a ZIP package by clicking \href{https://github.com/zhulianhua/dugksFoam/archive/master.zip}{here}. 25 | \begin{itemize} 26 | \item If using git: 27 | \begin{verbatim} 28 | git clone https://github.com/zhulianhua/dugksFoam.git 29 | cd dugksFoam/src 30 | \end{verbatim} 31 | \item If installing by ZIP package, move the ZIP package (\texttt{dugksFoam-master.zip}) to \verb|$FOAM_RUN/../applications|. Then unzip it by 32 | \begin{verbatim} 33 | unzip dugksFoam-master.zip 34 | mv dugksFoam-master dugksFoam 35 | cd dugksFoam/src 36 | \end{verbatim} 37 | \end{itemize} 38 | 39 | \item For OpenFOAM release older than 2.4.0, there is a compatible issue in the make file options about \verb|meshTool|. 40 | If you are using OpenFOAM older than 2.4.0, fix it by this command: 41 | \begin{verbatim} 42 | git apply PatchMeshToolIssue 43 | \end{verbatim} 44 | 45 | \item Compile the dugksFoam by: 46 | \begin{verbatim} 47 | ./Allwmake 48 | \end{verbatim} 49 | 50 | \item Check if the compilation is OK: 51 | \begin{verbatim} 52 | which dugksFoam 53 | \end{verbatim} 54 | It should tell you where the compiled executable \verb|dugksFoam| is. 55 | \end{enumerate} 56 | % 57 | 58 | % Local Variables: 59 | % TeX-master: "dugksFoam" 60 | % mode: latex 61 | % mode: flyspell 62 | % End: 63 | -------------------------------------------------------------------------------- /multidecompose.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import sys 4 | import argparse 5 | from shutil import copyfile 6 | 7 | 8 | def copy_file(path_read, path_write, i): 9 | names = os.listdir(path_read) 10 | for name in names: 11 | path_read_new = os.path.join(path_read, name) 12 | path_write_new = os.path.join(path_write, name) 13 | if os.path.isdir(path_read_new): 14 | if not os.path.exists(path_write_new): 15 | os.makedirs(path_write_new) 16 | copy_file(path_read_new, path_write_new, i) 17 | else: 18 | copyfile(path_read_new, path_write_new) 19 | if('0' in path_write_new or name == 'boundary'): 20 | modify_file(path_write_new, i) 21 | 22 | 23 | def modify_file(file_name, i): 24 | shift = phy_num*(i//phy_num) 25 | with open(file_name, "r") as f: 26 | lines = f.readlines() 27 | with open(file_name, "w") as f_w: 28 | for line in lines: 29 | if "procBoundary" in line or "myProcNo" in line or "neighbProcNo"in line: 30 | line = re.sub('\d+', lambda x: str(int(x.group())+shift), line) 31 | if "numberOfSubdomains" in line: 32 | line = re.sub('\d+',str(i),line) 33 | f_w.write(line) 34 | 35 | 36 | 37 | 38 | if __name__ == "__main__": 39 | phy_num = 1 40 | vel_num = 1 41 | root = os.getcwd() 42 | dict_root=os.path.join(root,'system','decomposeParDict') 43 | 44 | #need rm -f to remove the existing processorx folder 45 | os.system("rm -r processor*") 46 | 47 | parser = argparse.ArgumentParser(description='decompose physics space used for phy&vel parallel.') 48 | parser.add_argument('-p', required=True, help="the number of physical subdomains one wish to decompose", type=int) 49 | parser.add_argument('-v', required=True, help="the number of velocity subdomains one wish to decompose", type=int) 50 | args = parser.parse_args() 51 | phy_num = args.p 52 | vel_num = args.v 53 | 54 | #modify numofsubdomains = phy_num in decomposePar 55 | modify_file(dict_root,phy_num) 56 | 57 | #create the first row 58 | os.system("decomposePar") 59 | 60 | #create the rest processors folders 61 | for i in range(phy_num, phy_num * vel_num): 62 | path_read = os.path.join(root, 'processor'+str(i % phy_num)) 63 | path_write = os.path.join(root, 'processor'+str(i)) 64 | copy_file(path_read, path_write, i) 65 | 66 | #modify numofsubdomains = phy_num*vel_num in decomposePar 67 | modify_file(dict_root,phy_num*vel_num) 68 | 69 | #copy vMesh 70 | os.system("echo ./processor*/constant | xargs -n 1 cp -r ./constant/vMesh") 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /demo/cavity0.1/multidecompose.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import sys 4 | import argparse 5 | from shutil import copyfile 6 | 7 | 8 | def copy_file(path_read, path_write, i): 9 | names = os.listdir(path_read) 10 | for name in names: 11 | path_read_new = os.path.join(path_read, name) 12 | path_write_new = os.path.join(path_write, name) 13 | if os.path.isdir(path_read_new): 14 | if not os.path.exists(path_write_new): 15 | os.makedirs(path_write_new) 16 | copy_file(path_read_new, path_write_new, i) 17 | else: 18 | copyfile(path_read_new, path_write_new) 19 | if('0' in path_write_new or name == 'boundary'): 20 | modify_file(path_write_new, i) 21 | 22 | 23 | def modify_file(file_name, i): 24 | shift = phy_num*(i//phy_num) 25 | with open(file_name, "r") as f: 26 | lines = f.readlines() 27 | with open(file_name, "w") as f_w: 28 | for line in lines: 29 | if "procBoundary" in line or "myProcNo" in line or "neighbProcNo"in line: 30 | line = re.sub('\d+', lambda x: str(int(x.group())+shift), line) 31 | if "numberOfSubdomains" in line: 32 | line = re.sub('\d+',str(i),line) 33 | f_w.write(line) 34 | 35 | 36 | 37 | 38 | if __name__ == "__main__": 39 | phy_num = 1 40 | vel_num = 1 41 | root = os.getcwd() 42 | dict_root=os.path.join(root,'system','decomposeParDict') 43 | 44 | #need rm -f to remove the existing processorx folder 45 | os.system("rm -r processor*") 46 | 47 | parser = argparse.ArgumentParser(description='decompose physics space used for phy&vel parallel.') 48 | parser.add_argument('-p', required=True, help="the number of physical subdomains one wish to decompose", type=int) 49 | parser.add_argument('-v', required=True, help="the number of velocity subdomains one wish to decompose", type=int) 50 | args = parser.parse_args() 51 | phy_num = args.p 52 | vel_num = args.v 53 | 54 | #modify numofsubdomains = phy_num in decomposePar 55 | modify_file(dict_root,phy_num) 56 | 57 | #create the first row 58 | os.system("decomposePar") 59 | 60 | #create the rest processors folders 61 | for i in range(phy_num, phy_num * vel_num): 62 | path_read = os.path.join(root, 'processor'+str(i % phy_num)) 63 | path_write = os.path.join(root, 'processor'+str(i)) 64 | copy_file(path_read, path_write, i) 65 | 66 | #modify numofsubdomains = phy_num*vel_num in decomposePar 67 | modify_file(dict_root,phy_num*vel_num) 68 | 69 | #copy vMesh 70 | os.system("echo ./processor*/constant | xargs -n 1 cp -r ./constant/vMesh") 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /doc/demo.tex: -------------------------------------------------------------------------------- 1 | \chapter{Demo cases} 2 | \section{2D cavity flow at $\text{Kn}=0.075$} 3 | \label{sec_cavity} 4 | This demonstrational case is provided in the \verb|demos| subdirectory of the dugksFoam source code package. 5 | This case is a popular benchmark problem for validating numerical method for micro or rarefied gas flows. 6 | It has been studied in Ref.~\cite{zhulh15} using this solver, 7 | where you can find the detailed description of this problem. 8 | We only mention some setting that need special attention for a new user. 9 | The mesh file and setting have already been prepared in the case directory. 10 | So you can run the dugksFoam directly. 11 | 12 | The flow configuration is illustrated in Fig.~\ref{ldc}. 13 | The walls are diffusive boundaries. 14 | For such a simple geometry, you can use the \verb|blockMesh| shipped with the OpenFOAM to generate the structured mesh. 15 | Refer to the cavity flow tenurial case in the \emph{OpenFOAM User's Guide} for the detailed usage of \verb|blockMesh|. 16 | The initial temperautre filed is uniform 273K, and the wall temperature is also 273K. 17 | In this case, the Knudsen number Kn is 0.075 based on the initial density filed and the cavity width $L$. 18 | So the mean free path is 0.075m. 19 | The initial density field input in the \verb|0/rho| file should be calculated from the mean free path provided the argon gas properties. 20 | Refer to ~\cite{zhulh15} for the related formulations. 21 | We also provide a simple Python script named \verb|para.py| in the case's directory to compute the related parameters. 22 | You can run it by \verb|python para.py|. 23 | 24 | 25 | The discrete velocities used are $28\times28$ half-range Gauss-Hermite quadrature points. 26 | The files \verb|constant/Xis| and \verb|constant/weights| can be generated by 27 | \begin{verbatim} 28 | setDV.py GH 337.196399395 28 29 | \end{verbatim} 30 | where 28 is the number of discrete velocity in each direction, and 337.196399395 stands for the most probable speed of argon gas molecular at $T=273$K. 31 | Refer to Sec.~\ref{sec_dv} for more details about settings of discrete velocities. 32 | 33 | Fig.~\ref{ldc_UT} show some of the results of this case. 34 | You can also compare the results with those in \cite{zhulh15} in detail. 35 | 36 | \begin{figure} 37 | \centering 38 | % Requires \usepackage{graphicx} 39 | \includegraphics[width=0.4\textwidth]{img/ldc.pdf} 40 | \caption{Lid-driven cavity flow}\label{ldc} 41 | \end{figure} 42 | 43 | \begin{figure}[htbp] 44 | \centering 45 | \subfloat[]{\includegraphics[width=0.48\textwidth]{img/temperature.png}} ~ 46 | \subfloat[]{\includegraphics[width=0.48\textwidth]{img/U.png}} 47 | \caption{ 48 | Results of the cavity flow case. (a) Temperature contours and heat flux. (b) Velocity magnitude and streamlines. 49 | }\label{ldc_UT} 50 | \end{figure} 51 | 52 | % Local Variables: 53 | % TeX-master: "dugksFoam" 54 | % mode: latex 55 | % mode: flyspell 56 | % End: 57 | -------------------------------------------------------------------------------- /doc/overview.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Contents: Who contributed to this Document 3 | % $Id: overview.tex 456 2011-04-06 09:10:27Z oetiker $ 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | 6 | % Because this introduction is the reader's first impression, I have 7 | % edited very heavily to try to clarify and economize the language. 8 | % I hope you do not mind! I always try to ask "is this word needed?" 9 | % in my own writing but I don't want to impose my style on you... 10 | % but here I think it may be more important than the rest of the book. 11 | % --baron 12 | 13 | \chapter{Preface} 14 | 15 | The dugksFoam is an OpenFOAM solver for the Boltzmann equation with the Shakhov collision model. 16 | The numerical method behind it is the discrete unified gas kinetic scheme (DUGKS, see Ref.~\cite{guozl15}). 17 | The DUGKS discretizes the governing equation in both physical space and velocity space. 18 | It solves the partial differential equations of the discrete velocity distribution functions in a finite volume framework. 19 | In DUGKS, the fluxes of distribution functions are constructed from the local characteristic solution of the governing equation itself. 20 | This feature makes DUGKS very efficient for simulating near continuum flows. 21 | 22 | The OpenFOAM is one of the most popular open-source general CFD toolkits. 23 | The biggest feature of it is that it allows users to develop their own solvers in a very high level. 24 | The OpenFOAM provides the solver developers varies ready-to-use major components of numerical solving of PDE (mainly for finite-volume discretization), 25 | such as the arbitrary unstructured mesh representation, spatial discretization operator, time integration schemes, 26 | boundary condition types and message passing interface (MPI) based parallelization. 27 | In the development of a typical OpenFOAM solver, 28 | the developer spends most of the time to define the solving procedure, 29 | i.e., writing the Field Operation And Manipulation expressions. 30 | Besides these basic components, OpenFOAM also provides a branch of general utilities for pre-processing, 31 | post-processing, parallel computing, job control etc. 32 | 33 | By implementing the DUGKS into an OpenFOAM solver, we can take many advantages of the OpenFOAM toolkit. 34 | Such as the easy pre and post processing, parallelization, solving control and parameter configurations. 35 | We expect it can be a convenient tool for study non-equilibrium gas flow and heat transfer problem in complex geometries. 36 | In addition, it can serve as a reference for developing other kinetic type equations such as the phonon transport equation, semiconductor equation etc., 37 | because solving kinetic type equation in OpenFOAM is not so that common compared with those macro-filed based solvers the OpenFOAM provides. 38 | The only kinetic type equation solver appears in official OpenFOAM distribution is the discrete ordinates model (DOM) for thermal radiation computation. 39 | 40 | In this documentation, we present the installation, usages, demo cases of the dugksFoam. 41 | For the detailed information about the DUGKS, one can refer to the papers by Guo et al\cite{guozl13,guozl15}. 42 | For the detailed of implementation of the DUGKS in unstructured mesh and the configuration of demo cases in this documentation, 43 | one can refer the paper post on arxiv.org by the author\cite{zhulh15}. 44 | 45 | \endinput 46 | % 47 | 48 | % Local Variables: 49 | % TeX-master: "lshort2e" 50 | % mode: latex 51 | % mode: flyspell 52 | % End: 53 | -------------------------------------------------------------------------------- /src/fvDVM/zeroBoundaryGrad/zeroBoundaryVectors.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | Class 25 | Foam::zeroBoundaryVectors 26 | 27 | Description 28 | Least-squares gradient scheme vectors 29 | 30 | SourceFiles 31 | zeroBoundaryVectors.C 32 | 33 | \*---------------------------------------------------------------------------*/ 34 | 35 | #ifndef zeroBoundaryVectors_H 36 | #define zeroBoundaryVectors_H 37 | 38 | #include "MeshObject.H" 39 | #include "fvMesh.H" 40 | #include "surfaceFields.H" 41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 43 | 44 | namespace Foam 45 | { 46 | 47 | /*---------------------------------------------------------------------------*\ 48 | Class zeroBoundaryVectors Declaration 49 | \*---------------------------------------------------------------------------*/ 50 | 51 | class zeroBoundaryVectors 52 | : 53 | public MeshObject 54 | { 55 | // Private data 56 | 57 | //- Least-squares gradient vectors 58 | surfaceVectorField pVectors_; 59 | surfaceVectorField nVectors_; 60 | 61 | 62 | // Private Member Functions 63 | 64 | //- Construct Least-squares gradient vectors 65 | void calcLeastSquaresVectors(); 66 | 67 | 68 | public: 69 | 70 | // Declare name of the class and its debug switch 71 | TypeName("zeroBoundaryVectors"); 72 | 73 | 74 | // Constructors 75 | 76 | //- Construct given an fvMesh 77 | explicit zeroBoundaryVectors(const fvMesh&); 78 | 79 | 80 | //- Destructor 81 | virtual ~zeroBoundaryVectors(); 82 | 83 | 84 | // Member functions 85 | 86 | //- Return reference to owner least square vectors 87 | const surfaceVectorField& pVectors() const 88 | { 89 | return pVectors_; 90 | } 91 | 92 | //- Return reference to neighbour least square vectors 93 | const surfaceVectorField& nVectors() const 94 | { 95 | return nVectors_; 96 | } 97 | 98 | //- Delete the least square vectors when the mesh moves 99 | virtual bool movePoints(); 100 | }; 101 | 102 | 103 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 104 | 105 | } // End namespace Foam 106 | 107 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 108 | 109 | #endif 110 | 111 | // ************************************************************************* // 112 | -------------------------------------------------------------------------------- /src/fvDVM/pwlInterp2/pwlInterp2.C: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class pwlInterp2 4 | { 5 | //priviate 6 | private: 7 | std::vector xd, yd, zd; 8 | 9 | int find_posizition(std::vector xxd, double xi ) 10 | { 11 | int b; 12 | int l; 13 | int m; 14 | int r; 15 | 16 | if ( xi < xxd[0] || xxd[xxd.size()-1] < xi ) b = -1; 17 | else 18 | { 19 | l = 0; 20 | r = xxd.size() - 1; 21 | 22 | while ( l + 1 < r ) 23 | { 24 | m = ( l + r ) / 2; 25 | if ( xi < xxd[m] ) 26 | { 27 | r = m; 28 | } 29 | else 30 | { 31 | l = m; 32 | } 33 | } 34 | b = l; 35 | } 36 | return b; 37 | } 38 | 39 | public: 40 | pwlInterp2(std::vector& xd_, std::vector& yd_, std::vector& zd_) 41 | :xd(xd_), yd(yd_), zd(zd_) {}; 42 | 43 | std::vector interp(std::vector& xi_, std::vector& yi_) 44 | { 45 | std::vector zi(xi_.size()); 46 | 47 | double alpha; 48 | double beta; 49 | double det; 50 | double dxa; 51 | double dxb; 52 | double dxi; 53 | double dya; 54 | double dyb; 55 | double dyi; 56 | double gamma; 57 | int i; 58 | int j; 59 | int k; 60 | 61 | for ( k = 0; k < zi.size(); k++ ) 62 | { 63 | i = find_posizition(xd, xi_[k] ); 64 | if ( i == -1 ) 65 | { 66 | zi[k] = 0.0; 67 | continue; 68 | } 69 | 70 | j = find_posizition(yd, yi_[k] ); 71 | if ( j == -1 ) 72 | { 73 | zi[k] = 0.0; 74 | continue; 75 | } 76 | 77 | if (yi_[k] < yd[j+1] + ( yd[j] - yd[j+1] ) * (xi_[i] - xd[i] ) / ( xd[i+1] - xd[i] ) ) 78 | { 79 | dxa = xd[i+1] - xd[i]; 80 | dya = yd[j] - yd[j]; 81 | 82 | dxb = xd[i] - xd[i]; 83 | dyb = yd[j+1] - yd[j]; 84 | 85 | dxi =xi_[k] - xd[i]; 86 | dyi =yi_[k] - yd[j]; 87 | 88 | det = dxa * dyb - dya * dxb; 89 | 90 | alpha = ( dxi * dyb - dyi * dxb ) / det; 91 | beta = ( dxa * dyi - dya * dxi ) / det; 92 | gamma = 1.0 - alpha - beta; 93 | 94 | zi[k] = alpha * zd[i+1+j*xd.size()] + beta * zd[i+(j+1)*xd.size()] + gamma * zd[i+j*xd.size()]; 95 | } 96 | else 97 | { 98 | dxa = xd[i] - xd[i+1]; 99 | dya = yd[j+1] - yd[j+1]; 100 | 101 | dxb = xd[i+1] - xd[i+1]; 102 | dyb = yd[j] - yd[j+1]; 103 | 104 | dxi =xi_[k] - xd[i+1]; 105 | dyi =yi_[k] - yd[j+1]; 106 | 107 | det = dxa * dyb - dya * dxb; 108 | 109 | alpha = ( dxi * dyb - dyi * dxb ) / det; 110 | beta = ( dxa * dyi - dya * dxi ) / det; 111 | gamma = 1.0 - alpha - beta; 112 | 113 | zi[k] = alpha * zd[i+(j+1)*xd.size()] + beta * zd[i+1+j*xd.size()] + gamma * zd[i+1+(j+1)*xd.size()]; 114 | } 115 | } 116 | return zi; 117 | } 118 | }; 119 | -------------------------------------------------------------------------------- /src/fvDVM/zeroBoundaryGrad/zeroBoundaryGrad.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | Class 25 | Foam::fv::zeroBoundaryGrad 26 | 27 | Description 28 | Second-order gradient scheme using least-squares. 29 | 30 | SourceFiles 31 | zeroBoundaryGrad.C 32 | 33 | \*---------------------------------------------------------------------------*/ 34 | 35 | #ifndef zeroBoundaryGrad_H 36 | #define zeroBoundaryGrad_H 37 | 38 | #include "gradScheme.H" 39 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 41 | 42 | namespace Foam 43 | { 44 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 46 | 47 | namespace fv 48 | { 49 | 50 | /*---------------------------------------------------------------------------*\ 51 | Class zeroBoundaryGrad Declaration 52 | \*---------------------------------------------------------------------------*/ 53 | 54 | template 55 | class zeroBoundaryGrad 56 | : 57 | public fv::gradScheme 58 | { 59 | // Private Member Functions 60 | 61 | //- Disallow default bitwise copy construct 62 | zeroBoundaryGrad(const zeroBoundaryGrad&); 63 | 64 | //- Disallow default bitwise assignment 65 | void operator=(const zeroBoundaryGrad&); 66 | 67 | 68 | public: 69 | 70 | //- Runtime type information 71 | TypeName("zeroBoundary"); 72 | 73 | 74 | // Constructors 75 | 76 | //- Construct from mesh 77 | zeroBoundaryGrad(const fvMesh& mesh) 78 | : 79 | gradScheme(mesh) 80 | {} 81 | 82 | //- Construct from Istream 83 | zeroBoundaryGrad(const fvMesh& mesh, Istream&) 84 | : 85 | gradScheme(mesh) 86 | {} 87 | 88 | 89 | // Member Functions 90 | 91 | //- Return the gradient of the given field to the gradScheme::grad 92 | // for optional caching 93 | virtual tmp 94 | < 95 | GeometricField 96 | ::type, fvPatchField, volMesh> 97 | > calcGrad 98 | ( 99 | const GeometricField& vsf, 100 | const word& name 101 | ) const; 102 | }; 103 | 104 | 105 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 106 | 107 | } // End namespace fv 108 | 109 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 110 | 111 | } // End namespace Foam 112 | 113 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 114 | 115 | #ifdef NoRepository 116 | # include "zeroBoundaryGrad.C" 117 | #endif 118 | 119 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 120 | 121 | #endif 122 | 123 | // ************************************************************************* // 124 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/mixedFvsPatchField/mixedFvsPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "mixedFvsPatchField.H" 27 | 28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 29 | 30 | namespace Foam 31 | { 32 | 33 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 34 | 35 | template 36 | mixedFvsPatchField::mixedFvsPatchField 37 | ( 38 | const fvPatch& p, 39 | const DimensionedField& iF 40 | ) 41 | : 42 | fvsPatchField(p, iF) 43 | {} 44 | 45 | 46 | template 47 | mixedFvsPatchField::mixedFvsPatchField 48 | ( 49 | const mixedFvsPatchField& ptf, 50 | const fvPatch& p, 51 | const DimensionedField& iF, 52 | const fvPatchFieldMapper& mapper 53 | ) 54 | : 55 | fvsPatchField(ptf, p, iF, mapper) 56 | {} 57 | 58 | 59 | template 60 | mixedFvsPatchField::mixedFvsPatchField 61 | ( 62 | const fvPatch& p, 63 | const DimensionedField& iF, 64 | const dictionary& dict 65 | ) 66 | : 67 | fvsPatchField(p, iF, Field("value", dict, p.size())) 68 | {} 69 | 70 | 71 | template 72 | mixedFvsPatchField::mixedFvsPatchField 73 | ( 74 | const mixedFvsPatchField& ptf 75 | ) 76 | : 77 | fvsPatchField(ptf) 78 | {} 79 | 80 | 81 | template 82 | mixedFvsPatchField::mixedFvsPatchField 83 | ( 84 | const mixedFvsPatchField& ptf, 85 | const DimensionedField& iF 86 | ) 87 | : 88 | fvsPatchField(ptf, iF) 89 | {} 90 | 91 | 92 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 93 | 94 | template 95 | tmp > mixedFvsPatchField::valueInternalCoeffs 96 | ( 97 | const tmp& 98 | ) const 99 | { 100 | return tmp > 101 | ( 102 | new Field(this->size(), pTraits::zero) 103 | ); 104 | } 105 | 106 | 107 | template 108 | tmp > mixedFvsPatchField::valueBoundaryCoeffs 109 | ( 110 | const tmp& 111 | ) const 112 | { 113 | return *this; 114 | } 115 | 116 | 117 | template 118 | tmp > mixedFvsPatchField::gradientInternalCoeffs() const 119 | { 120 | return -pTraits::one*this->patch().deltaCoeffs(); 121 | } 122 | 123 | 124 | template 125 | tmp > mixedFvsPatchField::gradientBoundaryCoeffs() const 126 | { 127 | return this->patch().deltaCoeffs()*(*this); 128 | } 129 | 130 | 131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 132 | 133 | } // End namespace Foam 134 | 135 | // ************************************************************************* // 136 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvsPatchField/farFieldFvsPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "farFieldFvsPatchField.H" 27 | 28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 29 | 30 | namespace Foam 31 | { 32 | 33 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 34 | 35 | template 36 | farFieldFvsPatchField::farFieldFvsPatchField 37 | ( 38 | const fvPatch& p, 39 | const DimensionedField& iF 40 | ) 41 | : 42 | fvsPatchField(p, iF) 43 | {} 44 | 45 | 46 | template 47 | farFieldFvsPatchField::farFieldFvsPatchField 48 | ( 49 | const farFieldFvsPatchField& ptf, 50 | const fvPatch& p, 51 | const DimensionedField& iF, 52 | const fvPatchFieldMapper& mapper 53 | ) 54 | : 55 | fvsPatchField(ptf, p, iF, mapper) 56 | {} 57 | 58 | 59 | template 60 | farFieldFvsPatchField::farFieldFvsPatchField 61 | ( 62 | const fvPatch& p, 63 | const DimensionedField& iF, 64 | const dictionary& dict 65 | ) 66 | : 67 | fvsPatchField(p, iF, Field("value", dict, p.size())) 68 | {} 69 | 70 | 71 | template 72 | farFieldFvsPatchField::farFieldFvsPatchField 73 | ( 74 | const farFieldFvsPatchField& ptf 75 | ) 76 | : 77 | fvsPatchField(ptf) 78 | {} 79 | 80 | 81 | template 82 | farFieldFvsPatchField::farFieldFvsPatchField 83 | ( 84 | const farFieldFvsPatchField& ptf, 85 | const DimensionedField& iF 86 | ) 87 | : 88 | fvsPatchField(ptf, iF) 89 | {} 90 | 91 | 92 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 93 | 94 | template 95 | tmp > farFieldFvsPatchField::valueInternalCoeffs 96 | ( 97 | const tmp& 98 | ) const 99 | { 100 | return tmp > 101 | ( 102 | new Field(this->size(), pTraits::zero) 103 | ); 104 | } 105 | 106 | 107 | template 108 | tmp > farFieldFvsPatchField::valueBoundaryCoeffs 109 | ( 110 | const tmp& 111 | ) const 112 | { 113 | return *this; 114 | } 115 | 116 | 117 | template 118 | tmp > farFieldFvsPatchField::gradientInternalCoeffs() const 119 | { 120 | return -pTraits::one*this->patch().deltaCoeffs(); 121 | } 122 | 123 | 124 | template 125 | tmp > farFieldFvsPatchField::gradientBoundaryCoeffs() const 126 | { 127 | return this->patch().deltaCoeffs()*(*this); 128 | } 129 | 130 | 131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 132 | 133 | } // End namespace Foam 134 | 135 | // ************************************************************************* // 136 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/DVMsymmetryFvsPatchField/DVMsymmetryFvsPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "DVMsymmetryFvsPatchField.H" 27 | 28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 29 | 30 | namespace Foam 31 | { 32 | 33 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 34 | 35 | template 36 | DVMsymmetryFvsPatchField::DVMsymmetryFvsPatchField 37 | ( 38 | const fvPatch& p, 39 | const DimensionedField& iF 40 | ) 41 | : 42 | fvsPatchField(p, iF) 43 | {} 44 | 45 | 46 | template 47 | DVMsymmetryFvsPatchField::DVMsymmetryFvsPatchField 48 | ( 49 | const DVMsymmetryFvsPatchField& ptf, 50 | const fvPatch& p, 51 | const DimensionedField& iF, 52 | const fvPatchFieldMapper& mapper 53 | ) 54 | : 55 | fvsPatchField(ptf, p, iF, mapper) 56 | {} 57 | 58 | 59 | template 60 | DVMsymmetryFvsPatchField::DVMsymmetryFvsPatchField 61 | ( 62 | const fvPatch& p, 63 | const DimensionedField& iF, 64 | const dictionary& dict 65 | ) 66 | : 67 | fvsPatchField(p, iF, Field("value", dict, p.size())) 68 | {} 69 | 70 | 71 | template 72 | DVMsymmetryFvsPatchField::DVMsymmetryFvsPatchField 73 | ( 74 | const DVMsymmetryFvsPatchField& ptf 75 | ) 76 | : 77 | fvsPatchField(ptf) 78 | {} 79 | 80 | 81 | template 82 | DVMsymmetryFvsPatchField::DVMsymmetryFvsPatchField 83 | ( 84 | const DVMsymmetryFvsPatchField& ptf, 85 | const DimensionedField& iF 86 | ) 87 | : 88 | fvsPatchField(ptf, iF) 89 | {} 90 | 91 | 92 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 93 | 94 | template 95 | tmp > DVMsymmetryFvsPatchField::valueInternalCoeffs 96 | ( 97 | const tmp& 98 | ) const 99 | { 100 | return tmp > 101 | ( 102 | new Field(this->size(), pTraits::zero) 103 | ); 104 | } 105 | 106 | 107 | template 108 | tmp > DVMsymmetryFvsPatchField::valueBoundaryCoeffs 109 | ( 110 | const tmp& 111 | ) const 112 | { 113 | return *this; 114 | } 115 | 116 | 117 | template 118 | tmp > DVMsymmetryFvsPatchField::gradientInternalCoeffs() const 119 | { 120 | return -pTraits::one*this->patch().deltaCoeffs(); 121 | } 122 | 123 | 124 | template 125 | tmp > DVMsymmetryFvsPatchField::gradientBoundaryCoeffs() const 126 | { 127 | return this->patch().deltaCoeffs()*(*this); 128 | } 129 | 130 | 131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 132 | 133 | } // End namespace Foam 134 | 135 | // ************************************************************************* // 136 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/maxwellWallFvsPatchField/maxwellWallFvsPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "maxwellWallFvsPatchField.H" 27 | 28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 29 | 30 | namespace Foam 31 | { 32 | 33 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 34 | 35 | template 36 | maxwellWallFvsPatchField::maxwellWallFvsPatchField 37 | ( 38 | const fvPatch& p, 39 | const DimensionedField& iF 40 | ) 41 | : 42 | fvsPatchField(p, iF) 43 | {} 44 | 45 | 46 | template 47 | maxwellWallFvsPatchField::maxwellWallFvsPatchField 48 | ( 49 | const maxwellWallFvsPatchField& ptf, 50 | const fvPatch& p, 51 | const DimensionedField& iF, 52 | const fvPatchFieldMapper& mapper 53 | ) 54 | : 55 | fvsPatchField(ptf, p, iF, mapper) 56 | {} 57 | 58 | 59 | template 60 | maxwellWallFvsPatchField::maxwellWallFvsPatchField 61 | ( 62 | const fvPatch& p, 63 | const DimensionedField& iF, 64 | const dictionary& dict 65 | ) 66 | : 67 | fvsPatchField(p, iF, Field("value", dict, p.size())) 68 | {} 69 | 70 | 71 | template 72 | maxwellWallFvsPatchField::maxwellWallFvsPatchField 73 | ( 74 | const maxwellWallFvsPatchField& ptf 75 | ) 76 | : 77 | fvsPatchField(ptf) 78 | {} 79 | 80 | 81 | template 82 | maxwellWallFvsPatchField::maxwellWallFvsPatchField 83 | ( 84 | const maxwellWallFvsPatchField& ptf, 85 | const DimensionedField& iF 86 | ) 87 | : 88 | fvsPatchField(ptf, iF) 89 | {} 90 | 91 | 92 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 93 | 94 | template 95 | tmp > maxwellWallFvsPatchField::valueInternalCoeffs 96 | ( 97 | const tmp& 98 | ) const 99 | { 100 | return tmp > 101 | ( 102 | new Field(this->size(), pTraits::zero) 103 | ); 104 | } 105 | 106 | 107 | template 108 | tmp > maxwellWallFvsPatchField::valueBoundaryCoeffs 109 | ( 110 | const tmp& 111 | ) const 112 | { 113 | return *this; 114 | } 115 | 116 | 117 | template 118 | tmp > maxwellWallFvsPatchField::gradientInternalCoeffs() const 119 | { 120 | return -pTraits::one*this->patch().deltaCoeffs(); 121 | } 122 | 123 | 124 | template 125 | tmp > maxwellWallFvsPatchField::gradientBoundaryCoeffs() const 126 | { 127 | return this->patch().deltaCoeffs()*(*this); 128 | } 129 | 130 | 131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 132 | 133 | } // End namespace Foam 134 | 135 | // ************************************************************************* // 136 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/zeroGradientFvsPatchField/zeroGradientFvsPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "zeroGradientFvsPatchField.H" 27 | 28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 29 | 30 | namespace Foam 31 | { 32 | 33 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 34 | 35 | template 36 | zeroGradientFvsPatchField::zeroGradientFvsPatchField 37 | ( 38 | const fvPatch& p, 39 | const DimensionedField& iF 40 | ) 41 | : 42 | fvsPatchField(p, iF) 43 | {} 44 | 45 | 46 | template 47 | zeroGradientFvsPatchField::zeroGradientFvsPatchField 48 | ( 49 | const zeroGradientFvsPatchField& ptf, 50 | const fvPatch& p, 51 | const DimensionedField& iF, 52 | const fvPatchFieldMapper& mapper 53 | ) 54 | : 55 | fvsPatchField(ptf, p, iF, mapper) 56 | {} 57 | 58 | 59 | template 60 | zeroGradientFvsPatchField::zeroGradientFvsPatchField 61 | ( 62 | const fvPatch& p, 63 | const DimensionedField& iF, 64 | const dictionary& dict 65 | ) 66 | : 67 | fvsPatchField(p, iF, Field("value", dict, p.size())) 68 | {} 69 | 70 | 71 | template 72 | zeroGradientFvsPatchField::zeroGradientFvsPatchField 73 | ( 74 | const zeroGradientFvsPatchField& ptf 75 | ) 76 | : 77 | fvsPatchField(ptf) 78 | {} 79 | 80 | 81 | template 82 | zeroGradientFvsPatchField::zeroGradientFvsPatchField 83 | ( 84 | const zeroGradientFvsPatchField& ptf, 85 | const DimensionedField& iF 86 | ) 87 | : 88 | fvsPatchField(ptf, iF) 89 | {} 90 | 91 | 92 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 93 | 94 | template 95 | tmp > zeroGradientFvsPatchField::valueInternalCoeffs 96 | ( 97 | const tmp& 98 | ) const 99 | { 100 | return tmp > 101 | ( 102 | new Field(this->size(), pTraits::zero) 103 | ); 104 | } 105 | 106 | 107 | template 108 | tmp > zeroGradientFvsPatchField::valueBoundaryCoeffs 109 | ( 110 | const tmp& 111 | ) const 112 | { 113 | return *this; 114 | } 115 | 116 | 117 | template 118 | tmp > zeroGradientFvsPatchField::gradientInternalCoeffs() const 119 | { 120 | return -pTraits::one*this->patch().deltaCoeffs(); 121 | } 122 | 123 | 124 | template 125 | tmp > zeroGradientFvsPatchField::gradientBoundaryCoeffs() const 126 | { 127 | return this->patch().deltaCoeffs()*(*this); 128 | } 129 | 130 | 131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 132 | 133 | } // End namespace Foam 134 | 135 | // ************************************************************************* // 136 | -------------------------------------------------------------------------------- /src/fvDVM/fvDVM/fvDVMI.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | inline const Foam::discreteVelocity& 26 | Foam::fvDVM::DVi(const label I) const 27 | { 28 | return DV_[I]; 29 | } 30 | 31 | inline const Foam::discreteVelocity& Foam::fvDVM::DVxyz 32 | ( 33 | const label ix, 34 | const label iy, 35 | const label iz 36 | ) const 37 | { 38 | const label I = iz*nXiY_*nXiX_ + iy*nXiX_ + ix; 39 | return DV_[I]; 40 | } 41 | 42 | inline Foam::volScalarField& Foam::fvDVM::rhoVol() 43 | { 44 | return rhoVol_; 45 | } 46 | 47 | inline Foam::volScalarField& Foam::fvDVM::Tvol() const 48 | { 49 | return Tvol_; 50 | } 51 | 52 | inline Foam::volVectorField& Foam::fvDVM::Uvol() const 53 | { 54 | return Uvol_; 55 | } 56 | 57 | inline const Foam::volVectorField& Foam::fvDVM::qVol() const 58 | { 59 | return qVol_; 60 | } 61 | 62 | inline const Foam::volScalarField& Foam::fvDVM::tauVol() const 63 | { 64 | return tauVol_; 65 | } 66 | 67 | inline const Foam::surfaceScalarField& Foam::fvDVM::rhoSurf() const 68 | { 69 | return rhoSurf_; 70 | } 71 | 72 | inline const Foam::volScalarField& Foam::fvDVM::rhoflux() const 73 | { 74 | return rhoflux_; 75 | } 76 | 77 | inline const Foam::surfaceScalarField& Foam::fvDVM::rho() const 78 | { 79 | return rho_; 80 | } 81 | 82 | inline const Foam::surfaceScalarField& Foam::fvDVM::Tsurf() const 83 | { 84 | return Tsurf_; 85 | } 86 | 87 | inline const Foam::surfaceVectorField& Foam::fvDVM::Usurf() const 88 | { 89 | return Usurf_; 90 | } 91 | 92 | inline const Foam::surfaceVectorField& Foam::fvDVM::qSurf() const 93 | { 94 | return qSurf_; 95 | } 96 | 97 | inline const Foam::surfaceTensorField& Foam::fvDVM::stressSurf() const 98 | { 99 | return stressSurf_; 100 | } 101 | 102 | inline const Foam::surfaceScalarField& Foam::fvDVM::tauSurf() const 103 | { 104 | return tauSurf_; 105 | } 106 | 107 | inline Foam::label Foam::fvDVM::nXi() const 108 | { 109 | return nXi_; 110 | } 111 | 112 | inline Foam::label Foam::fvDVM::nXiPerDim() const 113 | { 114 | return nXiPerDim_; 115 | } 116 | 117 | inline Foam::dimensionedScalar Foam::fvDVM::xiMax() const 118 | { 119 | return xiMax_; 120 | } 121 | 122 | inline Foam::dimensionedScalar Foam::fvDVM::xiMin() const 123 | { 124 | return xiMin_; 125 | } 126 | 127 | //inline Foam::scalar Foam::fvDVM::res() const 128 | //{ 129 | //return res_; 130 | //} 131 | 132 | //inline Foam::label Foam::fvDVM::checkSteps() const 133 | //{ 134 | //return checkSteps_; 135 | //} 136 | 137 | inline Foam::dimensionedScalar Foam::fvDVM::R() const 138 | { 139 | return R_; 140 | } 141 | 142 | inline Foam::scalar Foam::fvDVM::omega() const 143 | { 144 | return omega_; 145 | } 146 | 147 | inline Foam::dimensionedScalar Foam::fvDVM::Tref() const 148 | { 149 | return Tref_; 150 | } 151 | 152 | inline Foam::dimensionedScalar Foam::fvDVM::muRef() const 153 | { 154 | return muRef_; 155 | } 156 | 157 | inline Foam::scalar Foam::fvDVM::Pr() const 158 | { 159 | return Pr_; 160 | } 161 | 162 | inline Foam::label Foam::fvDVM::KInner() const 163 | { 164 | return KInner_; 165 | } 166 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/symmetryModFvPatchField/symmetryModFvPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include 27 | #include "symmetryModFvPatchField.H" 28 | #include "dictionary.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 36 | 37 | template 38 | symmetryModFvPatchField::symmetryModFvPatchField 39 | ( 40 | const fvPatch& p, 41 | const DimensionedField& iF 42 | ) 43 | : 44 | fvPatchField(p, iF) 45 | {} 46 | 47 | 48 | template 49 | symmetryModFvPatchField::symmetryModFvPatchField 50 | ( 51 | const symmetryModFvPatchField& ptf, 52 | const fvPatch& p, 53 | const DimensionedField& iF, 54 | const fvPatchFieldMapper& mapper 55 | ) 56 | : 57 | fvPatchField(ptf, p, iF, mapper) 58 | {} 59 | 60 | 61 | template 62 | symmetryModFvPatchField::symmetryModFvPatchField 63 | ( 64 | const fvPatch& p, 65 | const DimensionedField& iF, 66 | const dictionary& dict 67 | ) 68 | : 69 | fvPatchField(p, iF, dict), 70 | dfContainer_() 71 | { 72 | Field::operator=(pTraits::one); 73 | } 74 | 75 | 76 | template 77 | symmetryModFvPatchField::symmetryModFvPatchField 78 | ( 79 | const symmetryModFvPatchField& ptf 80 | ) 81 | : 82 | fvPatchField(ptf) 83 | {} 84 | 85 | 86 | template 87 | symmetryModFvPatchField::symmetryModFvPatchField 88 | ( 89 | const symmetryModFvPatchField& ptf, 90 | const DimensionedField& iF 91 | ) 92 | : 93 | fvPatchField(ptf, iF) 94 | {} 95 | 96 | 97 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 98 | 99 | template 100 | void symmetryModFvPatchField::autoMap 101 | ( 102 | const fvPatchFieldMapper& m 103 | ) 104 | { 105 | fvPatchField::autoMap(m); 106 | dfContainer_.autoMap(m); 107 | } 108 | 109 | 110 | template 111 | void symmetryModFvPatchField::rmap 112 | ( 113 | const fvPatchField& ptf, 114 | const labelList& addr 115 | ) 116 | { 117 | fvPatchField::rmap(ptf, addr); 118 | 119 | const symmetryModFvPatchField& fgptf = 120 | refCast >(ptf); 121 | 122 | dfContainer_.rmap(fgptf.dfContainer_, addr); 123 | } 124 | 125 | template 126 | void symmetryModFvPatchField::evaluate(const Pstream::commsTypes) 127 | { 128 | if (!this->updated()) 129 | { 130 | this->updateCoeffs(); 131 | } 132 | } 133 | 134 | template 135 | void symmetryModFvPatchField::write(Ostream& os) const 136 | { 137 | fvPatchField::write(os); 138 | this->writeEntry("value", os); 139 | } 140 | 141 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 142 | 143 | } // End namespace Foam 144 | 145 | // ************************************************************************* // 146 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureInFvPatchField/pressureInFvPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include 27 | #include "pressureInFvPatchField.H" 28 | #include "dictionary.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 36 | 37 | template 38 | pressureInFvPatchField::pressureInFvPatchField 39 | ( 40 | const fvPatch& p, 41 | const DimensionedField& iF 42 | ) 43 | : 44 | fvPatchField(p, iF), 45 | pressureIn_(0.0) 46 | {} 47 | 48 | 49 | template 50 | pressureInFvPatchField::pressureInFvPatchField 51 | ( 52 | const pressureInFvPatchField& ptf, 53 | const fvPatch& p, 54 | const DimensionedField& iF, 55 | const fvPatchFieldMapper& mapper 56 | ) 57 | : 58 | fvPatchField(ptf, p, iF, mapper), 59 | pressureIn_(ptf.pressureIn_) 60 | {} 61 | 62 | 63 | template 64 | pressureInFvPatchField::pressureInFvPatchField 65 | ( 66 | const fvPatch& p, 67 | const DimensionedField& iF, 68 | const dictionary& dict 69 | ) 70 | : 71 | fvPatchField(p, iF, dict, false), 72 | pressureIn_(dict.lookupOrDefault("pressureIn", -VGREAT)) 73 | { 74 | //evaluate(); 75 | Field::operator=(pTraits::one); 76 | } 77 | 78 | 79 | template 80 | pressureInFvPatchField::pressureInFvPatchField 81 | ( 82 | const pressureInFvPatchField& ptf 83 | ) 84 | : 85 | fvPatchField(ptf), 86 | pressureIn_(ptf.pressureIn_) 87 | {} 88 | 89 | 90 | template 91 | pressureInFvPatchField::pressureInFvPatchField 92 | ( 93 | const pressureInFvPatchField& ptf, 94 | const DimensionedField& iF 95 | ) 96 | : 97 | fvPatchField(ptf, iF), 98 | pressureIn_(ptf.pressureIn_) 99 | {} 100 | 101 | 102 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 103 | 104 | template 105 | void pressureInFvPatchField::autoMap 106 | ( 107 | const fvPatchFieldMapper& m 108 | ) 109 | { 110 | fvPatchField::autoMap(m); 111 | } 112 | 113 | 114 | template 115 | void pressureInFvPatchField::rmap 116 | ( 117 | const fvPatchField& ptf, 118 | const labelList& addr 119 | ) 120 | { 121 | fvPatchField::rmap(ptf, addr); 122 | 123 | const pressureInFvPatchField& fgptf = 124 | refCast >(ptf); 125 | 126 | pressureIn_ = fgptf.pressureIn_; 127 | } 128 | 129 | template 130 | void pressureInFvPatchField::evaluate(const Pstream::commsTypes) 131 | { 132 | if (!this->updated()) 133 | { 134 | this->updateCoeffs(); 135 | } 136 | 137 | // Do nothing 138 | 139 | //Info << inComingByRho_ << endl; 140 | fvPatchField::evaluate(); 141 | } 142 | 143 | template 144 | void pressureInFvPatchField::write(Ostream& os) const 145 | { 146 | fvPatchField::write(os); 147 | this->writeEntry("value", os); 148 | os.writeKeyword("pressureIn") 149 | << pressureIn_ << token::END_STATEMENT << nl; 150 | } 151 | 152 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 153 | 154 | } // End namespace Foam 155 | 156 | // ************************************************************************* // 157 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/pressureOutFvPatchField/pressureOutFvPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include 27 | #include "pressureOutFvPatchField.H" 28 | #include "dictionary.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 36 | 37 | template 38 | pressureOutFvPatchField::pressureOutFvPatchField 39 | ( 40 | const fvPatch& p, 41 | const DimensionedField& iF 42 | ) 43 | : 44 | fvPatchField(p, iF), 45 | pressureOut_(0.0) 46 | {} 47 | 48 | 49 | template 50 | pressureOutFvPatchField::pressureOutFvPatchField 51 | ( 52 | const pressureOutFvPatchField& ptf, 53 | const fvPatch& p, 54 | const DimensionedField& iF, 55 | const fvPatchFieldMapper& mapper 56 | ) 57 | : 58 | fvPatchField(ptf, p, iF, mapper), 59 | pressureOut_(ptf.pressureOut_) 60 | {} 61 | 62 | 63 | template 64 | pressureOutFvPatchField::pressureOutFvPatchField 65 | ( 66 | const fvPatch& p, 67 | const DimensionedField& iF, 68 | const dictionary& dict 69 | ) 70 | : 71 | fvPatchField(p, iF, dict, false), 72 | pressureOut_(dict.lookupOrDefault("pressureOut", -VGREAT)) 73 | { 74 | //evaluate(); 75 | Field::operator=(pTraits::one); 76 | } 77 | 78 | 79 | template 80 | pressureOutFvPatchField::pressureOutFvPatchField 81 | ( 82 | const pressureOutFvPatchField& ptf 83 | ) 84 | : 85 | fvPatchField(ptf), 86 | pressureOut_(ptf.pressureOut_) 87 | {} 88 | 89 | 90 | template 91 | pressureOutFvPatchField::pressureOutFvPatchField 92 | ( 93 | const pressureOutFvPatchField& ptf, 94 | const DimensionedField& iF 95 | ) 96 | : 97 | fvPatchField(ptf, iF), 98 | pressureOut_(ptf.pressureOut_) 99 | {} 100 | 101 | 102 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 103 | template 104 | void pressureOutFvPatchField::autoMap 105 | ( 106 | const fvPatchFieldMapper& m 107 | ) 108 | { 109 | fvPatchField::autoMap(m); 110 | } 111 | 112 | 113 | template 114 | void pressureOutFvPatchField::rmap 115 | ( 116 | const fvPatchField& ptf, 117 | const labelList& addr 118 | ) 119 | { 120 | fvPatchField::rmap(ptf, addr); 121 | 122 | const pressureOutFvPatchField& fgptf = 123 | refCast >(ptf); 124 | 125 | pressureOut_ = fgptf.pressureOut_; 126 | } 127 | 128 | template 129 | void pressureOutFvPatchField::evaluate(const Pstream::commsTypes) 130 | { 131 | if (!this->updated()) 132 | { 133 | this->updateCoeffs(); 134 | } 135 | 136 | // Do nothing 137 | 138 | //Info << inComingByRho_ << endl; 139 | fvPatchField::evaluate(); 140 | } 141 | 142 | 143 | template 144 | void pressureOutFvPatchField::write(Ostream& os) const 145 | { 146 | fvPatchField::write(os); 147 | this->writeEntry("value", os); 148 | os.writeKeyword("pressureOut") 149 | << pressureOut_ << token::END_STATEMENT << nl; 150 | } 151 | 152 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 153 | 154 | } // End namespace Foam 155 | 156 | // ************************************************************************* // 157 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/farFieldFvPatchField/farFieldFvPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "farFieldFvPatchField.H" 27 | 28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 29 | 30 | namespace Foam 31 | { 32 | 33 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 34 | 35 | template 36 | farFieldFvPatchField::farFieldFvPatchField 37 | ( 38 | const fvPatch& p, 39 | const DimensionedField& iF 40 | ) 41 | : 42 | fvPatchField(p, iF) 43 | {} 44 | 45 | 46 | template 47 | farFieldFvPatchField::farFieldFvPatchField 48 | ( 49 | const fvPatch& p, 50 | const DimensionedField& iF, 51 | const dictionary& dict 52 | ) 53 | : 54 | fvPatchField(p, iF, dict, true) 55 | {} 56 | 57 | 58 | template 59 | farFieldFvPatchField::farFieldFvPatchField 60 | ( 61 | const farFieldFvPatchField& ptf, 62 | const fvPatch& p, 63 | const DimensionedField& iF, 64 | const fvPatchFieldMapper& mapper 65 | ) 66 | : 67 | fvPatchField(ptf, p, iF, mapper) 68 | { 69 | if (&iF && mapper.hasUnmapped()) 70 | { 71 | WarningIn 72 | ( 73 | "farFieldFvPatchField::farFieldFvPatchField\n" 74 | "(\n" 75 | " const farFieldFvPatchField&,\n" 76 | " const fvPatch&,\n" 77 | " const DimensionedField&,\n" 78 | " const fvPatchFieldMapper&\n" 79 | ")\n" 80 | ) << "On field " << iF.name() << " patch " << p.name() 81 | << " patchField " << this->type() 82 | << " : mapper does not map all values." << nl 83 | << " To avoid this warning fully specify the mapping in derived" 84 | << " patch fields." << endl; 85 | } 86 | } 87 | 88 | 89 | template 90 | farFieldFvPatchField::farFieldFvPatchField 91 | ( 92 | const farFieldFvPatchField& ptf 93 | ) 94 | : 95 | fvPatchField(ptf) 96 | {} 97 | 98 | 99 | template 100 | farFieldFvPatchField::farFieldFvPatchField 101 | ( 102 | const farFieldFvPatchField& ptf, 103 | const DimensionedField& iF 104 | ) 105 | : 106 | fvPatchField(ptf, iF) 107 | {} 108 | 109 | 110 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 111 | 112 | template 113 | tmp > farFieldFvPatchField::valueInternalCoeffs 114 | ( 115 | const tmp& 116 | ) const 117 | { 118 | return tmp > 119 | ( 120 | new Field(this->size(), pTraits::zero) 121 | ); 122 | } 123 | 124 | 125 | template 126 | tmp > farFieldFvPatchField::valueBoundaryCoeffs 127 | ( 128 | const tmp& 129 | ) const 130 | { 131 | return *this; 132 | } 133 | 134 | 135 | template 136 | tmp > farFieldFvPatchField::gradientInternalCoeffs() const 137 | { 138 | return -pTraits::one*this->patch().deltaCoeffs(); 139 | } 140 | 141 | 142 | template 143 | tmp > farFieldFvPatchField::gradientBoundaryCoeffs() const 144 | { 145 | return this->patch().deltaCoeffs()*(*this); 146 | } 147 | 148 | 149 | template 150 | void farFieldFvPatchField::write(Ostream& os) const 151 | { 152 | fvPatchField::write(os); 153 | this->writeEntry("value", os); 154 | } 155 | 156 | 157 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 158 | 159 | } // End namespace Foam 160 | 161 | // ************************************************************************* // 162 | -------------------------------------------------------------------------------- /src/fvDVM/Venkatakrishnan/VenkatakrishnanLimitedGrad/VenkatakrishnanLimitedGrad.H: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | Class 25 | Foam::fv::VenkatakrishnanLimitedGrad 26 | 27 | Description 28 | VenkatakrishnanLimitedGrad gradient scheme applied to a runTime selected base gradient 29 | scheme. 30 | 31 | The scalar limiter based on limiting the extrapolated face values 32 | between the maximum and minumum cell and cell neighbour values and is 33 | applied to all components of the gradient. 34 | 35 | SourceFiles 36 | VenkatakrishnanLimitedGrad.C 37 | 38 | \*---------------------------------------------------------------------------*/ 39 | 40 | #ifndef VenkatakrishnanLimitedGrad_H 41 | #define VenkatakrishnanLimitedGrad_H 42 | 43 | #include "gradScheme.H" 44 | #include "VenkatakrishnanSlopeMulti.C" 45 | 46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 47 | 48 | namespace Foam 49 | { 50 | 51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 52 | 53 | namespace fv 54 | { 55 | 56 | /*---------------------------------------------------------------------------*\ 57 | Class VenkatakrishnanLimitedGrad Declaration 58 | \*---------------------------------------------------------------------------*/ 59 | 60 | template 61 | class VenkatakrishnanLimitedGrad 62 | : 63 | public fv::gradScheme 64 | { 65 | // Private Data 66 | 67 | 68 | 69 | //- Limiter coefficient 70 | tmp > basicGradScheme_; 71 | 72 | //- Venkatakrishnan slope for every edge 73 | VenkatakrishnanSlopeMultiLimiter VenSlope_; 74 | 75 | 76 | // Private Member Functions 77 | 78 | //- Disallow default bitwise copy construct 79 | VenkatakrishnanLimitedGrad(const VenkatakrishnanLimitedGrad&); 80 | 81 | //- Disallow default bitwise assignment 82 | void operator=(const VenkatakrishnanLimitedGrad&); 83 | 84 | 85 | public: 86 | 87 | //- RunTime type information 88 | TypeName("VenkatakrishnanLimited"); 89 | 90 | 91 | // Constructors 92 | 93 | //- Construct from mesh and schemeData 94 | VenkatakrishnanLimitedGrad(const fvMesh& mesh, Istream& schemeData) 95 | : 96 | gradScheme(mesh), 97 | basicGradScheme_(fv::gradScheme::New(mesh, schemeData)), 98 | VenSlope_(schemeData) 99 | { 100 | } 101 | 102 | 103 | // Member Functions 104 | 105 | //- Return the gradient of the given field to the gradScheme::grad 106 | // for optional caching 107 | virtual tmp 108 | < 109 | GeometricField 110 | ::type, fvPatchField, volMesh> 111 | > calcGrad 112 | ( 113 | const GeometricField& vsf, 114 | const word& name 115 | ) const; 116 | }; 117 | 118 | 119 | // * * * * * * * * * * * * Inline Member Function * * * * * * * * * * * * * // 120 | 121 | 122 | 123 | // * * * * * * * * Template Member Function Specialisations * * * * * * * * // 124 | 125 | template<> 126 | tmp VenkatakrishnanLimitedGrad::calcGrad 127 | ( 128 | const volScalarField& vsf, 129 | const word& name 130 | ) const; 131 | 132 | 133 | template<> 134 | tmp VenkatakrishnanLimitedGrad::calcGrad 135 | ( 136 | const volVectorField& vsf, 137 | const word& name 138 | ) const; 139 | 140 | 141 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 142 | 143 | } // End namespace fv 144 | 145 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 146 | 147 | } // End namespace Foam 148 | 149 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 150 | 151 | #endif 152 | 153 | // ************************************************************************* // 154 | -------------------------------------------------------------------------------- /src/fvDVM/fieldMPIreducer/fieldMPIreducer.C: -------------------------------------------------------------------------------- 1 | #include "foam_defs.h" 2 | #include "fieldMPIreducer.H" 3 | 4 | #if FOAM_MAJOR <= 3 5 | #define BOUNDARY_FIELD_REF boundaryField() 6 | #else 7 | #define BOUNDARY_FIELD_REF boundaryFieldRef() 8 | #endif 9 | 10 | fieldMPIreducer::fieldMPIreducer( 11 | Foam::argList &args, 12 | int *argc, 13 | char ***argv) : pd(1), nproc_(1), rank_(0), col_size(1), col_rank(0), dvParallel_(false) 14 | { 15 | 16 | args.optionReadIfPresent("pd", pd); 17 | if (args.optionFound("dvParallel")) 18 | { 19 | if(!args.optionFound("parallel")) { 20 | MPI_Init(argc, argv); 21 | } 22 | MPI_Comm_rank(MPI_COMM_WORLD, &rank_); 23 | MPI_Comm_size(MPI_COMM_WORLD, &nproc_); 24 | //physical parallel 25 | if (pd == nproc_) 26 | { 27 | rank_ = 0; 28 | nproc_ = 1; 29 | } 30 | else 31 | { 32 | dvParallel_ = true; 33 | MPI_Type_contiguous(3, MPI_DOUBLE, &vecType_); 34 | MPI_Type_contiguous(9, MPI_DOUBLE, &tensorType_); 35 | MPI_Type_commit(&vecType_); 36 | MPI_Type_commit(&tensorType_); 37 | MPI_Op_create((MPI_User_function *)vectorSum, 1, &opSumVec_); 38 | MPI_Op_create((MPI_User_function *)tensorSum, 1, &opSumTensor_); 39 | spilt_comm(vel_comm); 40 | } 41 | } 42 | } 43 | 44 | //velocity parallel only has one communicator(same color,rank_%pd=0) 45 | void fieldMPIreducer::spilt_comm(MPI_Comm &vel_comm) 46 | { 47 | int color = rank_ % pd; 48 | MPI_Comm_split(MPI_COMM_WORLD, color, rank_, &vel_comm); 49 | MPI_Comm_rank(vel_comm, &col_rank); 50 | MPI_Comm_size(vel_comm, &col_size); 51 | 52 | // printf("WORLD RANK/SIZE: %d/%d --- ROW RANK/SIZE: %d/%d\n", rank_, nproc_, col_rank, col_size); 53 | } 54 | 55 | fieldMPIreducer::~fieldMPIreducer() 56 | { 57 | if (pd < nproc_) 58 | MPI_Comm_free(&vel_comm); 59 | } 60 | 61 | void fieldMPIreducer::reduceField(volScalarField &vsf) 62 | { 63 | List vsfPart(vsf); 64 | MPI_Allreduce( 65 | vsfPart.data(), 66 | vsf.data(), 67 | vsf.size(), 68 | MPI_DOUBLE, 69 | MPI_SUM, 70 | vel_comm); 71 | } 72 | 73 | void fieldMPIreducer::reduceField(surfaceScalarField &ssf) 74 | { 75 | List ssfPart(ssf); 76 | MPI_Allreduce( 77 | ssfPart.data(), 78 | ssf.data(), 79 | ssf.size(), 80 | MPI_DOUBLE, 81 | MPI_SUM, 82 | vel_comm); 83 | forAll(ssf.boundaryField(), patchi) { 84 | if(ssf.boundaryField()[patchi].type()!="empty") { 85 | //Info< vvfPart(vvf); 94 | //Info< svfPart(svf); 109 | //Info< sfPart(sf); 126 | MPI_Allreduce( 127 | sfPart.data(), 128 | sf.data(), 129 | sf.size(), 130 | MPI_DOUBLE, 131 | MPI_SUM, 132 | vel_comm); 133 | } 134 | 135 | void fieldMPIreducer::reduceField(vectorField &vf) 136 | { 137 | List vfPart(vf); 138 | MPI_Allreduce( 139 | vfPart.data(), 140 | vf.data(), 141 | vf.size(), 142 | vecType_, 143 | opSumVec_, 144 | vel_comm); 145 | } 146 | 147 | void fieldMPIreducer::reduceField(tensorField &vf) 148 | { 149 | List vfPart(vf); 150 | MPI_Allreduce( 151 | vfPart.data(), 152 | vf.data(), 153 | vf.size(), 154 | tensorType_, 155 | opSumTensor_, 156 | vel_comm); 157 | } 158 | 159 | void fieldMPIreducer::vectorSum(vector *in, vector *inout, int *len, MPI_Datatype *dptr) 160 | { 161 | int i; 162 | for (i = 0; i < *len; ++i) 163 | { 164 | *inout = *in + *inout; 165 | in++; 166 | inout++; 167 | } 168 | } 169 | 170 | void fieldMPIreducer::tensorSum(tensor *in, tensor *inout, int *len, MPI_Datatype *dptr) 171 | { 172 | int i; 173 | for (i = 0; i < *len; ++i) 174 | { 175 | *inout = *in + *inout; 176 | in++; 177 | inout++; 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /src/fvDVM/zeroBoundaryGrad/zeroBoundaryGrad.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "zeroBoundaryGrad.H" 27 | #include "zeroBoundaryVectors.H" 28 | #include "gaussGrad.H" 29 | #include "fvMesh.H" 30 | #include "volMesh.H" 31 | #include "surfaceMesh.H" 32 | #include "GeometricField.H" 33 | #include "zeroGradientFvPatchField.H" 34 | 35 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 36 | 37 | template 38 | Foam::tmp 39 | < 40 | Foam::GeometricField 41 | < 42 | typename Foam::outerProduct::type, 43 | Foam::fvPatchField, 44 | Foam::volMesh 45 | > 46 | > 47 | Foam::fv::zeroBoundaryGrad::calcGrad 48 | ( 49 | const GeometricField& vsf, 50 | const word& name 51 | ) const 52 | { 53 | typedef typename outerProduct::type GradType; 54 | 55 | const fvMesh& mesh = vsf.mesh(); 56 | 57 | tmp > tlsGrad 58 | ( 59 | new GeometricField 60 | ( 61 | IOobject 62 | ( 63 | name, 64 | vsf.instance(), 65 | mesh, 66 | IOobject::NO_READ, 67 | IOobject::NO_WRITE 68 | ), 69 | mesh, 70 | dimensioned 71 | ( 72 | "zero", 73 | vsf.dimensions()/dimLength, 74 | pTraits::zero 75 | ), 76 | zeroGradientFvPatchField::typeName 77 | ) 78 | ); 79 | GeometricField lsGrad = tlsGrad(); 80 | 81 | // Get reference to least square vectors 82 | const zeroBoundaryVectors& lsv = zeroBoundaryVectors::New(mesh); 83 | 84 | const surfaceVectorField& ownLs = lsv.pVectors(); 85 | const surfaceVectorField& neiLs = lsv.nVectors(); 86 | 87 | const labelUList& own = mesh.owner(); 88 | const labelUList& nei = mesh.neighbour(); 89 | 90 | forAll(own, facei) 91 | { 92 | register label ownFaceI = own[facei]; 93 | register label neiFaceI = nei[facei]; 94 | 95 | Type deltaVsf = vsf[neiFaceI] - vsf[ownFaceI]; 96 | 97 | lsGrad[ownFaceI] += ownLs[facei]*deltaVsf; 98 | lsGrad[neiFaceI] -= neiLs[facei]*deltaVsf; 99 | } 100 | 101 | // Boundary faces 102 | forAll(vsf.boundaryField(), patchi) 103 | { 104 | const fvsPatchVectorField& patchOwnLs = ownLs.boundaryField()[patchi]; 105 | 106 | const labelUList& faceCells = 107 | lsGrad.boundaryField()[patchi].patch().faceCells(); 108 | 109 | if (vsf.boundaryField()[patchi].coupled()) 110 | { 111 | const Field neiVsf 112 | ( 113 | vsf.boundaryField()[patchi].patchNeighbourField() 114 | ); 115 | 116 | forAll(neiVsf, patchFaceI) 117 | { 118 | lsGrad[faceCells[patchFaceI]] += 119 | patchOwnLs[patchFaceI] 120 | *(neiVsf[patchFaceI] - vsf[faceCells[patchFaceI]]); 121 | } 122 | } 123 | else 124 | { 125 | //Ignore the boundary faces 126 | //const fvPatchField& patchVsf = vsf.boundaryField()[patchi]; 127 | 128 | //forAll(patchVsf, patchFaceI) 129 | //{ 130 | //lsGrad[faceCells[patchFaceI]] += 131 | //patchOwnLs[patchFaceI] 132 | //*(patchVsf[patchFaceI] - vsf[faceCells[patchFaceI]]); 133 | //} 134 | } 135 | } 136 | 137 | lsGrad.correctBoundaryConditions(); 138 | gaussGrad::correctBoundaryConditions(vsf, lsGrad); 139 | 140 | return tlsGrad; 141 | } 142 | 143 | 144 | // ************************************************************************* // 145 | -------------------------------------------------------------------------------- /doc/fancyhea.sty: -------------------------------------------------------------------------------- 1 | % fancyheadings.sty version 1.7 2 | % Fancy headers and footers. 3 | % Piet van Oostrum, Dept of Computer Science, University of Utrecht 4 | % Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands 5 | % Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!sun4nl!ruuinf!piet) 6 | % Sep 16, 1994 7 | % version 1.4: Correction for use with \reversemargin 8 | % Sep 29, 1994: 9 | % version 1.5: Added the \iftopfloat, \ifbotfloat and \iffloatpage commands 10 | % Oct 4, 1994: 11 | % version 1.6: Reset single spacing in headers/footers for use with 12 | % setspace.sty or doublespace.sty 13 | % Oct 4, 1994: 14 | % version 1.7: changed \let\@mkboth\markboth to 15 | % \def\@mkboth{\protect\markboth} to make it more robust 16 | 17 | \def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}} 18 | \def\@xlhead[#1]#2{\gdef\@elhead{#1}\gdef\@olhead{#2}} 19 | \def\@ylhead#1{\gdef\@elhead{#1}\gdef\@olhead{#1}} 20 | 21 | \def\chead{\@ifnextchar[{\@xchead}{\@ychead}} 22 | \def\@xchead[#1]#2{\gdef\@echead{#1}\gdef\@ochead{#2}} 23 | \def\@ychead#1{\gdef\@echead{#1}\gdef\@ochead{#1}} 24 | 25 | \def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}} 26 | \def\@xrhead[#1]#2{\gdef\@erhead{#1}\gdef\@orhead{#2}} 27 | \def\@yrhead#1{\gdef\@erhead{#1}\gdef\@orhead{#1}} 28 | 29 | \def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}} 30 | \def\@xlfoot[#1]#2{\gdef\@elfoot{#1}\gdef\@olfoot{#2}} 31 | \def\@ylfoot#1{\gdef\@elfoot{#1}\gdef\@olfoot{#1}} 32 | 33 | \def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}} 34 | \def\@xcfoot[#1]#2{\gdef\@ecfoot{#1}\gdef\@ocfoot{#2}} 35 | \def\@ycfoot#1{\gdef\@ecfoot{#1}\gdef\@ocfoot{#1}} 36 | 37 | \def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}} 38 | \def\@xrfoot[#1]#2{\gdef\@erfoot{#1}\gdef\@orfoot{#2}} 39 | \def\@yrfoot#1{\gdef\@erfoot{#1}\gdef\@orfoot{#1}} 40 | 41 | \newdimen\headrulewidth 42 | \newdimen\footrulewidth 43 | \newdimen\plainheadrulewidth 44 | \newdimen\plainfootrulewidth 45 | \newdimen\headwidth 46 | \newif\if@fancyplain \@fancyplainfalse 47 | \def\fancyplain#1#2{\if@fancyplain#1\else#2\fi} 48 | 49 | % Command to reset various things in the headers: 50 | % a.o. single spacing (taken from setspace.sty) 51 | % and the catcode of ^^M (so that epsf files in the header work if a 52 | % verbatim crosses a page boundary) 53 | \def\fancy@reset{\restorecr 54 | \def\baselinestretch{1}% 55 | \ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e 56 | \ifx\@currsize\normalsize\@normalsize\else\@currsize\fi% 57 | \else% NFSS (2.09) present 58 | \@newbaseline% 59 | \fi} 60 | 61 | % Initialization of the head and foot text. 62 | 63 | \headrulewidth 0.4pt 64 | \footrulewidth\z@ 65 | \plainheadrulewidth\z@ 66 | \plainfootrulewidth\z@ 67 | 68 | \lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}} 69 | % i.e. empty on ``plain'' pages \rightmark on even, \leftmark on odd pages 70 | \chead{} 71 | \rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}} 72 | % i.e. empty on ``plain'' pages \leftmark on even, \rightmark on odd pages 73 | \lfoot{} 74 | \cfoot{\rm\thepage} % page number 75 | \rfoot{} 76 | 77 | % Put together a header or footer given the left, center and 78 | % right text, fillers at left and right and a rule. 79 | % The \lap commands put the text into an hbox of zero size, 80 | % so overlapping text does not generate an errormessage. 81 | 82 | \def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\hbox 83 | {\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill 84 | \parbox[b]{\headwidth}{\centering#3\strut}\hfill 85 | \llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5} 86 | 87 | 88 | \def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\footrule 89 | \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill 90 | \parbox[t]{\headwidth}{\centering#3\strut}\hfill 91 | \llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5} 92 | 93 | \def\headrule{{\if@fancyplain\headrulewidth\plainheadrulewidth\fi 94 | \hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}} 95 | 96 | \def\footrule{{\if@fancyplain\footrulewidth\plainfootrulewidth\fi 97 | \vskip-0.3\normalbaselineskip\vskip-\footrulewidth 98 | \hrule\@width\headwidth\@height\footrulewidth\vskip0.3\normalbaselineskip}} 99 | 100 | \def\ps@fancy{ 101 | \def\@mkboth{\protect\markboth} 102 | \@ifundefined{chapter}{\def\sectionmark##1{\markboth 103 | {\uppercase{\ifnum \c@secnumdepth>\z@ 104 | \thesection\hskip 1em\relax \fi ##1}}{}} 105 | \def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne 106 | \thesubsection\hskip 1em\relax \fi ##1}}} 107 | {\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth>\m@ne 108 | \@chapapp\ \thechapter. \ \fi ##1}}{}} 109 | \def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@ 110 | \thesection. \ \fi ##1}}}} 111 | \ps@@fancy 112 | \global\let\ps@fancy\ps@@fancy 113 | \headwidth\textwidth} 114 | \def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy} 115 | \def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy} 116 | \def\ps@@fancy{ 117 | \def\@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd} 118 | \def\@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd} 119 | \def\@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd} 120 | \def\@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd} 121 | } 122 | \def\@lodd{\if@reversemargin\hss\else\relax\fi} 123 | \def\@rodd{\if@reversemargin\relax\else\hss\fi} 124 | 125 | \let\latex@makecol\@makecol 126 | \def\@makecol{\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol} 127 | \def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi} 128 | \def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi} 129 | \def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi} 130 | -------------------------------------------------------------------------------- /src/scripts/setDV.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys 3 | import numpy as np 4 | from numpy import linalg as LA 5 | 6 | def print_header_Xis(): 7 | return ''' 8 | /*--------------------------------*- C++ -*----------------------------------*\\ 9 | | ========= | | 10 | | \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 11 | | \\\\ / O peration | Version: 2.2.1 | 12 | | \\\\ / A nd | Web: www.OpenFOAM.org | 13 | | \\\\/ M anipulation | | 14 | \*---------------------------------------------------------------------------*/ 15 | FoamFile 16 | { 17 | version 2.0; 18 | format ascii; 19 | class dictionary; 20 | location "constant"; 21 | object Xis; 22 | } 23 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 24 | ''' 25 | 26 | def print_header_weights(): 27 | return ''' 28 | /*--------------------------------*- C++ -*----------------------------------*\\ 29 | | ========= | | 30 | | \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | 31 | | \\\\ / O peration | Version: 2.2.1 | 32 | | \\\\ / A nd | Web: www.OpenFOAM.org | 33 | | \\\\/ M anipulation | | 34 | \*---------------------------------------------------------------------------*/ 35 | FoamFile 36 | { 37 | version 2.0; 38 | format ascii; 39 | class dictionary; 40 | location "constant"; 41 | object weights; 42 | } 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 44 | ''' 45 | 46 | def print_help(): 47 | print ''' 48 | Usage exampels: 49 | 50 | 1. Using half-range Gasuu-Hermit quaderature points: 51 | setDV GH 408.1 28 52 | where 408 is the most probable molecular speed, and 28 is 53 | the number of discrete velocities in each velocity space directions. 54 | 55 | OR 56 | 57 | 2. Using compound Newton-Cotes rule: 58 | setDV NC 1600.0 41 59 | where 1600 is max discrete velocity in each velocity space directions, 60 | and 41 is number of directions velocity in each velocity space directions. 61 | NOTE: The number should be like 4*Z+1 where (Z=1,2,3.....). 62 | ''' 63 | 64 | def save_file(Xis, weights): 65 | print("Writting constant/Xis and constant/weights...\n") 66 | with open('constant/Xis','w') as f_Xi: 67 | f_Xi.write(print_header_Xis()) 68 | f_Xi.write(str(len(Xis))) 69 | f_Xi.write("\n(\n") 70 | for i in Xis: 71 | f_Xi.write("% 18.15e\n" % i) 72 | f_Xi.write(");") 73 | 74 | with open('constant/weights','w') as f_weight: 75 | f_weight.write(print_header_weights()) 76 | f_weight.write(str(len(weights))) 77 | f_weight.write("\n(\n") 78 | for i in weights: 79 | f_weight.write("% 18.15e\n" % i) 80 | f_weight.write(");") 81 | print("Writting Done!\n") 82 | 83 | def dvGH(C,N2): 84 | N = N2/2 85 | 86 | a = np.zeros(N) 87 | b = np.zeros(N) 88 | a[0] = 1.0/np.sqrt(np.pi) 89 | a[1] = 2.0/np.sqrt(np.pi)/(np.pi-2.0) 90 | b[1] = a[0]/( a[0] + a[1])/2.0 91 | 92 | for i in range(2,N): 93 | b[i] = (i-1)+1.0/2.0-b[i-1]-a[i-1]**2 94 | a[i] = (i**2/4.0/b[i]-b[i-1]-1.0/2)/a[i-1]-a[i-1] 95 | 96 | J = np.diag(a) + np.diag(np.sqrt(b[1:N]),1) \ 97 | + np.diag(np.sqrt(b[1:N]),-1) 98 | 99 | v,V = LA.eig(J) 100 | 101 | w = V[0,:]*V[0,:]*np.sqrt(np.pi)/2.0 102 | 103 | vw = np.transpose(np.vstack((v,w))) 104 | vw = vw[vw[:,0].argsort()] 105 | v = vw[:,0] 106 | w = vw[:,1] 107 | 108 | Xis = np.hstack((-np.flipud(v),v)) 109 | weights = np.hstack((np.flipud(w),w)) 110 | weights = weights*np.exp(Xis**2)*C 111 | Xis = Xis*C 112 | return (Xis, weights) 113 | 114 | def dvNC(xiMax,N): 115 | nXi = N 116 | xiMin = -xiMax 117 | dv = (xiMax - xiMin)/(nXi-1) 118 | nBy4 = (nXi-1)/4 119 | 120 | Xis = np.zeros(nXi) 121 | weights = np.zeros(nXi) 122 | 123 | for i in range(nXi): 124 | Xis[i] = xiMin + dv*i 125 | 126 | for i in range(nBy4): 127 | weights[4*i+0] = 14.0/90*4 128 | weights[4*i+1] = 32.0/90*4 129 | weights[4*i+2] = 12.0/90*4 130 | weights[4*i+3] = 32.0/90*4 131 | 132 | weights[0] = 7.0/90*4 133 | weights[nXi-1] = 7.0/90*4 134 | 135 | for i in range(nXi): 136 | weights[i] = dv*weights[i] 137 | 138 | return (Xis, weights) 139 | 140 | if __name__ == '__main__': 141 | if len(sys.argv) != 4 : 142 | print_help() 143 | exit() 144 | elif sys.argv[1] == 'GH': 145 | if int(sys.argv[3])%2 != 0 or int(sys.argv[3]) < 7: 146 | print("ERROR! Number of discrete velocity should be even, and at least 6.") 147 | print_help() 148 | exit() 149 | 150 | Xis, weights = dvGH(float(sys.argv[2]), int(sys.argv[3])) 151 | save_file(Xis, weights) 152 | elif sys.argv[1] == 'NC': 153 | if int(sys.argv[3])%4 != 1: 154 | print("The last number should be 4*Z+1, where Z = 1,2,3,...\n") 155 | print_help() 156 | exit() 157 | Xis, weights = dvNC(float(sys.argv[2]), int(sys.argv[3])) 158 | save_file(Xis, weights) 159 | else: 160 | print_help() 161 | exit() 162 | -------------------------------------------------------------------------------- /src/fvDVM/BCs/calculatedMaxwellFvPatchField/calculatedMaxwellFvPatchField.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include 27 | #include "calculatedMaxwellFvPatchField.H" 28 | #include "dictionary.H" 29 | 30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 31 | 32 | namespace Foam 33 | { 34 | 35 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 36 | 37 | template 38 | calculatedMaxwellFvPatchField::calculatedMaxwellFvPatchField 39 | ( 40 | const fvPatch& p, 41 | const DimensionedField& iF 42 | ) 43 | : 44 | fvPatchField(p, iF), 45 | inComingByRho_(p.size(), pTraits::zero), 46 | outGoing_(p.size(), pTraits::zero) 47 | {} 48 | 49 | 50 | template 51 | calculatedMaxwellFvPatchField::calculatedMaxwellFvPatchField 52 | ( 53 | const calculatedMaxwellFvPatchField& ptf, 54 | const fvPatch& p, 55 | const DimensionedField& iF, 56 | const fvPatchFieldMapper& mapper 57 | ) 58 | : 59 | fvPatchField(ptf, p, iF, mapper), 60 | inComingByRho_(ptf.inComingByRho_, mapper), 61 | outGoing_(ptf.inComingByRho_, mapper) 62 | {} 63 | 64 | 65 | template 66 | calculatedMaxwellFvPatchField::calculatedMaxwellFvPatchField 67 | ( 68 | const fvPatch& p, 69 | const DimensionedField& iF, 70 | const dictionary& dict 71 | ) 72 | : 73 | fvPatchField(p, iF, dict), 74 | inComingByRho_(p.size(), pTraits::zero), 75 | outGoing_(p.size(), pTraits::zero) 76 | { 77 | //evaluate(); 78 | //set field to scalar(1) 79 | //*this == scalar(1.0); 80 | Field::operator=(pTraits::one); 81 | } 82 | 83 | 84 | template 85 | calculatedMaxwellFvPatchField::calculatedMaxwellFvPatchField 86 | ( 87 | const calculatedMaxwellFvPatchField& ptf 88 | ) 89 | : 90 | fvPatchField(ptf), 91 | inComingByRho_(ptf.inComingByRho_), 92 | outGoing_(ptf.outGoing_) 93 | {} 94 | 95 | 96 | template 97 | calculatedMaxwellFvPatchField::calculatedMaxwellFvPatchField 98 | ( 99 | const calculatedMaxwellFvPatchField& ptf, 100 | const DimensionedField& iF 101 | ) 102 | : 103 | fvPatchField(ptf, iF), 104 | inComingByRho_(ptf.inComingByRho_), 105 | outGoing_(ptf.outGoing_) 106 | {} 107 | 108 | 109 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 110 | 111 | template 112 | void calculatedMaxwellFvPatchField::autoMap 113 | ( 114 | const fvPatchFieldMapper& m 115 | ) 116 | { 117 | fvPatchField::autoMap(m); 118 | inComingByRho_.autoMap(m); 119 | outGoing_.autoMap(m); 120 | } 121 | 122 | 123 | template 124 | void calculatedMaxwellFvPatchField::rmap 125 | ( 126 | const fvPatchField& ptf, 127 | const labelList& addr 128 | ) 129 | { 130 | fvPatchField::rmap(ptf, addr); 131 | 132 | const calculatedMaxwellFvPatchField& fgptf = 133 | refCast >(ptf); 134 | 135 | inComingByRho_.rmap(fgptf.inComingByRho_, addr); 136 | outGoing_.rmap(fgptf.outGoing_, addr); 137 | } 138 | 139 | template 140 | void calculatedMaxwellFvPatchField::evaluate(const Pstream::commsTypes) 141 | { 142 | if (!this->updated()) 143 | { 144 | this->updateCoeffs(); 145 | } 146 | 147 | //- Get global outgoing density flux at wall 148 | //Field outGoingPart(outGoing_); 149 | //MPI_Allreduce( 150 | //outGoingPart.data(), 151 | //outGoing_.data(), 152 | //outGoing_.size(), 153 | //MPI_DOUBLE, 154 | //MPI_SUM, 155 | //MPI_COMM_WORLD 156 | //); 157 | 158 | fvPatchField::operator==(outGoing_/mag(inComingByRho_)); 159 | //- Debug 160 | //Info << inComingByRho_ << endl; 161 | fvPatchField::evaluate(); 162 | // reset outGoing to zero 163 | outGoing_ = pTraits::zero; 164 | } 165 | 166 | template 167 | void calculatedMaxwellFvPatchField::write(Ostream& os) const 168 | { 169 | fvPatchField::write(os); 170 | this->writeEntry("value", os); 171 | } 172 | 173 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 174 | 175 | } // End namespace Foam 176 | 177 | // ************************************************************************* // 178 | -------------------------------------------------------------------------------- /src/fvDVM/zeroBoundaryGrad/unweightedLeastSquaresVectors.C: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*\ 2 | ========= | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 4 | \\ / O peration | 5 | \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation 6 | \\/ M anipulation | 7 | ------------------------------------------------------------------------------- 8 | License 9 | This file is part of OpenFOAM. 10 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by 13 | the Free Software Foundation, either version 3 of the License, or 14 | (at your option) any later version. 15 | 16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with OpenFOAM. If not, see . 23 | 24 | \*---------------------------------------------------------------------------*/ 25 | 26 | #include "zeroBoundaryVectors.H" 27 | #include "volFields.H" 28 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 30 | 31 | namespace Foam 32 | { 33 | defineTypeNameAndDebug(zeroBoundaryVectors, 0); 34 | } 35 | 36 | 37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 38 | 39 | Foam::zeroBoundaryVectors::leastSquaresVectors(const fvMesh& mesh) 40 | : 41 | MeshObject(mesh), 42 | pVectors_ 43 | ( 44 | IOobject 45 | ( 46 | "LeastSquaresP", 47 | mesh_.pointsInstance(), 48 | mesh_, 49 | IOobject::NO_READ, 50 | IOobject::NO_WRITE, 51 | false 52 | ), 53 | mesh_, 54 | dimensionedVector("zero", dimless/dimLength, vector::zero) 55 | ), 56 | nVectors_ 57 | ( 58 | IOobject 59 | ( 60 | "LeastSquaresN", 61 | mesh_.pointsInstance(), 62 | mesh_, 63 | IOobject::NO_READ, 64 | IOobject::NO_WRITE, 65 | false 66 | ), 67 | mesh_, 68 | dimensionedVector("zero", dimless/dimLength, vector::zero) 69 | ) 70 | { 71 | calcLeastSquaresVectors(); 72 | } 73 | 74 | 75 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // 76 | 77 | Foam::zeroBoundaryVectors::~leastSquaresVectors() 78 | {} 79 | 80 | 81 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 82 | 83 | void Foam::zeroBoundaryVectors::calcLeastSquaresVectors() 84 | { 85 | if (debug) 86 | { 87 | Info<< "zeroBoundaryVectors::calcLeastSquaresVectors() :" 88 | << "Calculating least square gradient vectors" 89 | << endl; 90 | } 91 | 92 | const fvMesh& mesh = mesh_; 93 | 94 | // Set local references to mesh data 95 | const labelUList& owner = mesh_.owner(); 96 | const labelUList& neighbour = mesh_.neighbour(); 97 | 98 | const volVectorField& C = mesh.C(); 99 | 100 | // Set up temporary storage for the dd tensor (before inversion) 101 | symmTensorField dd(mesh_.nCells(), symmTensor::zero); 102 | 103 | forAll(owner, facei) 104 | { 105 | label own = owner[facei]; 106 | label nei = neighbour[facei]; 107 | 108 | symmTensor wdd = sqr(C[nei] - C[own]); 109 | dd[own] += wdd; 110 | dd[nei] += wdd; 111 | } 112 | 113 | 114 | surfaceVectorField::GeometricBoundaryField& blsP = 115 | pVectors_.boundaryField(); 116 | 117 | forAll(blsP, patchi) 118 | { 119 | const fvsPatchVectorField& patchLsP = blsP[patchi]; 120 | 121 | const fvPatch& p = patchLsP.patch(); 122 | const labelUList& faceCells = p.patch().faceCells(); 123 | 124 | // Build the d-vectors 125 | vectorField pd(p.delta()); 126 | 127 | forAll(pd, patchFacei) 128 | { 129 | dd[faceCells[patchFacei]] += sqr(pd[patchFacei]); 130 | } 131 | } 132 | 133 | 134 | // Invert the dd tensor 135 | const symmTensorField invDd(inv(dd)); 136 | 137 | 138 | // Revisit all faces and calculate the pVectors_ and nVectors_ vectors 139 | forAll(owner, facei) 140 | { 141 | label own = owner[facei]; 142 | label nei = neighbour[facei]; 143 | 144 | vector d = C[nei] - C[own]; 145 | 146 | pVectors_[facei] = (invDd[own] & d); 147 | nVectors_[facei] = -(invDd[nei] & d); 148 | } 149 | 150 | forAll(blsP, patchi) 151 | { 152 | fvsPatchVectorField& patchLsP = blsP[patchi]; 153 | 154 | const fvPatch& p = patchLsP.patch(); 155 | const labelUList& faceCells = p.faceCells(); 156 | 157 | // Build the d-vectors 158 | vectorField pd(p.delta()); 159 | 160 | forAll(pd, patchFacei) 161 | { 162 | patchLsP[patchFacei] = 163 | (invDd[faceCells[patchFacei]] & pd[patchFacei]); 164 | } 165 | } 166 | 167 | if (debug) 168 | { 169 | Info<< "zeroBoundaryVectors::calcLeastSquaresVectors() :" 170 | << "Finished calculating least square gradient vectors" 171 | << endl; 172 | } 173 | } 174 | 175 | 176 | bool Foam::zeroBoundaryVectors::movePoints() 177 | { 178 | calcLeastSquaresVectors(); 179 | return true; 180 | } 181 | 182 | 183 | // ************************************************************************* // 184 | --------------------------------------------------------------------------------