<< MASCARET_compute Toolbox Mascaret MASCARET_create >>

Toolbox Mascaret >> Toolbox Mascaret > MASCARET_compute_BC

MASCARET_compute_BC

Computing function for one or more time steps with the boundary conditions.

Calling sequence

[error]=MASCARET_compute_BC(id,InitTime,FinalTime,TimeStep,TimeCl,Cl1,Cl2,print)

Arguments

error

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

id

MASCARET instance number returned by the function MASCARET_create

InitTime

Initial time of the simulation (s)

FinalTime

Final time of the simulation (s)

TimeStep

Computational time step in second(s)

TimeCl

The time vector for all the new boundary conditions, size as the number of rows in Cl1 or Cl2.

Cl1

Component #1 for the boundary condition, it is a matrix for the time evolution of values for the boundary conditions

The matrix size is : the number of rows in the TimeCl vector * the number of boundary conditions (number of columns)

Depending on the type of the boundary condition : Type 1 or 3 --> Discharge ; Type 2 --> level ; Type 7 --> min. livel

Cl2

Component #2 for the boundary condition, it is a matrix for the time evolution of values for the boundary conditions

The matrix size is : the number of rows in the TimeCl vector * the number of boundary conditions (as for Cl1)

Depending on the type of the boundary condition : Type 1 or 2 --> not used ; Type 3 --> level ; Type 7 --> max. level

print

Flag for writing on listing files (1-> write 0-> no write)

Description

Function for the simulation of one or more time steps specifying new values for the boundary conditions. Compute a new hydraulic state with the help of the previous state and of the current model.

Another API function can also do the same job but with less arguments, it is MASCARET_compute

Before using this function, it is necessary to initialise the MASCARET state, calling one of the following functions MASCARET_initStateName, MASCARET_initState ou MASCARET_importXml with the last parameter set to 0 (zero).

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);        
        
// get Boundary Conditions info        
[err,pasTpsCalcul]=MASCARET_getDouble(id,"Model.DT",0,0,0);
assert_checkequal(err,0);  
[err,nbCl]=MASCARET_getNbBoundCond(id);
assert_checkequal(err,0);  
for i = 1:nbCl
    [err,nomCL,numLoi]=MASCARET_getNameBndCond(id,i);
    assert_checkequal(err,0);
    printf("Name of the Boundary Condition # %d is : %s corresponding to the graph # %d\n", i, nomCL, numLoi);
end

// initialisation
err = MASCARET_initStateName(id,toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.lig",impression);
assert_checkequal(err,0);

// computation
tailleTpsCL = 3;
cl2 = zeros(tailleTpsCL,nbCl); // not used
cl1 = zeros(tailleTpsCL,nbCl);
cl1(:,2) = 2.;
tpsCalcul0   =      0.0;
deltaT       =    600.0;
tpsCalcul1   =   deltaT; 
tpsCl = (tpsCalcul0:deltaT/2:tpsCalcul1).';
cl1(:,1) = 150./3600.* tpsCl;
err = MASCARET_compute_BC(id,tpsCalcul0, tpsCalcul1, pasTpsCalcul, tpsCl, cl1, cl2, impression);
assert_checkequal(err,0);

// model deletion
err = MASCARET_delete(id);
assert_checkequal(err,0);

See also


Report an issue
<< MASCARET_compute Toolbox Mascaret MASCARET_create >>