Archive for Computational Physics

Marking Over

Posted in Biographical, Education, Maynooth with tags , on June 9, 2025 by telescoper

Better is the end of a thing than the beginning thereof…

I’ve just graded the last of my assignments for this (academic year). I had a bigger class than usual for Computational Physics this time round, so it took much longer than usual to mark the project component. It always takes a while because I not only have to read and grade the reports, but also look at the code they submit and run it to check that it works. I uploaded the final grades to our system just now and although I finished later than planned I was relieved to see that I’m not the last lecturer to do so!

What happens next is that all the marks from all the modules will be collated and cross-checked. Then we will have a meeting of the Departmental Examination Board (on Thursday morning) to go through the results in the presence of our External Examiner. Since this is the end of the academic year, we will also look at the final grades of those students who are completing their studies this year in order to consider the classification of their degrees. There may also be some who are not qualified to graduate and may have to repeat failed examinations or other assessments. Another (pleasant) duty of our Examination Board on Thursday will be to award prizes for the best performance, not just for finalists but for students at every stage, including the first year.

I was teaching a module for the Department of Engineering last Semester so I should attend their final Examination Board too. Many of our students at Maynooth take joint degrees, in which case their final degree classification depends on grades from two Departments. For that reason, there is an overall Examination Board at which the marks are combined. Fortunately, only the Head of Department (who is not me) has to attend that one.

If all goes to plan, students will receive their final marks on Friday 27th June. It’s a lengthy process so as to allow plenty of opportunities to check and validate the different stages. After that, on Tuesday 1st July, we have a consultation day at which students can ask for advice about repeat examinations, etc, and after that we have to make sure repeat examinations are available. The repeat examination period is Wednesday 6th August to Tuesday 19th August.

Between the end of this week and the repeat exams, perhaps I’ll get a bit of time to do some research…

New Publication at the Open Journal of Astrophysics

Posted in OJAp Papers, The Universe and Stuff with tags , , , on January 11, 2024 by telescoper

Well, it’s 2024 and time to start a new volume – the seventh – of the Open Journal of Astrophysics with the very first paper of the new year. The paper in question is the 1st paper in Volume 7 (2024)  and the 116th altogether. This one was published on 8th January 2024.

The title is “A new timestep criterion for N-body simulations” and it presents a new method for estimating characteristic dynamical timescales in N-body simulations, based on derivatives up to fourth order, which can be used to adjust timesteps used in numerical computations. The paper is in the folder marked Earth and Planetary Astrophysics as the paper discusses applications to orbital dynamics in planetary systems, but the method is of much wider applicability.

The authors are Dang Pham & Hanno Rein  (University of Toronto, Canada) and David S. Spiegel (Google, USA).

Here is the overlay of the paper containing the abstract:

 

 

You can click on the image of the overlay to make it larger should you wish to do so. You can find the officially accepted version of the paper on the arXiv here.

A Midweek Lecture

Posted in Biographical, Education with tags , , , , on May 3, 2023 by telescoper

It’s halfway through the last week of teaching term, and it’s been a busy day. Earlier on, I gave my final “proper” lecture of the Semester in Advanced Electromagnetism, about the reflection and transmission of electromagnetic waves at interfaces. That’s basically optics, but done in terms of the electric and magnetic fields. I have two more classes this week, on Friday, but these will be revision tutorials devoted to going through past examination questions etc. I’ve had special requests for problems involving conformal transformations and the method of images, so that should be fun!

Meanwhile, my Computational Physics class are working hard on their projects, due in on Friday. My office is opposite the lab so I’ve had a few students coming to ask for help, but mostly they are just beavering away. I hope most of them are writing up by now. I just did a quick check and nobody has submitted anything yet. I suppose that, as usual, they will all wait until the last minute!

I have a telecon coming up in a few minutes, but after that I’ll be attending this public lecture:

The speaker, Professor Clare Elwell is a physicist at University College London, where she is the Director of the Near Infrared Spectroscopy (NIRS) Group. Specifically, Prof Elwell develops non-invasive techniques to study brain function, paving the way for defining early markers of autism, developing more targeted care following brain injury, and for better understanding brain development in global health settings. Prof Elwell described her pioneering work in using invisible near infrared light to probe the human brain. Near Infrared Spectroscopy (NIRS) is a portable, wearable, low-cost brain imaging technology which can be used to study the brain in newborn babies, toddlers and adults in a range of different scenarios.

I’ll post an update when I get home after the lecture. Actually, there’s no need because the lecture was streamed and a recording is now available. The lecture starts a fairly long way in and the sound didn’t start until part-way through the introductions so I’ve cued the link to the start of the lecture itself.

It was a very interesting lecture by a very engaging speaker. The audience was smaller than I’d expected, though, with less than a hundred in the theatre. This might be because it was scheduled in the middle of the last week of teaching term, which is a very busy time of year for academic staff.

Teaching those who want to learn

Posted in Biographical, Education, mathematics, Maynooth with tags , , , on April 21, 2023 by telescoper

Yesterday afternoon I ran the last formal Computational Physics laboratory of the term. As is often the case with these sessions, the students were given a Python task to work through, with assistance available from myself and a demonstrator (and indeed other students). We have 25 students registered on this module, who are split into two groups, so about a dozen students were in yesterday’s session. That’s a comfortable number to make sure everyone can get some help.

This is the sixth year I’ve done this module, and I decided a long time ago that the best way to ensure that students learn the necessary skills is to give them things to do and let them work things out for themselves (with help where necessary). A couple of years ago, on my module feedback questionnaire, a student wrote an intended criticism along the lines of – “It’s like he expects us to learn to code by doing it ourselves, rather than him teaching us”. That is, of course, exactly what I intended, though we do give plenty of help during the labs.

Just as the best way to learn a foreign language is by speaking it, the best way to learn coding is by writing programs. Some of the students on this module have done any before, so for them the early stages of the module are rather straightforward. At least half the class, however, haven’t done any programming, so for them it’s a fairly steep learning curve.

Anyway, it being the last formal session of term this week’s task was a rather challenging one, involving the solution of a boundary value problem via the shooting method. It’s a good exercise because it brings together methods for solving ordinary differential equations with root-finding, as well as requiring some thought as to the general construction of a code that combines these two.

As expected, given the difference in background of the students, some finished this in good time, but others went more slowly. Some very excellent things happened, though, which made me very happy with the the whole experience.

One was that instead of leaving as soon as they had finished, a few of the students who had completed the task early stayed behind to help their friends. I encourage this, but it doesn’t always happen as much as yesterday. It’s called teamwork, and it’s essential not only in physics but also in everyday life.

The lab session was supposed to finish at 4pm, but not all students were done by then. Another excellent thing though was they didn’t just quit when they had run out of time. I stayed well past 4pm to help those who were determined to finish. In one case it was just a ‘0’ that should have been a ‘1’ in the index of an array that stopped it working. I don’t know why it took me so long to spot this, but we got there in the end.

One student, however, had another class at 4pm so left, only to return at five to continue. The student finally left, having completed the exercise, at about 6.45. The persistence shown by the students in refusing to be defeated was truly admirable. This harks back to a piece of advice I gave some time ago:

If you really want to develop as a physicist, don’t just solve a lot of easy problems; challenge yourself by tackling difficult ones too. Don’t be afraid to get “stuck” or make a mistake, as those are both necessary parts of the learning process. Above all, develop the confidence in your ability to take on a problem and back yourself to solve it and don’t be deterred if the answer doesn’t come quickly!

You may say that if it took some students much longer than the allocated time to finish then the problem was too difficult. That may be the case, but do you ever really learn if you’re not stretched? There is a place for straightforward formulaic tasks in higher education, but there’s much more to a university education than doing things like that.

Obviously the lab took up much more of my time as I had originally planned – more than double, in fact – but I went home pleased with a good day’s work. As I’ve said on this blog many times before, there are few things more rewarding than teaching students who want to learn.

Essays and (Computational) Physics

Posted in Biographical, Education, Maynooth with tags , , , , , on March 14, 2023 by telescoper

There have been more news stories about ChatGPT and assessment in universities going around. There’s one here from The Journal and another here from The Conversation to give just two examples.

I wrote about this myself a couple of months ago in a post that included this:

I have to admit that I’ve never really understood the obsession in some parts of academia with “the student Essay” as a form of assessment. I agree that writing skills are extremely important but they’re not the only skills it is important for students to acquire during the course of a degree. Of course I’m biased because I work in Theoretical Physics, an area in which student essays play a negligible role in assessment. Our students do have to write project reports, etc, but writing about something you yourself have done seems to me to be different from writing about what other people have done. While forms of assessment in science subjects have evolved considerably over the last 50 years, other domains still seem to concentrate almost exclusively on “The Essay”.

Whatever you think about the intrinsic value of The Essay (or lack thereof) it is clear that if it is not done in isolation (and under supervision) it is extremely vulnerable to cheating.

A few people have retorted that communication skills are very important in higher education. I agree with that wholeheartedly, but it seems to me that (a) there are other ways of communicating than via formal essays and (b) there are, should be, more to academic study than  writing about things.

That said, I do think we could be doing more in some disciplines, including my own, to cultivate communication skills in general and writing skills in particular. In Theoretical Physics we certainly don’t do this as much as we should. I do have a project report in my 3rd Year computational physics module, but that is a relatively short document and the report itself counts only one-third of the marks (and the project is only 40% of the module mark).

These thoughts somehow reminded me of this. You can click on it to make it bigger if it’s difficult to read. It was the first paper (called colloquially Paper Zero) of my finals examination at the University of Cambridge way back in 1985, getting on for 40 years ago:

wpid-wp-1425648226410.jpeg

As you can probably infer from the little circle around number 4, I decided to write an Essay about topic 4. I’ve always been interested in detective stories so this was an easy choice for me, but I have absolutely no idea what I wrote about for three hours. Nor do I recall actually ever getting a mark for the essay, so I never really knew whether it really counted for anything. I do remember, however, that I had another 3-hour examination in the afternoon of the same day, two three-hour examinations the following day, and would have had two the day after that had I not elected to do a theory project which let me off one paper at the end and for which I got a good mark.

Anyway, to get back to the essay paper, we certainly don’t set essay examinations like that here in the the Department of Theoretical Physics at Maynooth University and I suspect they no longer do so in the Department of Physics at Cambridge either. At the time I didn’t really see the point of making students write such things under examination conditions but then we didn’t have ChatGPT way back then. No doubt it could generate a reasonable essay on any of the topics given.

I am skeptical about whether any of my 3rd year computational physicists would use ChatGPT to write their reports, but they might. But ChatGPT can write Python code too. Am I worried about that? Not greatly. I’ve asked it to write scripts for the various class exercises I’ve set so far and the code it has produced has usually failed. It will get better though….

Reflections on the St Brigid’s Day Holiday

Posted in Biographical, Education, Maynooth with tags , , on February 6, 2023 by telescoper

It’s Monday 6th February 2023, which means that today is a new experience for me: a Bank Holiday in February. This is taking place on the first Monday after Imbolc, a Gaelic festival marking the point halfway between the winter solstice and vernal equinox. The 1st day of February is also the Feast day of St Brigid of Kildare (c. 451-525), one of Ireland’s patron saints, along with Saints Patrick and Colm Cille. . From what I’ve read, St Brigid is an a sort of amalgamation of a pagan deity and an early Christian figure, part legend and part real person. One of her miraculous powers was the ability to change water into ale, which perhaps explains her enduring popularity among the Irish.

Anyway, it’s nice to have a day off even if it is just a week after the start of Semester Two, well before exhaustion sets in. Last week I started both my modules. I was particularly apprehensive about the first laboratory session for Computational Physics 1 on Thursday. In previous years the first session has always generated a lot of technical problems. This year we are running a new version of the operating system on our Linux cluster as well as a new version of Python. Students are issued with accounts specifically for use on this cluster and even logging for the first time and changing passwords has proved a challenge. I am now also using a digital display screen instead of the old data projector I used to have and which conked out last year.

This time, however, there were no significant problems at all in the Lab. Let’s hope the same is true for the Tuesday lab, which is a repeat but with a different (and slightly larger) group of students. In recognition of the likelihood of technical hitches I don’t usually aim to do very much in Lab 1, but this time I managed to cover quite a lot of material. By next week I’ll be starting to get the students to write bits of their own code. Thereafter it gets increasingly hands-on. There’s no efficient way to learn coding other than by doing it, so the sooner they get going with that the better.

I don’t actually have any lectures timetabled on Mondays this semester and, since the lab for tomorrow (Tuesday) is a repeat of last Thursday’s, I don’t have anything urgent to prepare. I’m therefore using the time off to do some Open Journal business – including publishing a paper – and, despite the cold, do a bit of gardening to prepare for Spring.

The Term Ahead

Posted in Biographical, Education, Maynooth with tags , , , , on January 29, 2023 by telescoper

It’s the day before the start of a new Semester in Maynooth. Last week we finished all due processes relating to the First Semester examinations and the provisional results will be uploaded to “The System” next week. They’re provisional at this stage because they’re not set in stone until the final meeting of the Examination Board. Obviously I can’t discuss the results here. I could comment here about how clunky the whole process is, including multiple downloads of spreadsheets and subsequent uploads somewhere else, but I won’t bother. Nobody seems to be interesting in fixing it. Perhaps by the time I retire “The System” will have been replaced by something that doesn’t waste an enormous amount of staff time. But I doubt it.

It’s a curiosity of the teaching allocation in the Department of Theoretical Physics that I do first-year and second-year modules (MP110 Mechanics and Special Relativity and MP201 Vector Calculus & Fourier Series) in Semester 1 while in Semester 2 it’s the third and fourth year students who have to put up with my ramblings.

The menu for this term involves MP354 Computational Physics 1, which entails just one hour of lectures per week but two two-hour lab sessions. Each student attends one of these sessions, so they get 3 contact hours per week but I have to look after both sessions. Our computer lab has a small cluster of Linux machines and, this term, a brand new display screen which I am looking forward to playing with. I’m also looking forward to seeing how the infamous ChatGPT copes with the Python coding exercises I give the students to do in class: I’ve only tried one so far, without much success. This is the first module I taught at Maynooth, back in 2018, so this will be the 6th time I’ve done it.

My other class is MP465 Advanced Electromagnetism, which I’m doing for the 3rd time now. This is a standard chalk-and-talk kind of module covering a well-established syllabus, and involving two lectures per week plus a tutorial. At least I’m teaching in a classroom rather than online like when I first did this module!

In 2020/21 (during the Pandemic restrictions) I did five modules as well as being Head of Department. At this time two academic staff departures left us severely short-staffed and struggling to deliver our programmes. My workload then was unmanageable and I asked to step down. I changed my mind when were eventually allowed to recruit two lecturers and saw out my three-year term to the end. I had better not repeat here what I think of the deliberate management decisions that left us reeling and had such negative effects on staff morale and on the education of students in the Department. I just hope the damage is not irreparable.

Although I am doing the same number of modules as last term, the number of contact hours I have to do is higher (8 versus 5) because of the labs and the fact that we don’t have tutors for 4th-year modules so lecturers have to do the tutorials themselves. Four modules a year is a much heavier teaching load than a Full Professor at a UK university would be expected to carry, but it seems normal in Ireland where the funding for sciences is far less than adequate. The impact on research productivity is obvious and is systemic. There are excellent physicists in Maynooth but they are given little time or other resources. It’s a big waste of potential. That’s another “System” that needs changing, but I see little appetite for change of the required sort at institutional level. It’s all about recruiting more and more students to be taught with fewer and fewer resources.

The impact of this on staff careers is severe: teaching loads are so heavy that it’s very difficult to reach the level of research productivity required for promotion. For myself, though, the next career step will be retirement so I don’t have to worry about promotion. Fortunately too, I enjoy teaching, so I’ll just get on with it. So I’ll stop writing and get on with preparing my first week of lectures and lab sessions!

Elliptical Discussions

Posted in Cute Problems, Education, Maynooth, The Universe and Stuff with tags , , on April 7, 2022 by telescoper

It’s the ninth week of Semester 2 and I’m coming to the end of lectures and laboratory sessions for my Computational Physics module; for the remaining three weeks (plus the Easter vacation) the students in this class will be mainly concentrating on the mini-projects that form part of the assessment.

This afternoon, though we had a session on how to transform higher-order differential equations into sets of coupled first-order ODEs suitable for vectorization and consequent solution using standard techniques. The problem we focussed on today was the simple problem of orbital motion of a test particle under the gravitational force in plane-polar coordinates, which can be prepared for physical solution thusly:

This sort of thing reminds me of my undergraduate theory project at Cambridge, where I did a similar thing to solve the equations governing the action of a four-level laser, though that was in Fortran rather than Python. In my own solution I used Python’s off-the-shelf solver odeint.

I like the orbital motion problem a lot because it’s a bit more than a coding exercise: students have to think about how to choose initial data, how to test the their code and interpret the results. Even before that there’s the issue of what units to use; SI units are a bit daft for astronomical problems. For solar system calculations it makes sense to use Astronomical Units for distances and years for time; in such a system it’s easy to work out that GM is just 4π2, which avoids having to deal with ridiculously large or ridiculously small numbers.

Anyway, the fun thing about this lab was that once everyone had got their code working they could try setting initial data to get a circular orbit as a special case, explore how the shape of elliptical orbits depends on the input data, how to make an unbound orbit, and so on. It’s important to understand the output of a numerical calculation in terms of basic physical principles. All that led to a discussion in class of solar system exploration, transfer orbits, what would happen if the mass of the Sun suddenly changed, or if G was a function of time, and lots of other things.

I find sessions like this that encourage students to explore problems themselves very rewarding and I think they add a valuable extra dimension to standard teaching formats. I hope the projects that they’ll be doing from now on – involving topics in areas ranging from atomic physics, cosmology, particle physics and climate science, and done in groups – will provoke even more discussion of this type.

A Day of Computing

Posted in Biographical, Education, Maynooth, The Universe and Stuff with tags , , , , , , on February 3, 2022 by telescoper

Last Semester, Thursday was what I optimistically called a “Research Day” (on the basis that I had no teaching on it). This Semester it’s one of my busiest teaching days, with lecturing in the morning and a lab session in the afternoon, both for Computational Physics.

For most of the last two years I’ve been delivering the lectures and running the lab remotely, but now that we’re back teaching face-to-face I gave the lecture in person and was in the lab with the class for this afternoon’s session. I’ve got about twice as many students this year as last year swill be running two lab sessions (one next Tuesday repeating the material from the Thursday one, and so on throughout the term).

Running the lab remotely worked reasonably well because Python is available to download for free and works on a standard Windows-based PC. In the lab however we use a Linux (Ubuntu) system, which gives the students the chance to try a different operating system (and one which is for many purposes better than Windows).

It’s good to be back running the computing laboratory class in person but I was a bit nervous this morning because since I last did it that way the machines we have in our laboratory have all been upgraded to a new operating system and have a new (and very different) version of Python (3.9 versus the now obsolete 2.7). I’ve been around long enough to realize that things can go wrong in such situations, so I warned the class during this morning’s lecture that there might be teething troubles. Sure enough we had quite a few technical glitches but, to be honest, it it could have been a lot worse. Next Tuesday’s lab should be a bit less stressful as we’ve fixed a few of the things that went wrong.

So, by no means a disaster, but a busy and quite stressful day. Time to go home and relax.

Ireland’s Covid-19 Models

Posted in Covid-19, mathematics, Maynooth with tags , , , , , on July 1, 2021 by telescoper

Yesterday the Chair of the National Public Health Emergency Team (NPHET), who also happens to be the President of Maynooth University, Professor Philip Nolan published a lengthy but interesting Twitter thread (which you can find unrolled here). In these tweets he explained the reason behind NPHET’s recommendation to pause the process of relaxing Covid-19 restrictions, postponing the next phase which was due to begin on 5th July with indoor dining.

The basic reason for this is obvious. When restrictions were lifted last summer the reproduction number increased to a value in the range 1.4 to 1.6 but the infection rate was then just a handful per day (on July 1st 2020 the number of new cases reported was 6). Now the figures are orders of magnitude higher (yesterday saw 452 new cases). A period of exponential growth starting from such a high base would be catastrophic. It was bad enough last year starting from much lower levels and the Delta variant currently in circulation is more transmissable. Vaccination obviously helps, but only about 40% of the Irish population is fully immunized.

Incidentally the target earlier this year was that 82% of the adult population should have received one jab. We are missing detailed numbers because of the recent ransomware attack on the HSE system, but it is clear that number has been missed by a considerable margin. The correct figure is more like 67%. Moreover, one dose does not provide adequate protection against the Delta variant so we’re really not in a good position this summer. In fact I think there’s a strong possibility that we’ll be starting the 2021/22 academic year in worse shape than we did last year.

In general think the Government’s decision was entirely reasonable, though it obviously didn’t go down well with the hospitality sector and others. What does not seem reasonable to me is the suggestion that restaurants should be open for indoor dining only for people who are fully vaccinated. This would not only be very difficult to police, but also ignores the fact that the vast majority of people serving food in such environments would not be vaccinated and are therefore at high risk.

As things stand, I think it highly unlikely that campuses will be open in September. Rapidly growing pockets of Delta variant have already been seeded in Ireland (and elsewhere in Europe). It seems much more likely to me that September will see us yet again in a hard lockdown with all teaching online.

But the main reason for writing this post is that the thread I mentioned above includes a link to a paper on the arXiv (by Gleeson et al.) that describes the model used to describe the pandemic here in Ireland. Here is the abstract:

We describe the population-based SEIR (susceptible, exposed, infected, removed) model developed by the Irish Epidemiological Modelling Advisory Group (IEMAG), which advises the Irish government on COVID-19 responses. The model assumes a time-varying effective contact rate (equivalently, a time-varying reproduction number) to model the effect of non-pharmaceutical interventions. A crucial technical challenge in applying such models is their accurate calibration to observed data, e.g., to the daily number of confirmed new cases, as the past history of the disease strongly affects predictions of future scenarios. We demonstrate an approach based on inversion of the SEIR equations in conjunction with statistical modelling and spline-fitting of the data, to produce a robust methodology for calibration of a wide class of models of this type.

You can download a PDF of the paper here.

This model is a more complicated variation of the standard compartment-based models described here. Here’s a schematic of the structure:

This model that makes a number of simplifying assumptions but it does capture the main features of the growth of the pandemic reasonably well.

Coincidentally I set a Computational Physics project this year that involved developing a Python code that does numerical solutions of this model. It’s not physics of course, but the network of equations is similar to what you mind find in physical systems – it’s basically just a set of coupled ODEs- and I thought it would be interesting because it was topical. The main point is that if you study Theoretical Physics you can apply the knowledge and skills you obtain in a huge range of fields and disciplines. Developing the model does of course require domain-specific epidemiological knowledge but the general task of modelling complex time-evolving systems is definitely something physicists should be adept at doing. Transferable skills is the name of the game!

P.S. It came as no surprise to learn that the first author of the modelling paper, Prof. James Gleeson of the University of Limerick, has an MSc in Mathematical Physics.