fortran95 or c for a new stellar evolution program?

Bill Paxton paxton at kitp.ucsb.edu
Sun Nov 20 19:26:36 GMT 2005


Hi All,

I'm trying to get some input from knowledgeable younger players with  
interests in stellar evolution simulation about what programming  
language to use for a fresh start system.   (My fantasy is a 1d  
stellar evolution code that is useful both for teaching and research,  
is easy to download and use, and is fun to study and modify.)

The only candidate languages I'm even willing to consider are  
fortran95 and c.  The feature set of fortran77 is too limited for the  
kind of system building I want to do, and c++ doesn't add critical  
new functionality for this kind of application (plus all c++ users  
know c, but not vice versa).  Availability of free, reliable,  
efficient compilers favors c over fortran95 (at least at present).   
Availability of packages for various parts of the physics (such as  
equation of state, nuclear reaction network, etc.) favors fortran95  
over c (at least until Frank Timmes rewrites his stuff!).  Language  
differences between fortran95 and c seem relatively minor for this  
application: the only major deficiency of fortran95 compared to c is  
the unfortunate lack of pointers to procedures as valid components of  
derived types.  I can imagine situations in which I'd like to have  
them, but it probably is not a show-stopper for fortran95 in this  
application.

My impression is that while many of the "older" generation are  
uncomfortable with anything other than fortran77, there is a large  
fraction of the "younger" generation who are more comfortable with c  
(or even c++)!  Does using fortran95 just make both groups unhappy?   
Or is it a good compromise that lets a larger number of people use  
the system -- the fortran folks lured in by the name; the c folks  
lured in by the promise of c-like features.

In particular, if a user comes from a fortran77 background, would  
fortran95 be any better if the code has lots of statements like the  
following that are basically doing c-like things in fortran95?

			grid % pt(k) % dq_dv(q, i) = d2 * rs(q) * vs(i)

If someone has never used derived data types and pointers, that  
"simple" assignment statement is probably just as daunting as the  
equivalent in c.

			grid -> pt[k] -> dq_dv[q, i] = d2 * rs[q] * vs[i];

So perhaps the jump from fortran77 to fortran95 is about as bad as  
the jump to c, and then the case for fortran95 seems much weaker.

I can go either way on this choice, although my preference is c.

Opinions?  Comments?  I'd enjoy hearing from you.

Cheers,
Bill

p.s. Why don't I just keep working on EZ?   Perhaps Seneca said it  
best in Hercules Furens (Act II, 437):

	"Non est ad astra mollis e terris via."

		The way from earth to the stars is not EZ.



More information about the stellar-discuss mailing list