the universe is a multi - physics environment in which , from an astrophysical point of view , newton s gravitational force law , radiative processes , nuclear reactions and hydrodynamics mutually interact .the astrophysical problems which are relevant to this study generally are multi - scale , with spatial and temporal scales ranging from m and seconds on the small end to m and on the large end .the combined multi - physics , multi - scale environment presents a tremendous theoretical challenge for modern science . while observational astronomy fills important gaps in our knowledge by harvesting ever - wider spectral coverage with continuously increasing resolution and sensitivity , our theoretical understanding lags behind these exciting developments in instrumentation .  in many ways ,computational astrophysics lies intermediate between observations and theory .simulations generally cover a wider range of physical phenomena than observations with individual telescopes , whereas purely theoretical studies are often tailored to solving sets of linearized differential equations .as soon as these equations show emergent behavior in which the mutual coupling of non - linear processes result in complex behavior , the computer provides an enormous resource for addressing these problems .furthermore simulations can support observational astronomy by mimicking observations and aiding their interpretation by enabling parameter - space studies .they can elucidate the often complex consequences of even simple physical theories , like the non - linear behavior of many - body gravitational systems .but in order to deepen our knowledge of the physics , extensive computer simulations require large programming efforts and a thorough fundamental understanding of many aspects of the underlying theory .  from a management perspective, the design of a typical simulation package differs from construction of a telescope in one very important respect . whereas modern astronomical instrumentation is generally built by teams of tens or hundreds of people , theoretical models are usually one - person endeavors .pure theory lends itself well to this relatively individualistic approach , but scientific computing is in a less favorable position .so long as the physical scope of a problem remains relatively limited , the necessary software can be built and maintained by a single numerically educated astronomer or scientific programmer .these programs are often `` single - author , single - use '' , and thus single - purpose : recycling of scientific software within astronomy is still rare .more complex computer models often entail non - linear couplings between many distinct , and traditionally separate , physical domains . developing a simulation environment suitable for multi - physics scientific research is not a simple task .problems which encompass multiple temporal or spatial scales are often coded by small teams of astronomers .many recent successful projects have been carried out in this way ; examples are gadget , and starlab . in all these cases ,a team of scientists collaborated in writing a large - scale simulation environment .the resulting software has a broad user base , and has been applied to a wide variety of problems .these packages , however , each address one quite specific task , and their use is limited to a rather narrow physical domain .in addition , considerable expertise is needed to use them and expanding these packages to allow the addition of a new physical domain is hampered by early design choices .  in this paperwe describe a software framework that targets multi - scale , multi - physics problems in a hierarchical and internally consistent implementation .its development is based on the philosophy of `` open knowledge . ''we call this environment muse , for multiphysics software environment .the development of muse began during the modest-6a workshop in lund , sweden , but the first lines of code were written during modest-6d / e in amsterdam ( the netherlands ) .the idea of noah s ark ( see [ sect : noah ] ) was conceived and realized in 2007 , during the modest-7f workshop in amsterdam and the modest-7a meeting in split ( croatia ) .the development of a multi - physics simulation environment can be approached from a monolithic or from a modular point of view . in the monolithic approach a single numerical solveris systematically expanded to include more physics .basic design choices for the initial numerical solver are generally petrified in the initial architecture .nevertheless , such codes are sometimes successfully redesigned to include two or possibly even three solvers for a different physical phenomenon ( see flash , where hydrodynamics has been combined with magnetic fields * ? ? ? * ) ) . rather than forming a self - consistent framework ,the different physical domains in these environments are made to co - exist .this approach is prone to errors , and the resulting large simulation packages often suffer from bugs , redundancy in source code , sections of dead code , and a lack of homogeneity .the assumptions needed to make these codes compile and operate without fatal errors often hampers the science .in addition , the underlying assumptions are rarely documented , and the resulting science is often hard to interpret .we address these issues in muse by the development of a modular numerical environment , in which independently developed specialized numerical solvers are coupled at a meta level , resulting in the coherent framework as depicted in fig.[fig : amuse_structure ] .modules are designed with well defined interfaces governing their interaction with the rest of the system .scheduling of , and communication among modules is managed by a top - level `` glue '' language . in the case of muse , this glue language is python , chosen for its rich feature set , ease of programming , object - oriented capabilities , large user base , and extensive user - written software libraries .however , we have the feeling that python is not always consistent and of equally high quality in all places .the objective of the glue code is to realize the interoperation between different parts of the code , which may be realized via object - relational mapping , in which individual modules are equipped with instruction sets to exchange information with other modules .the modular approach has many advantages .existing codes which have been well tuned and tested within their own domains can be reused by wrapping them in a thin interface layer and incorporating them into a larger framework .the identification and specification of suitable interfaces for such codes allows them to be interchanged easily .an important element of this design is the provision of documentation and exemplars for the design of new modules and for their integration into the framework. a user can `` mix and match '' modules like building blocks to find the most suitable combination for the application at hand , or to compare them side by side .the first interface standard between stellar evolution and stellar dynamics goes back to .the resulting software is also more easily maintainable , since all dependencies between a module and the rest of the system are well defined and documented .a particular advantage of a modular framework is that a motivated scholar can focus attention on a narrower area , write a module for it , then integrate it into the framework with knowledge of only the bare essentials of the interface .for example , it would take little extra work to adapt the results of a successful student project into a separate module , or for a researcher working with a code in one field of physics to find out how the code interacts in a multi - physics environment .the shallower learning curve of the framework significantly lowers the barrier for entry , making it more accessible and ultimately leading to a more open and extensible system .the only constraint placed on a new module is that it must be written ( or wrapped ) in a programming language with a foreign function interface that can be linked to a contemporary unix - like system . as in the high - level language ` haskell ` , a foreign function interface provide a mechanism by which a program written in one language can call routines from another language .supported languages include low - level ( ` c ` , ` c++ ` and ` fortran ` ) as well as other high - level languages such as ` c # ` , ` java ` , ` haskell ` , ` python ` and ` ruby ` . currently , individual muse modules are written in ` fortran ` , ` c ` , and ` c++ ` , and are interfaced with ` python ` using ` f2py ` or ` swig ` .several interfaces are written almost entirely in python , minimizing the programming burden on the legacy programmer .the flexibility of the framework allows a much broader range of applications to be prototyped , and the bottom - up approach makes the code much easier to understand , expand and maintain .if a particular combination of modules is found to be particularly suited to an application , greater efficiency can be achieved by hard coding the interfaces and factoring out the glue code , thus effectively ramping up to a specialized monolithic code .   [ cols="<,<,<,<",options="header " , ]   instead of writing all new code from scratch , in muse we realized a software framework in which the glue language provides an object - relational mapping via a virtual library which is used to bind a wide collection of diverse applications .muse consists of a hierarchical component architecture that encapsulates dynamic shared libraries for simulating stellar evolution , stellar dynamics and treatments for colliding stars . as part of the muse specification, each module manages its own internal ( application - specific ) data , communicating through the interface only the minimum information needed for it to interoperate with the rest of the system .additional packages for file i / o , data analysis and plotting are included .our objective is eventually to incorporate treatments of gas dynamics and radiative transfer , but at this point these are not yet implemented .we have so far included at least two working packages for each of the domains of stellar collisions , stellar evolution and stellar dynamics , in what we call the `` noah s ark '' milestone .the homogeneous interface that connects the kernel modules enables us to switch packages at runtime via the scheduler .the goal of this paper is to demonstrate the modularity and interchangeability of the muse framework . in tab.[tab : musemodules ] we give an overview of the currently available modules in muse .   to simulate gravitational dynamics ( e.g. between stars and/or planets ) , we incorporate packages to solve newton s equations of motion by means of gravitational -body solvers .several distinct classes of -body kernels are currently available .these are based on the direct force evaluation methods or tree codes .currently four direct -body methods are incorporated , all of which are based on the fourth - order hermite predictor - corrector -body integrator , with block time steps .some of them can benefit from special - purpose hardware such as grape or a gpu .direct methods provides the high accuracy needed for simulating dense stellar systems , but even with special computer hardware they lack the performance to simulate systems with more than particles .the barnes - hut tree - codes are included for use in simulations of large- systems .two of the four codes are also grape / gpu - enabled .many applications require the structure and evolution of stars to be followed at various levels of detail . at a minimum , the dynamical modules need to know stellar masses and radii as functions of time , since these quantities feed back into the dynamical evolution . at greater levels of realism ,stellar temperatures and luminosities ( for basic comparison with observations ) , photon energy distributions ( for feedback on radiative transfer ) , mass loss rates , outflow velocities and yields of various chemical elements ( returned to the gas in the system ) , and even the detailed interior structure ( to follow the outcome of a stellar merger or collision ) , are also important .consequently the available stellar evolution modules should ideally include both a very rapid but approximate code for applications where speed ( enabling large numbers of stars ) is paramount ( e.g. when using the barnes - hut tree code to follow the stellar dynamics ) as well as a detailed ( but much slower ) structure and evolution code where accuracy is most important ( for example when studying specific objects in relatively small but dense star clusters ) .currently two stellar evolution modules are incorporated into muse .one , called ` eft89 ` , is based on fits to pre - calculated stellar evolution tracks , the other solves the set of coupled partial differential equations that describe stellar structure and evolution following the henyey code originally designed by .the latter code , called ` evtwin ` is a fully implicit stellar evolution code that solves the stellar structure equations and the reaction - diffusion equations for the six major isotopes concurrently on an adaptive mesh .evtwin is designed to follow in detail the internal evolution of a star of arbitrary mass .the basic code , written in fortran 77/90 , operates on a single star that is , the internal data structures ( fortran common blocks ) describe just one evolving object .the ` evtwin ` variant describes a pair of stars , the components of a binary , and includes the possibility of mass transfer between them .a single star is modeled as a primary with a distant , non - evolving secondary .the lower speed of ` evtwin ` is inconvenient , but the much more flexible description of the physics allows for more realistic treatment of unconventional stars , such as collision products .only two ` evtwin ` functions the `` initialize '' and `` evolve '' operations are exposed to the muse environment .the f90 wrapper also is minimal , providing only data storage and the commands needed to swap stellar models in and out of ` evtwin ` and to return specific pieces of information about the stored data .all other high - level control structures , including identification of stars and scheduling their evolution , is performed in a python layer that forms the outer shell of the ` evtwin ` interface .the result is that the structure and logic of the original code is largely preserved , along with the expertise of its authors .physical interactions between stars are currently incorporated into muse by means of one of two simplified hydrodynamic solvers .the simpler of the two is based on the `` sticky sphere '' approximation , in which two objects merge when their separation becomes less than the sum of their effective radii .the connection between effective and actual radius is calibrated using more realistic sph simulations of stellar collisions .the second is based on the make - me - a - star ( mmas ) package and its extension make - me - a - massive - star ( mmams , ) .mma(m)s constructs a merged stellar model by sorting the fluid elements of the original stars by entropy or density , then recomputing their equilibrium configuration , using mass loss and shock heating data derived from sph calculations . ultimately , we envisage inclusion of a full sph treatment of stellar collisions into the muse framework.  mmas ( and mmams ) can be combined with full stellar evolution models , as they process the internal stellar structure in a similar fashion to the stellar evolution codes .the sticky sphere approximation only works with parameterized stellar evolution , as it does not require any knowledge of the internal stellar structure .   at this moment one example module for performing rudimentary radiative transfer calculations is incorporated in muse .the module uses a discrete grid of cells filled with gas or dust which is parameterized in a local density and an opacity , with which we calculate the optical depth ( ) . a star , that may or may not be embedded in one of the grid cells emits photons , each of which is traced through the medium until it is absorbed , escapes or lands in the camera .in each cloud cell or partial cell a photon has a finite probability that it is scattered or absorbed .this probability is calculated by solving the scattering function , which depends on the angles and the stokes parameter .we adopt electron scattering for gas and for dust scattering ( see for details ) .  since this module is in a rather experimental stage we only present two images of its working , rather than a more complete description in [ sect : examples ] . in fig.[fig : rtplummer ] we present the result of a cluster simulation using 1024 stars which initially were distributed in a sphere with a virial radius of 1.32pc and in which the masses of the stars ware selected randomly from the salpeter mass function between 1 and 100 , totaling the cluster mass to about 750 .these parameters ware selected to mimic the pleiades cluster .the cluster was scaled to virial equilibrium before we started its evolution .the cluster is evolved dynamically using the bhtree package and the eft89 module is used for evolving the stars .we further assumed that the cluster was embedded in a giant molecular cloud .the scattering parameters were set to simulate visible light .the gas and dust was distributed in a homogeneous cube with 5pc on each side which was divided into grid cells with a density of h particles/ .  in fig.[fig : rtplummer ] we present the central 5pc of the cluster at an age of 120myr .the luminosity and position of the stars are observed from the z - axis , i.e. they are projected on the xy - plane . in the left panelwe present the stellar luminosity color coded , and the size of the symbols reflects the distance from the observer , i.e. , there it gives an indication of how much gas is between the star and the observer .the right image is generated using the mcrt module in muse and shows the photon - packages which were traced from the individual stars to the camera position .each photon - package represents a multitude of photons .a notorious pitfall in combining scientific software is the failure to perform correct conversion of physical units between modules . in a highly modular environment such as muse , this is a significant concern .one approach to the problem could have been to insist on a standard set of units for modules incorporated into muse but this is neither practical nor in keeping with the muse philosophy .  instead , in the near future, we will provide a units module in which information about the specific choice of units the conversion factors between them and certain useful physical constants are collected . when a module is added to muse, the programmer adds a declaration of the units it uses and expects .when several modules are imported into a muse experiment , the units module then ensures that all external values passed to each module are properly converted .naturally , the flexibility afforded by this approach also introduces some overhead .however , this very flexibility is muse s great advantage ; it allows an experimenter to easily mix and match modules until the desired combination is found . at that point ,the dependence on the units module can be removed ( if desired ) , and conversion of physical units performed by explicit code .this leads to more efficient interfaces between modules , while the correctness of the manual conversion can be checked at any time against the units module .large scale simulations , and in particular the multiscale and multiphysics simulations for which our framework is intended , require a large number of very different algorithms , many of which achieve their highest performance on a specific computer architecture .for example , the gravitational -body simulations are best performed on a grape enabled pc , the hydrodynamical simulations may be efficiently accelerated using gpu hardware , while the trivially parallel simultaneous modeling of a thousand single stars is best done on a beowulf cluster or grid computer .the top - level organization of where each module should run is managed using a resource broker , which is grid enabled ( see [ sect : grid ] ) .we include a provision for individual packages to indicate the class of hardware on which they operate optimally .some modules are individually parallelized using the mpi library , whereas others ( like stellar evolution ) are handled in a master - slave fashion by the top - level manager .   due to the wide range in computational characteristics of the available modules, we generally expect to run muse on a computational grid containing a number of specialized machines . in this waywe reduce the run time by adopting computers which are best suited to each module .for example , we might select a large grape cluster in tokyo for a direct -body calculation , while the stellar evolution is calculated on a beowulf cluster in amsterdam . herewe report on our preliminary grid interface , which allows us to use remote machines to distribute individual muse modules .the current interface uses the muse scheduler as the manager of grid jobs and replaces internal module calls with a job execution sequence .this is implemented with pyglobus , an application programming interface to the globus grid middleware written in python .the execution sequence for each module consists of :  * write the state of a module , such as its initial conditions , to a file , * transfer the state file to the destination site * construct a grid job definition using the globus resource specification language * submit the job to the grid ; the grid job subsequently * * reads the state file , * * executes the specified muse module , * * writes the new state of the module to a file , and * * copies the state file back to the muse scheduler * then read the new state file and resume the simulation .the grid interface has been tested successfully using das-3 , which is a five - cluster wide - area ( in the netherlands ) distributed system designed by the advanced school for computing and imaging ( asci ) .we executed individual invocations of stellar dynamics , stellar evolution , and stellar collisions on remote machines .here we demonstrate the possibility of changing the integration method within a muse application during runtime .we deployed two integrators to simulate the merging of two galaxies , each containing a central black hole .the final stages of such a merger , with two black holes orbiting one another , can only be integrated accurately using a direct method .since this is computationally expensive , the early evolution of such a merger is generally ignored and these calculations are typically started some time during the merger process , for example when the two black holes form a hard bound pair inside the merged galaxy .  these rather arbitrary starting conditions for the binary black hole merger problem can be improved by integrating the initial merger between the two galaxies .we use the bhtree code to reduce the computational cost of simulating this merger process . at a predetermined distance between the two black holes , when the tree code is unlikely to produce accurate results ,the simulation is continued using the direct integration method for all particles .overall this results in a considerable reduction in runtime while still allowing an accurate integration of the close black hole interaction .fig.[fig : gc_2k ] shows the results of such a simulation .the initial conditions are two plummer spheres , each consisting of 32k equal - mass particles . at the center of each `` galaxy '' we place a black hole with mass 1% that of the galaxy .the two stellar systems are subsequently set on a collision orbit , but at a fairly large separation .we use two stellar dynamics modules ( see [ sect : noah ] ) : ` bhtree ` , with a fixed shared time step , and ` phigrape ` , a direct method using hierarchical block time steps . both modules are grape - enabled and we make use of this to speed up the simulation significantly .the calculation is performed three times , once using phigrape alone , once using only bhtree , and once using the hybrid method . in the latter casethe equations of motion are integrated using phigrape if the two black holes are within n - body units ( indicated by the horizontal dashed line in fig.[fig : gc_2k ] ) ; otherwise we use the tree code .fig.[fig : gc_2k ] shows the time evolution of the distance between the two black holes .  the integration with only the direct phigrape integrator took about 250 minutes , while the tree code took about 110 minutes .as expected , the relative error in the energy of the direct -body simulation ( ) is orders of magnitude smaller than the error in the tree code ( % ) .the hybrid code took about 200 minutes to finish the simulation , with an energy error a factor of better than that of the tree code .if we compare the time evolution of the black hole separation for the tree and the hybrid code we find that the hybrid code reproduces the results of the direct integration ( assuming it to be the most `` correct '' solution ) quite well . in summary, the hybrid method seems to be well suited to this kind of problem , as it produces more accurate results than the tree code alone and it is also faster than the direct code .the gain in performance is not very large ( only % ) for the particular problem studied here , but as the compute time for the tree code scales with whereas the direct method scales with ; a better gain is to be expected for larger .in addition , the muse implementation of the tree code is rather basic , and both its performance and its accuracy could be improved by using a variable block time step .hydrodynamic interactions such as collisions and mergers can strongly affect the overall energy budget of a dense stellar cluster and even alter the timing of important dynamical phases such as core collapse .furthermore , stellar collisions and close encounters are believed to produce a number of non - canonical objects , including blue stragglers , low - mass x - ray binaries , recycled pulsars , double neutron star systems , cataclysmic variables and contact binaries .these stars and systems are among the most challenging to model and are also among the most interesting observational markers . predicting their numbers , distributions and other observable characteristics is essential for detailed comparisons with observations .when the stellar dynamics module in muse identifies a collision , the stellar evolution module provides details regarding the evolutionary state and structure of the two colliding stars .this information is then passed on to the stellar collision module , which calculates the structure of the merger remnant , returning it to the stellar evolution module , which then continues its evolution .this detailed treatment of stellar mergers requires a stellar evolution module and a collision treatment which resolve the internal structure of the stars ; there is no point in using a sticky - sphere approach in combination with a henyey - type stellar evolution code .fig.[fig : hrd ] presents the evolutionary track of a test case in which ` evtwin ` ( generally the more flexible ` twin ` code is used , which allows the evolution of two stars in a binary ) was used to evolve the stars in our experiment . a 10 star near the end of its main - sequence collided with a 7 star of the same age .the collision itself was resolved using ` mmams ` .the evolution of the resulting collision product continued using ` evtwin ` , which is presented as the solid curve in fig.[fig : hrd ] .for comparison we also plot ( dashed curve ) the evolutionary track of a star with the same mass as the merger product .the evolutionary tracks of the two stars are quite different , as are the timescales on which the stars evolve after the main sequence and through the giant branch .the normal star becomes brighter as it follows an ordinary main - sequence track , whereas the merged star fades dramatically as it re - establishes thermal equilibrium shortly after the collision .the initial evolution of the merger product is numerically difficult , as the code attempts to find an equilibrium evolutionary track , which is hard because the merger product has no hydrogen in its core . as a consequence, the star leaves the main - sequence almost directly after it establishes equilibrium , but since the core mass of the star is unusually small ( comparable to that of a 10 star at the terminal - age main sequence ) it is under luminous compared to the normal star .the slight kink in the evolutionary track between and 4.3 occurs when the merger product starts to burn helium in its core .the star crosses the hertzsprung gap very slowly ( in about 1 myr ) , whereas the normal star crosses within a few 10,000 years .this slow crossing is caused by the small core of the merger product , which first has to grow to a mass to be consistent with a star before it can leave the hertzsprung gap .the episode of extended hertzsprung gap lifetime is interesting as observing an extended lifetime hertzsprung gap star is much more likely than witnessing the actual collision .observing a star on the hertzsprung gap with a core too low in mass for its evolutionary phase would therefore provide indirect evidence for the collisional history of the star ( regretfully one would probably require some stellar stethoscope to observe the stellar core in such a case ) .dense star clusters move in the potential of a lower density background . for globular clustersthis is the parent s galaxy halo , for open star clusters and dense young clusters it is the galactic disc , and nuclear star clusters are embedded in their galaxy s bulge .these high - density star clusters are preferably modeled using precise and expensive direct - integration methods . for the relatively low density regimes , however, a less precise method would suffice ; saving a substantial amount of compute time and allowing a much larger number of particles to simulate the low - density host environment . in [ sect : tdecomp ] we described a temporal decomposition of a problem using a tree code o( ) and a direct -body method . herewe demonstrate a spatial domain decomposition using the same methods .the calculations performed in this are run via a muse module which is based on bridge . within bridgea homogeneous and seamless transition between the different numerical domains is possible with a similar method as is used in the mixed - variable symplectic method , in which the hamiltonian is divided into two parts : an analytic keplerian part and the individual interactions between particles .the latter are used to perturb the regular orbits . in our implementation the accurate direct method , used to integrate the high - density regions , is coupled to the much faster tree - code , which integrates the low - density part of the galaxies .the stars in the high - density regions are perturbed by the particles in the low - density environment .the method implemented in muse and presented here uses an accurate direct -body solver ( like hermite0 ) for the high density regime whereas the rest of the system is integrated using bhtree . in principle, the user is free to choose the integrator used in the accurate part of the integration ; in our current implementation we adopt hermite0 , but the tree - code is currently petrified in the scheduler .this version of bridge is currently not available in the public version of muse .  to demonstrate the working of this hybrid scheme we simulate the evolution of a star cluster orbiting within a galaxy .the star cluster is represented by 8192 particles with a salpeter mass function between 1 and 100 distributed according to a model density profile .this cluster is located at a distance of 16pc from the center of the galaxy , with a velocity of 65 km s in the transverse direction .the galaxy is represented by equal - mass particles in a king model density distribution .the stars in the star cluster are evolved using the muse stellar evolution module ` eft89 ` , the galaxy particles have all the same mass of 30 and were not affected by stellar evolution .the cluster , as it evolves internally , spirals in towards the galactic center due to dynamical friction .while the cluster spirals in , it experiences core collapse . during this phasemany stars are packed together in the dense cluster core and stars start to collide with each other in a collision runaway process .these collisions are handled internally in the direct part of bridge . throughout the core collapse of the cluster abouta dozen collisions occur with the same star , causing it to grow in mass to about 700 .although the stellar evolution of such collision products is highly uncertain , we assume here that the massive star collapses to a black hole of intermediate mass .the direct part as well as the tree - part of the simulation was performed on a full 1 tflops grape-6 , whereas the tree - code was run on the host pc .the total cpu time for this simulation was about half a day , whereas without bridge the run would have taken years to complete .the majority ( ) of the compute time was spent in the tree code , integrating the particles in the simulated galaxy .( note again that this fraction depends on the adopted models and the use of special - purpose hardware to accelerate the direct part of the integration . )total energy was conserved to better than ( initial total energy was -0.25 ) .the results of the simulation are presented in fig.[bridge ] .here we see how the cluster ( slightly ) spirals in , due to dynamical friction with the surrounding ( tree - code ) stars , toward the galactic center before dissolving at an age of about 4myr . by that time , however , the runaway collision has already resulted in a single massive star of more than 700 .the description of stellar evolution adopted in this calculation is rather simple and does not incorporate realistic mass loss , and it is expected that the collision runaway will have a mass of by the time it collapses to a black hole in a supernova explosion .the supernova itself may be unusually bright ( possibly like sn2006gy ) and may collapse to a relatively massive black hole .similar collision runaway results were obtained using direct -body simulations using starlab and nbody , and with monte - carlo stellar dynamics simulations .while muse contains many self - contained dynamical modules , all of the stellar evolution modules described thus far have relied on simple analytical formulations or lookup formulae .here we present a new simulation combining a dynamical integrator with a `` live '' stellar evolution code , following the detailed internal evolution of stars in real time as the dynamics unfolds .a similar approach has been undertaken by ross church , in his phd thesis .the novel ingredient in this calculation is a muse interface onto the ` evtwin ` stellar evolution program , modified for use within muse ( see [ sect : stellarmergers ] for a description ) .  in keeping with the philosophy of not rewriting existing working code , in incorporating `evtwin ` into ` muse ` , we have made minimal modifications to the program s internal structure .instead , we wrap the program in a f90 data - management layer which maintains a copy of the stellar data for each star in the system . advancing a system of stars simply entails copying the chosen star into the program and telling it to take a step .evtwin proceeds with the task at hand , blissfully unaware that it is advancing different stellar models at every invocation ( see [ sect : stellarmergers ] ) .-0.25 in  figure [ fig : stargrav ] shows four snapshots during the evolution of a 1024-body system , carried out within muse using evtwin and the simple shared - timestep hermite0 dynamical module . initially the stars had a mass function for , for a mean mass of andwere distributed according to a plummer density profile with a dynamical time scale of 10 myr , a value chosen mainly to illustrate the interplay between dynamics and stellar evolution .( the initial cluster half - mass radius was pc . )the initial half - mass relaxation time of the system was 377 myr .the four frames show the state of the system at times 0 , 200 , 400 , and 600 myr , illustrating the early mass segregation and subsequent expansion of the system as stars evolve and lose mass .the integrator was kept deliberately simple , using a softened gravitational potential to avoid the need for special treatment of close encounters , and there was no provision for stellar collisions and mergers . both collisions and close encounterswill be added to the simulation , and described in a future paper .we note that , although the hermite0 module is the least efficient member of the muse dynamical suite , nevertheless the cpu time taken by the simulation was roughly equally divided between the dynamical and stellar modules . even without hardware acceleration ( by grape or gpu ) , a more efficient dynamical integrator ( such as one of the individual block time step schemes already installed in muse ) would run at least an order of magnitude faster , underscoring the need for careful load balancing when combining modules in a hybrid environment .the multiscale software environment presented in this paper provides a diverse and flexible framework for numerical studies of stellar systems .now that the noah s ark milestone has been reached , one can ask what new challenges muse has to offer .many of the existing modules have been adapted for grid use and , as demonstrated in [ sect : grid ] , muse can be used effectively to connect various computers around the world . however , there are currently a number of limitations in its use , and in its range of applications , which will be addressed in the future .most of the current application modules remain unsuitable for large - scale scientific production simulations .the stellar dynamics codes do not yet efficiently deal with close binaries and multiples , although modules are under development , and external potentials , though relatively easy to implement , have not yet been incorporated .binary evolution is not implemented , and the diagnostics available to study the output of the various modules remain quite limited .many improvements can be made to the environment , and we expect to include many new modules , some similar to existing ones , others completely different in nature .the current framework has no method for simulating interstellar gas , although this would be an extremely valuable addition to the framework , enabling study of gas - rich star clusters , galaxy collisions , colliding - wind binary systems , etc .in addition , radiation transfer is currently not implemented , nor are radiative feedback mechanisms between stars and gas . both would greatly increase the applicability base of the framework .however , both are likely to challenge the interface paradigm on which muse is based .the current muse setup , in which the individual modules are largely decoupled , has a number of attractive advantages over a model in which we allow direct memory access .the downside is that muse in its present form works efficiently only for systems in which the various scales are well separated .communication between the various modules , even of the same type , is currently all done via the top interface layer . for small studies , this poses relatively little overhead , but for more extensive calculations , or those in which more detailed data must be shared , it is desirable to minimize this overhead .one way to achieve this would be by allowing direct data access between modules .however , for such cases , the unit conversion modules could not be used , and consistency in the units between the modules can not be guaranteed . as a result , each module would be required to maintain consistent units throughout , which may be hard to maintain and prone to bugs .in addition , the general problem of sharing data structures between modules written in different languages , currently resolved by the use of the glue language , resurfaces .we are grateful to atakan grkan , junichiro makino , stephanie rusli and dejan vinkovi for many discussions .our team meetings have been supported by the yukawa institute for theoretical physics in kyoto , the international space science institute in bern , the department of astronomy of the university of split in split , the institute for advanced study in princeton and the astronomical institute anton pannekoek in amsterdam .this research was supported in part by the netherlands organization for scientific research ( nwo grant no . 635.000.001 and 643.200.503 ) , the netherlands advanced school for astronomy ( nova ) , the leids kerkhoven - bosscha fonds ( lkbf ) , the astrosim program of the european science foundation , by nasa atp grants nng04gl50 g and nnx07ah15 g , by the national science foundation under grants ast-0708299 ( s.l.w.m . ) and phy-0703545 ( j.c.l . ) , by the special coordination fund for promoting science and technology ( grape - dr project ) , the japan society for the promotion of science ( jsps ) for young scientists , ministry of education , culture , sports , science and technology , japan and deisa .some of the calculations were done on the lisa cluster and the das-3 wide - area computer in the netherlands .we are also grateful to sara computing and networking services , amsterdam for their support .                                       ,k. , bubak , m. , sloot , p. 2008a, in computational science iccs 2008 8th international conference ( eds . m. bubak , g.d.v .albada , j. dongarra , p. sloot ) , krakow , poland , lecture notes of computer science , springer ( 2008 ) , vol .5102 , p. 217, k. , bubak , m. , sloot , p. 2008b, in parallel processing and applied mathematics 7th international conference , ppam 2007 , ( eds .r. wyrzykowski , j. dongarra , k. karczewski , j. wasniewski ) , gdansk , poland , lecture notes of computer science , springer ( 2008 ) , vol . 4957 , p. 780, a. , deiters , s. , eggleton , p. , freitag , m. , giersz , m. , heggie , d. , hurley , j. , hut , p. , ivanova , n. , klessen , r. s. , kroupa , p. , lombardi , jr . ,j. c. , mcmillan , s. , portegies zwart , s. , zinnecker , h. 2003 , new astronomy , 8 , 605

Abstract: we present muse , a software framework for combining existing computational tools for different astrophysical domains into a single multiphysics , multiscale application . muse facilitates the coupling of existing codes written in different languages by providing inter - language tools and by specifying an interface between each module and the framework that represents a balance between generality and computational efficiency . this approach allows scientists to use combinations of codes to solve highly - coupled problems without the need to write new codes for other domains or significantly alter their existing codes . muse currently incorporates the domains of stellar dynamics , stellar evolution and stellar hydrodynamics for studying generalized stellar systems . we have now reached a `` noah s ark '' milestone , with ( at least ) two available numerical solvers for each domain . muse can treat multi - scale and multi - physics systems in which the time- and size - scales are well separated , like simulating the evolution of planetary systems , small stellar associations , dense stellar clusters , galaxies and galactic nuclei . in this paper we describe three examples calculated using muse : the merger of two galaxies , the merger of two evolving stars , and a hybrid -body simulation . in addition , we demonstrate an implementation of muse on a distributed computer which may also include special - purpose hardware , such as grapes or gpus , to accelerate computations . the current muse code base is publicly available as open source at http://muse.li .    a&a   [ firstpage ]