Commit b6b0e8e8 authored by Sébastien Timmermans's avatar Sébastien Timmermans
Browse files

[ErrMsg] equil mbs_error call

parent f05839cc
......@@ -214,6 +214,9 @@ int mbs_run_equil(MbsEquil* eq, MbsData* s)
// - - - - - - - - - - - - - -
err = mbs_equil_init(eq, s);
if (err < 0){
s->DoneEquil = 0;
mbs_equil_finish(eq, s);
mbs_error_msg("[%d] in mbs_equil_init !! \n", _MBS_ERR_MOD_EQUIL + err);
return err;
}
......@@ -222,12 +225,19 @@ int mbs_run_equil(MbsEquil* eq, MbsData* s)
err = mbs_equil_loop(eq, s); // another name might be more appropriate
if (err < 0){
s->DoneEquil = 0;
mbs_equil_finish(eq, s);
mbs_error_msg("[%d] in mbs_equil_loop !! \n", _MBS_ERR_MOD_EQUIL + err);
return err;
}
// 3. Finish the simulation
// - - - - - - - - - - - -
err = mbs_equil_finish(eq, s);
if (err < 0) {
s->DoneEquil = 0;
mbs_error_msg("[%d] in mbs_equil_loop !! \n", _MBS_ERR_MOD_EQUIL + err);
return err;
}
return err;
}
......@@ -274,8 +284,7 @@ int mbs_equil_init(MbsEquil* eq, MbsData* s)
err = mbs_check_mbs_data_values(eq->aux, s);
if (err < 0) {
mbs_msg(">>EQUIL>> Incoherences detected during module initialization! (See message above) \n");
mbs_error_msg("[%d] in mbs_equil_init !! \n", _MBS_ERR_MOD_EQUIL + err);
return _MBS_ERR_MOD_EQUIL+ err;
return err;
}
// 1.1 test if an Equilibrium is needed AND if, in a case of a closed-loop system, partionning has been made
......@@ -286,24 +295,21 @@ int mbs_equil_init(MbsEquil* eq, MbsData* s)
if (s->DonePart == 0 && s->Ncons > 0)
{
mbs_msg(">>EQUIL>> The coordinate Partitioning has not be performed for the system !\n");
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_init \n", _MBS_ERR_MOD_EQUIL);
return _MBS_ERR_MOD_EQUIL;
return _MBS_ERR_MOD_SPEC_11;
}
// Checking constraints and dependant variable coherence
err = mbs_check_nhu_nqv(s);
if (err < 0) {
mbs_msg(">>EQUIL>> Inchoherence detected during module initialization! \n");
mbs_error_msg("[%d] in mbs_equil_init !! \n", _MBS_ERR_MOD_EQUIL + err);
return _MBS_ERR_MOD_EQUIL+ err;
return err;
}
// check on the equil mode
if (eq->options->mode != 1 && eq->options->mode != 2 && eq->options->mode != 3)
{
mbs_msg(">>EQUIL>> mode %d does not exist check documentation for equil->options->mode \n", eq->options->mode);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_init \n", _MBS_ERR_MOD_EQUIL + err);
return _MBS_ERR_MOD_EQUIL + err;
return err;
}
// 1.2 Verify whether a static equilibrium has been performed before a quasistatic or dynamic equilibrium
if ((eq->options->mode == 2 || eq->options->mode == 3) && s->DoneEquil != 1)
......@@ -377,8 +383,7 @@ int mbs_equil_init(MbsEquil* eq, MbsData* s)
eq->qdd_saved = NULL;
mbs_msg(">>EQUIL>> There are no equilibrium variables: nqu=%d , Nux=%d, nxe=%d - irrelevant process\n", s->nqu, s->Nux, eq->options->nxe);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_init \n", _MBS_ERR_MOD_EQUIL);
return _MBS_ERR_MOD_EQUIL;
return _MBS_ERR_MOD_SPEC_12;
}
eq->x = get_dvec_0(eq->nx);
......@@ -565,8 +570,7 @@ int mbs_equil_init(MbsEquil* eq, MbsData* s)
eq->buffers[bufId] = mbs_new_buffer(f, f_anim, bufElemNb[bufId], eq->options->buffersize, bufferIDs[bufId], eq->options->save_anim, 0, 1. / (double)eq->options->framerate);
if (eq->buffers[bufId] == NULL)
{
mbs_msg(">>EQUIL>> Terror while initializing buffer num %d \n", bufId);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_init \n", _MBS_ERR_MOD_EQUIL);
mbs_msg(">>EQUIL>> Error while initializing buffer num %d \n", bufId);
free(f);
free(f_anim);
free(respath);
......@@ -574,7 +578,7 @@ int mbs_equil_init(MbsEquil* eq, MbsData* s)
free(fnameSuffix);
free(bufferIDs);
free(bufElemNb);
return _MBS_ERR_MOD_EQUIL;
return _MBS_ERR_LOW_FILES;
}
}
......@@ -621,15 +625,19 @@ int mbs_equil_loop(MbsEquil* eq, MbsData* s)
case 1:
{
err = mbs_equil_fsolvepk(&(mbs_equil_fct), eq, eq->aux, s);
if (err < 0)
{
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk.\n", err);
return(err);
}
break;
}
default:
{
err = _MBS_ERR_MOD_EQUIL + _MBS_ERR_INIT;
err = _MBS_ERR_INIT;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Invalid option value: MbsEquil->options->method=%d.\n", eq->options->method);
mbs_error_msg(">>EQUIL>> [%d] Choose a method listed in the documentation.\n", err);
mbs_msg(">>EQUIL>> [%d] Choose a method listed in the documentation.\n", err);
return(err);
}
}
......@@ -691,21 +699,19 @@ int mbs_equil_finish(MbsEquil* eq, MbsData* s)
// memory has been released, raise error
if (err1 < 0 && err2 <0)
{
err = _MBS_ERR_MOD_EQUIL + err1; // arbitrary choice
mbs_error_msg("[%d] and [%d] in mbs_equil_finish !! \n", err, _MBS_ERR_MOD_EQUIL + err2);
return(err);
mbs_msg("[%d] and [%d] in mbs_equil_finish !! \n", err1, err2);
return err1; // arbitrary choice
}
else if (err1 < 0){
err = _MBS_ERR_MOD_EQUIL + err1;
err = err1;
mbs_error_msg("[%d] in mbs_equil_finish !! \n", err);
mbs_msg("[%d] in mbs_equil_finish !! \n", err);
return(err);
}
else if (err2 < 0){
err = _MBS_ERR_MOD_EQUIL + err2;
err = err2;
mbs_error_msg("[%d] in mbs_equil_finish !! \n", err);
mbs_msg("[%d] in mbs_equil_finish !! \n", err);
return(err);
}
}
......@@ -888,14 +894,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xd);
free_dvec_0(f);
free_dvec_0(fd);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error at initial gradient computation \n");
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
......@@ -951,12 +951,10 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(f);
free_dvec_0(fd);
mbs_equil_finish(eq, s);
err = _MBS_ERR_MOD_EQUIL + _MBS_ERR_MOD_SPEC_12;
err = _MBS_ERR_MOD_SPEC_12;
mbs_msg(">>EQUIL>> mbs_equil_fsolvepk: none of the proposed parameter are sensitive !\n");
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk \n", err);
return(err);
}
......@@ -987,13 +985,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error at initial function evaluatoin !\n");
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
......@@ -1020,13 +1013,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error during files saving !\n");
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
......@@ -1075,13 +1063,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error during equilibrium process at iteration %d !\n", eq->iter);
mbs_error_msg("[%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg("[%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
}
......@@ -1115,13 +1098,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_ivec_0(indx);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error during equilibrium process at iteration %d !\n", eq->iter);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
lubksb_0(grads, eq->nxs, indx, xds);
......@@ -1224,13 +1202,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error during relaxation step %d for equilibrium iteration %d !\n", r_cou, eq->iter);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return err;
}
......@@ -1280,13 +1253,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Error during files saving !\n");
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
}
......@@ -1306,13 +1274,8 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err += _MBS_ERR_MOD_EQUIL;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Equilibrium function error during equilibrium process at iteration %d !\n", eq->iter);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
......@@ -1332,13 +1295,10 @@ int mbs_equil_fsolvepk(int(*fun_ptr)(double*, int, double*, MbsEquil*, MbsAux*,
free_dvec_0(xdsR);
free_dvec_0(xsR);
mbs_equil_finish(eq, s);
err = _MBS_ERR_MOD_EQUIL + _MBS_ERR_MOD_SPEC_11;
err = _MBS_ERR_MOD_SPEC_14;
mbs_msg(">>EQUIL>>\n");
mbs_msg(">>EQUIL>> Equilibrium process has not converged after %d iterations !\n", eq->options->itermax);
mbs_error_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
mbs_msg(">>EQUIL>> [%d] in mbs_equil_fsolvepk !! \n", err);
return(err);
}
else
......
......@@ -212,7 +212,7 @@ extern "C" {
/*
* Error specific to the modules:
*
* Part dynamics:
* Part :
* -11 :
* -12 : LU tot = wrong choice of qu and qv
* -13 :
......@@ -223,6 +223,17 @@ extern "C" {
* -18 :
* -19 :
*
* Equil :
* -11 : Coordinate part. has not been done before calling the equil process
* -12 : None of the proposed parameter are sensitive
* -13 : They are no equilibrium variables
* -14 : Equilibrium process has not converged after many iterations
* -15 :
* -16 :
* -17 :
* -18 :
* -19 :
*
* Direct dynamics:
* -11 :
* -12 :
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment