Help - Search - Members - Calendar
Full Version: How to deal with ThermoFluid
Modelica Forum > Modelica > Modelica
wilmfone
Hi,

after a lot of tries to build up some models out of decomposed components I can't answer the question how to work with Thermofluid.
I built up some Pipes with a simple heat transfer and tried to figure out how to put medium specific properties to the control volumes.
Out of that process I got a lot of questions:

1. Why is the HeatObject already put in in the Control Volumes?
2. How can I connect the HeatObject to realize a real heat transfer between the CV an any extern source/sink? Because all the time I got a message like:


The problem is structurally singular for the element type Real.
The number of scalar Real unknown elements are 21.
The number of scalar Real equation elements are 18.
The problem for Real elements is underdetermined.
3 scalar Real equations are missing for the variables or its derivatives:
PipeDDvarh1.heat.q.T[1]
PipeDDvarh1.heat.q.T[2]
PipeDDvarh1.heat.q.T[3]
PipeDDvarh1.heat.T[1]
PipeDDvarh1.heat.T[2]
PipeDDvarh1.heat.T[3]
PipeDDvarh1.heat.w.T[1]
PipeDDvarh1.heat.w.T[2]
PipeDDvarh1.heat.w.T[3]

Depending on the discretization this message becomes bigger or smaller. But it appears all the time I try to use the heat object.

3. How can I put medium specific properties to my models when all other parts (Interfaces, CV, Sinks and Sources, etc.) are present? (Graphical based composition!)
4. I want to use the syntax directly instead of the objects but caused by the problems my overview is not complete about model building processes with ThermoFluid. What is the most effective way?


Thank in advance and best regards from

Thore
wilmfone
Hi again,

since I didn't understand the HeatObject till the end I can't figure out how to add additional (a second) heat transfer to the environment to an existing tube and shell heat exchanger.

Anyone has an idea?

Thanks,

Thore
footwork
From looking at this library for my own problems I agree it is difficult to use. It's also worth noting that it appears no serious development has taken place on it for some time and it's not clear whether it will be developed in the future. For my problems, fluid flows, heat transfer and some chemistry, I've been using Modelica_fluids with a reasonable amount of success and the Media library (which was spun out of ThermoFluid I beleive) maybe this is a better starting point for you also. If there are specific things from TF which you require then maybe look at porting small parts of functionality into Modelica_fluid, this seems the route forward to me but with out knowing application it's difficult to know.


Carsten
Yes, Modelica Media and Modelica Fluid will be the base libraries for thermodynamic and fluid modeling, both libraries, especially the Fluid, are still under development. But they are maintainced by the Modelica Association. So to keep compatibility for the future its the best to start from there. Some functions (e.g. semiLinear) are specially written for use of these libraries. Look on the CVS Modelica Server to see more about the present development.
wilmfone
How to import the Modelica 2.2.1 library???

After some other work I'm free again to go on. I want to upgrade the usually invocated Modelica Standard Library to the new version 2.2.1. But how to do it? I tried the Scripts in the specific directory of the new library and I got some messages that it has converted anything. But back in the Modelling environment nothing has changed.

Please tell me how to change the invocation of the libraries! It isn't really obvious how to do some steps...

Thanks in advance.

wilmfone
Carsten
If you want to use the Modelica Standard Library 2.2.1 you do not have to convert it! You can download it from the Modelica server (www.modelica.org). If you use Dymola 6.0b Modelica Standard Library 2.2.1 is loaded by default. Otherwise you have to take a look to the file dymodraw.ini in the insert directory. There you can change the libraries, which are loaded when sarting Dymola.

Carsten
Hannes
Hello Thore,

I'm sorry, but when I saw your error-message talking about 18 equations and 21 unknowns, I had to laugh. The reason is that in my diploma thesis I'm currently struggling with the same problem: I'm also working on some basic thermodynamics and I'm using an exchangeable water model in my tanks, pumps, pipes and so on. And: I always have a difference of equations and unknowns that is THREE! Really always. I don't find the reason.

So I'm happy that there's someone else facing my problem. I'd be glad if we could discuss about it.

My WaterModel is something like this:

package SeaWater_2
"VERY simple model for seawater: incompressible, constants except u=u(s,t)"
extends PartialSeaWater;
//import
// PV_RO_components.Hydraulics.Water.Components.SpecificHeatCapacity.Fichtner.seawater_SI_SpecificHeatCapacity;
model extends Properties
//(
//t(start=25,stateSelect=StateSelect.prefer),
//p(start=2e5,stateSelect=StateSelect.prefer),
//X_s(start=0,stateSelect=StateSelect.prefer))
//initial equation
// der(p)=0;
// der(t)=0;
// der(X_s)=0;
equation
rho = 1020 "in kg/m^3 const";
/////////////////////////////////////////////////////////////////
u = 1e5 + cp*(t-0) "u=u0+cp*(t-t0)";
/////////////////////////////////////////////////////////////////
eta = 1e-3;
/////////////////////////////////////////////////////////////////
cp = 4180;
end Properties;
end SeaWater_2;


which inherits from

encapsulated partial package PartialSeaWater
"Basic (partial) features of seawater"
import SI = Modelica.SIunits;
import PV_RO_components.Quantities.Salinity;
import PV_RO_components.misc.myConstants.p_std;
record PropertiesRecord
"Collection of fundamental viables of this medium"
public
StaticPressure p "Static non-gauge pressure";
CelsiusTemperature t "Celsius temperature";
Density rho "Density";
SpecificInternalEnergy u "Specific internal energy";
SpecificEnthalpy h "Specific enthalpy";
MassFraction X_s "Mass fraction of salt";
////////////////////////////////////////////////////////////////////////////
// further variables, not necessarily basic ones
////////////////////////////////////////////////////////////////////////////
Salinity s "Salinity";
SpecificHeatCapacity cp "Specific heat capacity";
DynamicViscosity eta "Dynamic viscosity";
KinematicViscosity nu "Kinematic viscosity";

annotation (Icon(Rectangle(extent=[-80,80; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
end PropertiesRecord;

replaceable partial model Properties
public
extends PropertiesRecord;
public
parameter MassFraction X_s_max(min=0.040,max=0.13,start=0.13)
"Maximal salinity before error";
equation
s = X_s/(1-X_s) "always valid";
assert(X_s>=0 and X_s<=X_s_max, "Invalid mass fraction of salt!");
h = u + p/rho "always valid";
eta = rho * nu "always valid";

annotation (Icon(Ellipse(extent=[-80,80; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
end Properties;

type CelsiusTemperature = SI.CelsiusTemperature(min=0,max=60,nominal=25,start=25)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type DynamicViscosity = SI.DynamicViscosity(min=1e-5,max=6e-3,nominal=1e-3,start=1e-3)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type KinematicViscosity = SI.KinematicViscosity(min=1e-8,max=6e-6,nominal=1e-6,start=1e-6)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type StaticPressure = SI.StaticPressure(min=0.8*p_std,max=100e5,nominal=10e5,start=10e5)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type MassFraction = SI.MassFraction(min=0,max=1,nominal=0.035,start=0.035)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type Density = SI.Density(min=900,max=1200,nominal=1020,start=1020)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type SpecificInternalEnergy = SI.SpecificInternalEnergy(nominal=1e5,start=1e5)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type SpecificEnthalpy = SI.SpecificEnthalpy(nominal=1e5,start=1e5)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type SpecificHeatCapacity = SI.SpecificHeatCapacity(nominal=4180,start=4180)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type MassFlowRate = SI.MassFlowRate(nominal=10,start=0)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
type EnthalpyFlowRate = SI.EnthalpyFlowRate(nominal=1e5,start=0)
annotation (Icon(Line(points=[-80,-80; -80,-80; 80,-80; -80,40; 80,40;
0,80; -80,40; -80,-80; 80,40; 80,-80], style(color=3,
rgbcolor={0,0,255}))));
end PartialSeaWater;

So the state of water is described by 10 variables while 7 equations are within the water model. Another 3 free state variables have to be computed from mass balance, energy balance and momentum balance or so.

model DummyComponent
annotation (Icon(Ellipse(extent=[-80,80; 80,-80], style(
color=3,
rgbcolor={0,0,255},
fillColor=6,
rgbfillColor={255,255,0}))));
import PV_RO_components.Hydraulics.Connectors.Port_SeaWater;
import waterLib = PV_RO_components.Hydraulics.Water;
import SI = Modelica.SIunits;
public
replaceable package Water = waterLib.PartialSeaWater;
Port_SeaWater port_a(redeclare package Water=Water)
annotation (extent=[-100,-8; -80,12]);
Port_SeaWater port_b(redeclare package Water=Water)
annotation (extent=[80,-10; 100,10]);
Water.Properties state;
SI.Mass m;
SI.Mass ms;
parameter SI.Volume vol(start=1);
SI.MassFlowRate dotM_flow;
SI.InternalEnergy U;
///////////////////////////////////////////////////////////////////
/**/
initial equation
///////////////////////////////////////////////////////////////////
state.t = 25;
der(state.t) = 0;
der(state.rho) = 0;
der(state.X_s) = 0;
///////////////////////////////////////////////////////////////////
/**/
equation
///////////////////////////////////////////////////////////////////
// pressure
state.p = (port_a.p + port_b.p)/2;
// total mass
m = vol * state.rho;
port_a.dotM_flow + port_b.dotM_flow = der(m);
// partial mass
ms = state.X_s * m;
port_a.dotM_flow_s + port_b.dotM_flow_s = der(ms);
// energy
U = state.u * m;
port_a.dotH_flow + port_b.dotH_flow = der(U);
// mass flow
port_a.dotM_flow = 10*(port_a.p - port_b.p) "Why especially this dotM?";
// partial mass flow
port_a.dotM_flow_s = port_a.dotM_flow * (if port_a.dotM_flow>=0 then port_a.X_s else state.X_s);
port_b.dotM_flow_s = port_b.dotM_flow * (if port_b.dotM_flow>=0 then port_b.X_s else state.X_s);
// enthalpy flow
port_a.dotH_flow = port_a.dotM_flow * (if port_a.dotM_flow>=0 then port_a.h else state.h);
port_b.dotH_flow = port_b.dotM_flow * (if port_b.dotM_flow>=0 then port_b.h else state.h);
end DummyComponent;

which uses

connector Port_SeaWater "Interface for a streaming salty seawater (binary fluid with water and salt)
OUT OF or INTO a hydraulic device"
import waterLib = PV_RO_components.Hydraulics.Water;
replaceable package Water = waterLib.PartialSeaWater;
///////////////////////////////////////////////////////////////////
Water.StaticPressure p "Static non-gauge pressure";
flow Water.MassFlowRate dotM_flow "Total mass flow rate";
Water.SpecificEnthalpy h "Mass-specific enthalpy";
flow Water.EnthalpyFlowRate dotH_flow "Enthalpy flow rate";
Water.MassFraction X_s "Ratio: Mass of salt per total mass";
flow Water.MassFlowRate dotM_flow_s "Mass flow rate of salt";
end Port_SeaWater;



Can you help me finding the last three equations?


Hannes
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.