3.1.5.5. c3po.multi1D.Multi1DPhysicsDriver module

Inheritance diagram of c3po.multi1D.Multi1DPhysicsDriver

Contain the classes Multi1DPhysicsDriver and DriversAPI and the function shiftList().

class c3po.multi1D.Multi1DPhysicsDriver.DriversAPI(physics, meshes, testIndex, weights=None)

Bases: Multi1DAPI

DriversAPI implements Multi1DAPI with 1D PhysicsDriver.

__init__(physics, meshes, testIndex, weights=None)

Build a DriversAPI object.

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, 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 each PhysicsDriver in the 3D model. For exemple, a weigh of 10. means that the associated PhysicsDriver represents 10 identical PhysicsDriver.

getCellSizes(index)

See Multi1DAPI.getCellSizes().

getNature(fieldName)

See Multi1DAPI.getNature().

getNumberOfCells(index)

See Multi1DAPI.getNumberOfCells().

getSize()

See Multi1DAPI.getSize().

getValues(index, fieldName)

See Multi1DAPI.getValues().

setValues(index, fieldName, values)

See Multi1DAPI.setValues().

class c3po.multi1D.Multi1DPhysicsDriver.Multi1DPhysicsDriver(physics, grid, weights=None)

Bases: PhysicsDriverWrapper

Multi1DPhysicsDriver allows to handle as a unique PhysicsDriver that reads and writes 3D fields a list of 1D PhysicsDriver.

__init__(physics, grid, weights=None)

Build a Multi1DPhysicsDriver object.

Parameters:
  • physics (list[PhysicsDriver]) – A list of 1D PhysicsDriver objects.

  • grid (Grid) – A c3po.multi1D.Grid object that defines the 2D base of the 3D meshes used by Multi1DPhysicsDriver, and associates an element of physics to 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 each PhysicsDriver in the 3D model. For exemple, a weigh of 10. means that the associated PhysicsDriver represents 10 identical PhysicsDriver.

getFieldType(name)

See c3po.DataAccessor.DataAccessor.getFieldType().

getFieldUnit(name)

See c3po.DataAccessor.DataAccessor.getFieldUnit().

getInputFieldsNames()

See c3po.DataAccessor.DataAccessor.getInputFieldsNames().

getInputMEDDoubleFieldTemplate(name)

See c3po.DataAccessor.DataAccessor.getInputMEDDoubleFieldTemplate().

getMeshUnit()

See c3po.DataAccessor.DataAccessor.getMeshUnit().

getOutputFieldsNames()

See c3po.DataAccessor.DataAccessor.getOutputFieldsNames().

getOutputMEDDoubleField(name)

See c3po.DataAccessor.DataAccessor.getOutputMEDDoubleField().

getPhysicsDrivers()

Return the wrapped PhysicsDriver list.

Returns:

The wrapped PhysicsDriver list.

Return type:

list[PhysicsDriver]

setInputMEDDoubleField(name, field)

See c3po.DataAccessor.DataAccessor.setInputMEDDoubleField().

shiftPhysicsDrivers(shiftMap)

Shift the hold PhysicsDriver according to shiftMap.

Parameters:

shiftMap (list[int]) – A list of integers of same length than physics. shiftMap[i] is the new position of physics[i]. ‘wherever’ can be used to indicate that this element is no more used. In this case, the associated PhysicsDriver is moved to one of the free positions.

Returns:

  • list[PhysicsDriver] – The list of PhysicsDriver that were associated to ‘wherever’ in the shiftMap.

  • For example, shiftMap=[3, 'wherever', 1, 2] indicates that at first call physics_0

  • goes to position 3, physics_1 is discharged, physics_2 goes to 1 and physics_3

  • goes to 2. It returns [physics_1] (and physics_1 goes 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 and physics_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 listToShift are shifted according to shiftMap.

Note

Users should not need to call this function directly.

Parameters:
  • listToShift (list) – The list to shift.

  • shiftMap (list[int]) – A list of integers of same length than listToShift. shiftMap[i] is the new position of listToShift[i]. ‘wherever’ can be used to indicate that an element can go to any free position. It is also returned by the function.

Returns:

  • list – The list of listToShift elements that were associated to ‘wherever’ in the shiftMap and the new list with shifted elements.

  • For example, shiftMap=[3, 'wherever', 1, 2] indicates that at first call listToShift[0]

  • goes to position 3, listToShift[1] is discharged, listToShift[2] goes to 1 and

  • listToShift[3] goes to 2. It returns ([listToShift[1]], newlist). At the second call

  • with 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 and listToShift[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 first

  • return [listToShift[1]] etc.