gruvoc.trifile: Tools for reading Cart3D tri files¶
One key functionality of this module is to determine the file type of
.ugrid files or determine that they are not recognizable files of
that format.
- class cape.gruvoc.trifile.TriFileType(fmt, byteorder, filetype, precision, compIDs)¶
- byteorder¶
Alias for field number 1
- compIDs¶
Alias for field number 4
- filetype¶
Alias for field number 2
- fmt¶
Alias for field number 0
- precision¶
Alias for field number 3
- cape.gruvoc.trifile.get_tri_mode(fname_or_fp: IOBase | str, fmt: str | None = None) TriFileType | None¶
Identify TRI file format if possible
- Call:
>>> mode = get_tri_mode(fname_or_fp, fmt=None)
- Outputs:
- mode:
None|TriFileType File type, big|little endian, stream|fortran, etc.
- mode:
- cape.gruvoc.trifile.get_triq_mode(fname_or_fp: IOBase | str, fmt: str | None = None) TriFileType | None¶
Identify TRI file format if possible
- Call:
>>> mode = get_triq_mode(fname_or_fp, fmt=None)
- Outputs:
- mode:
None|TriFileType File type, big|little endian, stream|fortran, etc.
- mode:
- cape.gruvoc.trifile.read_tri(mesh: UmeshBase, fname_or_fp: str | IOBase, meta: bool = False, fmt: str | None = None)¶
Read data to a mesh object from
.trifile- Call:
>>> read_tri(mesh, fname, meta=False, fmt=None) >>> read_tri(mesh, fp, meta=False, fmt=None)
- Inputs:
- cape.gruvoc.trifile.read_triq(mesh: UmeshBase, fname_or_fp: str | IOBase, meta: bool = False, fmt: str | None = None)¶
Read data to a mesh object from
.triqfile- Call:
>>> read_triq(mesh, fname, meta=False, fmt=None) >>> read_triq(mesh, fp, meta=False, fmt=None)
- Inputs:
- cape.gruvoc.trifile.triq_get_skin_friction(triq, comp=None, **kw)¶
Get components of skin friction coeffs
- Call:
>>> cf_x, cf_y, cf_z = triq.GetSkinFriction(comp=None, **kw)
- Inputs:
- triq: class:Umesh
Unstructured mesh object
- comp: {
None} |str|int Subset component ID or name or list thereof
- incm, momentum:
True| {False} Include momentum (flow-through) forces in total
- gauge: {
True} |False Calculate gauge forces (
True) or absolute (False)- save:
True| {False} Store vectors of forces for each triangle as attributes
- xMRP: {
0.0} |float x-coordinate of moment reference point
- yMRP: {
0.0} |float y-coordinate of moment reference point
- zMRP: {
0.0} |float z-coordinate of moment reference point
- MRP: {[xMRP, yMRP, zMRP]} |
list(len=3) Moment reference point
- m, mach: {
1.0} |float Freestream Mach number
- RefArea, Aref: {
1.0} |float Reference area
- RefLength, Lref: {
1.0} |float Reference length (longitudinal)
- RefSpan, bref: {Lref} |
float Reference span (for rolling and yawing moments)
- Re, Rey: {
1.0} |float Reynolds number per grid unit
- gam, gamma: {
1.4} |float> 1 Freestream ratio of specific heats
- Utilized Attributes:
- triq.nnode:
int Number of nodes
- triq.q:
np.ndarray[float] shape: (nnode,*nq*))
Vector of 5, 9, or 13 states on each node
- triq.nnode:
- Outputs:
- cf_x:
np.ndarray x-component of skin friction coefficient
- cf_y:
np.ndarray y-component of skin friction coefficient
- cf_z:
np.ndarray z-component of skin friction coefficient
- cf_x:
- Versions:
2017-04-03
@ddalle: v1.0
- cape.gruvoc.trifile.triq_get_tri_forces(mesh, comp=None, **kw)¶
Calculate forces on tris
- Call:
>>> C = triq.GetTriForces(comp=None, **kw)
- Inputs:
- triq: class:Umesh
Unstructured mesh object
- comp: {
None} |str|int Subset component ID or name or list thereof
- incm, momentum:
True| {False} Include momentum (flow-through) forces in total
- gauge: {
True} |False Calculate gauge forces (
True) or absolute (False)- save:
True| {False} Store vectors of forces for each triangle as attributes
- xMRP: {
0.0} |float x-coordinate of moment reference point
- yMRP: {
0.0} |float y-coordinate of moment reference point
- zMRP: {
0.0} |float z-coordinate of moment reference point
- MRP: {[xMRP, yMRP, zMRP]} |
list(len=3) Moment reference point
- m, mach: {
1.0} |float Freestream Mach number
- RefArea, Aref: {
1.0} |float Reference area
- RefLength, Lref: {
1.0} |float Reference length (longitudinal)
- RefSpan, bref: {Lref} |
float Reference span (for rolling and yawing moments)
- Re, Rey: {
1.0} |float Reynolds number per grid unit
- gam, gamma: {
1.4} |float> 1 Freestream ratio of specific heats
- Utilized Attributes:
- triq.nNode:
int Number of nodes
- triq.q:
np.ndarray[float] shape: (nNode,*nq*)
Vector of 5, 9, or 13 states on each node
- triq.nNode:
- Output Attributes:
- triq.Fp:
np.ndarrayshape=(nTri,3) Vector of pressure forces on each triangle
- triq.Fm:
np.ndarrayshape=(nTri,3) Vector of momentum (flow-through) forces on each triangle
- triq.Fv:
np.ndarrayshape=(nTri,3) Vector of viscous forces on each triangle
- triq.Fp:
- Outputs:
- Versions:
2017-02-15
@ddalle: v1.0
- cape.gruvoc.trifile.triq_interp_surf_pt(triq, x, **kw)¶
Interpolate triq.q to the nearest point on the surface
- Call:
>>> x0, q = triq_interp_surf_pt(triq, x, **kw)
- Inputs:
- triq: class:Umesh
Unstructured mesh object
- x:
np.ndarray(float, shape=(3,)) Array of x, y, and z coordinates of test point
- k: {
None} |int Pre-specified index of nearest triangle (0-based)
- k1: {
None} |int Pre-specified index of nearest triangle (1-based)
- z: {
None} |float Pre-specified projection distance of x to tri k1
- kw:
dict Keyword arguments passed to
Tri.GetNearestTri()
- Outputs:
- x0:
np.ndarrayshape=(3,) Point projected onto the surface
- q:
np.ndarrayshape=(triq.nq,) Interpolated state from triq.q
- x0:
- Versions:
2017-10-10
@ddalle: v1.02018-10-12
@serogers: v2.0; subtriangles2022-03-10
@ddalle: v2.1; skip GetNearestTri()
- cape.gruvoc.trifile.triq_weighted_avg(triq1, triq2)¶
Calculate weighted average with a second triangulation
- Call:
>>> triq_weighted_avg(triq1, triq2)
- Inputs:
- triq: class:Umesh
Unstructured mesh object
- triq2: class:Umesh
Second unstructured mesh object
- Versions:
2015-09-14
@ddalle: v1.0
- cape.gruvoc.trifile.write_tri(mesh: UmeshBase, fname_or_fp: str | IOBase, fmt: str | None = None)¶
Write data from a mesh object to
.trifile