0

I'm working on a Fluids Mechanics toy problem, the Three Reservoirs Problem and I want to solve it using Minizinc.

I have three pipes and I use three equations for each pipe, the result of using them in a pipe is a fluid velocity in that pipe. The system constraint says that the sum of velocities of the pipes must be zero.

So, I'm facing an error:

Error: Registry: Constraint float_log10 not found

I don't know why this happens. The Minizinc Standard Library has the builtin log10 and it fits my needs: function var float: log10(var float: x)

Thanks.

My code is:

%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")];
Manuel
  • 478
  • 8
  • 20
  • 2
    Most constraint programming solvers have no or limited support for floating point variables (even if the modeling system allows them). – Erwin Kalvelagen Nov 08 '16 at 03:08
  • Hi, thank you. I'm now heading towards Matlab Optimization Toolbox. If you have any suggestion I'd be glad to hear. – Manuel Nov 08 '16 at 03:30
  • 1
    There are some FlatZinc solvers that has somewhat support for var float: Gecode, JaCoP, and ECLiPSe. However, neither of then support log10. – hakank Nov 08 '16 at 22:23
  • Thanks, good to know. This still sounds extremely odd to me. – Manuel Nov 16 '16 at 04:12

0 Answers0