[mesa-users] Shape of arrays

Josiah Schwab jwschwab at berkeley.edu
Wed Aug 10 16:52:32 EDT 2016


Hi Corentin,

> However, if I run it, the code crashes because the size of s%rho is not
> s%nz (nb, s%nz == nz). Is there a reason for that?

Yes.  It means we don't have to re-allocate the arrays every time we
change the number of zones.

Either set things in a loop like

    do k = 1, nz
       vals(k,1) = s% Pgas(k)/s% P(k)
    end do

or do

   vals(1:nz) = s% Pgas(1:nz)/s% P(1:nz)

Josiah




More information about the Mesa-users mailing list