我正在研究流体力学玩具问题Three Reservoirs Problem,我想用Minizinc来解决它。
我有三个管道,每个管道使用三个方程式,在管道中使用它们的结果是该管道中的流体速度。系统约束表明管道的速度总和必须为零。
所以,我正面临一个错误:
Error: Registry: Constraint float_log10 not found
我不知道为什么会这样。 Minizinc Standard Library has the builtin log10符合我的需求:function var float: log10(var float: x)
感谢。
我的代码是:
%This is a tipicall fluids mechanics toy problem, the Three Reservoirs Problem.
% This time there are three concrete pipes with same diameter
%% CONSTANTS
%water's kinematic viscosity at 20 deg Celcius
float: k_visc = 0.000001004;
%pipe's rugosity
float: epsilon = 0.001; % meters
%pipe's diameter
float: D=0.28; %meters
float: pi = 3.141592;
%pipe's cross sectional area
float: A1 = (pi*(pow(D,2)))/4;
float: A2 = (pi*pow(D,2))/4;
float: A3 = (pi*pow(D,2))/4;
%pipe's longitude
int: L1 = 95; %meters
int: L2 = 125; %meters
int: L3 = 160; %meters
%reservoir altitude
int: z1 = 25; %meters
int: z2 = 115; %meters
int: z3 = 85; %meters
%% VARIABLES
var 50..200: hc; %this is the thing that should vary and drive every other number
%frictional coefficient
var 0.0..1: f1;
var 0.0..1: f2;
var 0.0..1: f3;
var 0..300.0: V1;
var 0..300.0: V2;
var 0..300.0: V3;
%Reynolds number
var 2000.0..2500000.0: Re1 = D*V1/k_visc;
var 2000.0..2500000.0: Re2 = D*V2/k_visc;
var 2000.0..2500000.0: Re3 = D*V3/k_visc;
%% CONSTRAINTS
%Colebrook
constraint 1 = sqrt(f1)*-2*log10(epsilon/(3.7*D) + 2.51/(Re1*sqrt(f1)));
constraint 1 = sqrt(f2)*-2*log10(epsilon/(3.7*D) + 2.51/(Re2*sqrt(f2)));
constraint 1 = sqrt(f3)*-2*log10(epsilon/(3.7*D) + 2.51/(Re3*sqrt(f3)));
%energy equation
constraint V1 = sqrt( (z1-hc)*(2*9.81*D)/(f1*L1) );
constraint V2 = sqrt( (z2-hc)*(2*9.81*D)/(f2*L2) );
constraint V3 = sqrt( (z3-hc)*(2*9.81*D)/(f3*L3) );
%mass conservation
constraint V1*A1+V2*A2+V3*A3 <= 0.01;
solve satisfy;
output["V1 = \(V1)\n"] ++ [show("V2 = \(V2)\n")] ++ [show("V3 = \(V3)\n")];