void update_table_liststore( int column, int reset, TableData *data , SteamState *S) { if (reset) reset_table (data); gtk_tree_model_get_iter_first( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_p(*S) * 1e-5, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_T(*S) - 273.15, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_h(*S) * 1e-3, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_s(*S) * 1e-3, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_u(*S) * 1e-3, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_v(*S), -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_rho(*S), -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_cp(*S) * 1e-3, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_cv(*S) * 1e-3, -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_x(*S), -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_k(*S), -1); gtk_tree_model_iter_next( GTK_TREE_MODEL(data->list), data->iter ); gtk_list_store_set( data->list, data->iter, column, freesteam_mu(*S), -1); }
/** ASCEND external evaluation function Outputs: mu, k, rho, cp Inputs: p, T @return 0 on success */ int mukrhocp_pT_calc(struct BBoxInterp *bbox, int ninputs, int noutputs, double *inputs, double *outputs, double *jacobian ){ (void)bbox; (void)jacobian; // not used (void)ninputs; (void)noutputs; // not used currently // convert inputs to freesteam dimensionful values double p = inputs[0]; /* ASCEND uses SI units, so no conversion needed */ double T = inputs[1]; /* ASCEND uses SI units, so no conversion needed */ #ifdef BBOX_DEBUG ERROR_REPORTER_HERE(ASC_USER_NOTE, "Evaluating with p = %f bar, T = %f K = %f C" ,p,T,T-273.15 ); #endif SteamState S; S = freesteam_set_pT(p,T); double mu = freesteam_mu(S); double k = freesteam_k(S); double rho = freesteam_rho(S); double cp = freesteam_cp(S); #ifdef BBOX_DEBUG ERROR_REPORTER_HERE(ASC_USER_NOTE, "Got mu = %f, k = %f, rho = %f, cp = %f" , mu, k, rho, cp ); #endif outputs[0] = mu; outputs[1] = k; outputs[2] = rho; outputs[3] = cp; return 0; }
//RT: returns viscosity for given pressure and temperature Foam::scalar Foam::mu_pT(scalar p, scalar T) { return freesteam_mu(freesteam_set_pT(p,T)); }