ladybug-tools / butterfly

:butterfly: A light python API for creating and running OpenFoam cases for CFD simulation.
http://ladybug-tools.github.io/butterfly.html
GNU General Public License v3.0
246 stars 70 forks source link

Sample file with HeatTransfer recipe doesn't converge #146

Open DambronOlivier opened 7 years ago

DambronOlivier commented 7 years ago

@TheodoreGalanos @mostaphaRoudsari @MaxMarschall @mimarilker

The case in question is of a Heat Transfer recipe with RAS model to simulate the Airflow inside a room considering internal heat gains (human body, equipment). Here is the definition in question: indoor_airflow_heat3.zip

When adding a manually written BC for T as suggested an error occurs at the Createcase component : bc_str_error1

Same error occured when I wrote manually the panels with the BC for alphat and p_rgh.
To get through I used a python component to declare those BC to format them properly. Only the BC "fixedGradient" does not appear in BF's BCs, unfortunately. It seems that it does not exist yet in BF.

Furthermore, I ran the simulation with a fixed value BC to T: bc_str_error2

All went fine until Time 92 : bc_str_error3

thinklikeanarchitect commented 7 years ago

I didnt get any errors with this file.

DambronOlivier commented 7 years ago

@mimarilker Did you let it run some time and observe the non-convergence until the error around time 95?

thinklikeanarchitect commented 7 years ago

sorry, did not wait this iteration actually, but as I know divergence stems from mostly insufficient mesh and incompatible boundary conditions.

MaxMarschall commented 7 years ago

I have been getting the same error, usually after like 2 timesteps...

TheodoreGalanos commented 7 years ago

Hi everyone,

As @mimarilker says if the simulation starts that means that there is no BF or OF error for that matter. The main reason for the divergence of the solution (which is what the error shows) are indeed the mesh and boundary conditions.

Reading the error it seems that there is something wrong with the calculation of pressure, as it drops to 0 (1e-21). I'll try and run the case today let you know what I find.

Regards, Theodore.

thinklikeanarchitect commented 7 years ago

I ran that case and saw problematic results as to temperature values. The highest ones are 10000000... which shows that something went wrong. However I have solved the issue by changing highest values (11 probes) and now the results are reasonable. I think the errors you saw somehow related with boundary conditions not mesh. Because that highest weird numbers stem from wrong boundary.

DambronOlivier commented 7 years ago

Hi @mimarilker ,

thanks for your time on this. Did you juste replace them with a python component? replacing values above threshold to average of rest?

Would you have an idea how to correct the BC for this case?

thinklikeanarchitect commented 7 years ago

Actually its not very easy to replace highest numbers, I have tried too many things until to be succeed. Bcs as u know there is an order in the probe data, so just replacing didnt do trick. I will look for the file that I changed and let u know.

Edit: I couldnt find it, sorry:( I think I have rewritten it.

mostaphaRoudsari commented 7 years ago

Hi @DambronOlivier,

  1. For boundary component you can only use the boundary types that's available. The text input will work for solution parameters but not the boundary component. This is an inconsistency that we need to address as soon as possible.

  2. Make sure probes are located in the meshed area. A number of probes are located inside the heatbox / human body and so the number of probes won't match the number of the results. Butterfly has a method to search for missing probes but it would be to expensive to run it during the run-time. Here is the simple solution to solve it. image

  3. I can also generate the error after 89 steps but doesn't look to be a butterfly issue. @TheodoreGalanos here is the openfoam folder in case it's easier for you to check the files than checking in Grasshopper: indoor_airflow_heat36.zip

DambronOlivier commented 7 years ago

@mostaphaRoudsari Thank you!

  1. works like a charm.
mostaphaRoudsari commented 7 years ago

Number 1 is also addressed. I will edit the title of this issue to represent the real problem. @DambronOlivier did you have any chance to create a case that converges using a custom boundary condition?

TheodoreGalanos commented 7 years ago

I feel this is a meshing issue. I've run heat transfer cases with our standard settings with no problems. Hard to tell without running the actual case, will do so soon I hope.

DambronOlivier commented 7 years ago

@mostaphaRoudsari

I have tried to input the custom BC for T but I do get an error. capture1 capture

mostaphaRoudsari commented 7 years ago

@DambronOlivier can you try to use space instead of tab? For some reason the space between uniform and the values is removed. If you share your input text in panel I can also debug this on my side.

DambronOlivier commented 7 years ago

@mostaphaRoudsari I have typed the text as it shows with spaces and no tabs.

DambronOlivier commented 7 years ago

Hi @mostaphaRoudsari ,

My previous message was a bit misleading. I meant that the error occurred, though I had written the BC manually as a panel.

{ type fixedGradient; gradient uniform 310; }

mostaphaRoudsari commented 7 years ago

Hi @DambronOlivier, I forgot to check this one. Will check and report back.

mostaphaRoudsari commented 7 years ago

@DambronOlivier it's fixed now! Thanks for reporting the bug.

This issue is the last open issue to be fixed and then we have the GH plugin ready for the release!

DambronOlivier commented 7 years ago

@mostaphaRoudsari I have tried to run the case though I remain with an issue. I suppose the BCs I have set are wrong. capture1

I am still unable to upload a zip file, please find the case and the gh file in this link if you wish to have a look. https://we.tl/z8TG8Yr61Y

I will try with a simple wall boundary condition for the heat source.

DambronOlivier commented 7 years ago

@mostaphaRoudsari I have run the case with a Wall Boundary Condition for the heatbox. The solution does not tend to convergence after 3000 Times.

capture

The initial intention of this case was to simulate stratification of heat with a simple box representing a human body. @TheodoreGalanos had provided some advices on the fixedGradient BC for Temperature, although with my recent experience with CFD, I am still unable to set properly the other boundary conditions for this case.

mostaphaRoudsari commented 7 years ago

Thanks @DambronOlivier. This error is different from the previous one and not a butterfly issue. I leave this issue to @TheodoreGalanos to comment.

TheodoreGalanos commented 7 years ago

Hi @DambronOlivier

On the first issue, OF is quite specific as to what is going on. OF was assuming that your box is an inlet due to the specified BC atm. Changing the BC on all 0 files for the box to be identical to the wall (it is a wall itself after all) was the right choice! Good job!

Concerning the second case, your residuals appear to have converged. Generally, it is much more important, and indicative of a converged case, to look for stability in residuals and other parameters of of your case (e.g. average temperature, velocity, pressure, etc) than absolute value of residuals. In your residual plot you can see that for quite a while now there is no change in the values so that means the case is converged. Now, that does not mean it has converged to a correct result. This is heavily related to the mesh quality. I would say that for the current crude mesh involved, perhaps the solver has reached the solution accuracy it can reach. Also, generally, schemes are also important, final solutions should always include 2nd order schemes (in your case they are 2nd order).

Kind regards, Theodore.

DambronOlivier commented 7 years ago

Hi @TheodoreGalanos,

I have been testing another similar case and trying to see how would the buoyancy drives the airflow in the intermediate level. Here are the simple wall BCs I used: capture3

The solution seem to converge looking at the residuals, though I am not sure if to an acceptable value. I have added 2nd order schemes (101 to 1000): capture

Have used only Castellated mesh since snap caused some issues: capture2 I am not sure of what happens above the ground box which is the heat source. Does the mesh quality seem coherent to you for this case?

Kind Regards, Olivier

mostaphaRoudsari commented 7 years ago

This can also be part of the challenge that we had for this case: https://github.com/ladybug-tools/butterfly/issues/203