This module is part of Cassiopee, a free open-source pre- and post-processor for CFD simulations.

To use the Connector module with the array interface:

import Connector as X

and with the pyTree interface:
import Connector.PyTree as X

res = X.connectMatch(a1, a2, sameZone=0, tol=1.e-6, dim=3)

Some parameters can be specified: blankingType, delta, masknot, tol. Their meanings are described in the table below:

Parameter value |
Meaning |

blankingType=0 | blank nodes inside bodies (node_in). |

blankingType=2 | blank cell centers inside bodies (center_in). |

blankingType=1 | blank cell centers intersecting with body (cell_intersect). |

blankingType=-2 | blank cell centers using an optimized cell intersection (cell_intersect_opt) and interpolation depth=2 (blanking region may be reduced where blanking point can be interpolated). |

blankingType=-1 | blank cell centers using an optimized cell intersection (cell_intersect_opt) and interpolation depth=1. |

delta=0. | cells are blanked in the body |

delta greater than 0. | the maximum distance to body, in which cells are blanked |

masknot=0 | Classical blanking applied |

masknot=1 | Inverted blanking applied: cells out of the body are blanked |

dim=3 | body described by a surface and blanks 3D cells. |

dim=2 | body blanks 2D or 1D zones. |

tol=1.e-8 (default) | tolerance for the multiple definition of the body. |

Warning: in case of blankingType=0, location of cellns and coords must be identical.

cellns = X.blankCells(coords, cellns, body, blankingType=2, delta=1.e-10,
dim=3, masknot=0, tol=1.e-8)

The blanking is achieved by setting the Cellnaturefield to

The input grids are defined by coords located at nodes as a list of arrays. The body mask is defined by sets of tetrahedra in any orientation, as a list of arrays.

If the

The parameters meanings and values are described in the table below:

Parameter value |
Meaning |

blankingType=0 | blanks the nodes falling inside the body masks (node_in). |

blankingType=2 | blanks the cells having their center falling inside the body masks (center_in). |

blankingType=1 | blanks the cells that intersect or fall inside the body masks (cell_intersect). |

tol=1.e-12 (default) | tolerance for detecting intersections (NOT USED CURRENTLY). |

cellnval=0 (default) | value used for flagging as blanked. |

blankingMode=0 (default) | Appending mode: cellns is only modified for nodes/cells falling inside the body mask by setting the value in cellns to cellnval. |

blankingMode=1 | Overwriting mode: cellns is modified for both nodes/cells falling inside (set to cellnval) and outside (set to 1) the body mask. |

Warning: in case of blankingType=0, location of cellns and coords must be identical.

cellns = X.blankCellsTetra(coords, cellns, body, blankingType=2, tol=1.e-12)

The blanking is achieved by setting the Cellnaturefield to

The input grids are defined by coords located at nodes as a list of arrays. The body mask is defined by triangular surface meshes in any orientation, as a list of arrays.

If the

The parameters meanings and values are described in the table below:

Parameter value |
Meaning |

blankingType=0 | blanks the nodes falling inside the body masks (node_in). |

blankingType=2 | blanks the cells having their center falling inside the body masks (center_in). |

blankingType=1 | blanks the cells that intersect or fall inside the body masks (cell_intersect). |

tol=1.e-12 (default) | tolerance for detecting intersections (NOT USED CURRENTLY). |

cellnval=0 (default) | value used for flagging as blanked. |

blankingMode=0 (default) | Appending mode: cellns is only modified for nodes/cells falling inside the body mask by setting the value in cellns to cellnval. |

blankingMode=1 | Overwriting mode: cellns is modified for both nodes/cells falling inside (set to cellnval) and outside (set to 1) the body mask. |

Warning: in case of blankingType=0, location of cellns and coords must be identical.

cellns = X.blankCellsTri(coords, cellns, body, blankingType=2, tol=1.e-12, cellnval=0, blankingMode=0)

a = X.setHoleInterpolatedPoints(a, depth=2, dir=0, loc='centers', cellNName='cellN')

Priorities can be defined for zones: prio1=0 means that the priority of zone 1 is high. If two zones have the same priority, then the cell volume criterion is used to set the cellN to 2 for one of the overlapping cells, the other not being modified.

If the priorities are not specified, the cell volume criterion is applied also:

cellns = X.optimizeOverlap(nodes1, centers1, nodes2, centers2, prio1=0, prio2=0)

b = X.maximizeBlankedCells(a, depth=2, dir=1) *.or.* B = X.maximizeBlankedCells(A, depth=2)

t = X.setDoublyDefinedBC(z, cellN, listOfInterpZones, listOfCelln, range, depth=2)

cellN = X.blankIntersectingCells(A, cellN, tol=1.e-10)

t = X.connectMatch(t, tol=1.e-6, dim=3)

t = X.connectMatchPeriodic(t, rotationCenter=[0.,0.,0.], rotationAngle=[0.,0.,0.], translation=[0.,0.,0.], tol=1.e-6, dim=3)

t = X.connectNearMatch(t, ratio=2, tol=1.e-6, dim=3)

t = X.setDegeneratedBC(t,dim=3,tol=1.e-10)

interDict = X.getIntersectingDomains(t, t2=None, method='AABB', taabb=None, tobb=None, taabb2=None, tobb2=None)

domNames = X.getCEBBIntersectingDomains(A, B, sameBase)

niter defines the number of iterations on which CEBB intersections are detected, starting from iteration inititer.

dt defines the timestep.

func defines a python function defining the motion of base, funcs is the list of python functions describing motions for bases.

Warning: 1. motions here are only relative motions. If all bases are translated with the same translation motion, it must not be defined in func.

2. If no motion is defined on a basis, then the corresponding function must be []:

domNames = X.getCEBBTimeIntersectingDomains(base, func, bases, funcs, inititer=0, niter=1, dt=1, sameBase)

t = X.applyBCOverlaps(t, depth=2, loc='centers')

t = X.setDoublyDefinedBC(t, depth=2)

The blanking matrix BM is a numpy array of size nbases x nbodies.

BM(i,j)=1 means that ith basis is blanked by jth body.

BM(i,j)=0 means no blanking, and BM(i,j)=-1 means that inverted hole-cutting is performed.

blankingType can be 'cell_intersect', 'cell_intersect_opt', 'center_in' or 'node_in'. Parameter depth is only meaningfull for 'cell_intersect_opt'.

XRaydim1 and XRaydim2 are the dimensions of the X-Ray hole-cutting in the x and y directions in 3D.

If the variable 'cellN' does not exist in the input pyTree, it is initialized to 1, located at 'nodes' if 'node_in' is set, and at centers in other cases.

Warning: 'cell_intersect_opt' can be CPU time-consuming when delta>0.

B = X.blankCells(t, bodies, BM, depth=2, blankingType='cell_intersect', delta=1.e-10, dim=3, tol=1.e-8, XRaydim1=1000, XRaydim2=1000)

The blanking is achieved by setting the Cellnaturefield to

The mesh to be blanked is defined by a pyTree t, where each basis defines a Chimera component. The list of bodies blanking the grids is defined in bodies. Each element of the list bodies is a set of CGNS/Python zones defining a tetrahedra mesh.

The blanking matrix BM is a numpy array of size nbases x nbodies.

BM(i,j)=1 means that ith basis is blanked by jth body.

BM(i,j)=0 means no blanking, and BM(i,j)=-1 means that inverted hole-cutting is performed.

blankingType can be 'cell_intersect', 'center_in' or 'node_in'.

If the variable 'cellN' does not exist in the input pyTree, it is initialized to 1, located at 'nodes' if 'node_in' is set, and at centers in other cases.

If the

B = X.blankCellsTetra(t, bodies, BM, blankingType='node_in', tol=1.e-12, cellnval=0, overwrite=0)

The blanking is achieved by setting the Cellnaturefield to

The mesh to be blanked is defined by a pyTree t, where each basis defines a Chimera component. The list of bodies blanking the grids is defined in bodies. Each element of the list bodies is a set of CGNS/Python zones defining a triangular watertight closed surface.

The blanking matrix BM is a numpy array of size nbases x nbodies.

BM(i,j)=1 means that ith basis is blanked by jth body.

BM(i,j)=0 means no blanking, and BM(i,j)=-1 means that inverted hole-cutting is performed.

blankingType can be 'cell_intersect', 'center_in' or 'node_in'.

If the variable 'cellN' does not exist in the input pyTree, it is initialized to 1, located at 'nodes' if 'node_in' is set, and at centers in other cases.

If the

B = X.blankCellsTri(t, bodies, BM, blankingType='node_in', tol=1.e-12, cellnval=0, overwrite=0)

t = X.setHoleInterpolatedPoints(t, depth=2, dir=0, loc='centers', cellNName='cellN')

Double wall projection technique is activated if 'double_wall'=1. The overlapping is optimized between zones from separated bases, and is based on a priority to the cell of smallest size. One can impose a priority to a base over another base, using the list priorities. For instance, priorities = ['baseName1',0, 'baseName2',1] means that zones from base of name 'baseName1' are preferred over zones from base of name 'baseName2':

t = X.optimizeOverlap(t, double_wall=0, priorities=[])

t = X.maximizeBlankedCells(t, depth=2)

t = X.cellN2OversetHoles(t)

a = X.blankIntersectingCells(a, tol=1.e-10, depth=2)

Interpolation order can be 2, 3 or 5 for structured donor zones, only order=2 for unstructured donor zones is performed.

Parameter loc can 'nodes' or 'centers', meaning that receptor points are zone nodes or centers.

penalty=1 means that a candidate donor cell located at a zone border is penalized against interior candidate cell.

nature=0 means that a candidate donor cell containing a blanked point(cellN=0) is not valid. If nature=1 all the nodes of the candidate donor cell must be cellN=1 to be valid.

double_wall=1 activates the double wall correction. If there are walls defined by families in aR or aD, the corresponding top trees topTreeRcv or/and topTreeDnr must be defined.

If sameName=1, interpolation from donor zones with the same name as receptor zones are avoided.

Interpolation data are stored as a ZoneSubRegion_t node, stored under the donor or receptor zone node depending of the storage:

a = X.setInterpData(aR, aD, double_wall=0, order=2, penalty=1, nature=0, loc='nodes', storage='direct', topTreeRcv=None, topTreeDnr=None,
sameName=0)

tR = X.getOversetInfo(tR,tD,type='interpolated')

Interpolation order can be 2, 3 or 5 for structured donor zones, only order=2 for unstructured donor zones is performed.

Parameter loc can 'nodes' or 'centers', meaning that receptor points are zone nodes or centers.

penalty=1 means that a candidate donor cell located at a zone border is penalized against interior candidate cell.

nature=0 means that a candidate donor cell containing a blanked point(cellN=0) is not valid. If nature=1 all the nodes of the candidate donor cell must be cellN=1 to be valid.

Interpolation data are stored as a ZoneSubRegion_t node, stored under the donor or receptor zone node depending of the storage. aR must contain information about distances and normals to bodies, defined by 'TurbulentDistance','gradxTurbulentDistance','gradyTurbulentDistance' and 'gradzTurbulentDistance', located at nodes or cell centers. Corrected points are defined in aR as points with cellN=2, located at nodes or cell centers. Parameter he is a constant, meaning that the interpolated points are pushed away of a distance he from the IBC points if these are external to the bodies. Parameter hi is a constant. If hi=0., then the interpolated points are mirror points of IBC points. If hi>0., then these mirror points are then pushed away of hi from their initial position. hi and he can be defined as a field (located at nodes or centers) for any point.

a = X.setIBCData(aR, aD, order=2, penalty=0, nature=0, method='lagrangian', loc='nodes', storage='direct', he=0., hi=0., dim=3)

Compute and store all the information required for IBM computations. Input data are:

Parameter |
Meaning |

t | pyTree defining the computational domain as a structured mesh |

tb | pyTree defining the obstacles. Each obstacle must be defined in a CGNS basis as a surface closed mesh, whose normals must be oriented towards the fluid region |

DEPTH | number of layers of IBM corrected points (usually 2 meaning 2 ghost cells are required) |

loc='centers'(default) | location of IBM points: at nodes if loc='nodes' or at cell centers if loc='centers' |

The problem dimension (2 or 3D) and the equation model (Euler, Navier-Stokes or RANS) are required in tb. Output data is:

- the pyTree t with a 'cellN' field located at nodes or centers, marking as computed/updated/blanked points for the solver (cellN=1/2/0).

- a donor pyTree tc storing all the information required to transfer then the solution at cellN=2 points:

t, tc = X.ToolboxIBM.prepareIBMData(t, tb, DEPTH=2, loc='centers')

Extract the IBM particular points once the IBM data is computed and stored in a pyTree. These points are the IBM points that are marked as updated points for the IBM approach and the corresponding wall and interpolated (in fluid) points.

If information is stored in the donor pyTree tc, then a=tc, else a must define the receptor pyTree t.

ti = X.ToolboxIBM.extractIBMInfo(a)

Extract the solution at walls. If IBM data is stored in donor pyTree tc, then a must be tc, else a is the pyTree t.

If tb is None, then tw is the cloud of wall points. If tb is a triangular surface mesh, then the solution extracted at cloud points is interpolated on the vertices of the triangular mesh. a must contain the fields in the ZoneSubRegions of name prefixed by 'IBCD'.

tw = X.ToolboxIBM.extractIBMWallFields(a,tb=None)

Both Chimera and IBM transfers can be applied and are identified by the prefix name of the ZoneSubRegion node created when computing the overset or IBM interpolation data.

Parameter variables is the list of variable names that are transfered by Chimera interpolation.

Parameter variablesIBC defines the name of the 5 variables used for IBM transfers.

Parameter bcType can be 0 or 1 (see table below for details).

Parameter varType enables to define the meaning of variablesIBC, if their name is not standard (see table below for more details).

Parameter storage enables to define how the information is stored (see table below).

Parameter |
Meaning |

bcType = 0 | IBM transfers model slip conditions |

bcType = 1 | IBM transfers model no-slip conditions |

varType = 1 | Density,MomentumX,MomentumY,MomentumZ,EnergyStagnationDensity |

varType = 2 | Density,VelocityX,VelocityY,VelocityZ,Temperature |

varType = 3 | Density,VelocityX,VelocityY,VelocityZ,Pressure |

storage = 0 | interpolation data is stored in receptor zones aR |

storage = 1 | interpolation data is stored in donor zones topTreeD |

storage =-1 | interpolation data storage is unknown or can be stored in donor and receptor zones. |

extract = 1 | wall fields are stored in zone subregions (density and pressure, utau and yplus if wall law is applied). |

aR = X.setInterpTransfers(aR, topTreeD, variables=None, variablesIBC=['Density', 'MomentumX', 'MomentumY', 'MomentumZ', 'EnergyStagnationDensity'], bcType=0, varType=1, storage='unknown')

Double wall projection technique is activated if 'double_wall=1'. Parameter 'sameBase=1' means that donor zones can be found in the same base as the current zone.

loc='cell' or 'face' indicates the location of the interpolated points (cell center or face). Interpolations with location at 'face' correspond to interpolation for EX points according to elsA solver.

prefixFile is the prefix for the name of the connectivity files generated for elsA solver (solver='elsA') or Cassiopee solver (solver='Cassiopee'). If prefixFile is not defined by user, no files are generated.

nGhostCells is the number of ghost cells that are required by elsA solver when writing connectivity files.

If storage='direct', interpolation data are stored on the interpolated zone, if storage='inverse', interpolation data are stored in the donor zone as a ZoneSubRegion_t node:

t = X.setInterpolations(t, loc='cell', double_wall=0, storage='direct', prefixFile = '', sameBase=0, solver='elsA', nGhostCells=2)

Only data stored at cell centers are transfered.

t = X.chimeraTransfer(t, storage='direct', variables=[])

t = X.chimeraInfo(t, type='interpolated')

Return to main userguide