You're reading the documentation for a development version. For the latest stable documentation, please have a look at v5.1.X.

C-API#

The C-API lets programs in other languages configure, run and read out simulations through the shared library; CADET-Python uses it to run simulations from Python. Its functions are collected in a versioned struct of function pointers, which cdtGetAPIv1_1_0a2() fills. Earlier versions remain available for backwards compatibility; this page documents the latest one. The rules for changing the C-API are described in Changing the CAPI.

Entry point#

cdtResult cdtGetAPIv1_1_0a2(cdtAPIv1_1_0a2 *ptr)#
[source]
struct cdtAPIv1_1_0a2#
[source]

Holds function pointers to API version 1.1a2

Public Members

cdtResult(*) getFileFormat (int *fileFormat)

Return the current file format version.

Param fileFormat:

[out] The current file format

cdtDriver *(*) createDriver (void)

Creates a driver that handles simulation on a high level.

Return:

Driver handle or NULL if an error occurred

void(*) deleteDriver (cdtDriver *drv)

Deletes a driver created by createDriver.

Param drv:

[in] Driver handle

cdtResult(*) runSimulation (cdtDriver *drv, cdtParameterProvider const *paramProvider)

Runs a full simulation using the given driver and parameter provider.

Param drv:

[in] Driver handle

Param paramProvider:

[in] Callback parameter provider

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getNumUnitOp (cdtDriver *drv, int *nUnits)

Returns the number of unit operations.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param nUnits:

[out] Number of unit operations

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getNumParTypes (cdtDriver *drv, int unitOpId, int *nParTypes)

Returns the number of particle types.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param nParTypes:

[out] Number of particle types

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getNumSensitivities (cdtDriver *drv, int *nSens)

Returns the number of parameter sensitivities.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param nSens:

[out] Number of parameter sensitivities

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionInlet (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the solution of the last simulation at unit inlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionOutlet (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the solution of the last simulation at unit outlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionBulk (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nComp, bool *keepAxialSingletonDimension)

Returns the solution of the last simulation of the column bulk phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of radial cells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionParticle (cdtDriver *drv, int unitOpId, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nComp, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the solution of the last simulation of the column particle liquid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionSolid (cdtDriver *drv, int unitOpId, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nBound, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the solution of the last simulation of the column particle solid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nBound:

[out] Number of bound states

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionFlux (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParticleTypes, int *nComp, bool *keepAxialSingletonDimension)

Returns the solution of the last simulation of the column particle flux.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParticleTypes:

[out] Number of particle types

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionVolume (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime)

Returns the solution of the last simulation of the unit volume.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeInlet (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the solution derivative of the last simulation at unit inlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeOutlet (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the solution derivative of the last simulation at unit outlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeBulk (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nComp, bool *keepAxialSingletonDimension)

Returns the solution derivative of the last simulation of the column bulk phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of radial cells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeParticle (cdtDriver *drv, int unitOpId, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nComp, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the solution derivative of the last simulation of the column particle liquid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeSolid (cdtDriver *drv, int unitOpId, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nBound, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the solution derivative of the last simulation of the column particle solid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nBound:

[out] Number of bound states

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeFlux (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParticleTypes, int *nComp, bool *keepAxialSingletonDimension)

Returns the solution derivative of the last simulation of the column particle flux.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParticleTypes:

[out] Number of particle types

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionDerivativeVolume (cdtDriver *drv, int unitOpId, double const **time, double const **data, int *nTime)

Returns the solution derivative of the last simulation of the unit volume.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityInlet (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the parameter sensitivity of the last simulation at unit inlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityOutlet (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the parameter sensitivity of the last simulation at unit outlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityBulk (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nComp, bool *keepAxialSingletonDimension)

Returns the parameter sensitivity of the last simulation of the column bulk phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of radial cells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityParticle (cdtDriver *drv, int unitOpId, int sensIdx, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nComp, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the parameter sensitivity of the last simulation of the column particle liquid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivitySolid (cdtDriver *drv, int unitOpId, int sensIdx, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nBound, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the parameter sensitivity of the last simulation of the column particle solid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nBound:

[out] Number of bound states

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityFlux (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParticleTypes, int *nComp, bool *keepAxialSingletonDimension)

Returns the parameter sensitivity of the last simulation of the column particle flux.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParticleTypes:

[out] Number of particle types

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityVolume (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime)

Returns the parameter sensitivity of the last simulation of the unit volume.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeInlet (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the parameter sensitivity derivative of the last simulation at unit inlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeOutlet (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nPort, int *nComp)

Returns the parameter sensitivity derivative of the last simulation at unit outlet.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nPort:

[out] Number of ports

Param nComp:

[out] Number of components

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeBulk (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nComp, bool *keepAxialSingletonDimension)

Returns the parameter sensitivity derivative of the last simulation of the column bulk phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of radial cells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeParticle (cdtDriver *drv, int unitOpId, int sensIdx, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nComp, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the parameter sensitivity derivative of the last simulation of the column particle liquid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeSolid (cdtDriver *drv, int unitOpId, int sensIdx, int parType, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParShells, int *nBound, bool *keepAxialSingletonDimension, bool *keepParticleSingletonDimension)

Returns the parameter sensitivity derivative of the last simulation of the column particle solid phase.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param parType:

[out] Particle type index

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParShells:

[out] Number of particle shells

Param nBound:

[out] Number of bound states

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Param keepParticleSingletonDimension:

[out] Keep particle singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeFlux (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime, int *nAxialCells, int *nRadialCells, int *nParticleTypes, int *nComp, bool *keepAxialSingletonDimension)

Returns the parameter sensitivity derivative of the last simulation of the column particle flux.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Param nAxialCells:

[out] Number of axial cells

Param nRadialCells:

[out] Number of ports

Param nParticleTypes:

[out] Number of particle types

Param nComp:

[out] Number of components

Param keepAxialSingletonDimension:

[out] Keep axial singleton dimension

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSensitivityDerivativeVolume (cdtDriver *drv, int unitOpId, int sensIdx, double const **time, double const **data, int *nTime)

Returns the parameter sensitivity derivative of the last simulation of the unit volume.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param sensIdx:

[in] Sensitivity ID

Param time:

[out] Time array pointer

Param data:

[out] Data array pointer

Param nTime:

[out] Number of time points

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastState (cdtDriver *drv, double const **state, int *nStates)

Returns the last state of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastStateTimeDerivative (cdtDriver *drv, double const **state, int *nStates)

Returns the last time derivative state of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastUnitState (cdtDriver *drv, int unitOpId, double const **state, int *nStates)

Returns the last state of the unit operation of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastUnitStateTimeDerivative (cdtDriver *drv, int unitOpId, double const **state, int *nStates)

Returns the last time derivative state of the unit operation of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastSensitivityState (cdtDriver *drv, int sensIdx, double const **state, int *nStates)

Returns the last sensitivity state of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param sensIdx:

[in] Sensitivity ID

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastSensitivityStateTimeDerivative (cdtDriver *drv, int sensIdx, double const **state, int *nStates)

Returns the last time derivative sensitivity state of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param sensIdx:

[in] Sensitivity ID

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastSensitivityUnitState (cdtDriver *drv, int sensIdx, int unitOpId, double const **state, int *nStates)

Returns the last sensitivity state of the unit operation of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param sensIdx:

[in] Sensitivity ID

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getLastSensitivityUnitStateTimeDerivative (cdtDriver *drv, int sensIdx, int unitOpId, double const **state, int *nStates)

Returns the last time derivative sensitivity state of the unit operation of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param sensIdx:

[in] Sensitivity ID

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param state:

[out] State vector pointer

Param nStates:

[out] Number of entries in the state vector

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getPrimaryCoordinates (cdtDriver *drv, int unitOpId, double const **data, int *nCoords)

Returns the primary coordinates of the given unit operation.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param data:

[out] Data array pointer

Param nCoords:

[out] Number of coordinates

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSecondaryCoordinates (cdtDriver *drv, int unitOpId, double const **data, int *nCoords)

Returns the secondary coordinates of the given unit operation.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param data:

[out] Data array pointer

Param nCoords:

[out] Number of coordinates

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getParticleCoordinates (cdtDriver *drv, int unitOpId, int parType, double const **data, int *nCoords)

Returns the secondary coordinates of the given unit operation.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param unitOpId:

[in] ID of the unit operation whose solution is returned

Param parType:

[in] Particle type index

Param data:

[out] Data array pointer

Param nCoords:

[out] Number of coordinates

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getSolutionTimes (cdtDriver *drv, double const **time, int *nTime)

Returns the time points at which the solution was computed.

Before this function is called, a simulation has to be run successfully. The array pointers are only valid until a new simulation is started.

Param drv:

[in] Driver handle

Param time:

[out] Time array pointer

Param nTime:

[out] Number of time points

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) getTimeSim (cdtDriver *drv, double *timeSim)

Returns the run time of the simulation.

Before this function is called, a simulation has to be run successfully.

Param drv:

[in] Driver handle

Param timeSim:

[out] Simulation run time pointer

Return:

cdtOK on success, a negative value indicating the error otherwise

cdtResult(*) setTimeout (cdtDriver *drv, double timeoutSec)

Set a timeout on the current simulator.

The timeout persists for the full lifetime of the simulator.

Param drv:

[in] Driver handle

Param timeoutSec:

[in] Timeout for a time integration process in seconds. A value smaller or equal to 0.0 means no timeout (default).

Return:

cdtOK on success, a negative value indicating the error otherwise

Parameter provider#

A caller passes the simulation configuration as a cdtParameterProvider, a struct of callbacks that CADET-Core queries for parameter values.

struct cdtParameterProvider#
[source]

ParameterProvider interface is used for querying parameters and data.

Public Members

void *userData#
[source]

User data passed to every callback function.

cdtResult(*) getDouble (void *userData, const char *paramName, double *val)

Returns the value of a parameter of type double.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param val:

[out] Value of the parameter

Return:

cdtOK on success, cdtError on error

cdtResult(*) getInt (void *userData, const char *paramName, int *val)

Returns the value of a parameter of type int.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param val:

[out] Value of the parameter

Return:

cdtOK on success, cdtError on error

cdtResult(*) getBool (void *userData, const char *paramName, uint8_t *val)

Returns the value of a parameter of type bool.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param val:

[out] Value of the parameter (0 if false, 1 if true)

Return:

cdtOK on success, cdtError on error

cdtResult(*) getString (void *userData, const char *paramName, char const **val)

Returns the value of a parameter of type string.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param val:

[out] Value of the parameter (the string is copied internally)

Return:

cdtOK on success, cdtError on error

cdtResult(*) getDoubleArray (void *userData, const char *paramName, int *numElements, double **vals)

Returns a parameter array of type double.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param numElements:

[out] Number of elements in the array

Param vals:

[out] Pointer to contiguous array of elements (will be copied internally)

Return:

cdtOK on success, cdtError on error

cdtResult(*) getIntArray (void *userData, const char *paramName, int *numElements, int **vals)

Returns a parameter array of type int.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param numElements:

[out] Number of elements in the array

Param vals:

[out] Pointer to contiguous array of elements (will be copied internally)

Return:

cdtOK on success, cdtError on error

cdtResult(*) getBoolArray (void *userData, const char *paramName, int *numElements, uint8_t **vals)

Returns a parameter array of type bool.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param numElements:

[out] Number of elements in the array

Param vals:

[out] Pointer to contiguous array of elements (will be copied internally)

Return:

cdtOK on success, cdtError on error

cdtResult(*) getStringArray (void *userData, const char *paramName, int *numElements, char const ***vals)

Returns a parameter array of type string.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param numElements:

[out] Number of elements in the array

Param vals:

[out] Pointer to contiguous array of elements (will be copied internally)

Return:

cdtOK on success, cdtError on error

cdtResult(*) getDoubleArrayItem (void *userData, const char *paramName, int idx, double *val)

Returns an item of a parameter array of type double.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param idx:

[in] Index of the requested element

Param val:

[out] Value

Return:

cdtOK on success, cdtError on error

cdtResult(*) getIntArrayItem (void *userData, const char *paramName, int idx, int *val)

Returns an item of a parameter array of type int.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param idx:

[in] Index of the requested element

Param val:

[out] Value

Return:

cdtOK on success, cdtError on error

cdtResult(*) getBoolArrayItem (void *userData, const char *paramName, int idx, uint8_t *val)

Returns an item of a parameter array of type bool.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param idx:

[in] Index of the requested element

Param val:

[out] Value

Return:

cdtOK on success, cdtError on error

cdtResult(*) getStringArrayItem (void *userData, const char *paramName, int idx, char const **val)

Returns an item of a parameter array of type string.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param idx:

[in] Index of the requested element

Param val:

[out] Value (will be copied internally)

Return:

cdtOK on success, cdtError on error

int(*) exists (void *userData, const char *elemName)

Checks whether a given parameter or scope exists.

Param userData:

[in] User supplied data

Param elemName:

[in] Name of the parameter or scope

Return:

Non-zero if the parameter exists, otherwise 0

cdtResult(*) isArray (void *userData, const char *paramName, uint8_t *res)

Checks whether a given parameter is an array.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Param res:

[out] Non-zero if the parameter is an array, otherwise 0

Return:

cdtOK on success, cdtError on error

int(*) numElements (void *userData, const char *paramName)

Returns the number of elements (of an array) in a given field.

Param userData:

[in] User supplied data

Param paramName:

[in] Name of the parameter

Return:

Number of elements in the given field (or non-positive number if field does not exist)

cdtResult(*) pushScope (void *userData, const char *scope)

Changes to a given namespace subscope.

Param userData:

[in] User supplied data

Param scope:

[in] Name of the scope

Return:

cdtOK on success, cdtError on error

cdtResult(*) popScope (void *userData)

Changes to the parent of the current namespace scope.

Param userData:

[in] User supplied data

Return:

cdtOK on success, cdtError on error

Logging#

void(*) cdtLogHandler (const char *file, const char *func, const unsigned int line, int lvl, const char *lvlStr, const char *message)

Callback for each log message.

Param file:

[in] Name of the file

Param func:

[in] Name of the function

Param line:

[in] Line number

Param lvl:

[in] Log level encoding the severity of the message

Param lvlStr:

[in] Name of the log level

Param message:

[in] Actual log message

void cdtSetLogReceiver(cdtLogHandler recv)#
[source]

Sets the log receiver replacing any previously set receiver.

Parameters:
  • recv – [in] Pointer to handler implementation or NULL

void cdtSetLogLevel(int lvl)#
[source]

Sets the log level.

All messages on a lower log level (i.e., higher severity or information content) are filtered out.

Parameters:
  • lvl – [in] New log level

int cdtGetLogLevel()#
[source]

Returns the current log level.

Returns:

Current log level

Library information#

const char *cdtGetLibraryVersion()#
[source]

Returns the version string of the libcadet library.

Returns:

Version string

const char *cdtGetLatestCAPIVersion()#
[source]

Returns the latest C-API version implemented by CADET.

Returns:

C-API Version number

const char *cdtGetLibraryCommitHash()#
[source]

Returns the git commit hash of the source which was used to build the binaries.

Returns:

Git commit hash as string

const char *cdtGetLibraryBuildType()#
[source]

Returns the build type (Debug, Release, RelWithDebInfo, RelMinSize).

Returns:

Build type