Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

undefined pressure variable error

Please login with a confirmed email address before reporting spam

Hi!

I am new to comsol and I created this toy model to play with in order to get a better understanding.
The model intends to simulate the rizing air in a cylinder. The cylinder has an inner and outer radius. Between these two radiuses the cylinder is made of steel held at a fixed high temperature. The air is supposed to rize from the bottom where it is room temperature. I have modeled gravity in the z direction using a Volume Force. Running the model I get the following error

Undefined variable.
- Variable: pA
- Geometry: geom1
- Domain: 2
Failed to evaluate variable.
- Variable: comp1.mat1.def.rho
- Defined as: ((unit_kg_cf*comp1.mat1.def.rho((pA/unit_Pa_cf),(comp1.T/unit_K_cf)))/(unit_m_cf^3))

So it does not seem to recognize the pressure variable which the density of air depends on. The model is attached.

Any help is greatly appreciated! Also if other obvious newbie design flaws are spotted :)
Thanks!


4 Replies Last Post Mar 4, 2015, 6:03 p.m. EST
Luke Gritter Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Mar 2, 2015, 2:07 p.m. EST
Lukas,

Instead of trying to call the density function from the material, just use the predefined variable spf.rho in the volume force expression. This will get rid of the error.

Other items:

1) You have not coupled the fluid flow and heat transfer physics. The quickest way to do this is to right-click on the Multiphysics node and select "Non-Isothermal Flow".

2) You have not defined the temperature at the bottom, so the model is currently isothermal.

3) Depending on what you are trying to model, the fluid flow boundary conditions may be incorrect. If you want the flow to pass through the tube, then you will need an outlet boundary condition at the top.

4) In this case, it is probably better to use a relative density (that is, the density minus a reference density) in the volume force expression. This will eliminate the pressure gradient due to gravity.

--
Luke Gritter
AltaSim Technologies
Lukas, Instead of trying to call the density function from the material, just use the predefined variable spf.rho in the volume force expression. This will get rid of the error. Other items: 1) You have not coupled the fluid flow and heat transfer physics. The quickest way to do this is to right-click on the Multiphysics node and select "Non-Isothermal Flow". 2) You have not defined the temperature at the bottom, so the model is currently isothermal. 3) Depending on what you are trying to model, the fluid flow boundary conditions may be incorrect. If you want the flow to pass through the tube, then you will need an outlet boundary condition at the top. 4) In this case, it is probably better to use a relative density (that is, the density minus a reference density) in the volume force expression. This will eliminate the pressure gradient due to gravity. -- Luke Gritter AltaSim Technologies

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Mar 2, 2015, 3:02 p.m. EST
Luke,

Thank you very much!

My intent with the model is to calculate the air temperature and flow rate at the outlet. Given room temperature of air at inlet and constant high temperature of steel cylinder.

I did get rid of the pressure error using your suggestion, and thats nice, but I am very unsure how I should define variables so that they are accessible had not spf.rho been defined. I tried without success putting pressure among the global variables.

As for BC, I added inlet temperature and outflow bc to the "Heat transfer in fluids" node. It is also possible to add BC att the "Laminar Flow" node. It is not clear to me to which node the BC should be added.

I modified the volume force to -g(rho-1.2). I am not sure that was what you meant? Unfortunately I now get other errors. I attach the modified model. Further directions are greatly appreciated.

Lukas
Luke, Thank you very much! My intent with the model is to calculate the air temperature and flow rate at the outlet. Given room temperature of air at inlet and constant high temperature of steel cylinder. I did get rid of the pressure error using your suggestion, and thats nice, but I am very unsure how I should define variables so that they are accessible had not spf.rho been defined. I tried without success putting pressure among the global variables. As for BC, I added inlet temperature and outflow bc to the "Heat transfer in fluids" node. It is also possible to add BC att the "Laminar Flow" node. It is not clear to me to which node the BC should be added. I modified the volume force to -g(rho-1.2). I am not sure that was what you meant? Unfortunately I now get other errors. I attach the modified model. Further directions are greatly appreciated. Lukas


Luke Gritter Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Mar 4, 2015, 3:07 p.m. EST
Lukas,

To enable the flow to pass through the cylinder, you must define the inlet and outlet boundary conditions for the Laminar Flow interface.

Global variables are (by definition) not spatially dependent, so you cannot make the pressure a global variable. If you want to define a variable that is spatially variant, use the local Variables node under the local Definitions node (under Component 1).

A good way to gain initial familiarity with COMSOL is to take advantage of the Model Library, which you can open under the File menu in Windows OS or under the Windows menu in Linux. The library contains many example models (including fluid flow and heat transfer) with step-by-step instructions.

--
Luke Gritter
AltaSim Technologies
Lukas, To enable the flow to pass through the cylinder, you must define the inlet and outlet boundary conditions for the Laminar Flow interface. Global variables are (by definition) not spatially dependent, so you cannot make the pressure a global variable. If you want to define a variable that is spatially variant, use the local Variables node under the local Definitions node (under Component 1). A good way to gain initial familiarity with COMSOL is to take advantage of the Model Library, which you can open under the File menu in Windows OS or under the Windows menu in Linux. The library contains many example models (including fluid flow and heat transfer) with step-by-step instructions. -- Luke Gritter AltaSim Technologies

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Mar 4, 2015, 6:03 p.m. EST
Thanks Luke,

the pressure error occured in the volume force, so I resolved that by using the local density variable. You are correct about the outlet and inlet bc. I fixed that.

I found the supplied models very useful, but sometimes they only state that a given bc should be used and not the reasoning why one should be used and not the other. Whith a little bit of time and practice I feel confident to sort them out.
Thanks Luke, the pressure error occured in the volume force, so I resolved that by using the local density variable. You are correct about the outlet and inlet bc. I fixed that. I found the supplied models very useful, but sometimes they only state that a given bc should be used and not the reasoning why one should be used and not the other. Whith a little bit of time and practice I feel confident to sort them out.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.