Functional

Definition

List 75 Example of a functional type condition definition
1<Item name="discharge" caption="Discharge time series">
2  <Definition valueType="functional" >
3    <Parameter valueType="real" caption="Time" />
4    <Value valueType="real" caption="Discharge" />
5  </Definition>
6</Item>

Example of widget

../_images/widget_example_func.png

Figure 56 Widget example of a functional type condition

Example code to read data

Calculation condition, Grid generating condition

FORTRAN

List 76 Code example to functional type condition (for calculation conditions and grid generating conditions) FORTRAN
 1integer:: ier, discharge_size
 2double precision, dimension(:), allocatable:: discharge_time, discharge_value
 3
 4! Read size
 5call cg_iRIC_Read_FunctionalSize(fid, "discharge", discharge_size, ier)
 6! Allocate memory
 7allocate(discharge_time(discharge_size))
 8allocate(discharge_value(discharge_size))
 9! Load values into the allocated memory
10call cg_iRIC_Read_Functional(fid, "discharge", discharge_time, discharge_value, ier)

C/C++

List 77 Code example to functional type condition (for calculation conditions and grid generating conditions) C++
 1integer:: ier, discharge_size
 2std::vector<double> discharge_time, discharge_value;
 3
 4// Read size
 5ier = cg_iRIC_Read_FunctionalSize(fid, "discharge", &discharge_size)
 6// Allocate memory
 7discharge_time.assign(discharge_size, 0);
 8discharge_value.assign(discharge_size, 0);
 9// Load values into the allocated memory
10ier = cg_iRIC_Read_Functional(fid, "discharge", discharge_time.data(), discharge_value.data())

Python

List 78 Code example to functional type condition (for calculation conditions and grid generating conditions) Python
1discharge_time, discharge_value = cg_iRIC_Read_Functional(fid, "discharge")

Boundary condition

FORTRAN

List 79 Code example to functional type condition (for boundary conditions) FORTRAN
 1integer:: ier, discharge_size
 2double precision, dimension(:), allocatable:: discharge_time, discharge_value
 3
 4! Read size
 5call cg_iRIC_Read_BC_FunctionalSize(fid, "inflow", 1, "discharge", discharge_size, ier)
 6! Allocate memory
 7allocate(discharge_time(discharge_size))
 8allocate(discharge_value(discharge_size))
 9! Load values into the allocated memory
10call cg_iRIC_Read_BC_Functional(fid, "inflow", 1, "discharge", discharge_time, discharge_value, ier)

C/C++

List 80 Code example to functional type condition (for boundary conditions) C++
 1integer:: ier, discharge_size
 2std::vector<double> discharge_time, discharge_value;
 3
 4// Read size
 5ier = cg_iRIC_Read_BC_FunctionalSize(fid, "inflow", 1, "discharge", &discharge_size)
 6// Allocate memory
 7discharge_time.assign(discharge_size, 0);
 8discharge_value.assign(discharge_size, 0);
 9// Load values into the allocated memory
10ier = cg_iRIC_Read_BC_Functional(fid, "inflow", 1, "discharge", discharge_time.data(), discharge_value.data());

Python

List 81 Code example to functional type condition (for boundary conditions) Python
1discharge_time, discharge_value = cg_iRIC_Read_BC_Functional(fid, "inflow", 1, "discharge")