3.1.5.5. c3po.multi1D.Multi1DPhysicsDriver module
Contain the classes Multi1DPhysicsDriver and DriversAPI and the function
shiftList().
- class c3po.multi1D.Multi1DPhysicsDriver.DriversAPI(physics, meshes, testIndex, weights=None)
Bases:
Multi1DAPIDriversAPIimplementsMulti1DAPIwith 1DPhysicsDriver.- __init__(physics, meshes, testIndex, weights=None)
Build a
DriversAPIobject.- Parameters:
physics (list[PhysicsDriver]) – A list of 1D PhysicsDriver objects.
meshes (list) – A list (of same length than
physics) of axial meshes. Each mesh is expected to be a list of z coordinates.testIndex (int) – Index to be used when a required information is shared by all elements of physics (the value from
physics[testIndex]is then used).weights (list[float]) – If provided,
weightsshould be a list (of same length thanphysics) of floats. They are used as multiplication factors for extensive variables, thus allowing to choose the weigh of eachPhysicsDriverin the 3D model. For exemple, a weigh of 10. means that the associatedPhysicsDriverrepresents 10 identicalPhysicsDriver.
- getCellSizes(index)
- getNature(fieldName)
- getNumberOfCells(index)
- getSize()
See
Multi1DAPI.getSize().
- getValues(index, fieldName)
- setValues(index, fieldName, values)
- class c3po.multi1D.Multi1DPhysicsDriver.Multi1DPhysicsDriver(physics, grid, weights=None)
Bases:
PhysicsDriverWrapperMulti1DPhysicsDriverallows to handle as a uniquePhysicsDriverthat reads and writes 3D fields a list of 1DPhysicsDriver.- __init__(physics, grid, weights=None)
Build a
Multi1DPhysicsDriverobject.- Parameters:
physics (list[PhysicsDriver]) – A list of 1D PhysicsDriver objects.
grid (Grid) – A
c3po.multi1D.Gridobject that defines the 2D base of the 3D meshes used byMulti1DPhysicsDriver, and associates an element ofphysicsto each cell of this 2D base.list[float] (weights) – If provided, weights should be a list (of same length than
physics) of floats. They are used as multiplication factors for extensive variables, thus allowing to choose the weigh of eachPhysicsDriverin the 3D model. For exemple, a weigh of 10. means that the associatedPhysicsDriverrepresents 10 identicalPhysicsDriver.
- getFieldType(name)
- getFieldUnit(name)
- getInputFieldsNames()
- getInputMEDDoubleFieldTemplate(name)
See
c3po.DataAccessor.DataAccessor.getInputMEDDoubleFieldTemplate().
- getMeshUnit()
- getOutputFieldsNames()
- getOutputMEDDoubleField(name)
See
c3po.DataAccessor.DataAccessor.getOutputMEDDoubleField().
- getPhysicsDrivers()
Return the wrapped
PhysicsDriverlist.- Returns:
The wrapped PhysicsDriver list.
- Return type:
- setInputMEDDoubleField(name, field)
See
c3po.DataAccessor.DataAccessor.setInputMEDDoubleField().
- shiftPhysicsDrivers(shiftMap)
Shift the hold
PhysicsDriveraccording toshiftMap.- Parameters:
shiftMap (list[int]) – A list of integers of same length than
physics.shiftMap[i]is the new position ofphysics[i]. ‘wherever’ can be used to indicate that this element is no more used. In this case, the associatedPhysicsDriveris moved to one of the free positions.- Returns:
list[PhysicsDriver] – The list of
PhysicsDriverthat were associated to ‘wherever’ in theshiftMap.For example,
shiftMap=[3, 'wherever', 1, 2]indicates that at first callphysics_0goes to position 3,
physics_1is discharged,physics_2goes to 1 andphysics_3goes to 2. It returns
[physics_1](andphysics_1goes to position 0).At the second call with the same input,
physics_0(now at position 3) goes to 2,physics_1(at 0) goes to 3,physics_2(at 1) is discharged andphysics_3(at 2)goes to 1. It returns
[physics_2].The thrid call returns
[physics_3], the fourth call[physics_0], the fifth call[physics_1].
- updateOutputMEDDoubleField(name, field)
See
c3po.DataAccessor.DataAccessor.updateOutputMEDDoubleField().
- c3po.multi1D.Multi1DPhysicsDriver.shiftList(listToShift, shiftMap)
Create a new list where elements of
listToShiftare shifted according toshiftMap.Note
Users should not need to call this function directly.
- Parameters:
- Returns:
list – The list of
listToShiftelements that were associated to ‘wherever’ in theshiftMapand the new list with shifted elements.For example,
shiftMap=[3, 'wherever', 1, 2]indicates that at first calllistToShift[0]goes to position 3,
listToShift[1]is discharged,listToShift[2]goes to 1 andlistToShift[3]goes to 2. It returns([listToShift[1]], newlist). At the second callwith the same input,
listToShift[0](now at position 3) goes to 2,listToShift[1](at 0)goes to 3,
listToShift[2](at 1) is discharged andlistToShift[3](at 2) goes to 1.Its first return is now
[listToShift[2]]. The thrid call first return is[listToShift[3]], the fourth call first return[listToShift[0]], the fifth call firstreturn
[listToShift[1]]etc.