# 2017-07-02 daily note

1- I'm in the Copenhagen airport, killing time at gate A6, where my flight to Amsterdam is scheduled at 17:00. Now they started boarding the flght. I just want to say, once again, that I hate flying!

# 2017-06-29 daily note

1- I was thinking about the well models for the long horizontal wells that go through many FVM cells. If the well pressure is known, it can be directly modeled in my FVM code, using a linear source term. If the flow rate is known, then it is not possible to directly find the source term in each cell, and one new variable (bottom hole pressure) must be defined. This new variable can also be eliminated from the system of equations, but then the equation for all the cells that are connected by the well needs to be modified. It makes sense, since the flow from the well to each cell depends on the flow into other cells that are in the perforated zone of the well. It can be done in my code, but things are mostly manual. I will think about a simple scheme for adding new variables to the system of equations.

2- I just agreed to review two more papers. I'll be busy next week.

3- This is not going to be a coherent thought: I wasted more than two weeks of my precious time on things that did not work. The only justification was that I won't regret for "not trying" later. This is stupid, even pathetic. I could have focused on my work without bothering. Of course it was not only my fault. Part of it is boundary condition as usual. Life is not always fair, and I'm very unhappy now. But I'm not really sad for being unhappy. I told you it's not going to make sense.

What should I do?

4- Life is not that bad after all.

# 2017-06-27 daily note

1- Working in the Lyngby library on my master student's code; Yesterday, I was busy with personal stuff, hence no daily note. I feel pain on the left side of my rib cage, so I've made an appointment with a Doctor (my own doctor is on holidays). I guess the pain is a direct result of an unprepared body and a long canoe ride. I googled my symptoms and my professional diagnosis is that I will be dying soon. Just to ask a second opinion, I'm going to visit a doctor. Jokes aside, do not google your symptoms but take them seriously.

2- Now I'm thinking about death; what happens to my family if I die. If I'm cured from this horrible disease, am I going to change my lifestyle? I know it's a cliché, but it is not that bad to be forced to think about the end.

3- This Homayoun Shajarian's song, "ahay khabardar" that I can directly translate to "Hey, watchful" with a better translation "be alert"; it is killing me. The melody is based on Farhad's "city's martyrs" or "Shahidaye shahr". His voice is just beautiful.

# 2017-06-23 daily note

1- I promised to give a talk about "fossil-fuel-dependent renewable energy" this coming November. My plan is to prepare a presentation based on my current work on the low-quality geothermal energy. But today is one of those days that I can barely focus on anything. The results of my work is almost ready (except the down hole pumping exergy) and I just need to write it down.

2- I just found that the assumption of injecting 100 m3/h cold water and extracting the same flow of hot water is wrong, since the amount of water that is extracted (kg water) is less than what will be later reinjected. I have to assume that 100 m3/h is extracted at high temperature and a the same mass flow of water is reinjected into the reservoir. I will run the code this afternoon on my gaming laptop (that is almost never used for gaming).

3- Presentation structure: Introduction to exergy (skip if unnecessary for the audience); problem statement and incentives; introduce the tools (exergetic recovery factors); model overview (flow in pipes, flow in porous media, pressure differences); process flow diagram (from natural gas to geothermal energy); results and discussion (compare with other alternatives, natural gas burner, talk about COP);

# 2017-06-22 daily note

1- Julia 0.6 is released and I finally updated my JFVM package to the most recent version of type system in Julia. I have not tagged the new version yet, but it is possible to check out the master branch. I also updated the readme page for JFVM and FVTool. Like it or not, it is more important to have a beautiful front page for presenting your work. Few people bother to go deep and check the inside. If the cover isn't shining, the product is as good as nonexistent.

2- Just check my paper that is under review in Applied Energy. One of the figures is extremely small. Apparently, I'd scaled it to 12% instead of resizing it to 12 cm! Stupid me. I also found a typing mistake in the conclusions. I just amended the file. There are very good conclusions in the paper, but the model and the results are rather boring (except the exergy section). Fortunately, the conclusions are very clear and interesting, thanks to the exergy analysis that I performed on the boring results of the model.

3- Still working on the geothermal energy paper. Now I have also calculated the coefficient of performance for the process, and the CO2 emission per unit heat delivered. One other way of analyzing the data is to find the maximum COP subject to some practical constraints, e.g., a project life time higher than 30 years, and a heat delivery rate that can cover a district(?) or a few houses(?) or greenhouses(?). One other issue with my current calculation is that I do not consider the pump inside the production well. The pressure in the production well goes below the hydrostatic pressure, i.e., the water level is not at the surface. We need to have a pump down-hole to bring water to the surface. If water level is, i.e., 1000 m down the production well, the pump should bring it up to the surface (i.e., atmospheric pressure). This 100 bar is quite high and needs to be considered in the calculation. I'll include it today.

# 2017-06-21 daily note

1- I'm thinking about exergy, second law of thermodynamics, and of course reversibility. Few years ago (well, more than a few years) I was helping Maryam translating a biology paper (or a book chapter). The paper described the transport of nutrients and ions in from the blood stream into the human cells via the cell membrane and how important it is to have the right concentration of ions around this membrane (do not eat salt!). What mesmerized me at the time was the efficiency of this small unit. It could not really do much, but in combinations with millions of other cells (perhaps all as efficient), they can do all the amazing things that we do every day, with a low exergy loss, or, in other words with a high reversibility. This is something that is achieved over millions of years of evolution, although I'm not sure if reversibility has anything to do with survival or not.
When I look for irreversible processes, the first example that comes to my mind is war. It s large and fast, with many irreversible effects. A drone attack -justified or not- against a terrorist commander disguised among civilians suddenly kills the school children playing outside his house. This is highly irreversible. So is a process like insitu combustion for the extraction of oil (it burns lots of hydrocarbons to mobilize the rest). All the manmade irreversible processes that I can think of are large and fast. When you want the results overnight, you have destruct lots of exergy. Reversible processes are slow. We can make them fast by doing them in small scale. Millions of miniaturized fuel cells can be combined to do the job of a power plant. They can be stopped easily; a power plant cannot. It must go on and on because it is not easy to start it up. It's simply too big. A small unit? Not difficult to start up. I have to stop here, otherwise I cannot get anything done today.

# 2017-06-20 daily note

1- Just finished the figures. I feel this mental bareer that stops me from finishing the geothermal energy paper. I have to focus and finish it.

2- The pressure in a cell with constant source/sink terms is extremely mesh dependent. By refining the mesh, I constantly get a higher pressure for a cell with a source term, and a lower pressure for a cell with a sink term.

# 2017-06-19 daily note

Another Monday at the library, spending my paternity leave on the topic I like and enjoy. I spent most of my time drawing figures and process flow diagrams. I could not find a good tool for drawing Sankey diagrams. So I do it in matplotlib, which is rather limited, save the results in svg format, and edit the file in Inkscape.

# 2017-06-16 daily note

1- Last night, I managed to analyze all my simulation results in with a short Julia script. The visualization looks quite good. Today, I'm going to do the difficult part: describing and discussion the results. I'm probably going to stick to my own simulation results, which is more comprehensive in terms of analyzing the effect of various parameters.

2- This is the first paper that I'm writing using my finite volume toolbox. The number of users of this tool has grown since I published it online, and several researchers asked me how to cite it. Perhaps, it is the time to think about a publication. I know a couple of educational journals, but they are not openly accessible. I will look around for a publication. Perhaps I can write a paper and ask a couple of friends to review it and then get a doi for it from Zenodo. It can be uploaded on the same repository, including the reviews. I go for the latter.

3- I have helped many colleagues and students during my life, and many have helped me. During a discussion, my former supervisor pointed out that it is nice to help others, but I should not be very idealistic about it. It is important that my help (that can easily lead to a considerable contribution) is acknowledged in one form or another, e.g., being mentioned in the acknowledgment section of the thesis or paper, or even better by co-authorship. This is something I have practiced myself. Usually, my acknowledgment slide is not at the end of the presentation but right at the beginning. Sadly, not everybody practices this unless they are told or even coerced to do so. The reason I wrote this is that I just saw a publication from a student, whom I helped a lot. I even shared some of my unpublished codes with him. Of course he thanked me verbally, but when I look at the list of the authors on his paper, I can see that my contribution has been way more than one or two co-authors. I'm not unhappy about it; but I care enough to write about it here.

4- My brain is blocked again. The simulation results are analyzed. There are a lot of things that I can describe, yet I do not know how to start. Let's write my thoughts here.
I rewrote the whole model in my own FVM code, because I wanted to have more simulation results. I also was thinking about making the model more accessible by using a free software (in this case my own JFVM.jl). Previously, we had only 25 simulation results. Now it's 150. I'm looking into some important factors: + Project life time: when cold water breaks through the production well, the project is done. The production stops until the earth warms up the cold water. I have calculated it in my simulations. + CO2 emission per unit exergy: from a societal point of view, it is important to have an exergy source with the lowest CO2 emission. Usually, I compare this factor with the CO2 emission of methane, that has the lowest CO2 emission among the fossil fuels (roughly 0.05 kg/MJ exergy]. Here, I'm looking only at the exergy value which is somehow not fair, since I have calculated it from the exergy of the produced hot water. I cannot really warm up the same amount of water by burning methane. Perhaps, it is necessary to consider the energy content as well (possible to do in my analysis code). + Recovery factors: this is the outcome of my PhD thesis; the extracted resource must be able to pay for the extraction and clean up processes, otherwise the whole process is not practical. This is a clear concept but does not consider the scope. It can be addresses by only analyzing the a range of realistic process parameters, e.g., not a very low production rate.

5- I did the new calculations and created the table of results. I think the story looks better now. I have a process, that consumes some fossil fuel and delivers some heat. This process can be a direct combustion of the fossil fuel or conversion of the fossil fuel to electricity to drive a geothermal circulation pump or a heat pump. Now we are going to compare them.

# 2017-06-15 daily note

1- Do we pay enough attention to the boundary conditions? Sometimes too much, sometimes too little. I have read many papers, that simulates a physical system, that is well described, with no mention of the boundary conditions. Consider Danckwerts boundary condition. Many people don't consider it in their simulations. Wrong boundary conditions results in erroneous outcome from a well thought-out model. I'm going to consider the importance of the boundary conditions in my reviews; major revision if you fail to describe it! When do we pay too much attention to the boundary conditions? Mostly in life, specially in politics. I have to think more about it.

2- Write a post about the change of temperature with altitude in the atmosphere. Use coolprop.

3- This is how I read excel files (different sheets) and save the sheets as csv files using Pandas, PyCall, and Julia.

# make sure that pandas and xlrd are installed:
# sudo pip install pandas
# sudo pip install xlrd
using PyCall
@pyimport pandas as pd
file_names=["Geothermal_Q100_.xlsx", "Geothermal_Q150_.xlsx",
"Geothermal_Q200_.xlsx", "Geothermal_Q250_.xlsx"]
for fn in file_names
x1=pd.ExcelFile(fn)
sh_names = x1[:sheet_names]
for sh in sh_names
df[:to_csv](fn[1:end-5]*sh*".csv")
end
end


4- Finally finished the code for the geothermal energy problem, including the sensitivity analysis. I'll run it on my other laptop at home. This laptop is fine, but not a workhorse. The outcome of these simulations will be in a paper, and most probably in a presentation next month.

5- A quiet evening. Birds chirping outside the window and I'm killing myself by listening to this song from Homayoon Shajarian. What an amazing voice. The results of my simulations are good. So far I have only analyzed a few samples, and now I'm going to do all 150 simulation results automatically. You can find the results of my work in this repository.