<< MASCARET_importXml Toolbox Mascaret MASCARET_initStateName >>

Toolbox Mascaret >> Toolbox Mascaret > MASCARET_initState

MASCARET_initState

Initialise a MASCARET model with water level and discharge values

Calling sequence

[error] = MASCARET_initState(id,Q,Z)

Arguments

error

(Output argument) Error code value : zero indicates that no errors occurred

id

MASCARET instance number returned by the function MASCARET_create

Q

Vector of the discharges for the initial solution with the dimension equal to the number of cross-sections given by the model.

Z

Vector of the water levels for the initial solution with the dimension equal to the number of cross-sections given by the model.

Description

Function for initialising a MASCARET model with water level and discharge values.

This function initialises the state with two vectors (discharge and water level) for an initial solution.

Before using this function, it is necessary to import a MASCARET model with the function MASCARET_importModel.

Example

toolbox_dir=getenv("toolbox_dir");
c = filesep();

// creation of the MASCARET model
[err, id] = MASCARET_create();
assert_checktrue(id>0);

// read data from files
path_xml = "file://"+toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.xcas";
TabNomFichier = [strsubst(path_xml,'\','/'), ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.geo", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1_0.loi", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1_1.loi", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.lis", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.opt"];
 
TypeNomFichier = ["xcas","geo","loi","loi","listing","res"];
impression = 0;
err = MASCARET_importModel(id,TabNomFichier,TypeNomFichier,impression);
assert_checkequal(err,0);
        
// initialisation
[err,size1,size2,size3] = MASCARET_getSizeVar(id,"Model.X", 0);
assert_checkequal(err,0);  
Qinit = zeros(size1,1);
Zinit = 2*ones(size1,1);
err = MASCARET_initState(id,Qinit,Zinit);
assert_checkequal(err,0);     
        
// model deletion
err = MASCARET_delete(id);
assert_checkequal(err,0);

See also


Report an issue
<< MASCARET_importXml Toolbox Mascaret MASCARET_initStateName >>