Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

registry.dimspec: adding a new dimension

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
I want to introduce a four-dimensional array, with the fourth dimension acting as a kind of time dimension, e.g., THETAstore(i,k,j,t). This array is then gradually filled with values at every time step and once the array is fully filled, time-averaged values are calculated, e.g. THETAmean(i,k,j) = SUM(i,k,j,:)/COUNTER

I managed to realize this with adding a dimension to registry.dimspec and dimensioning my variables THETAstore and THETAmean with "ikjt"
dimspec   t      4    namelist=les_nst                  c     time_average
As Fortran uses Column-major ordering of arrays, this procedure is really slow and increases the run time tremendously. Therefore, I want to move the time dimension to be the first one to speed up looping over these arrays: THETAstore(t,i,k,j)
I tried to use
dimspec    t       1    namelist=les_nst                  c     time_average
and dimensioned THETAstore as "tikj" in the registry. Although the model compiles without errors, I do not see valid results for THETAmean(i,k,j) = SUM:),i,k,j)/COUNTER in my output. Furthermore, I cannot output the THETAstore to the wrfout-files with activating history output in the registry or with using run-time IO.

- Is it possible to output 4-dimensional arrays to netcdf?
- Is it possible to just add a dimension before the default i,k,j indexing or would that require major modifications of the WRF code?

cheers and thanks in advance
Take a look at this FAQ regarding adding 4D arrays and see if it helps: