cape.pyfun.mapbc
: FUN3D boundary condition module¶
This module provides an interface to FUN3D .mapbc
files, which
specify a boundary condition and name for each component ID in the
surface grid. An example of such a file is shown below.
13 21 5050 farfield_front 22 5050 farfield_top 23 5050 farfield_left 24 5050 farfield_bottom 25 5050 farfield_right 26 5050 farfield_back 1 4000 cap 2 4000 body 3 4000 base 11 4000 fin1 12 4000 fin2 13 4000 fin3 14 4000 fin4
The entry on the first line is the total number of components, which is also the number of remaining rows. Each data row has three columns:
Surface component ID in original mesh
FUN3D boundary condition index
Name of the surface component
Providing an interface for this file (rather than simply copying a template into each run folder) is convenient because FUN3D considers these to be components 1 through 13 (not 21, 22, … 14), and combining this interface with a configuration XML file or configuration JSON file allows users to get the index or indices of of surfaces in a FUN3D component by name.
If BC is an instance of the class provided in this module,
MapBC
, for the .mapbc
file shown above, then the following
methods show the main capabilities for going back and forth between
component numbers and surface numbers.
>>> BC.GetSurfIndex("cap") 6 >>> BC.GetSurfID("cap") 7 >>> BC.GetSurfIndex(1) 6 >>> BC.GetCompID("cap") 1 >>> BC.GerSurfID(11) 10
There is also a method MapBC.SetBC()
that can be used to change the
FUN3D boundary condition indices.
- See also:
- class cape.pyfun.mapbc.MapBC(fname=None)¶
FUN3D boundary condition map class
- Call:
>>> BC = MapBC(fname)
- Inputs:
- fname:
str
Name of
mapbc
file to read
- fname:
- Outputs:
- BC:
pyFun.mapbc.MapBC
Boundary condition map instance
- BC.n:
int
Number of surfaces
- BC.SurfID:
np.ndarray
[int
] FUN3D surface indices, numbered 1 to n
- BC.CompID:
np.ndarray
[int
] Corresponding component IDs of each surface
- BC.BCs:
np.ndarray
[int
] Boundary condition numbers
- BC.Names:
list
[str
] List of surface names
- BC:
- Versions:
2016-03-30
@ddalle
: First version
- GetCompID(compID)¶
Get the component ID number used to tag this face in the mesh
- Call:
>>> compID = BC.GetCompID(compID) >>> compID = BC.GetCompID(face)
- Inputs:
- BC:
pyFun.mapbc.MapBC
FUN3D boundary condition interface
- face:
str
Name of face
- BC:
- Outputs:
- compID:
int
Face triangulation index
- compID:
- Versions:
2016-03-30
@ddalle
: First version
- GetSurfID(compID, check=True, warn=False)¶
Get surface ID number from input component ID or name
- Call:
>>> surfID = BC.GetSurfID(compID, check=True, warn=False) >>> surfID = BC.GetSurfID(face, check=True, warn=False)
- Inputs:
- BC:
pyFun.mapbc.MapBC
FUN3D boundary condition interface
- compID:
int
Face triangulation index
- face:
str
Name of face
- check: {
True
} |False
Whether or not to return an error if component is not found
- warn:
True
| {False
} Whether or not to print warnings if not raising errors
- BC:
- Outputs:
- surfID:
int
Index of the FUN3D surface, surfaces numbered 1 to n
- surfID:
- Versions:
2016-03-30
@ddalle
: First version
- GetSurfIndex(compID, check=True, warn=False)¶
Get surface ID number from input component ID or name
- Call:
>>> i = BC.GetSurfID(compID, check=True, warn=False) >>> i = BC.GetSurfID(face, check=True, warn=False)
- Inputs:
- BC:
pyFun.mapbc.MapBC
FUN3D boundary condition interface
- compID:
int
Face triangulation index
- face:
str
Name of face
- check: {
True
} |False
Whether or not to return an error if component is not found
- warn:
True
| {False
} Whether or not to print warnings if not raising errors
- BC:
- Outputs:
- i:
int
Index of the FUN3D surface, 0-based
- i:
- Versions:
2016-03-30
@ddalle
: First version
- Read(fname)¶
Read a FUN3D boundary condition map file (
.mapbc
)- Call:
>>> BC.Read(fname)
- Inputs:
- BC:
pyFun.mapbc.MapBC
FUN3D boundary condition map interface
- fname:
str
File name
- BC:
- Versions:
2016-03-29
@ddalle
: First version
- SetBC(compID, bc)¶
Set boundary condition
- Call:
>>> BC.SetBC(compID, bc) >>> BC.SetBC(face, bc)
- Inputs:
- BC:
pyFun.mapbc.MapBC
FUN3D boundary condition interface
- compID:
int
Face triangulation index
- face:
str
Name of face
- bc:
int
FUN3D boundary condition number
- BC:
- Versions:
2016-03-30
@ddalle
: First version
- Write(fname=None)¶
Write FUN3D MapBC file
- Call:
>>> BC.Write(fname=None)
- Inputs:
- BC:
pyFun.mapbc.MapBC
FUN3D boundary condition interface
- fname:
str
|None
Name of file to write; defaults to BC.fname
- BC:
- Versions:
2016-03-30
@ddalle
: First version