104 |
, 0.0 \ |
, 0.0 \ |
105 |
) /* returns 0 on success */ |
) /* returns 0 on success */ |
106 |
|
|
107 |
CALCFN(helmholtz_p,2,1); |
#define CALCFNDERIV(NAME,INPUTS,OUTPUTS) \ |
108 |
|
result += CreateUserFunctionBlackBox(#NAME \ |
109 |
|
, helmholtz_prepare \ |
110 |
|
, NAME##_calc /* value */ \ |
111 |
|
, NAME##_calc /* derivatives */ \ |
112 |
|
, (ExtBBoxFunc*)NULL /* hessian not provided yet */ \ |
113 |
|
, (ExtBBoxFinalFunc*)NULL /* finalisation not implemented */ \ |
114 |
|
, INPUTS,OUTPUTS /* inputs, outputs */ \ |
115 |
|
, NAME##_help /* help text */ \ |
116 |
|
, 0.0 \ |
117 |
|
) /* returns 0 on success */ |
118 |
|
|
119 |
|
CALCFNDERIV(helmholtz_p,2,1); |
120 |
CALCFN(helmholtz_u,2,1); |
CALCFN(helmholtz_u,2,1); |
121 |
CALCFN(helmholtz_s,2,1); |
CALCFN(helmholtz_s,2,1); |
122 |
CALCFN(helmholtz_h,2,1); |
CALCFN(helmholtz_h,2,1); |
192 |
|
|
193 |
/** |
/** |
194 |
Evaluation function for 'helmholtz_p'. |
Evaluation function for 'helmholtz_p'. |
195 |
@param jacobian ignored |
@param inputs array with values of inputs T and rho. |
196 |
|
@param outputs array with just value of p |
197 |
|
@param jacobian, the partial derivative df/dx, where |
198 |
|
each row is df[i]/dx[j] over each j for the y_out[i] of |
199 |
|
matching index. The jacobian array is 1-D, row major, i.e. |
200 |
|
df[i]/dx[j] -> jacobian[i*ninputs+j]. |
201 |
@return 0 on success |
@return 0 on success |
202 |
*/ |
*/ |
203 |
int helmholtz_p_calc(struct BBoxInterp *bbox, |
int helmholtz_p_calc(struct BBoxInterp *bbox, |
208 |
CALCPREPARE; |
CALCPREPARE; |
209 |
|
|
210 |
/* first input is temperature, second is molar density */ |
/* first input is temperature, second is molar density */ |
211 |
outputs[0] = helmholtz_p(inputs[0], inputs[1], helmholtz_data); |
if(bbox->task == bb_func_eval){ |
212 |
|
outputs[0] = helmholtz_p(inputs[0], inputs[1], helmholtz_data); |
213 |
|
}else{ |
214 |
|
//ERROR_REPORTER_HERE(ASC_USER_NOTE,"JACOBIAN CALCULATION FOR P!\n"); |
215 |
|
jacobian[0*1+0] = helmholtz_dpdT_rho(inputs[0], inputs[1], helmholtz_data); |
216 |
|
jacobian[0*1+1] = helmholtz_dpdrho_T(inputs[0], inputs[1], helmholtz_data); |
217 |
|
} |
218 |
|
|
219 |
/* no need to worry about error states etc. */ |
/* no need to worry about error states etc. */ |
220 |
return 0; |
return 0; |