# How to maintain the water level in a tank ?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 July 20, 2020, 05:14 How to maintain the water level in a tank ? #1 New Member   Join Date: Jun 2020 Posts: 6 Rep Power: 4 Hi every one ! My model is about a spillway or a tank overflowing with a fixed flow rate on the inlet. I would like to see the overflow into a second part which is half filled and then flowing by the outlet as we can see on the following picture. https://drive.google.com/file/d/1RMl...ew?usp=sharing But here I'm encountring a problem with the right part of my model, i need to maintain the water level, I have tried a lot of bounded condition for the pressure and it's always flowing by the outlet. Have you any idea about the p_rgh conditon I need to set ? Thank you in advance for taking time to help me ! Audrey

 July 22, 2020, 09:52 Please I'm still stuck #2 New Member   Join Date: Jun 2020 Posts: 6 Rep Power: 4 Please if my question is not clear could you inform me, maybe I could give detail about something you don't understand. Since my first message I have tried a lot of boundary combinaison but it's always the same isssue : . The water on the right side is not flowing as if the outlet was blocked and so the tank is totally filling . The water is flowing at the begining Have you any solution maybe modifying the the p_rgh condition or the velocity ? Thanks for reading, Audrey

 July 23, 2020, 08:47 #3 Senior Member   Join Date: Dec 2019 Location: Cologne, Germany Posts: 321 Rep Power: 7 from my understanding of your problem you want to keep the water level constant by adjusting the flow rate. i don't know if you have the necessary programing skills, but here is my idea how i would do it: write a new boundary condition that accesses certain predefined areas in the domain and check what the water concentration is there, if there water concentration is lower than a certain level, increase water flow. and vice versa. now, how to adjust the water stream is also an iterative process, it is obvious to adjust it, but increase by how much? i think that something you need to find by trial and error. do you know how to custom write a BC?

 July 23, 2020, 09:06 #4 New Member   Join Date: Jun 2020 Posts: 6 Rep Power: 4 Thanks for your answer ! Yess of course, I think there is 2 differents ways to do it either with the flow rate or with the pressure ! I understand your idea but indeed it's my first advanced model and I don't know how to impose a value with a condition, I think I could search on the internet. I have also encountered a problem when I was trying to control the water level, I was modifying only the flowrate on the inlet and on the outlet but I saw the same result, even if I set the outlet flowrate to 0 its flowing ... Have you any idea of my mistake ?

 July 23, 2020, 09:14 #5 Senior Member   Join Date: Dec 2019 Location: Cologne, Germany Posts: 321 Rep Power: 7 i think there should be tutorials on how to write a custom BC (not with codedSource though, i think thats too basic). first of all, i would write a code that accesses data from the domain and does simple things like increasing or decreasing the flow, save your files and check with paraview if you are on the right track. one step at a time. afterwards you can play around and adjust everything else.

 July 28, 2020, 11:10 CodedFixedValue - lookup alpha.water #6 New Member   Join Date: Jun 2020 Posts: 6 Rep Power: 4 Hi ! I have tried to create my own boundary condition for the flow rate at the outlet regarding the level of alpha water, I have seen various ways to do that but none of them worked. The big problem is that I want to set a water level constant in the middle of 2 patch : the outlet and just a little upper (wall), so when I want to get the value of alpha water, I have to get it from another patch that the outlet. First I have seen the exprFixedValue used with aliases, variables and valueExpression, but my release of OPF is not suitable. Then I have tried to use groovyBC, and once again the release was'nt good. So I have download the new version of OPF the 20.06 and the expression are different that I have seen in forum, here I'm using uniformedFixedValue with the expression type ! But The problem is I don't arrive to get the value of alpha water on the upper patch. And moreover the fonction I'm using to make an average is not working : mag() and Sf(). To finish I'm currently using the codedFixedValue type, I have followed all the step to get the value of alpha in the upper patch but when I'm writting my result I obtain a null matrix ... Here my few line code to get the value of alpha on the upper patch named 'wall_out': Code: ```outlet { type codedFixedValue; name outlet; redirectType flowRateOut; value uniform (0 0 0); code #{ label ownName = this->patch().boundaryMesh().findPatchID("wall_out"); const volScalarField& alphaW= this->db().lookupObject("alpha.water"); const fvMesh & mesh = alphaW.mesh(); const fvPatch& boundaryPatch = mesh.boundary()[ownName];//patch(); const vectorField& Cf = boundaryPatch.Cf(); const scalarField& aWPatch= alphaW.boundaryField()[ownName]; vectorField& v = *this; scalar &t = this->db().time().value();``` If you have any idea I will really appreciate ! Audrey

 Tags overflow, spillway, water level