Added tests to the backend

This commit is contained in:
jowr
2014-08-04 18:20:00 +02:00
parent 4f9df69c96
commit d41b51cd5f

View File

@@ -49,19 +49,23 @@ void IncompressibleBackend::update(long input_pair, double value1, double value2
clear();
if (get_debug_level()>=50) std::cout << format("Incompressible backend: _fractions are %s ",vec_to_string(_fractions).c_str()) << std::endl;
if (fluid->is_pure()){
this->_fluid_type = FLUID_TYPE_INCOMPRESSIBLE_LIQUID;
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Fluid type is %d ",this->_fluid_type) << std::endl;
if ((_fractions.size()!=1) || (_fractions[0]!=0.0)){
throw ValueError(format("%s is a pure fluid. The composition has to be set to a vector with one entry equal to 0.0 or nothing. %s is not valid.",this->name().c_str(),vec_to_string(_fractions).c_str()));
}
} else {
this->_fluid_type = FLUID_TYPE_INCOMPRESSIBLE_SOLUTION;
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Fluid type is %d ",this->_fluid_type) << std::endl;
if (_fractions.size()!=1 || ((_fractions[0]<0.0) || (_fractions[0]>1.0)) ){
throw ValueError(format("%s is a solution or brine. Mass fractions must be set to a vector with one entry between 0 and 1. %s is not valid.",this->name().c_str(),vec_to_string(_fractions).c_str()));
}
}
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Fluid type is %d ",this->_fluid_type) << std::endl;
this->_phase = iphase_liquid;
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Phase type is %d ",this->_phase) << std::endl;
if (this->_fluid_type==FLUID_TYPE_INCOMPRESSIBLE_SOLUTION && _fractions.size()==0){
throw ValueError("This is a solution or brine. Mass fractions must be set");
}
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Phase type is %d ",this->_phase) << std::endl;
switch (input_pair)
{