Sie sind auf Seite 1von 7

How to set up a basic case for

chtMultiRegionFoam
Bernhard Linseisen

July 21, 2011


Abstract
The OpenFOAM-solver chtMultiRegionFoam is meant to be used for
heat-transfer between a solid and a uid originally. As it does work with
dierent regions of dierent properties, the setup is a little dierent from
the other OF-cases.
This HowTo is written for setting up a very basic case for chtMultiRegion-
Foam (cMRF) in an OF-2 installation. It might work for earlier versions
as well, but it might fail as well.
This HowTo is a rst version and it worked on my personal machine for
the particular testcase I set up. If there are any bugs or errors in it, please
drop me an email.
1 The Case built in this Test
The case for this HowTo is a simple step with warm solid parts, which is subected
to an airow. A visualization (not true to size and relation!) can be seen in 1
For the length 20 units have been chosen, height and depth are 1 unit each.
The main setup les (blockMeshDict and howtocase.setSet) can be seen in the
attachment.
2 Construction of the Case
The main time factor for setting up a case for chtMultiRegionFoam is the basic
construction of the case. The preparation and the running later on are merely
a question of few minutes.
2.1 The Basic Directory Structure
The very basic structure of the case is identical to any other cases within OF.
So at rst build a structure like that in a directory for the case at hand (in this
HowTo named case for simplicity):

bernhard.linseisen@cern.ch
1
Air1
Solid1
Solid2
Air2
Figure 1: Visualization of the Case
cd <case>
mkdir 0
mkdir constant
mkdir system
2.2 The .setSet-File
Within the case folder you have to make a le with the ending .setSet which
gives the dierent regions in the process later. The sample le for this case is
attached for simplicity.
The basic idea behind this le is one of dierent sets of cells, faces or points.
The sets constructed with help of the .setSet-le later become the regions for cht-
MultiRegionFoam. One can see this le as a kind of dictionary-le for the setSet-
command within OF. While the dierent options for this le are described within
setSet.C within the path /applications/utilities/mesh/manipulation/setSet/ of
your OF2-installation, the commands used in this HowTo are briey explained
with the rst two lines of the le 4 as examples: The line
cellSet Solid1 new boxToCell (0 0 0) (10 0.3 1)
does build a set from a cell with the name Solid1. The new action shows
it will be a new set. The source for the cellSet-function is the boxToCell-
function, which is used in other parts of the code as well. The numbers in
brackets are parameters for the boxToCell-function, here building a cell from a
rectangular box spanning between the points with coordinates (0 0 0) and (10
0.3 1).
The line
cellZoneSet Solid1 new setToCellZone Solid1
does build a zoneset from another cellset. The basics are identical to above.
Only the source has changed, being the setToCellZone-function with the input
parameter Solid1, which was established in the line above. So basically the
structure within the .setSet-le is as follows:
2
function <setName> <action> <source>
The further available functions and actions can be found within setSet.C .
2.3 Setup of the 0 Directory
Bring in the necessary parameter les as usual. For chtMultiRegionFoam it is
necessary to have les for: epsilon, k, p, p rgh, T, U, Ychar and Ypmma. These
les are identical to what one would nd in any other case/0-directory. There
is one major exception: The description for boundaryField has to look as
follows:
boundaryField
{
".*"
{
type calculated;
value uniform <standardvalue>;
}
}
In Addition, for each of the regions planned there has to be a folder within the
0 directory, so in this case it would be:
cd <case>/0
mkdir Air1
mkdir Air2
mkdir Solid1
mkdir Solid2
Within each of these directories further les have to be made: For the solid
regions: T, Ychar and Ypmma. For the uid regions: epsilon, g, k, p, p rgh, T
and U. These les are to be set up like any other standard parameter le. In
addition to the boundaries on the outside of the complete simulation domain it
is necessary to enter additional boundary conditions for any of the boundaries
between the regions. These are built according to following scheme:
{
<regionname1>_to_<regionname2>
{
...
}
}
While testing the BC calculated did not work for these, zeroGradient was
working well at least from the numeric side.
Furtheron each of the regional folders has to contain a le called cellToRe-
gion. This le is built like any other BC-denition-le, with the type either
being zeroGradient or calculated, the latter one with value uniform 0;.
Possibly other parameters would work as well, but only these have been tested.
In any case every boundary to another cell has to be described, ideally outside
BC is zeroGradient while inside BC is calculated.
3
2.4 Setup of the constant Directory
Within the constant-folder it is necessary again to produce all the regional
folders:
cd <case>/constant
mkdir Air1
mkdir Air2
mkdir Solid1
mkdir Solid2
Within this folder it also is necessary to build (or copy from elsewhere) a le
called regionProperties. This le tells which solvers will have to be applied
to the dierent regions, either the ones for a uid or the ones for a solid. An
example for this le can be seen in the Attachment 4.
As is standard for the other cases, also here it is necessary to set up a standard
polymesh-directory, including a standard blockMeshDict-le.
In contrast to a standard case, the les dening the other Properties have to
go into the dierent regional folders, i.e. transportProperties and thermo-
physicalProperties within the folders for uid regions and solidThermophysi-
calProperties within the folders for the solid regions.
2.5 Setup of the system Directory
Fo into the system directory and once again set up the folders for the regions:
cd <case>/system
mkdir Air1
mkdir ...
Get a working controlDict-le, for example from the tutorials into this folder.
Afterwards get (or produce) a dummy fvSchemes-le. This one is the same
as any other fvSchemes, except for the dierent functions containing no values
between the curly brackets. Furtheron one has to get a fvSolution which only
denes the outer correctors into this folder.
It is optional to get a decomposeParDict le for the case one opts for do-
ing parallel computations. For all of the dierent regional folders: Get a
decomposeParDict-le and get full fvSchemes and fvSolution les into the fold-
ers. For the latter ones, keep in mind that they will be dierent for the uids
and for the solids!
3 Final Preparations and Running of the Case
The last part mainly should work without any further problems. For the prepa-
ration, do
cd <case>
blockMesh
setSet -batch <file>.setSet
splitMeshRegions -cellZones -overwrite
4
Furtheron you have to remove the solid elds from the uid regions and the
uid elds from the solid regions. It is advisable to simply use that part of the
Allrun script.
Unfortunately, part of the commands before seems to overwrite the data in the
case/0/region/* les, so now it is necessary to set these values in the follow-
ing way: Change the values within the newly added boundaries at the region-
connections to something dierent from 0. Change the type of the boundary
conditions for U, T and p rgh to something dierent from calculated. After this
is done you can start the simulation like usual with
chtMultiRegionFoam
4 Reminder
If you nd any errors, please do inform me! Else: Have fun with chtMultiRe-
gionFoam!
5
Attachment
howToCase.setSet
cellSet Solid1 new boxToCell (0 0 0) (10 0.3 1)
cellZoneSet Solid1 new setToCellZone Solid1
cellSet Solid2 new boxToCell (10 0 0) (20 0.5 1)
cellZoneSet Solid2 new setToCellZone Solid2
cellSet Air1 new boxToCell (0 0.3 0) (10 1 1)
cellZoneSet Air1 new setToCellZone Air1
cellSet Air2 new boxToCell (10 0.5 0) (20 1 1)
cellZoneSet Air2 new setToCellZone Air2
Figure 2: howToCase.setSet
6
regionProperties
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.0 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object regionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
fluidRegionNames ( Air1 Air2 );
solidRegionNames ( Solid1 Solid2 );
// ************************************************************************* //
Figure 3: regionProperties
7

Das könnte Ihnen auch gefallen