Merge commit 'c8949a5f9e822ec508fd6c732ab0c089e507d27d'. Author: Hrvoje Jasak. Merge: Hrvoje Jasak.

Conflicts:
	src/foam/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C
This commit is contained in:
Hrvoje Jasak 2017-02-10 13:22:03 +00:00
commit 6e7e7ec622
296 changed files with 9668 additions and 3294 deletions

View file

@ -1,8 +1,8 @@
# -*- mode: org; -*- # -*- mode: org; -*-
# #
#+TITLE: *Cumulative List of Contributors for foam-extend-3.0* #+TITLE: *Cumulative List of Contributors for foam-extend
#+AUTHOR: Hrvoje Jasak. #+AUTHOR: Hrvoje Jasak.
#+DATE: 10 January 2014 #+DATE: 9 February 2017
#+LINK: http://foam-extend.org #+LINK: http://foam-extend.org
#+OPTIONS: author:nil #+OPTIONS: author:nil
@ -91,4 +91,7 @@ Contents:
Alexander Vakhrushev Alexander Vakhrushev
Vuko Vukcevic Vuko Vukcevic
Niklas Wikstrom Niklas Wikstrom
Celio Fernandes
Luis Ferras
Manoel de Araujo
J.Miguel Nobrega

View file

@ -40,8 +40,8 @@
# Requirements: # Requirements:
# 1: Your foam-extend environment must be properly initialized # 1: Your foam-extend environment must be properly initialized
# 2: AllMake.stage1 if you are overriding your system compiler # 2: AllMake.stage1 if you are overriding your system compiler
# 3: The file etc/prefs.sh should be used for setting the variables enabling # 3: The file etc/prefs.sh should be used for setting the variables
# the compilation of the various packages # enabling the compilation of the various packages
# #
# Author: # Author:
# Martin Beaudoin, Hydro-Quebec, (2015) # Martin Beaudoin, Hydro-Quebec, (2015)
@ -104,6 +104,13 @@ then
( rpm_make -p openmpi-1.8.8 -s openmpi-1.8.8.spec -u http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.8.tar.gz \ ( rpm_make -p openmpi-1.8.8 -s openmpi-1.8.8.spec -u http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.8.tar.gz \
-f --define '_configureAdditionalArgs "$WM_THIRD_PARTY_USE_OPENMPI_188_ConfigureAdditionalArgs"') -f --define '_configureAdditionalArgs "$WM_THIRD_PARTY_USE_OPENMPI_188_ConfigureAdditionalArgs"')
} }
# mvipich2-2.2
#
[ ! -z "$WM_THIRD_PARTY_USE_MVAPICH2_22" ] && {
echo "Building mvapich2 2.2"
( rpm_make -p mvapich2-2.2 -s mvapich2-2.2.spec -u http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2.tar.gz \
-f --define '_configureAdditionalArgs "$WM_THIRD_PARTY_USE_MVAPICH2_22_ConfigureAdditionalArgs"')
}
else else
echo "Using system installed OpenMPI" echo "Using system installed OpenMPI"
echo "" echo ""

View file

@ -0,0 +1,268 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration |
# \\ / A nd | For copyright notice see file Copyright
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of foam-extend.
#
# foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# RPM spec file for mvapich2-2.2
#
# Description
# RPM spec file for creating a relocatable RPM
#
# Author:
# Martin Beaudoin, Hydro-Quebec, (2015)
#
#------------------------------------------------------------------------------
# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable
%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)}
%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)}
# Disable the generation of debuginfo packages
%define debug_package %{nil}
# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory
%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild
%define _tmppath %{_topdir}/tmp
# Will install the package directly $WM_THIRD_PARTY_DIR
# Some comments about package relocation:
# By using this prefix for the Prefix: parameter in this file, you will make this
# package relocatable.
#
# This is fine, as long as your software is itself relocatable.
#
# Simply take note that libraries built with libtool are not relocatable because the
# prefix we specify will be hard-coded in the library .la files.
# Ref: http://sourceware.org/autobook/autobook/autobook_80.html
#
# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will
# not be able to reutilize this RPM, even though it is relocatable. You will need to
# regenerate the RPM.
#
%define _prefix %{_WM_THIRD_PARTY_DIR}
%define name mvapich2
%define release %{_WM_OPTIONS}
%define version 2.2
%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root
BuildRoot: %{buildroot}
Summary: mvapich2
License: BSD
Name: %{name}
Version: %{version}
Release: %{release}
URL: http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/
Source: %url/%{name}-%{version}.tar.gz
Prefix: %{_prefix}
Group: Development/Tools
%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
#--------------------------------------------------------------------------
#
# Here, we define default compiling options for mvapich2
#
# One can override the option on the commande line : --define='MACRO EXPR'
#
%{!?_configureAdditionalArgs: %define _configureAdditionalArgs Undefined}
%description
%{summary}
%prep
%setup -q
%build
# export WM settings in a form that GNU configure recognizes
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
set +x
echo ""
echo "Compilation options:"
echo " _configureAdditionalArgs : %{_configureAdditionalArgs}"
echo ""
set -x
unset mpiWith
# Enable GridEngine if it appears to be in use
# If you don't want any integration with SGE, simply unset the SGE
# environment variable
if [ -n "$SGE_ROOT" ]
then
mpiWith="$mpiWith --with-sge"
else
mpiWith="$mpiWith --without-sge"
mpiWith="$mpiWith --enable-mca-no-build=ras-gridengine,pls-gridengine"
fi
# Infiniband support
# Adjust according to your local paths
# if [ -d /usr/local/ofed -a -d /usr/local/ofed/lib64 ]
# then
# mpiWith="$mpiWith --with-openib=/usr/local/ofed"
# mpiWith="$mpiWith --with-openib-libdir=/usr/local/ofed/lib64"
# fi
# NOTE. Option --disable-mcast disables Infiniband when libs are not present
./configure \
--prefix=%{_installPrefix} \
--exec_prefix=%{_installPrefix} \
--enable-mpirun-prefix-by-default \
--enable-orterun-prefix-by-default \
--enable-shared \
--enable-mpi-cxx \
--disable-static \
--disable-mpi-f77 \
--disable-mpi-f90 \
--without-slurm \
--enable-mpi-profile $mpiWith \
--disable-vt \
echo %{?_configureAdditionalArgs}`
[ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1
make -j $WM_NCOMPPROCS
%install
make install DESTDIR=$RPM_BUILD_ROOT
# Creation of foam-extend specific .csh and .sh files"
echo ""
echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}"
echo ""
#
# Generate package specific .sh file for foam-extend
#
mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc
cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh
# Load %{name}-%{version} libraries and binaries
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export MVAPICH2_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
export MVAPICH2_BIN_DIR=\$MVAPICH2_DIR/bin
export MVAPICH2_LIB_DIR=\$MVAPICH2_DIR/lib
# Enable access to the package runtime applications and libraries
[ -d \$MVAPICH2_BIN_DIR ] && _foamAddPath \$MVAPICH2_BIN_DIR
[ -d \$MVAPICH2_LIB_DIR ] && _foamAddLib \$MVAPICH2_LIB_DIR
export MPI_HOME=\$MVAPICH2_DIR
export MPI_ARCH_PATH=\$MPI_HOME
export OPAL_PREFIX=\$MPI_ARCH_PATH
# We initialize the rest of the environment using mpicc --showme:
# This does not work with MVAPICH2
#export MVAPICH2_INCLUDE_DIR="\`mpicc --showme:incdirs\`"
#export MVAPICH2_COMPILE_FLAGS="\`mpicc --showme:compile\`"
#export MVAPICH2_LINK_FLAGS="\`mpicc --showme:link\`"
# Set the foam-extend compilation flags
export PINC=\$MVAPICH2_COMPILE_FLAGS
export PLIBS=\$MVAPICH2_LINK_FLAGS
if [ "\$FOAM_VERBOSE" -a "\$PS1" ]
then
echo " Environment variables defined for OpenMPI:"
echo " MVAPICH2_BIN_DIR : \$MVAPICH2_BIN_DIR"
echo " MVAPICH2_LIB_DIR : \$MVAPICH2_LIB_DIR"
echo " MVAPICH2_INCLUDE_DIR : \$MVAPICH2_INCLUDE_DIR"
echo " MVAPICH2_COMPILE_FLAGS : \$MVAPICH2_COMPILE_FLAGS"
echo " MVAPICH2_LINK_FLAGS : \$MVAPICH2_LINK_FLAGS"
echo ""
echo " MPI_HOME : \$MPI_HOME"
echo " MPI_ARCH_PATH : \$MPI_ARCH_PATH"
echo " OPAL_PREFIX : \$OPAL_PREFIX"
echo " PINC : \$PINC"
echo " PLIBS : \$PLIBS"
fi
DOT_SH_EOF
#
# Generate package specific .csh file for foam-extend
#
cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh
# Load %{name}-%{version} libraries and binaries
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv MVAPICH2_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
setenv MVAPICH2_BIN_DIR \$MVAPICH2_DIR/bin
setenv MVAPICH2_LIB_DIR \$MVAPICH2_DIR/lib
# Enable access to the package runtime applications and libraries
if ( -e \$MVAPICH2_BIN_DIR ) then
_foamAddPath \$MVAPICH2_BIN_DIR
endif
if ( -e \$MVAPICH2_LIB_DIR ) then
_foamAddLib \$MVAPICH2_LIB_DIR
endif
setenv MPI_HOME \$MVAPICH2_DIR
setenv MPI_ARCH_PATH \$MPI_HOME
setenv OPAL_PREFIX \$MPI_ARCH_PATH
# We initialize the rest of the environment using mpicc --showme:
setenv MVAPICH2_INCLUDE_DIR "\`mpicc --showme:incdirs\`"
setenv MVAPICH2_COMPILE_FLAGS "\`mpicc --showme:compile\`"
setenv MVAPICH2_LINK_FLAGS "\`mpicc --showme:link\`"
# Set the foam-extend compilation flags
setenv PINC "\$MVAPICH2_COMPILE_FLAGS"
setenv PLIBS "\$MVAPICH2_LINK_FLAGS"
if (\$?FOAM_VERBOSE && \$?prompt) then
echo " Environment variables defined for OpenMPI:"
echo " MVAPICH2_BIN_DIR : \$MVAPICH2_BIN_DIR"
echo " MVAPICH2_LIB_DIR : \$MVAPICH2_LIB_DIR"
echo " MVAPICH2_INCLUDE_DIR : \$MVAPICH2_INCLUDE_DIR"
echo " MVAPICH2_COMPILE_FLAGS : \$MVAPICH2_COMPILE_FLAGS"
echo " MVAPICH2_LINK_FLAGS : \$MVAPICH2_LINK_FLAGS"
echo ""
echo " MPI_HOME : \$MPI_HOME"
echo " MPI_ARCH_PATH : \$MPI_ARCH_PATH"
echo " OPAL_PREFIX : \$OPAL_PREFIX"
echo " PINC : \$PINC"
echo " PLIBS : \$PLIBS"
endif
DOT_CSH_EOF
#finally, generate a .tgz file for systems where using rpm for installing packages
# as a non-root user might be a problem.
(mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version})
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%{_installPrefix}

View file

@ -82,6 +82,7 @@ rpm_make()
echo "Package name : $_PACKAGE" echo "Package name : $_PACKAGE"
echo "Package URL : $_PACKAGE_URL" echo "Package URL : $_PACKAGE_URL"
echo "RPM spec file name: $_SPECFILE" echo "RPM spec file name: $_SPECFILE"
echo "RPM file name : $_RPMFILENAME"
echo "Additional flags : $_ADDITIONALFLAGS" echo "Additional flags : $_ADDITIONALFLAGS"
# Shift options # Shift options

View file

@ -13,7 +13,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
label inertIndex = -1; label inertIndex = -1;
volScalarField Yt("Yt", 0.0*Y[0]); volScalarField Yt("Yt", 0.0*Y[0]);
for (label i=0; i<Y.size(); i++) for (label i = 0; i < Y.size(); i++)
{ {
if (Y[i].name() != inertSpecie) if (Y[i].name() != inertSpecie)
{ {

View file

@ -3,6 +3,9 @@ rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H(); U = rUA*UEqn().H();
// Update boundary velocity for consistency with the flux
mrfZones.correctBoundaryVelocity(U);
if (pimple.nCorrPISO() <= 1) if (pimple.nCorrPISO() <= 1)
{ {
UEqn.clear(); UEqn.clear();

View file

@ -13,7 +13,7 @@
U = rUA*UEqn.H(); U = rUA*UEqn.H();
// Calculate phi for boundary conditions // Calculate phi for boundary conditions
phi = rhof*fvc::interpolate(U) & mesh.Sf(); phi = rhof*(fvc::interpolate(U) & mesh.Sf());
surfaceScalarField phid2 = rhoReff/rhof*phi; surfaceScalarField phid2 = rhoReff/rhof*phi;

View file

@ -12,6 +12,9 @@
{ {
U = rUA*UEqn.H(); U = rUA*UEqn.H();
// Update boundary velocity for consistency with the flux
mrfZones.correctBoundaryVelocity(U);
// Calculate phi for boundary conditions // Calculate phi for boundary conditions
phi = rhof*fvc::interpolate(U) & mesh.Sf(); phi = rhof*fvc::interpolate(U) & mesh.Sf();

View file

@ -12,6 +12,9 @@
{ {
U = rUA*UEqn.H(); U = rUA*UEqn.H();
// Update boundary velocity for consistency with the flux
mrfZones.correctBoundaryVelocity(U);
// Calculate phi for boundary conditions // Calculate phi for boundary conditions
phi = rhof*fvc::interpolate(U) & mesh.Sf(); phi = rhof*fvc::interpolate(U) & mesh.Sf();

View file

@ -1,13 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso conjugateHeatTransfer
wmake blockCoupledScalarTransportFoam
wmake conjugateHeatFoam
wmake conjugateHeatSimpleFoam
wmake pUCoupledFoam
wmake MRFPorousFoam
# ----------------------------------------------------------------- end-of-file

View file

@ -81,8 +81,30 @@ int main(int argc, char *argv[])
# include "couplingTerms.H" # include "couplingTerms.H"
// Solve the block matrix // Solve the block matrix
maxResidual = cmptMax(UpEqn.solve().initialResidual()); residual = UpEqn.solve();
maxResidual = cmptMax(residual.initialResidual());
// Check for divergence
if (mag(residual.finalResidual() - residual.initialResidual()) > 1)
{
Info<< "DIVERGENCE: rescue step" << endl;
// Solving potential flow equation and correcting velocities
phi = (fvc::interpolate(U) & mesh.Sf());
solve
(
tpEqn
==
- fvc::div(U)
);
phi += tpEqn().flux() + tpresSource;
U = fvc::reconstruct(phi);
}
else
{
// Retrieve solution // Retrieve solution
UpEqn.retrieveSolution(0, U.internalField()); UpEqn.retrieveSolution(0, U.internalField());
UpEqn.retrieveSolution(3, p.internalField()); UpEqn.retrieveSolution(3, p.internalField());
@ -91,6 +113,7 @@ int main(int argc, char *argv[])
p.correctBoundaryConditions(); p.correctBoundaryConditions();
phi = (fvc::interpolate(U) & mesh.Sf()) + tpEqn().flux() + tpresSource; phi = (fvc::interpolate(U) & mesh.Sf()) + tpEqn().flux() + tpresSource;
}
// Make flux relative in rotating zones // Make flux relative in rotating zones
mrfZones.relativeFlux(phi); mrfZones.relativeFlux(phi);

View file

@ -5,6 +5,9 @@
fvc::div(phi) fvc::div(phi)
); );
// Update boundary velocity for consistency with the flux
mrfZones.correctBoundaryVelocity(U);
// Momentum equation // Momentum equation
fvVectorMatrix UEqn fvVectorMatrix UEqn
( (
@ -49,9 +52,7 @@
trAU().rename("rAU"); trAU().rename("rAU");
} }
// Insert the additional components. Note this will destroy the H and A // Under-relax momentum. Note this will destroy the H and A
UEqn += fvm::SuSp(-divPhi, U) + divPhi*U;
UEqn.relax(); UEqn.relax();
// Insert momentum equation // Insert momentum equation
@ -67,11 +68,20 @@
const scalarField& V = mesh.V().field(); const scalarField& V = mesh.V().field();
// Note: this insertion should only happen in porous cell zones // Note: insertion should only happen in porous cell zones
// A rewrite of the porousZones class interface is needed.
// HJ, 14/Mar/2016 // HJ, 14/Mar/2016
forAll (TUIn, cellI)
register label cellI;
forAll (pZones, pZoneI)
{ {
const labelList& curZoneCells = pZones[pZoneI].zone();
// Loop over all cells in the zone
forAll (curZoneCells, zcI)
{
cellI = curZoneCells[zcI];
const scalar& cellV = V[cellI]; const scalar& cellV = V[cellI];
const tensor& cellTU = TUIn[cellI]; const tensor& cellTU = TUIn[cellI];
@ -91,4 +101,5 @@
cellDD(2, 2) += cellV*cellTU.zz(); cellDD(2, 2) += cellV*cellTU.zz();
} }
} }
}
} }

View file

@ -1,4 +1,5 @@
// initialize values for convergence checks // initialize values for convergence checks
BlockSolverPerformance<vector4> residual;
scalar maxResidual = 0; scalar maxResidual = 0;
scalar convergenceCriterion = 0; scalar convergenceCriterion = 0;

View file

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I../conjugateHeatTransfer/lnInclude \
-I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
@ -7,8 +6,9 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/coupledMatrix/lnInclude \ -I$(LIB_SRC)/coupledMatrix/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude -I$(LIB_SRC)/conjugateHeatTransfer/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lincompressibleTurbulenceModel \ -lincompressibleTurbulenceModel \

View file

@ -20,9 +20,6 @@
+ 3.0*radiation->Rp()*pow4(T) + 3.0*radiation->Rp()*pow4(T)
); );
//Done automatically in 1.6.1-ext
//TFluidEqn->boundaryManipulate(T.boundaryField());
fvScalarMatrix* TSolidEqn = new fvScalarMatrix fvScalarMatrix* TSolidEqn = new fvScalarMatrix
( (
fvm::ddt(rhoCpsolid, Tsolid) fvm::ddt(rhoCpsolid, Tsolid)
@ -30,10 +27,6 @@
+ fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid) + fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid)
); );
//Done automatically in 1.6.1-ext
//TSolidEqn->boundaryManipulate(Tsolid.boundaryField());
// Add fluid equation // Add fluid equation
TEqns.set(0, TFluidEqn); TEqns.set(0, TFluidEqn);

View file

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I../conjugateHeatTransfer/lnInclude \
-I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
@ -7,8 +6,9 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/coupledMatrix/lnInclude \ -I$(LIB_SRC)/coupledMatrix/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude -I$(LIB_SRC)/conjugateHeatTransfer/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lincompressibleTurbulenceModel \ -lincompressibleTurbulenceModel \

View file

@ -14,9 +14,7 @@
rAU = 1.0/UEqn.A(); rAU = 1.0/UEqn.A();
// Insert the additional components. Note this will destroy the H and A // Under-relax momentum. Note this will destroy the H and A
UEqn += fvm::SuSp(-divPhi, U) + divPhi*U;
UEqn.relax(); UEqn.relax();
UpEqn.insertEquation(0, UEqn); UpEqn.insertEquation(0, UEqn);

View file

@ -1,6 +1,6 @@
Info << "Reading field p\n" << endl; Info << "Reading field p\n" << endl;
volScalarField p volScalarField p
( (
IOobject IOobject
( (
"p", "p",
@ -10,11 +10,11 @@ volScalarField p
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh mesh
); );
Info << "Reading field U\n" << endl; Info << "Reading field U\n" << endl;
volVectorField U volVectorField U
( (
IOobject IOobject
( (
"U", "U",
@ -24,21 +24,22 @@ volVectorField U
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh mesh
); );
#include "createPhi.H" # include "createPhi.H"
singlePhaseTransportModel laminarTransport(U, phi); singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
( autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport) incompressible::RASModel::New(U, phi, laminarTransport)
); );
// Block vector field for velocity (first entry) and pressure (second // Block vector field for velocity (first entry) and pressure (second
// entry). // entry).
Info << "Creating field Up\n" << endl; Info << "Creating field Up\n" << endl;
volVector4Field Up volVector4Field Up
( (
IOobject IOobject
( (
"Up", "Up",
@ -49,11 +50,11 @@ volVector4Field Up
), ),
mesh, mesh,
dimensionedVector4("zero", dimless, vector4::zero) dimensionedVector4("zero", dimless, vector4::zero)
); );
Info<< "Creating field rAU\n" << endl; Info<< "Creating field rAU\n" << endl;
volScalarField rAU volScalarField rAU
( (
IOobject IOobject
( (
"rAU", "rAU",
@ -64,6 +65,7 @@ volScalarField rAU
), ),
mesh, mesh,
runTime.deltaT() runTime.deltaT()
); );
mesh.schemesDict().setFluxRequired(p.name()); mesh.schemesDict().setFluxRequired(p.name());
mesh.schemesDict().setFluxRequired("pcorr");

View file

@ -61,53 +61,13 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {
// Momentum predictor # include "UEqn.H"
# include "pEqn.H"
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff()
);
mrfZones.addCoriolis(UEqn());
UEqn().relax();
solve(UEqn() == -fvc::grad(p));
volScalarField rAU = 1.0/UEqn().A();
U = rAU*UEqn().H();
UEqn.clear();
phi = fvc::interpolate(U, "interpolate(HbyA)") & mesh.Sf();
mrfZones.relativeFlux(phi);
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}
} }
# include "continuityErrs.H" // Calculate relative velocity
Urel == U;
// Explicitly relax pressure for momentum corrector mrfZones.relativeVelocity(Urel);
p.relax();
// Momentum corrector
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
turbulence->correct(); turbulence->correct();

View file

@ -0,0 +1,19 @@
// Solve the momentum equation
tmp<fvVectorMatrix> HUEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff()
);
mrfZones.addCoriolis(HUEqn());
// Get under-relaxation factor
const scalar UUrf = mesh.solutionDict().equationRelaxationFactor(U.name());
// Momentum solution
solve
(
relax(HUEqn(), UUrf)
==
-fvc::grad(p)
);

View file

@ -44,3 +44,19 @@
MRFZones mrfZones(mesh); MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U); mrfZones.correctBoundaryVelocity(U);
// Create Urel as a permanent field to make it available for on-the-fly
// post-processing operations
volVectorField Urel
(
IOobject
(
"Urel",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U
);
mrfZones.relativeVelocity(Urel);

View file

@ -0,0 +1,54 @@
{
p.boundaryField().updateCoeffs();
// Prepare clean 1/Ap without contribution from under-relaxation
// HJ, 26/Oct/2015
volScalarField rAU
(
"(1|A(U))",
1/HUEqn().A()
);
// Update boundary velocity for consistency with the flux
// This is needed for a ramped MRF
mrfZones.correctBoundaryVelocity(U);
// Store velocity under-relaxation point before using U for
// the flux precursor
U.storePrevIter();
U = rAU*HUEqn().H();
HUEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
mrfZones.relativeFlux(phi);
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
// Note: since under-relaxation does not change aU, H/a in U can be
// re-used. HJ, 22/Jan/2016
U = UUrf*(U - rAU*fvc::grad(p)) + (1 - UUrf)*U.prevIter();
U.correctBoundaryConditions();
}

View file

@ -1,8 +1,9 @@
{
p.boundaryField().updateCoeffs(); p.boundaryField().updateCoeffs();
// Prepare clean 1/Ap without contribution from under-relaxation // Prepare clean 1/Ap without contribution from under-relaxation
// HJ, 26/Oct/2015 // HJ, 26/Oct/2015
volScalarField rUA volScalarField rAU
( (
"(1|A(U))", "(1|A(U))",
1/HUEqn().A() 1/HUEqn().A()
@ -12,8 +13,9 @@
// the flux precursor // the flux precursor
U.storePrevIter(); U.storePrevIter();
U = rUA*HUEqn().H(); U = rAU*HUEqn().H();
HUEqn.clear(); HUEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf(); phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
@ -22,7 +24,7 @@
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(rAU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -43,6 +45,6 @@
// Momentum corrector // Momentum corrector
// Note: since under-relaxation does not change aU, H/a in U can be // Note: since under-relaxation does not change aU, H/a in U can be
// re-used. HJ, 22/Jan/2016 // re-used. HJ, 22/Jan/2016
U = UUrf*(U - rUA*fvc::grad(p)) + (1 - UUrf)*U.prevIter(); U = UUrf*(U - rAU*fvc::grad(p)) + (1 - UUrf)*U.prevIter();
U.correctBoundaryConditions(); U.correctBoundaryConditions();
}

View file

@ -4,6 +4,9 @@
U = rUA*UEqn.H(); U = rUA*UEqn.H();
// Update boundary velocity for consistency with the flux
mrfZones.correctBoundaryVelocity(U);
surfaceScalarField phiU surfaceScalarField phiU
( (
"phiU", "phiU",

View file

@ -314,6 +314,26 @@ int main(int argc, char *argv[])
} }
} }
if (args.optionFound("addEmptyPatch"))
{
word emptyPatchName(args.optionLookup("addEmptyPatch")());
dictionary emptyPatchDict;
emptyPatchDict.add("type", "empty");
emptyPatchDict.add("edgeLabels", labelList());
emptyPatchDict.add("ngbPolyPatchIndex", -1);
faPatchLst.append
(
faPatch::New
(
emptyPatchName,
emptyPatchDict,
faPatchLst.size(),
areaMesh.boundary()
).ptr()
);
}
Info << "Add faPatches ... "; Info << "Add faPatches ... ";
areaMesh.addFaPatches(List<faPatch*>(faPatchLst)); areaMesh.addFaPatches(List<faPatch*>(faPatchLst));
Info << "Done" << endl; Info << "Done" << endl;

View file

@ -119,12 +119,12 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
Foam::word regionName = polyMesh::defaultRegion; word regionName = polyMesh::defaultRegion;
if (args.optionReadIfPresent("region", regionName)) if (args.optionReadIfPresent("region", regionName))
{ {
Info<< "Selecting region " << regionName << " for time = " Info<< "Selecting region " << regionName << " for time = "
<< runTime.timeName() << Foam::nl << Foam::endl; << runTime.timeName() << nl << endl;
} }
// Set all times on processor meshes equal to reconstructed mesh // Set all times on processor meshes equal to reconstructed mesh

View file

@ -46,7 +46,6 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
dimensionedScalar rhoRef dimensionedScalar rhoRef
( (
"rhoRef", "rhoRef",

View file

@ -53,6 +53,21 @@ for i in range(1,len(t)):
my[i] += mvy[i] my[i] += mvy[i]
mz[i] += mvz[i] mz[i] += mvz[i]
# write clean data file
outForces=open('forces.dat','w')
for data in zip(t,fx,fy,fz):
outForces.write(' '.join([str(d) for d in data])+'\n')
outForces.close()
outMoments=open('moments.dat','w')
for data in zip(t,mx,my,mz):
outMoments.write(' '.join([str(d) for d in data])+'\n')
outMoments.close()
# plot forces # plot forces
import pylab import pylab
pylab.xlabel('iteration') pylab.xlabel('iteration')

View file

@ -62,6 +62,7 @@ for line in lines:
tepsilon.append(iepsilon) tepsilon.append(iepsilon)
epsilon.append(float(matchepsilon.group(2))) epsilon.append(float(matchepsilon.group(2)))
# write clean data file
outfile=open('residual.dat','w') outfile=open('residual.dat','w')
if iomega > 0: if iomega > 0:

View file

@ -91,11 +91,11 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_DIR/ThirdParty
# Use 'set' and 'unset' to adjust for your environent # Use 'set' and 'unset' to adjust for your environent
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# For AllMake.stage1 # For AllMake.stage1
export WM_THIRD_PARTY_USE_CMAKE_322=1 #export WM_THIRD_PARTY_USE_CMAKE_322=1
# #
# For AllMake.stage2 # For AllMake.stage2
export WM_THIRD_PARTY_USE_OPENMPI_165=1 export WM_THIRD_PARTY_USE_OPENMPI_188=1
# #
# For AllMake.stage3 # For AllMake.stage3

View file

@ -77,11 +77,11 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_DIR/ThirdParty
# This can be overriden in prefs.sh # This can be overriden in prefs.sh
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# For AllMake.stage1 # For AllMake.stage1
setenv WM_THIRD_PARTY_USE_CMAKE_322 1 #setenv WM_THIRD_PARTY_USE_CMAKE_322 1
# #
# For AllMake.stage2 # For AllMake.stage2
setenv WM_THIRD_PARTY_USE_OPENMPI_165 1 setenv WM_THIRD_PARTY_USE_OPENMPI_188 1
# #
# For AllMake.stage3 # For AllMake.stage3
@ -152,7 +152,7 @@ if ( ! $?WM_PRECISION_OPTION ) setenv WM_PRECISION_OPTION DP
# WM_COMPILE_OPTION = Opt | Debug | Prof # WM_COMPILE_OPTION = Opt | Debug | Prof
if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt
#setenv WM_COMPILE_OPTION Opt setenv WM_COMPILE_OPTION Opt
#setenv WM_COMPILE_OPTION Debug #setenv WM_COMPILE_OPTION Debug
# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI | MVAPICH2 # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI | MVAPICH2

View file

@ -210,6 +210,9 @@ setenv WM_THIRD_PARTY_USE_OPENMPI_188 1
#setenv WM_THIRD_PARTY_USE_OPENMPI_15 1 #setenv WM_THIRD_PARTY_USE_OPENMPI_15 1
#setenv WM_THIRD_PARTY_USE_OPENMPI_143 1 #setenv WM_THIRD_PARTY_USE_OPENMPI_143 1
#setenv WM_THIRD_PARTY_USE_OPENMPI_141 1 #setenv WM_THIRD_PARTY_USE_OPENMPI_141 1
#setenv WM_THIRD_PARTY_USE_MVAPICH2_22 1
#setenv WM_THIRD_PARTY_USE_MVAPICH2_22_ConfigureAdditionalArgs '--disable-mcast'
# #
# For AllMake.stage3 # For AllMake.stage3

View file

@ -220,6 +220,9 @@ export WM_THIRD_PARTY_USE_OPENMPI_188=1
#export WM_THIRD_PARTY_USE_OPENMPI_15=1 #export WM_THIRD_PARTY_USE_OPENMPI_15=1
#export WM_THIRD_PARTY_USE_OPENMPI_143=1 #export WM_THIRD_PARTY_USE_OPENMPI_143=1
#export WM_THIRD_PARTY_USE_OPENMPI_141=1 #export WM_THIRD_PARTY_USE_OPENMPI_141=1
#export WM_THIRD_PARTY_USE_MVAPICH2_22=1
#export WM_THIRD_PARTY_USE_MVAPICH2_22_ConfigureAdditionalArgs='--disable-mcast'
# #
# For AllMake.stage3 # For AllMake.stage3

View file

@ -576,8 +576,8 @@ endif
# zoltan # zoltan
# ~~~~~ # ~~~~~
if ( $?ZOLTAN_SYSTEM == 0 && $?WM_THIRD_PARTY_USE_ZOLTAN_36 != 0 && -e "$WM_THIRD_PARTY_DIR"/packages/zoltan-3.6/platforms/$WM_OPTIONS ) then if ( $?ZOLTAN_SYSTEM == 0 && $?WM_THIRD_PARTY_USE_ZOLTAN_35 != 0 && -e "$WM_THIRD_PARTY_DIR"/packages/zoltan-3.5/platforms/$WM_OPTIONS ) then
_foamSource $WM_THIRD_PARTY_DIR/packages/zoltan-3.6/platforms/$WM_OPTIONS/etc/zoltan-3.6.csh _foamSource $WM_THIRD_PARTY_DIR/packages/zoltan-3.5/platforms/$WM_OPTIONS/etc/zoltan-3.5.csh
endif endif
# Python # Python

View file

@ -375,22 +375,16 @@ SYSTEMOPENMPI)
unset mpi_version unset mpi_version
;; ;;
MVAPICH2) MVAPICH2)
mpi_version=mvapich2 mpi_version=mvapich2-2.2
if [ ! -z $WM_THIRD_PARTY_USE_MVAPICH2_20 ] && [ -e $WM_THIRD_PARTY_DIR/packages/mvapich2-2.2/platforms/$WM_OPTIONS ]
if [ -n "${MVAPICH2_BIN_DIR}" ] && [ -d "${MVAPICH2_BIN_DIR}" ]
then then
_foamAddPath $MVAPICH2_BIN_DIR if [ "$FOAM_VERBOSE" -a "$PS1" ]
else then
MVAPICH2_BIN_DIR=$(dirname `which mpicc`) echo "Using mvapich2 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
fi fi
_foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
if which mpicc >/dev/null
then
mpicc -v 2>/dev/null | grep -q "mpicc for MVAPICH2" ||
echo "Warning: `which mpicc` does not appear to be for MVAPICH2"
else
echo "Warning: mpicc not available"
fi fi
export MPI_HOME=`dirname $MVAPICH2_BIN_DIR` export MPI_HOME=`dirname $MVAPICH2_BIN_DIR`

View file

@ -59,6 +59,8 @@ thermophysicalModels/Allwmake
transportModels/Allwmake transportModels/Allwmake
turbulenceModels/Allwmake turbulenceModels/Allwmake
lagrangian/Allwmake lagrangian/Allwmake
wmake libso conjugateHeatTransfer
postProcessing/Allwmake postProcessing/Allwmake
conversion/Allwmake conversion/Allwmake

View file

@ -60,7 +60,7 @@ class chtRcTemperatureFvPatchScalarField
word kName_; word kName_;
//- Take radiation into account for this patch //- Take radiation into account for this patch
bool radiation_; Switch radiation_;
public: public:
@ -86,7 +86,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given chtRcTemperatureFvPatchScalarField onto a new patch //- Construct by mapping given chtRcTemperatureFvPatchScalarField
// onto a new patch
chtRcTemperatureFvPatchScalarField chtRcTemperatureFvPatchScalarField
( (
const chtRcTemperatureFvPatchScalarField&, const chtRcTemperatureFvPatchScalarField&,
@ -128,8 +129,26 @@ public:
// Access functions // Access functions
//- Return kName
const word& kName() const
{
return kName_;
}
//- Return access to kName
word& kName()
{
return kName_;
}
//- Return radiation //- Return radiation
bool radiation() const const Switch& radiation() const
{
return radiation_;
}
//- Return access to radiation
Switch& radiation()
{ {
return radiation_; return radiation_;
} }
@ -158,7 +177,6 @@ public:
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View file

@ -36,14 +36,10 @@ Author
#include "radiationConstants.H" #include "radiationConstants.H"
#include "VectorN.H" #include "VectorN.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField Foam::chtRcThermalDiffusivityFvPatchScalarField::
chtRcThermalDiffusivityFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -53,7 +49,8 @@ chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarF
{} {}
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField Foam::chtRcThermalDiffusivityFvPatchScalarField::
chtRcThermalDiffusivityFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -64,7 +61,8 @@ chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarF
{} {}
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField Foam::chtRcThermalDiffusivityFvPatchScalarField::
chtRcThermalDiffusivityFvPatchScalarField
( (
const chtRcThermalDiffusivityFvPatchScalarField& ptf, const chtRcThermalDiffusivityFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -76,7 +74,8 @@ chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarF
{} {}
chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField Foam::chtRcThermalDiffusivityFvPatchScalarField::
chtRcThermalDiffusivityFvPatchScalarField
( (
const chtRcThermalDiffusivityFvPatchScalarField& ptf, const chtRcThermalDiffusivityFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -88,7 +87,7 @@ chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarF
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void chtRcThermalDiffusivityFvPatchScalarField::evaluate void Foam::chtRcThermalDiffusivityFvPatchScalarField::evaluate
( (
const Pstream::commsTypes const Pstream::commsTypes
) )
@ -97,7 +96,7 @@ void chtRcThermalDiffusivityFvPatchScalarField::evaluate
} }
void chtRcThermalDiffusivityFvPatchScalarField::updateCoeffs() void Foam::chtRcThermalDiffusivityFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -109,16 +108,18 @@ void chtRcThermalDiffusivityFvPatchScalarField::updateCoeffs()
void void
chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity Foam::chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity
( (
chtRegionCoupleBase& owner, chtRegionCoupleBase& owner,
const chtRegionCoupleBase& neighbour const chtRegionCoupleBase& neighbour
) const ) const
{ {
if(debug) if (debug)
{ {
Info << "In chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity on " InfoIn
<< this->dimensionedInternalField().name() (
"chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity"
) << "for field " << this->dimensionedInternalField().name()
<< " in " << this->patch().boundaryMesh().mesh().name() << " in " << this->patch().boundaryMesh().mesh().name()
<< endl; << endl;
} }
@ -158,19 +159,19 @@ chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity
const scalarField& lfNei = neighbour.originalPatchField(); const scalarField& lfNei = neighbour.originalPatchField();
scalarField lTcNei = TwOwn.shadowPatchField().patchInternalField(); scalarField lTcNei = TwOwn.shadowPatchField().patchInternalField();
forAll(lData, facei) forAll (lData, facei)
{ {
lData[facei][0] = lTcNei[facei]; lData[facei][0] = lTcNei[facei];
lData[facei][1] = lfNei[facei]; lData[facei][1] = lfNei[facei];
} }
if(TwOwn.shadowPatchField().radiation()) if (TwOwn.shadowPatchField().radiation())
{ {
const scalarField& lQrNei = const scalarField& lQrNei =
owner.lookupShadowPatchField<volScalarField, scalar>("Qr"); owner.lookupShadowPatchField<volScalarField, scalar>("Qr");
const scalarField& lTwNei = TwOwn.shadowPatchField(); const scalarField& lTwNei = TwOwn.shadowPatchField();
forAll(lData, facei) forAll (lData, facei)
{ {
lData[facei][2] = lTwNei[facei]; lData[facei][2] = lTwNei[facei];
lData[facei][3] = lQrNei[facei]; lData[facei][3] = lQrNei[facei];
@ -180,15 +181,15 @@ chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity
const Field<VectorN<scalar, 4> > iData = const Field<VectorN<scalar, 4> > iData =
owner.regionCouplePatch().interpolate(lData); owner.regionCouplePatch().interpolate(lData);
forAll(iData, facei) forAll (iData, facei)
{ {
TcNei[facei] = iData[facei][0]; TcNei[facei] = iData[facei][0];
fNei[facei] = iData[facei][1]; fNei[facei] = iData[facei][1];
} }
if(TwOwn.shadowPatchField().radiation()) if (TwOwn.shadowPatchField().radiation())
{ {
forAll(iData, facei) forAll (iData, facei)
{ {
Qr[facei] += iData[facei][3]; Qr[facei] += iData[facei][3];
fourQro[facei] += fourQro[facei] +=
@ -205,46 +206,35 @@ chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity
const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index());
const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index());
//Info << "kOwn = " << kOwn << endl;
//Info << "kNei = " << kNei << endl;
//Info << "TcOwn = " << TcOwn << endl;
//Info << "TcNei = " << TcNei << endl;
//Info << "DeltaT = " << TcNei - TcOwn << endl;
//Info << "Qr = " << Qr << endl;
//Info << "kOwn + kNei = " << (kOwn + kNei) << endl;
//Info << "k = " << k << endl;
k = kOwn*(TwOwn*(kNei*(TcNei - TcOwn) + Qr + fourQro) - TcOwn*fourQro); k = kOwn*(TwOwn*(kNei*(TcNei - TcOwn) + Qr + fourQro) - TcOwn*fourQro);
k /= stabilise((fourQro + TwOwn*(kOwn + kNei))*(TcNei - TcOwn), SMALL); k /= stabilise((fourQro + TwOwn*(kOwn + kNei))*(TcNei - TcOwn), SMALL);
k /= p.deltaCoeffs(); k /= p.deltaCoeffs();
//Info << "k = " << k << endl; //Info << "k = " << k << endl;
forAll(k, facei) forAll (k, facei)
{ {
k[facei] = max(min(k[facei], 100*kHarm[facei]), 0.01*kHarm[facei]); k[facei] = max(min(k[facei], 100*kHarm[facei]), 0.01*kHarm[facei]);
} }
//Info << "k = " << k << endl;
owner.fvPatchScalarField::updateCoeffs(); owner.fvPatchScalarField::updateCoeffs();
} }
void void
chtRcThermalDiffusivityFvPatchScalarField::calcTemperature Foam::chtRcThermalDiffusivityFvPatchScalarField::calcTemperature
( (
chtRcTemperatureFvPatchScalarField& TwOwn, chtRcTemperatureFvPatchScalarField& TwOwn,
const chtRcTemperatureFvPatchScalarField& neighbour, const chtRcTemperatureFvPatchScalarField& neighbour,
const chtRegionCoupleBase& ownerK const chtRegionCoupleBase& ownerK
) const ) const
{ {
if(debug) if (debug)
{ {
Info << "In chtRcThermalDiffusivityFvPatchScalarField::calcTemperature on " InfoIn
<< this->dimensionedInternalField().name() (
"chtRcThermalDiffusivityFvPatchScalarField::calcTemperature"
) << "for field " << this->dimensionedInternalField().name()
<< " in " << this->patch().boundaryMesh().mesh().name() << " in " << this->patch().boundaryMesh().mesh().name()
<< endl; << endl;
} }
@ -280,19 +270,19 @@ chtRcThermalDiffusivityFvPatchScalarField::calcTemperature
scalarField lTcNei = scalarField lTcNei =
TwOwn.shadowPatchField().patchInternalField(); TwOwn.shadowPatchField().patchInternalField();
forAll(lData, facei) forAll (lData, facei)
{ {
lData[facei][0] = lTcNei[facei]; lData[facei][0] = lTcNei[facei];
lData[facei][1] = lfNei[facei]; lData[facei][1] = lfNei[facei];
} }
if(TwOwn.shadowPatchField().radiation()) if (TwOwn.shadowPatchField().radiation())
{ {
const scalarField& lTwNei = TwOwn.shadowPatchField(); const scalarField& lTwNei = TwOwn.shadowPatchField();
const scalarField& lQrNei = const scalarField& lQrNei =
TwOwn.lookupShadowPatchField<volScalarField, scalar>("Qr"); TwOwn.lookupShadowPatchField<volScalarField, scalar>("Qr");
forAll(lData, facei) forAll (lData, facei)
{ {
lData[facei][2] = lTwNei[facei]; lData[facei][2] = lTwNei[facei];
lData[facei][3] = lQrNei[facei]; lData[facei][3] = lQrNei[facei];
@ -302,15 +292,15 @@ chtRcThermalDiffusivityFvPatchScalarField::calcTemperature
const Field<VectorN<scalar, 4> > iData = const Field<VectorN<scalar, 4> > iData =
TwOwn.regionCouplePatch().interpolate(lData); TwOwn.regionCouplePatch().interpolate(lData);
forAll(iData, facei) forAll (iData, facei)
{ {
TcNei[facei] = iData[facei][0]; TcNei[facei] = iData[facei][0];
fNei[facei] = iData[facei][1]; fNei[facei] = iData[facei][1];
} }
if(TwOwn.shadowPatchField().radiation()) if (TwOwn.shadowPatchField().radiation())
{ {
forAll(iData, facei) forAll (iData, facei)
{ {
fourQro[facei] += fourQro[facei] +=
4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]); 4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]);
@ -322,29 +312,15 @@ chtRcThermalDiffusivityFvPatchScalarField::calcTemperature
const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index());
const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index());
//Info << "kOwn = " << kOwn << endl;
//Info << "kNei = " << kNei << endl;
//Info << "TcOwn = " << TcOwn << endl;
//Info << "TcNei = " << TcNei << endl;
//Info << "Qr = " << Qr << " Sum = " << sum(Qr*p.magSf()) << endl;
TwOwn *= TwOwn *=
(fourQro + Qr + kOwn*TcOwn + kNei*TcNei) (fourQro + Qr + kOwn*TcOwn + kNei*TcNei)
/(TwOwn*(kOwn + kNei) + fourQro); /(TwOwn*(kOwn + kNei) + fourQro);
//Info << "TwOwn = " << TwOwn << endl;
//scalarField q1 = (TwOwn - TcOwn)*kOwn;
//Info << "q1 = " << q1 << " Sum = " << sum(q1*p.magSf()) << endl;
//scalarField q2 = (TcNei - TcOwn)*ownerK*p.deltaCoeffs();
//Info << "q2 = " << q2 << " Sum = " << sum(q2*p.magSf()) << endl;
TwOwn.fvPatchScalarField::updateCoeffs(); TwOwn.fvPatchScalarField::updateCoeffs();
} }
void chtRcThermalDiffusivityFvPatchScalarField::write(Ostream& os) const void Foam::chtRcThermalDiffusivityFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
os.writeKeyword("remoteField") os.writeKeyword("remoteField")
@ -353,19 +329,18 @@ void chtRcThermalDiffusivityFvPatchScalarField::write(Ostream& os) const
} }
//- Specify data associated with VectorN<scalar, 4> type is contiguous
template<>
inline bool contiguous<VectorN<scalar, 4> >() {return true;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField namespace Foam
( {
makePatchTypeField
(
fvPatchScalarField, fvPatchScalarField,
chtRcThermalDiffusivityFvPatchScalarField chtRcThermalDiffusivityFvPatchScalarField
); );
} // End namespace Foam } // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -25,10 +25,12 @@ Class
chtRcThermalDiffusivityFvPatchScalarField chtRcThermalDiffusivityFvPatchScalarField
Description Description
Region couple patch field taking radiation into account Diffusivity for the region couple patch field taking radiation into account
Master side
Author Author
Henrik Rusche, Wikki GmbH. All rights reserved Henrik Rusche, Wikki GmbH. All rights reserved
Cleaned up by Hrvoje Jasak
SourceFiles SourceFiles
chtRcThermalDiffusivityFvPatchScalarField.C chtRcThermalDiffusivityFvPatchScalarField.C
@ -53,9 +55,6 @@ class chtRcThermalDiffusivityFvPatchScalarField
: :
public chtRegionCoupleBase public chtRegionCoupleBase
{ {
// Private data
public: public:
//- Runtime type information //- Runtime type information
@ -79,7 +78,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given chtRcThermalDiffusivityFvPatchScalarField onto a new patch //- Construct by mapping given
// chtRcThermalDiffusivityFvPatchScalarField onto a new patch
chtRcThermalDiffusivityFvPatchScalarField chtRcThermalDiffusivityFvPatchScalarField
( (
const chtRcThermalDiffusivityFvPatchScalarField&, const chtRcThermalDiffusivityFvPatchScalarField&,
@ -119,9 +119,6 @@ public:
// Member functions // Member functions
// Access
// Evaluation functions // Evaluation functions
//- Evaluate the patch field //- Evaluate the patch field
@ -148,7 +145,6 @@ public:
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };

View file

@ -31,14 +31,10 @@ Author
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::
chtRcThermalDiffusivitySlaveFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -48,7 +44,8 @@ chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPa
{} {}
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::
chtRcThermalDiffusivitySlaveFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -59,7 +56,19 @@ chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPa
{} {}
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::
chtRcThermalDiffusivitySlaveFvPatchScalarField
(
const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
chtRegionCoupleBase(ptf, iF)
{}
Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::
chtRcThermalDiffusivitySlaveFvPatchScalarField
( (
const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf, const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -71,20 +80,10 @@ chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPa
{} {}
chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField
(
const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
chtRegionCoupleBase(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const chtRegionCoupleBase& const Foam::chtRegionCoupleBase&
chtRcThermalDiffusivitySlaveFvPatchScalarField::shadowPatchField() const Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::shadowPatchField() const
{ {
return dynamic_cast<const chtRegionCoupleBase&> return dynamic_cast<const chtRegionCoupleBase&>
( (
@ -93,7 +92,7 @@ chtRcThermalDiffusivitySlaveFvPatchScalarField::shadowPatchField() const
} }
void chtRcThermalDiffusivitySlaveFvPatchScalarField::evaluate void Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::evaluate
( (
const Pstream::commsTypes const Pstream::commsTypes
) )
@ -102,7 +101,7 @@ void chtRcThermalDiffusivitySlaveFvPatchScalarField::evaluate
} }
void chtRcThermalDiffusivitySlaveFvPatchScalarField::updateCoeffs() void Foam::chtRcThermalDiffusivitySlaveFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -115,12 +114,16 @@ void chtRcThermalDiffusivitySlaveFvPatchScalarField::updateCoeffs()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField namespace Foam
( {
makePatchTypeField
(
fvPatchScalarField, fvPatchScalarField,
chtRcThermalDiffusivitySlaveFvPatchScalarField chtRcThermalDiffusivitySlaveFvPatchScalarField
); );
} // End namespace Foam } // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -25,10 +25,12 @@ Class
chtRcThermalDiffusivitySlaveFvPatchScalarField chtRcThermalDiffusivitySlaveFvPatchScalarField
Description Description
Region couple patch field taking radiation into account Diffusivity for the region couple patch field taking radiation into account
Slave side
Author Author
Henrik Rusche, Wikki GmbH. All rights reserved Henrik Rusche, Wikki GmbH. All rights reserved
Cleaned up by Hrvoje Jasak
SourceFiles SourceFiles
chtRcThermalDiffusivitySlaveFvPatchScalarField.C chtRcThermalDiffusivitySlaveFvPatchScalarField.C
@ -56,8 +58,6 @@ class chtRcThermalDiffusivitySlaveFvPatchScalarField
: :
public chtRegionCoupleBase public chtRegionCoupleBase
{ {
// Private data
public: public:
//- Runtime type information //- Runtime type information
@ -81,7 +81,8 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given chtRcThermalDiffusivitySlaveFvPatchScalarField onto a new patch //- Construct by mapping given
// chtRcThermalDiffusivitySlaveFvPatchScalarField onto a new patch
chtRcThermalDiffusivitySlaveFvPatchScalarField chtRcThermalDiffusivitySlaveFvPatchScalarField
( (
const chtRcThermalDiffusivitySlaveFvPatchScalarField&, const chtRcThermalDiffusivitySlaveFvPatchScalarField&,

Some files were not shown because too many files have changed in this diff Show more