a number of numerical magnetohydrodynamic ( mhd ) codes have been developed for modeling plasma flows in astrophysics .some of the most well - known codes are _ zeus _ , _ flash _ , _ pluto _ , and _ athena _ .a number of different numerical algorithms have also been developed for the numerical integration of the mhd equations including different approaches for the spatial and temporal approximations , and different algorithms for the approximate solution of the riemann problem .  in this work, we describe a code developed by our group for the numerical modeling of astrophysical mhd flows .the code has been developed for use in several coordinate systems : ( 1 ) 2.5d axisymmetric cylindrical coordinates ( ) ; ( 2 ) 2d polar coordinates ( ) ; ( 3 ) 3d cylindrical coordinates ( ) ; and ( 4 ) a cartesian ( , ) geometry which is used to conduct tests of the ideal and non - ideal mhd modules .the difference between our code and the above - mentioned codes lies in the specifics of the astrophysical problems that we solve .firstly , in the astrophysical regimes that we study , strong shocks ( where the energy dissipation can not be neglected ) are not expected to occur .this permits the use of the entropy conservation equation instead of the full energy equation .the advantage of this approach is that the entropy conservation equation does not contain terms that differ significantly in magnitude .for example , in the energy equation , the largest terms are the gravitational energy and the kinetic energy of the azimuthal motion ; these can be much larger than the internal energy and the energy of the poloidal motion near a gravitating body ( for example , a planet or star ) . additionally , in the vicinity of a magnetized star, the magnetic energy density can significantly exceed the matter pressure ( and the energy - density of thermal energy ) , leading to significant errors when computing the energy conservation equation .the different geometries have each been developed to solve a specific astrophysical problem and hence , there are slight differences in the algorithms across the various coordinate systems .the first version of the code to be developed was the axisymmetric 2.5d version ; its aim is to model the interaction of accreting magnetized stars with the surrounding accretion disk .the 2d version in polar coordinates was developed later on to study the situation where planets orbit in a magnetized disk .lastly , the 3d cylindrical version of the code was created to study intrinsically three dimensional problems such as bending waves in the disk or planets on inclined orbits .each version of the code is based on the standard ideal mhd approach : the matter flow can be described with the one - fluid approximation .  in the 2d polar version of the code ,the components of the velocity and magnetic field perpendicular to the plane of the flow are set to zero .additionally , surface density is used instead of volume density .the formal structure of the mhd equations is the same but we make additional suggestions about the disk and the definitions of the ( surface ) magnetic field so that the conservation equations retain the same conservative form .our codes use a riemann solver based on methods developed by , modified to include the equation for the entropy balance .the 2.5d axisymmetric cylindrical version of the code was developed to investigate astrophysical processes like disk accretion , magnetospheric accretion onto a magnetized star and outflows launched from the disk and star .such mhd flows may be responsible for many the observed properties of young stars . in all of these processes , both the magnetic field of the star as well as magnetic fields induced in the magnetosphere of the star and in the accretion disk play an important role .it is often suggested that the angular momentum transport in the accretion disk is due to the magnetic turbulence associated with the magnetorotational instability ( mri ) ( e.g. , ) . however , modelling this instability requires high grid resolution in the disk , which is computationally expensive . in many cases , it is more practical to allow for steady accretion by incorporating viscosity terms into the code that mimic the angular momentum transport , but do not require high grid resolution .for this reason , the 2.5d version incorporates an -type viscosity which can be switched on or off depending on the phenomena being studied .it is less clear how the matter in the disk interacts with magnetic field that is , which physical processes provide efficient magnetic diffusivity in the disk .reconnection of the magnetic field lines can provide an efficient diffusion mechanism , but the process of reconnection itself also requires some magnetic diffusivity .since the exact mechanism is poorly understood , the magnetic diffusivity is often parametrized in the non - ideal mhd terms .this is implemented in the 2.5d version of the code as a diffusivity module , which can also be switched on or off , with the diffusivity coefficient represented in a way analogous to the .  in the 2.5d axisymmetric cylindrical version of the code ,we split the magnetic field into a fixed component associated with the stellar magnetic field ( for example a dipole field ) and a field induced by currents in the magnetosphere and disk .in contrast , the magnetic field in the 2d polar version is not split into a stellar and current - induced component as the code was initially developed to study the interaction of a planet with a disk threaded by a magnetic field . in order to accurately compute the strength of the stellar gravity on the planet, the grid is allowed to co - rotate with the planet .this approach was suggested by , albeit for a different situation .the 3d cylindrical version of the code combines the two previous versions , enabling investigations of phenomena such as planet migration in a magnetized accretion disk , accretion onto a magnetized star as well as a variety of other problems .however , there is no diffusivity module implemented in the 3d version because the 3d instabilities which cause the magnetic field to diffuse are fully modelled .  in this work ,we describe our godunov - type codes which have been implemented on several different geometries and are designed for solving non - relativistic astrophysical mhd problems .[ sec : godunov ] describes different godunov approaches and the approach used in our codes . in sec .[ sec : numerical algorithms ] , we describe the different coordinate systems in detail . in sec .[ sec : tests ] , we describe tests of the code . sec .[ sec : astrophysical examples ] shows applications of these codes for different astrophysical problems and we conclude with a summary in sec .[ sec : conclusions ] .here we present the full set of ideal 3d mhd equations . viscosity and diffusivityare implemented for specific geometries and are described separately in sec .[ subsec : viscosity and diffusivity ] .the continuity equation in conservative form is : here are the 3d cylindrical coordinates , is the density , is the velocity , and is the time . the entropy conservation equation is : where is the entropy per unit mass and is the adiabatic index . the momentum equations in the , and directions are  where is the magnetic field vector , is the total pressure , and is the net external force from the central star and planet .lastly , the induction equations are : this system of equations describes the evolution of a magnetized plasma in cylindrical coordinates .in order to numerically solve the ideal mhd equations ( eqs . [ eq : cons_eqn]-[eq : full-3d ] ) , we use the godunov method . in godunov - type schemes ,the central problem is to develop an exact or approximate algorithm to solve the riemann problem .the construction of an exact solution to the riemann problem is possible , but it can be numerically complex and is often computationally expensive .the procedure of exact solutions of the riemann problem has been realized by and these exact solutions are used for the testing of our approximate riemann solver .consider the one - dimensional hyperbolic system of equations in conservative form : here , is the vector of conservative variables and is the flux function which maps each conservative variable to its corresponding flux .[ 1 - 1 ] can be rewritten in the integral form of the conservation laws where represents the _ exact solution _ of the riemann problem between the left and right states and ; is a self - similar distance - time variable ; is the interval along the variable at which all of the waves are localized ; and and are the fluxes for the left and right states , respectively .the riemann problem can be approximated by a number of discontinuities , each of which satisfies the rankine - hugoniot jump conditions : here , is velocity of the discontinuity ; are the conservative variables on either side of the discontinuity ; and are the fluxes of the conservative variables across the discontinuity . in the general case , and , excluding . in this case , the condition for self - consistency of the conservation laws is evidently satisfied , while eq .[ 1 - 1b ] for the calculation of fluxes gives , where is the flux in the interval which includes the point .if the point is located at the boundary between intervals ( that is , at the discontinuity where ) , then the flux can be calculated for any two adjacent states .these fluxes are the same as the ones present in the rankine - hugoniot jump conditions .-plane.,width=302 ]  the approximate solution of the riemann problem is represented by the vector which approximates the same conservation laws in integral form .the flux between the left and right states is approximated by one of the simplest approximate riemann solvers was proposed by and has two discontinuities separating three homogeneous states ( as shown in fig . [ hll ] ) .one discontinuity propagates to the left with velocity , while the other propagates to the right with velocity .the approximate solution is assumed to be homogeneous between these discontinuities : .-plane.,width=294 ]  more advanced approximate riemann solvers include two or more intermediate states .   here, we describe the construction of our godunov method for the equations of ideal mhd .as noted earlier , we use the entropy conservation equation instead of the energy equation . the conservative variables and fluxes in eq .[ 1 - 1 ] take on the form :   proposed a modification of the hllc approximate riemann solver for the equations of mhd in which the transverse -components of the velocity and magnetic field are assumed to be the same in both intermediate states . for this reason , in the limit , the hllc solver does not convert to the hllc algorithm with a purely transverse magnetic field ; this is because arbitrary jumps of the -components of velocity and magnetic field are still allowed at the contact discontinuity ( as they are converted to the tangential component ) .the choice of entropy conservation inhibits the modeling of mhd flows with strong shocks at which entropy production occurs .our approximate solution has four intermediate states the wave propagation in the hlld algorithm is shown in fig .the initial discontinuity between the states and decays and the discontinuities appear , propagating away with velocities ( the fast magnetosonic waves ) , ( the alfvn waves ) and ( the contact discontinuity ) .these jumps separate the initial and intermediate states ( see fig .[ hlld ] ) .the calculation of the conservative variables and fluxes in the intermediate states is performed using the following scheme .the normal velocities across the alfvn and contact discontinuities are assumed to be continuous which implies from the rankine - hugoniot jump conditions .we write the rankine - hugoniot conditions for fast magnetosonic waves for all equations except the conservation equation for the of the momentum . for the densities in states and , we obtain the relations from eq .[ 1 - 2 ] and the -component of the momentum equation we obtain where - \\ & \left [ \left ( \rho v_x^2 + p + \frac{b^2}{8\pi } - \frac{b_{x0}^2}{4\pi } \right)_r - b_r ( \rho v_x)_r \right ] ~.\end{aligned}\ ] ]  combining eq .[ 1 - 2 ] and the rankine - hugoniot jump conditions for the entropy , we find   to calculate the transverse components of the velocity and magnetic field in the intermediate states , we use the corresponding components of the momentum and induction equations . in the intermediate states , and , these values are determined from the jump conditions across the fast magnetosonic waves : analogously , we have the values of are calculated using the same formulae , substituting the index .the rankine - hugoniot jump conditions at the alfvn waves ( with ) can be solved , but only if in the first case , we adopt , which corresponds to an alfvn wave propagating to the left along the state . in the second case ,we take , which corresponds to an alfvn wave propagating to the right along the state .  to compute the transverse components of the velocity and magnetic field in the intermediate states , we use the fact that at the contact discontinuity for .  plugging these into the integral conservation laws , we find that the transverse components of the velocity and magnetic field are where  .note that the transverse components of the magnetic field are not necessarily equal ( ) due to the jump conditions for the alfvn waves in the complete system of mhd equations . here , we remove the condition ( in this case , for the of the momentum equation ) and hence lose the continuity of the magnetic pressure for the alfvn waves .  the fluxes in the intermediate states are calculated from the jump conditions one does not need to calculate all of the fluxes .rather , we determine which of the states appears at the point ( in other words , which interval contains the point ) and then calculate the corresponding flux using one of the formulae ( [ 1 - 5a])-([1 - 5d ] ) .  in the limit , the relationships in eq .[ 1 - 4 ] give the result similar relationships can be derived for the -component of velocity and magnetic field and for the fast magnetosonic wave which propagates to the right along . additionally since  , the intermediate states disappear .  in the above derivations it is assumed that the inequalities are satisfied .the case , corresponding to , has been considered above . the cases where or correspond to the switch - on waves propagating to the left or to the right , assuming or at , and are not considered .the wave velocities and are estimated as where are the velocities of the fast magnetosonic waves , propagating along the states respectively .   equations [ 1 - 4 ] and [ 1 - 5 ] show the values of the tangential velocities and magnetic fields in the intermediate states .the numerators on the right - hand sides of these formulae are non - negative , while the denominators have the form the formula for the left state is analogous .the physical sense of the last value is such that it should be positive because the alfvn wave should always propagate slower than the fast mhd discontinuity .the case when this denominator is zero corresponds to the switch - on wave , in which a finite tangential field beyond the discontinuity appears from the zero tangential field in front of the discontinuity . in the approximate riemann solver it is reasonable to retain this property ( the positive sign of the denominator ) in order to avoid a non - physical change of the sign of the tangential field and the appearance of a singularity as . for that, we require that the inequality is satisfied , at some . in that case, we have this can be rewritten as comparing this relationship with that for , we conclude that if the condition in eq .[ 1 - 6 ] is satisfied then .analogously : if the conditions in eq .[ 1 - 6 ] and/or eq .[ 1 - 7 ] are not satisfied ( after computing using eq .[ 1 - 3 ] ) then we perform a correction of and/or , choosing the fast magnetosonic velocity to be the largest and/or the smallest of the roots of eqs .[ 1 - 6 ] and/or [ 1 - 7 ] . here , can only increase while can only decrease .we then recalculate the value , check the conditions in eqs .[ 1 - 6 ] and [ 1 - 7 ] , and if necessary , once again apply corrections to and .we use the equation for entropy conservation instead of the equation of energy conservation . in this case, the correction of the velocities of the fast mhd discontinuities and the positivity of the approximate solution of the riemann solver ( in the sense that the density and entropy are positive in all intermediate states ) is established trivially .to increase the accuracy of the numerical algorithm , we perform a two - stage runge - kutta integration of the equations in time .in the first stage , we calculate the values for the intermediary timestep ,  here , the fluxes are calculated using the entropy - based hlld algorithm described above .formally , we can write the flux calculation procedure in the form where we take the left and right states in the hlld solver to be and .in a 2d cartesian geometry , the mhd equations take the form unlike the 1d case , the vector of the conservative variables has a total of seven components .the sixth and seventh components are and , which must satisfy the divergence free condition the numerical algorithm for 2d is analogous to the 1d case .the integration in time is performed using the two - step runge - kutta method at the same time , .an analogous algorithm for the calculation of fluxes is also used during the second stage of the time - advancement computation .  to ensure that the magnetic field is divergence - free in 2d , we use the method proposed by . in application to problems in cartesian coordinates , this approach is the following : if eq .[ 2 - 1 ] is satisfied , then one can represent the and of the magnetic field in the form at the same time , .when the equations are discretized , the conservative variables are determined in the cells while the and fluxes , and , are computed on the sides of the cells .the corresponding components of the flux function vectors and are where is the component of the electric field ( multiplied by the speed of light ) .thus , the component of the electric field is calculated twice using two different methods : the first as , and the second as .if is determined on the nodes of the grid , the components of the magnetic field can be calculated on the sides of the cells as at the same time , the divergence - free condition will be satisfied if we require the magnetic field in the cells are then computed from the calculated values on the cell boundaries   to calculate at the timestep , we determine the of the electric field at each node . the simple variant proposed by consists of averaging the values and over the cell sides surrounding the node at . for a homogeneous grid , this is   in it was noted that this approach is inconsistent with the numerical integration algorithm in the case of 1d problems ( where the solution does not depend either on or on ) , and that the proposed procedure does not guarantee consistency . a modified form ( for homogenous grids ) to calculate , we use either eqs .[ 2 - 2 ] or [ 2 - 3 ] .[ 2 - 3 ] has applications in damping out small - scale oscillations of the magnetic field .thus , at each stage of numerical integration of the mhd equations , the magnetic field in the plane is calculated along the following algorithm :  1 .use an approximate riemann solver to find the of the electric field at the sides of cells , .2 .  use eq .[ 2 - 2 ] or [ 2 - 3 ] to calculate the electric field in the nodes of the grid .3 .  calculate the of the magnetic field potential in grid nodes , .4 .  calculate and .5 .  using eq .[ 2 - 1a ] , calculate and .to solve the 2.5d mhd equations ( with magnetic diffusivity and viscosity ) in the disk , we split the different physical processes into several different modules .these are : ( 1 ) the ideal mhd " module in which we calculate the dynamics of the plasma and magnetic field with dissipative processes switched off ; the `` diffusivity '' modules ( 2 ) and ( 3 ) which calculate the diffusion of the poloidal and azimuthal components of the magnetic field for frozen values of the plasma velocity and thermodynamic parameters ( density and pressure ) ; and the `` viscosity '' module ( 4 ) which computes the viscous dissipation in the disk .  *( 1 ) * in the hydrodynamic module , the ideal mhd equations are integrated numerically using an explicit conservative godunov - type numerical scheme . in our numerical code, the dynamical variables are determined in the cells , while the vector - potential of the magnetic field , , is determined on the nodes . to calculate the fluxes between the cells , we use the previously described approximate riemann solver .  for better spatial resolution, we perform the reconstruction of the primitive variables to the boundaries between the calculated cells .we use two types of limiters : a ) the minmod limiter , and b ) a limiter which reconstructs the function with 3rd order accuracy ( which is similar to the limiter developed by ) .integration of the equations in time is performed with a two - step runge - kutta method .  to guarantee a divergence - free field in the 2.5d version of the code, the -component of the magnetic field vector - potential ( or magnetic flux function ) is calculated at each timestep and then used to obtain the poloidal components of the magnetic field ( , ) in a divergence - free form .in other words , the condition is guaranteed to be satisfied to within machine accuracy .the calculation of is performed using either the algorithm proposed by or the modified form proposed by .  * ( 2 ) * in the module where the diffusion of the poloidal magnetic field is calculated , we numerically integrate the equation for the -component of magnetic field vector - potential ( or magnetic flux function ) , using an explicit approximation .  * ( 3 ) * in the module where the diffusion of the azimuthal component of the magnetic field and * ( 4 ) * the viscous stresses are calculated , we add diffusive terms which approximate the corresponding spatial derivatives to the fluxes calculated by the ideal mhd module .the ideal and diffusivity modules are verified separately using a number of standard tests .the setup and results of these tests are discussed in sec .[ sec : tests ] .the ideal mhd equations in the axisymmetric cylindrical geometry are derived from the full set of 3d mhd equations by requring that ( see sec .[ subsec : geom 3d ] ) .the equations are written in a form which does not have singularities on the right hand side .for the and of the equation of motion and of the induction equation , we substitute the operator , representing divergence operator in cylindrical coordinates . as a result , the of the equations of motion takes on the form of angular momentum conservation while the of the induction equation takes on its typical form .  in discretizing the cylindrical mhd equations , we take into account the fact that near the symmetry axis ( where ) , different variables have different asymptotic behavior .for example , the values as whereas the values scale with .analogous behavior is shown by the fluxes corresponding to these variables .in particular , in the approximation of the of the equation of motion ( the angular momentum equation ) , we multiply the fourth equation ( eq . [ eq : momeqn_phi ] ) by and integrate it along and in the limits of the calculated cell .the equation is then rewritten in the form and , where and weakly depend on .here we have dropped the indices on and .we have next where analogously , thus , the angular momentum conservation equation for the cell has the form : it is clear that this approximation of the operator and more precisely of the multiplier , significantly differs from analogous terms ( for example , of ) only in the vicinity of the symmetry axis .the flux densities and , which are used in eq .[ eq : momeqn_phi ] , are calculated using the 1d algorithm for the approximate solution of the riemann problem .   herewe discuss the treatment of viscosity and diffusivity .we use equations of motion in cylindrical coordinates in the form :  the stress tensor consists of an ideal part : which is used to derive the momentum equations in eqs .[ eq : momeqn_r ] , [ eq : momeqn_phi ] and [ eq : momeqn_z ] , and a viscous part which takes into account small - scale turbulent velocity and magnetic field fluctuations .we assume that the stress due to the turbulent fluctuations can be represented in the same way as the collisional viscosity by substituting in the turbulent viscosity coefficient .the components of the tensor in axisymmetric cylindrical coordinates are : here is the angular velocity of the plasma and is the dynamical turbulent viscosity . in 3d, we only consider the and components of the stress tensor as these are expected to be dominant ; similarly , in 2d polar coordinates , we only consider the component.  separating out the viscous stress in the component of the momentum equation gives where and are components of the inviscid part of the stress tensor .we assume that the plasma has a finite magnetic diffusivity .that is , the matter may diffuse across the field lines .we also assume that the finite diffusivity of the plasma is due to the small - scale turbulent fluctuations of the velocity and the magnetic field .the induction equation averaged over the small - scale fluctuations has the form here , and are the averaged velocity and magnetic fields , and is electromotive force connected with the fluctuating fields .since the turbulent electromotive force is connected with small - scale fluctuations , it is reasonable to suppose that it has a simple relation to the ordered magnetic field .if we neglect the magnetic dynamo -effect , then , where is the coefficient of turbulent magnetic diffusivity . equation ( [ 4 - 1 ] ) now takes the form we should note that the term for formally coincides with ohm s law the coefficient of turbulent electric conductivity .  to calculate the evolution of the poloidal magnetic field it is useful to calculate the -component of the vector - potential or magnetic flux function .due to the assumed axisymmetry , substituting into the induction equation gives the equation for the component of the vector - potential   the azimuthal component of the induction equation gives   the viscosity and magnetic diffusivity lead to dissipation of the kinetic and magnetic energies , conversion into thermal energy and a corresponding increase of the entropy . in our simulationswe have neglected viscous and ohmic heating .we have also neglected radiative cooling .thus , the main effect of the viscous terms is the transport of angular momentum outward which allows matter to accrete inward to the disk - magnetosphere boundary .the main effect of the diffusion terms is the transport of matter through magnetic field lines .the dissipative terms and , are incorporated into the numerical algorithm by way of a flux correction in the finite - difference equations .the modified fluxes are included in the angular momentum conservation equations , and the modified fluxes ( components of the poloidal electric field ) are included into the of the induction equation .the approximation of the viscous stresses takes the form : the approximation of the poloidal electric field has the form : here , and are the and of electric field , and are the same components calculated in the approximation of the ideal plasma conductivity using the algorithm described above , .  the coefficients of the dynamical viscosity at the boundaries between calculated cells are calculated according to . here , and are the coefficients of the dynamical viscosity in the grid cells .analogously , we calculate and the coefficient of the dynamical viscosity at the boundaries between cells .  the azimuthal component of the electric field , responsible for the evolution of the magnetic flux function , is approximated using a special method .the azimuthal component of the turbulent electric field is presented in the form and approximated by .\end{split}\ ] ]  a corresponding term is added to eq .[ 4 - 4 ] , which takes on the form = - r_{i+1/2 } e_{\phi , i+1/2,j+1/2}^{id}. \end{split}\ ] ] the values of on the right hand side are calculated using eqs . [ 2 - 2 ] and [ 2 - 3 ] . at the first step of the time integration, we use a time - step of and calculate the values of .we have also developed a fully three dimensional version of the code in cylindrical coordinates . to calculate the fluxes between cells , we use the hlld method as in the 2.5d code . to correct the fluxes, we use the minmod flux corrector , which is applied on the primitive variables . to integrate the equations in time, we use the two - step runge - kutta method .the main differences between the 2d and 3d codes lie in the algorithm which ensures that the magnetic field is divergence - free .namely , the divergence - free condition is guaranteed by calculating the components of the magnetic field on the sides of cells from the induction equation : the components of the electric field are calculated at the edges of the cell as in the axisymmetric case .for example : where the values on the right hand side are the corresponding fluxes calculated by the riemann solver : is determined between cells and and so on .  after calculating the electric field components , the magnetic field components at the sides of cells ( for example , at )are calculated using the formula   the other components and are calculated in a similar fashion .this ensures that the magnetic field is divergence - free ( so long as the field is initially divergence - free at the beginning of the simulation ) . as a next step , the magnetic field in the cellsis calculated from the values on the cell boundaries :    to describe the interaction of the accretion disk with a planet in the presence of a magnetic field , we use a model which describes the processes in terms of surface variables ( density and pressure ) .the equations for this model are obtained by integrating the three - dimensional mhd equations along the which is perpendicular to the disk plane . for simplicity , we assume that the of the velocity and the magnetic field are zero and there is no field outside the disk .  the governing equations are derived from the ideal mhd equations ( eq .[ eq : full-3d ] ) by integrating in the vertical direction :   here is the surface density ; is the surface pressure ; is the -averaged analog of the mangetic field ; is an analog of the entropy ; , and are the components of the force per unit surface area acting from the planet on the disk matter .these resemble the standard form of the 2d equations where the in the 3d equations is set to 0 .the induction equations take on the form  here , is the `` magnetic thickness '' of the disk , which is the characteristic scale for the magnetic field distribution in .this scale is not identical to the disk height which characterizes the of the density and pressure in the disk .we take to be the same across both equations .since the magnetic field in the disk is unlikely to change sign in the vertical direction , the approximation seems to be reasonable . the next suggestion which helps to closethe system of equations is in the dependence of the magnetic thickness of the disk on the radius .in particular , if we assume is constant , then the induction equations will also take the standard form ( in the same sense that ) . to calculate the magnetic field and volumetric density and pressure from the values ,we assume a disk thickness at some characteristic radius and back out the volumetric terms .we have performed multiple tests of the code across different grid geometries . below we show two examples of such tests . in the first , we test the ideal mhd module ( with the viscosity and diffusivity modules switched off ) . in the second , we test the diffusion module separately .( left panel ) , ( middle panel ) and ( right panel ) . _bottom panels : _ the density contour lines . ]the first test is the standard rotor problem " in cartesian coordinates .this test has been used by a number of authors for testing mhd solvers which use the energy equation .we use this test to check the ideal mhd module of our code ( with viscosity and diffusivity switched off ) .the ideal mhd equations are solved on a regular cartesian grid in the region , with grid sizes , where for the three different tests . at the beginning of the simulations , ,the pressure in the region is constant , , and the magnetic field is homogeneous , , . in the center, there is a circle of higher - density matter ( ) with radius ( where the radius is ) .the matter in the inner circle initially rotates as a solid body with angular velocity . for ,the density is and the matter is at rest . in the ring in between these two regions , the density and velocity are linearly interpolated between the values at and .  ,pressure , kinetic energy , and magnetic energy along a horizontal line at the center of the rotor at time . [ fig : rotor_cuts],scaledwidth=45.0% ]  the equations of ideal adiabatic mhd are solved with the previously described godunov - type scheme .the timesteps are calculated from the condition where is the maximum timestep allowed by the courant - friedrichs - levy ( cfl ) condition .the results of the simulations at are shown in fig .[ ideal-6 ] . evidently , the density and the field line distribution is very similar in all three of our cases .the bottom panels of fig .[ ideal-6 ] show selected streamlines with numbers which clearly show the similarity of the results across the various grid sizes .[ fig : rotor_cuts ] shows slices along the -axis for the density , pressure , kinetic energy , and magnetic energy for each of the three grid sizes in addition to a high resolution grid with . at the highest resolutions ,the models are nearly indistinguishable and the convergence of the results is evident .   .from left to right : contours of the pressure , density and magnetic flux functions at the moment of time when the scaling parameter is . in all of the plots ,the solid line shows the numerical solution while the dashed line shows the analytical low - type solution.,width=268 ]  , but using an inhomogeneous grid with .,width=268 ]  .the dependence of the radial component of velocities and components perpendicular to the radius on the spherical radius for all grid cells.,width=288 ]  . from left to right : pressure , density and magnetic flux function at the moment of time when the scaling parameter is . in all plots ,the solid line shows the numerical solution , dashed line analytical solution.,width=226 ]  to test the ideal mhd module , we also compare our numerical calculations with analytic solutions found by .one of them has been used in for testing the corresponding module of the zeus code .it is convenient to write these solutions in spherical coordinates ( as we will do below ) , and then to convert them to cylindrical coordinates .  these solutions are self - similar and assume that the magnetic flux function has a dependence on the time and radial coordinate of the form .here is a time - dependent scaling parameter and is the self - similarity radius .the velocity has only a radial component ( in the spherical coordinate system ) which depends linearly on the radius .the function satisfies the equation , and the magnetic flux function satisfies the grad - shafranov equation .the other variables are connected with and and their derivatives by algebraic relationships . the first solution proposed by and used fortesting does not have an azimuthal component of the magnetic field .the second solution used in has a non - zero azimuthal magnetic field , but the motion of the plasma is inertial .  in the first solution , chose growing solutions of the function  the magnetic flux function has the form the poloidal components of the magnetic field are calculated along the known formulae the initial pressure and density are ( \xi^2 - \xi_0 ^ 2 ) , \\ & \rho = \frac{2 c^2 \xi}{\pi a^3 ( \alpha \xi + gm/\xi^2 ) } \bigg[7 ( \xi^2 - \xi_0 ^ 2)^2 \xi^2 \sin^2 \theta + \xi_0 ^ 6 \bigg].\end{aligned}\ ] ] and the radial velocity is given by :   we take the following parameters for the problem : , the adiabatic index is .  the solution is numerically computed over the region , with a rectangular region , , excised from the simulation .we use two grids : a homogeneous grid , with , and an inhomogeneous grid , . in both cases ,the excised rectangular region is homogeneous , with dimensions , though values are not computed in this region .thus , the cell sizes of the homogenous grid are and . for the inhomogeneous grid ,the grid size is increased in a geometrical progression with the power .the integration time - step has been chosen automatically such that .the function is determined by numerically integrating eq .[ 5 - 1 ] with the initial condition at sufficiently fine grid resolution . as an initial condition, the analytical solution is used with the parameter . for boundary conditions, we also use the analytical solution for all variables with the parameter corresponding to the moment of time . the simulations were performed up to the moment of time when .[ lou - un - a6 ] and fig .[ lou - nun40-a6 ] from left to right show the pressure , density and magnetic flux function at the moment of time when the scaling parameter is .[ lou - un - a6 ] shows the result of the simulations on a homogeneous grid , while fig .[ lou - nun40-a6 ] shows the results for the inhomogeneous grid . in all of the plots ,the solid line shows the numerical solution and the dashed line shows the analytical solution .[ lou - v - a6 ] shows the radial and transverse components of the velocities as a function of the spherical radius .one can see that the velocity is directed along the radial direction and is proportional to the radius with the high accuracy .  .the dependence of the radial component of velocities and components perpendicular to the radius on the spherical radius for all grid cells.,width=192 ]  in the second solution the scaling factor linearly depends on time , . in this case, the magnetic flux function has the form \dst{0 } & \xi > \xi_c~. \end{array } \right.\ ] ] the poloidal components of the magnetic field ( in spherical coordinates ) can be calculated using the analytic solution \dst{0 } & \xi > \xi_c~. \end{array } \right.\ ] ] \dst{0 } & \xi > \xi_c~. \end{array } \right.\ ] ] the azimuthal component of the magnetic field is \dst{0 } & \xi > \xi_c~. \end{array } \right.\end{aligned}\ ] ] the density and pressure are given by  \dst{\frac{7 d_0}{a^3 } \left(\frac{r_0}{\xi } \right)^8 } & \xi > \xi_c~. \end{array } \right.\ ] ]  \dst{\dfrac{7 d_0 \eta r_0 ^ 2  } { 6 a^4 } \exp \left ( \frac{2 gm}{3 \eta r_0 ^ 3 } \left(\frac{r_0}{\xi}\right)^9 \right ) } & \xi > \xi_c~. \end{array } \right.\ ] ] the radial velocity is simply .the parameters of the problem are assigned the following values : , the adiabatic index is .the equations of ideal mhd are integrated in the region , , where an inner rectangle with size , has been excised from the region .we use the homogeneous grid , and the grid in the excised region is .thus , the cell size is and .the time - step is chosen automatically such that . as an initial condition, we take the analytical solution described above for .we use the analytical solution for the boundary conditions , taking the parameter to correspond to the moment of time .the calculations are done up to the moment when the scaling parameter reaches the value .as before , fig . [ stone - a6 ] and fig . [ stone - v - a6 ]show the results of simulations at the moment when the scaling parameter becomes equal to .   as with the 2d code , we test the 3d code with the rotor problem .the 3d mhd equations are solved numerically in the cylindrical region , and the initial conditions are determined using the same initial conditions as in the 2d test . in the beginning of the simulations , , the pressure in the region is constant , , and the magnetic field is homogeneous , , . in the centerthere is a circle with radius where the matter density is and the matter rotates as a solid body with angular velocity . at ,the density is and the matter is at rest . in the ring , the density and velocity are linearly interpolated between those at and .  in the testwe use a homogeneous grid with .the integration time - step is chosen automatically in such way that .the results of the simulations at time are shown in fig .[ rotor ] .one can see that the density , pressure and the field line distributions are very similar to 2d case .   to test the ideal mhd module, we also use the analytical solution described in sec .[ subsubsec:2dlow ] .calculations were performed in the cylindrical region for a grid .results of simulations are shown in fig .[ lou ] . the color background shows pressure distribution ( left panel ) and density ( right panel ) .the lines show corresponding analytical solutions .  ._ left panel : _ density distribution ( color background ) and field lines ( solid lines ) . _ right panel : _ the pressure distribution ( color background ) and field lines ( solid lines).,width=264 ]   at scaling parameter , _ bottom panels : _ scaling parameter . ]  , magnetic flux function and the azimuthal velocity , from left to right .the solid lines indicate the numerical solutions while the dashed lines show the analytical solutions given by eqs .[ 5 - 5][5 - 7 ] .the bottom panels show the absolute errors in the calculation of the corresponding functions.,width=264 ]     here we test the diffusivity module of the code . for thiswe switch off the hydrodynamic fluxes and the corresponding right - hand side terms in eqs .[ 4 - 4 ] and [ 4 - 5 ] and integrate these equations numerically in the region , with the rectangular region , excised from simulations . the solutions for the magnetic flux function and azimuthal velocity are symmetric about the equatorial plane while solutions for the azimuthal component of the magnetic field are antisymmetric .all solutions go to zero at the symmetry axis we can find particular solutions of eqs . [ 5 - 2][5 - 4 ] by the method of variable separation in spherical coordinates . for , eq .[ 5 - 2 ] in spherical coordinates is for testing we choose the following solutions of eq .[ 5 - 2sph ] : where and are constants , is the spherical radius , and is the polar angle .the equations for the magnetic flux function and the -components of the velocity and magnetic field are integrated numerically using our 2.5d code ( with the switched - off hydrodynamic fluxes and zero right hand side terms ) .we use the same grid geometry as in the main simulations ; that is , cylindrical coordinates with a non - equidistant grid in both directions .  for the test, we take a grid of , and also a finer grid with . we also take the inner and outer radii ( in the ) of the simulation to be and . for these boundaries we set and to be equal to the analytical values determined by eqs .[ 5 - 5]-[5 - 7 ] .the initial conditions correspond to the exact solutions of eqs .[ 5 - 5]-[5 - 7 ] at .the constants and in these equations are chosen so that the solutions at the inner boundary are of the order of unity .we use , and integrate the equations up to ..the maximum absolute error in calculations of the and obtained in the diffusivity tests .[ cols="<,<,<,<,<",options="header " , ]   the top panels of fig .[ diff-50 - 100 ] show the result of the diffusivity test for the -component of the magnetic field , the vector potential , and the -component of the velocity .the solid lines show the numerical solution of eqs .[ 5 - 2]-[5 - 4 ] , which are obtained by integrating the equations using our code until .the dashed lines show the exact solutions given by eqs .[ 5 - 5]-[5 - 7 ] . evidently , the numerical and analytical solutions are nearly identical .the bottom panel shows the absolute errors for each function .one can see that the error is very small everywhere , taking into account the fact that the maximum value of all the functions , .the error increases towards the star because the value of the functions also strongly increases towards the star .we perform similar simulations and analysis for finer grid resolutions .table [ t : dif ] shows the maximum absolute errors , , , and .one can see that for the finer grid ( dimensions ) , this error is and times smaller compared to the coarsest grid ( dimensions ) .this confirms the convergence of the numerical solution towards the analytical solution .similar comparisons for the component give factors and , which also show convergence .similar comparisons for the component give factors and , which also show convergence .the codes discussed in this paper have already been used to study a variety of different astrophysical problems .below , we show a few examples of calculations with the code in both 2d and 3d geometries .   the hydrodynamic version of the code in 2.5d cylindrical coordinates was used to study counter - rotating accretion disks .the simulations show that the interaction between two counter - rotating regions of the disk strongly depends on the value of the viscosity coefficient which varies from up to .the simulations show that in counter - rotating disks , the accretion rate may be increased by a factor of .the problem is set up such that the inner region of the disk orbits the star in one direction while the outer part orbits in the opposing direction ( see fig .[ counter - blob ] , top panels ) .the simulations were performed for a viscosity parameter of .initially , the boundary between the counter - rotating regions of the disk is sharp . when the simulations start , the oppositely directed regions of the disk start interacting due to viscosity , leading to annihilation of the angular momentum at the interface .this matter , which has lost some of its centrifugal support , begins to accrete rapidly due to the unbalanced gravitational force .this leads to a hundred - fold increase of the accretion rate compared with a disk which does not have a counter - rotating component .the simulations also show that the component of the stress tensor , , dominates the angular momentum transport in the disk .we also study the case where a clump of counter - rotating matter is allowed to interact with the top of the disk ( see fig .[ counter - blob ] , bottom panels ) .we find that a part of the disk matter loses angular momentum through viscous interactions with the counter - rotating clump and is quickly accreted onto the star .analysis shows that in this case , three components of the viscosity tensor , and contribute to the angular momentum transport .     the code has also been utilized to study accretion onto a magnetized star from a turbulent accretion disk in 2.5d cylindrical coordinates .a sample of the results are shown in the right panel of figure [ 2d - mri-2 ] .the turbulence present in the disk is driven by the magneto - rotational ( mri ) instability ( e.g. , ) .simulations were performed for different magnetospheric radii and different initial values of the plasma parameter in the disk , which varied from to .the dynamical range of initial densities between the disk and corona was . inside the magnetosphere ,the dipole magnetic field varies as and the magnetic pressure varies as . in the regions of high magnetic pressure , the matter pressure and density become very low , thereby limiting the simulation timestep and slowing the calculation . to overcome this difficulty , we require : , where ; in other words , we require that the matter pressure does not fall below a certain fraction of the magnetic pressure . in the grid cells where the matter pressure becomes smaller than this value , it is adjusted to be .we then recalculate the density to be thermodynamically consistent . in cases of large magnetospheres , this leads to slightly enhanced matter density and pressure near the star .however , this does not change the physics of the magnetosphere because the magnetic pressure is still times higher than the matter pressure , and therefore the physics of the disk - magnetosphere interaction is described correctly in the sense that the magnetosphere is strongly magnetically - dominated . in other parts of simulation region , no floor density or pressure is added .the grid is compressed towards the disk midplane and towards the with the goal of having higher grid resolution in the disk and near the star .the left panel of figure [ 2d - mri-2 ] shows a typical grid used in this study with cells in the radial direction and cells in the axial direction .the number of grid cells covering the disk in the vertical direction ( in the middle of the disk ) is about 200 , and the mri - unstable modes are well - resolved even in cases of a small - scale turbulence .  for this study ,the viscosity or diffusivity terms are not enabled .the disk matter is loaded onto the magnetic field lines of the magnetosphere due to reconnection or due to the small numerical diffusivity which is present in the code .another problem which has been studied using this code is that of disk accretion onto a magnetized star rotating in the propeller regime . in the propeller regime of accretion, the magnetosphere of the star rotates more rapidly than the inner disk ; the angular momentum imparted on the disk by the magnetosphere can push the disk away or drive outflows from the disk - magnetosphere boundary ( e.g. , ) . as in the previous study ( sec .[ sec : mri accretion ] ) , the angular momentum transport in the disk is mediated by the mri - driven turbulence .the large centrifugal barrier at the disk - magnetosphere boundary inhibits direct accretion onto the star .rather , the disk matter accumulates at the disk - magnetosphere boundary until it compresses the magnetosphere inward of the corotation radius and accretion can proceed .the result is a burst of accretion in which part of the matter accretes onto the star and part is launched as a short - lived magneto - centrifugal wind .there is also a secondary low - density wind which flows out along field lines anchored to the surface of the star . in the latter component of the winds ,the matter is launched rapidly , resulting in low density regions near the star .  in order to prevent the density ( and simulation timestep ) from becoming too small, we implement a floor density condition .that is , we fix the minimum density in the simulation region to be , effectively adding a small amount of matter whenever the density drops below a certain threshold .we track the amount of matter that is added , and find that it is much smaller than the matter flux in the disk and in the wind .we also implement the matter pressure floor condition for matter pressure inside the magnetosphere ( see sec .[ sec : mri accretion ] ) .  as a word of caution : for relatively large values of , the matter which is added to maintain the floor pressure can have a tendency to flow out of the super - keplerian magnetosphere due to centrifugal forces , thereby forming an artificial outflow .however , for low enough values of ( up to ) , no artificial outflows from the inner magnetosphere were observed .[ 2d - propeller ] shows matter flux and also energy and angular momentum carried by the matter and the magnetic field ( see details and description of fluxes in ) .the axisymmetric grid is in cylindrical ( , ) coordinates with mesh compression towards the disk and towards the -axis such that there are a larger number of cells in the disk plane and near the star . in the models presented here, we use a non - uniform grid with dimension cells . corresponding to a grid that is 66 by 140 stellar radii in size . at ,the number of grid cells which cover the disk in the vertical direction is about 200 .  at the disk - magnetosphere boundary, 3d instabilities may cause the disk matter to penetrate through the magnetic field lines into the magnetosphere .since these instabilites are intrinsically three dimensional , they are not modeled in the current axisymmetric 2.5d simulations . to mimic these processes ,we implement diffusivity near the star using the diffusivity module described in sec .[ subsec : viscosity and diffusivity ] . to prevent modifications to the overall disk accretion rate , the diffusivity is only enabled near the disk - magnetosphere boundary .we study the disk - magnetosphere interaction in this region for different diffusivity parameters .we find that for larger values of , the disk matter penetrates through the magnetosphere more rapidly causing most of the accreting matter to be ejected into an outflow .a version of the code in 2d polar coordinates has been used to model the migration of a planet through a magnetized disk ( comins et al .2015 , in prep . ) . in a test version of this problem, we followed the approach by which used two different codes to solve this problem ( _ fargo _ and another code ) .our initial conditions are almost identical to those taken by : the planet s mass is 5 earth masses ; the disk has a constant surface density distribution ; the initial magnetic field has only an azimuthal component , , which scales with radius as where ; andlastly , the disk is locally - isothermal .we take for the adiabatic index to mimic a locally - isothermal disk .the size of simulation region is and , and the grid and .the grid is stretched in the radial direction such that the grid cells are almost rectangular in all parts of the simulation region .the magnetic resonances are resolved at 12 grid cells in the radial direction .our simulations confirm the results obtained by .namely , that if the plasma parameter is of order unity , then the magnetic resonances can be more important than the lindblad resonances ( which lead to inward migration ) and the migration can be stopped if the radial gradient of the azimuthal magnetic field is sufficiently large .[ magres ] shows the density distribution where the magnetic resonances are observed as azimuthally - stretched density depletions near the planet ( see left panel ) .the middle panel shows that in the region of magnetic resonances , the magnetic field is enhanced .the right panel shows a radial cut of the density and magnetic field along the planet s radial vector .we find that at the migration is inward ; in contrast , for steeper density profiles ( and ) the planet migrates outward .this is in accord with the results obtained by , who find that the inward migration consistently slows and reverses direction as increases .a version of the 3d code in cylindrical coordinates has been used to model the migration of a planet in a 3d hydrodynamic disk .the cylindrical simulation region extends between and and .the number of grid cells in each direction is , , and .the simulations show that the planet excites two waves in the disk at the lindblad resonances and migrates inward due to angular momentum transfer from the planet to the disk .the density perturbation is largest in the equatorial plane , and falls off away from the equatorial plane .[ 3d - planet ] shows an example of simulations which show typical waves in the disk .we have developed and tested a godunov - type code where the hlld solver of miyoshi and kusano is implemented . due to the nature of many of our astrophysical problems ( where strong shock waves are not expected ) ,we choose the adiabatic form of the energy equations .the codes pass standard tests and were used for solving different astrophysical problems .the simulations show that our entropy - conserving hlld solver performs satisfactorily in many astrophysical applications , such as studies of low - density , high - velocity outflows in propeller - driven winds .the ideal mhd module , viscosity module and diffusivity module were tested in different astrophysical situations .the authors thank the anonymous referee for valuable comments and constructive criticism and alisa blinova for help with this paper .resources supporting this work were provided by the nasa high - end computing ( hec ) program through the nasa advanced supercomputing ( nas ) division at the nasa ames research center and the nasa center for computational sciences ( nccs ) at goddard space flight center .the research was supported by nasa grant nnx12ai85 g and nsf grant ast-1211318 .avk was supported by the russian academic excellence project 5top100 " .koren , b. ( 1993 ) , a robust upwind discretisation method for advection , diffusion and source terms " , in vreugdenhil , c.b . ; koren , b. , _ numerical methods for advection diffusion problems _ , braunschweig : vieweg , p. 117, isbn 3 - 528 - 07645 - 3

Abstract: we describe a godunov - type magnetohydrodynamic ( mhd ) code based on the miyoshi & kusano ( 2005 ) solver which can be used to solve various astrophysical hydrodynamic and mhd problems . the energy equation is in the form of entropy conservation . the code has been implemented on several different coordinate systems : 2.5d axisymmetric cylindrical coordinates , 2d cartesian coordinates , 2d plane polar coordinates , and fully 3d cylindrical coordinates . viscosity and diffusivity are implemented in the code to control the accretion rate in the disk and the rate of penetration of the disk matter through the magnetic field lines . the code has been utilized for the numerical investigations of a number of different astrophysical problems , several examples of which are shown .   numerical methods , codes , magnetohydrodynamics


recent advances in ubiquitous computing and wireless sensor networks continue to obliterate the boundaries between the physical and the digital world  .sensor networks can be utilized in a large variety of deployments , ranging from personal homes over offices and cars to industrial facilities and public areas  . to cope with the resulting increase in demands for storing and processing sensor data , cloud computing elasticallyprovides the necessary computation and storage resources  .cloud computing allows the collection , processing , and storage of sensor data at large scales and as well enables the world - wide sharing of said data  . in the context of the sensorcloud project , we consider a scenario in which operators of sensor networks ( i.e. , private users , companies , or public institutions ) connect their sensor networks to the cloud  , where collected sensor data is processed by cloud services selected by the sensor network operator  . besides the remarkable advantages of cloud computing , it is important to note that sensor data often contains sensitive information .hence , when transferring this sensitive data to entities outside of trusted sensor networks , it might , e.g. , be unintentionally forwarded to third parties or used for non - authorized purposes  .furthermore , data stored and processed in the cloud might be subject to access by the cloud provider or governmental agencies  .thus , one major challenge when interconnecting sensor networks with the cloud is to account for the aforementioned security and privacy concerns .  as part of the efforts of the sensorcloud project, we developed a trust point - based security architecture for outsourcing sensor data to the cloud and the sensorcloud security library  .one important challenge in securely outsourcing sensor data to the cloud lies in the representation of sensor data and the corresponding security measures taken to protect the sensor data . in this paper, we report on the sensorcloud protocol , which has jointly been developed within the sensorcloud project to represent sensor data and actuator commands using json and subsequently secure this data using object security mechanisms . to this end, we rely on mechanisms that have been or currently are in the process of being standardized at the ietf and provide a best practice on how to utilize and combine them in an actual system .  the remainder of this document is structured as follows . in section [ sec : scenario ] , we present the sensorcloud scenario in more detail and provide references to more detailed descriptions of the overall security architecture . section [ sec : json - representation ] defines the json - based representation of sensor data and actuator commands in sensorcloud . in section [ sec : security - extensions ] , we describe the security extensions to this representation to realize the secure outsourcing of sensor data to the cloud .we conclude this paper in section [ sec : conclusion ] .in sensorcloud , we consider a scenario where each sensor network ( with an arbitrary number of sensor nodes ) is connected to the cloud via a dedicated gateway as depicted in figure [ fig : scenario ] .our goal is to store data securely in the cloud such that it can only be processed by authorized cloud services . to this end , the gateway encrypts sensitive sensor readings using a symmetric cipher before uploading it to the cloud .the encryption process is influenced by a user - configurable access control list containing services that are authorized to ( partially ) obtain and process the user s sensor data .now , only entities in possession of the symmetric key used for encrypting a piece of sensor data ( referred to as a data item ) have access to this specific data item .hence , to grant a cloud service access to a given data item the gateway has to provide this cloud service with the corresponding key .to this end , the gateway asymmetrically encrypts the corresponding symmetric key with the public key of the cloud service that should gain access to the sensor data and forwards the resulting encrypted key to the respective cloud service .more details , especially with respect to the design and implementation of the underlying security architecture as well as our choice of cryptographic primitives , can be found in the corresponding publications  .notably , sensor data originating from a single ( possibly virtual ) sensor node can contain multiple sensor readings from different sensors .for example , one data item measured by a meteorological sensor might consist of multiple single sensor readings such as humidity and temperature .hence , sensorcloud supports the transmission of multiple sensor readings of one sensor node in a single message  . as a cloud servicemight only be granted access to parts of the sensor readings , sensorcloud supports the encryption of individual parts of sensor data , thus realizing fine - grained access control .the processing of sensor data by a cloud service requires the verification of the integrity of received data , the decryption of the symmetric key , and finally the decryption of the actual sensor data .these operations have been implemented in the sensorcloud security library , which allows the transparent decryption of sensor data and the verification of its integrity by a cloud service  .it is available as open source software under the mit license .the remainder of this document defines the json - based messages used by the sensorcloud protocol to encode data items as well as additional configuration messages .more precisely , the json - based message layout defined by this document is used for both internal communication within the gateway and cloud , respectively , and for communication between those entities .the field ` ver ` contains the version number of the protocol , which defines the structure of the remainder of the message .hence , whenever the message structure or encapsulated payloads are subject to changes , the version number must be increased .the receiving peer must support the indicated version number . otherwise , it should notify the sending peer that the message was dropped .the version number is a positive integer and is currently defined as ` 1 ` .the sequence number ` seq ` is currently unused and must therefore be set to ` 0 ` .however , it enables end - to - end acknowledgments at the application layer .the corresponding retransmission mechanism will need to be developed in the future .if used , ` seq ` is a positive integer that must be increased by one for each json message header sent . a potential wrap - around ofthe sequence number is to be expected and implementations must interpret this case as an incrementation of the sequence number .the messages to be transmitted using one header are stored within an array in the field ` pl ` .section [ sec : payload - types ] defines a list of message types supported by sensorcloud .additional message types can be defined as necessary .messages must contain the field ` typ ` to indicate their message type for message processing purposes .moreover , they must include the ` gw ` field to indicate the gateway device that participates in the communication . among other aspects ,this information is required for applying object security measures .note that multiple messages of different types can be batched using one message header in order to reduce the overall communication overhead .each message indicates its message type via the field ` typ ` , which must be included in any message .the message type is a positive integer value and can currently take one of the values described in table [ tab : msg - types ] .

Abstract: the increasing deployment of sensor networks , ranging from home networks to industrial automation , leads to a similarly growing demand for storing and processing the collected sensor data . to satisfy this demand , the most promising approach to date is the utilization of the dynamically scalable , on - demand resources made available via the cloud computing paradigm . however , prevalent security and privacy concerns are a huge obstacle for the outsourcing of sensor data to the cloud . hence , sensor data needs to be secured properly before it can be outsourced to the cloud .   when securing the outsourcing of sensor data to the cloud , one important challenge lies in the representation of sensor data and the choice of security measures applied to it . in this paper , we present the sensorcloud protocol , which enables the representation of sensor data and actuator commands using json as well as the encoding of the object security mechanisms applied to a given sensor data item . notably , we solely utilize mechanisms that have been or currently are in the process of being standardized at the ietf to aid the wide applicability of our approach .


community detection ( cd ) has found applications in social , biological , business , and other kinds of networks .however , cd algorithms suffer from various flaws ( i ) most existing cd algorithms are heavily dependent on _ vertex ordering _ , yielding completely different community structures when the same network is processed in a different order . for example, figure [ example](a ) shows dissimilar community structures after running infomap  on different vertex orderings of the football network .( ii ) most optimization algorithms may produce multiple community structures with the same `` optimal '' value of the objective function .for instance , in figure [ example](b ) , assigning vertex to either or results in the same modularity score .( iii ) different cd algorithms detect communities in different ways , e.g. , as dense groups internally , or groups with sparse connections externally .it is therefore natural to think of an ensemble approach in which the strengths of different cd algorithms may help overcome the weaknesses of any specific cd algorithm .some preliminary attempts have been made by .* contributions . * in this paper , we design two ensemble cd algorithms .the endisco algorithm runs multiple `` base '' cd algorithms using a variety of vertex orderings to derive a first set of communities .we then consider the memberships of vertices obtained from base cd algorithms as features and derive a latent network using pair - wise similarity of vertices .the final disjoint community structure is obtained by running any cd algorithm again on the latent network .the medoc  algorithm leverages the fact that many communities returned by base algorithms are redundant and can therefore be grouped into `` meta - communities '' to avoid unnecessary computation .we use meta - communities to build an association matrix , where each entry indicates the probability of a vertex belonging to a meta - community . finally , we obtain both disjoint and overlapping community structures via post - processing on the association matrix ._ to the best of our knowledge , we are the first to propose ( i ) an ensemble framework for overlapping community detection , and ( ii ) an overlapping cd algorithm that leverages disjoint community information . _we run experiments to identify the best parameter settings for endisco and medoc .experiments on both synthetic and real - world networks show that our algorithms outperform both the state - of - the - art non - ensemble based methods and a recently proposed ensemble approach by a significant margin - values for all our experiments to show statistical significance . ] .we also show that our ensemble approaches reduce the effect of vertex ordering .* note : * we use the term `` community structure '' to indicate the result ( set of `` communities '' ) returned by an algorithm .each community is a set of vertices .there has been a great deal of work on clustering data using ensemble approaches ( see for a review ) . however , when it comes to clustering vertices in _ networks _ , ensemble approaches have been relatively scarce .dahlin and svenson were the first to propose an instance - based ensemble cd algorithm for networks which fuses different community structures into a final representation .a few methods addressed the utility of merging several community structures . a new ensemble scheme called cggc was proposed to maximize modularity .kanawati proposed yasca , an ensemble approach to different network partitions derived from ego - centered communities computed for each selected seed .he further emphasized the quality and diversity of outputs obtained from the base algorithms for ensemble selection .a `` consensus clustering '' approach was recently proposed which leverages a _ consensus matrix _ to produce a disjoint community structure which outperformed previous approaches .our work differs from this approach in at least three significant ways : ( i ) they measure the number of times two vertices are assigned to the same community , thus ignoring the global similarity of vertices ; whereas we capture the global similarity by representing the network within a feature space and grouping redundant base communities into meta communities ; ( ii ) they either take multiple algorithms or run a particular algorithm multiple times for generating an ensemble matrix , whereas we consider both options ; ( iii ) we are the first to show how aggregating multiple disjoint base communities can lead to discover both disjoint and overlapping community structures simultaneously .we show experimentally that endisco beats consensus clustering .[ insimul ]    build an ensemble matrix , where =;[algo1:sim ] + run for _ re - clustering vertices _ from and discover a disjoint community structure ;[algo1:assign ] +  ( * en*semble - based * dis*joint * co*mmunity detection ) starts by first using different cd algorithms to identify different community structures .second , an `` involvement '' function is used to measure the extent to which a vertex is involved with a given community , which in turn sets the posterior probabilities of each vertex belonging to different communities .third , endisco transforms the network into a feature space .fourth , an ensemble matrix is constructed by measuring the pair - wise similarity of vertices . finally , we apply any standard cd algorithm on the ensemble matrix and discover the final disjoint community structure .endisco  follows three fundamental steps ( a pseudo - code is shown in algorithm [ insimul ] ) :  * ( i ) generating base partitions . *given a network and a set of different base cd algorithms , endisco runs each algorithm on different vertex orderings ( randomly selected ) of .this generates a set of different community structures denoted , where each community structure constitutes a specific partitioning of vertices in , and each might be of different size ( step [ algo1:ensemble ] ) .  *( ii ) constructing ensemble matrix . * given a , we then compute the extent of s involvement in each community in via an `` involvement '' function ( step [ algo1:dist ] ) .possible definitions of are given in section [ algo1:paramater ] .for each vertex , we construct a feature vector whose elements indicate the distance of ( measured by ) from each community obtained from different runs of the base algorithms ( step [ algo1:fea ] ) .the size of is same as the number of communities in ( approx . , where is the average size of a base community structure ) .let be the largest distance of from any community in the sets in ( i.e. , in step [ algo1:d ] ) .we define the conditional probability of belonging to community ( step [ algo1:prob ] ) as : the numerator ensures that the greater the distance of from community , the less likely is to be in community .the normalization factor in the denominator ensures that .add - one smoothing in the numerator allows a non - zero probability to be assigned to all , especially for such that .the set of posterior probabilities of is : ( step [ algo1:post ] ) , which in turn transforms a vertex into a point in a multi - dimensional feature space .finally we construct an ensemble matrix whose entry is the similarity ( obtained from a function whose possible definitions are given in section [ algo1:paramater ] ) between the feature vectors of and ( step [ algo1:sim ] ) .the ensemble matrix ensures that the more communities a pair of vertices share the more likely they are connected in the network .  *( iii ) discovering final community structure . * in step [ algo1:assign ]we use a cd algorithm to re - cluster the vertices from and discover the final disjoint community structure ( step [ algo1:assign ] ) . * involvement function ( ) : * we use two functions to measure the involvement of a vertex in a community : ( i ) _ restricted closeness centrality _ ( ) : this is the inverse of the average shortest - path distance from the vertex to the vertices in community , i.e. , ; ( ii ) _ inverse distance from centroid _ ( _ idc _ ) : we first identify the vertex with highest closeness centrality ( w.r.t .the induced subgraph of ) in community , mark it as the centroid of ( denoted by ) , and then measure the involvement of as the inverse of the shortest - path distance between and , i.e. , . * similarity function ( ) : * we consider cosine similarity ( ) and chebyshev distance ( ) ( essentially , ) to measure the similarity between two vectors . * algorithm for re - clustering ( ) : * we consider each base cd algorithm as the one to re - cluster the vertices from the ensemble matrix .the idea is to show that a non - ensemble cd algorithm can perform even better when considering the ensemble matrix of network than the adjacency matrix of .however , one can use any cd algorithm in this step to detect the community structure .we will show the effect of different algorithms used in this step in section [ sec : impact ] . * number of iterations ( ) : * instead of fixing a hard value , we set to be dependent on the number of vertices in the network .we vary from to ( with step ) of and confirm that for most of the networks , the accuracy of the algorithm converges at ( figures [ parameter_dis](c ) and [ parameter_dis](f ) ) , and therefore we set in our experiments .suppose is the number of vertices in the network , is the number of base algorithms and is the number of vertex orderings .further suppose is the average size of the community structure .then the loop in step [ algo1:v ] of algorithm 1 would iterate times ( where ) .the construction of the ensemble matrix in step [ algo1:sim ] would take .graph partitioning is np - hard even to find a solution with guaranteed approximation bounds however , heuristics such as the famous kernighan - lin algorithm take time .[ meclud ]  construct a -partite graph ( where ) consisting of partitions , each corresponding to each community structure obtained in step 2 : vertices in partition are communities in and edges are drawn between two pair - wise vertices ( communities ) and with the edge weight ;[algo2:cons ] + run to re - cluster vertices in and discover a meta - community structure , ;[algo2:run ] + construct an association matrix , where , indicating the association of vertex to a meta - community ;[algo2:asso ] + each row in indicates the membership probabilities of the corresponding vertex in meta - communities ; + to get , we assign a vertex to community ;[algo2:dc ] + to get , we assign a vertex to a set of communities so that ;[algo2:oc ] + ,  ( * me*ta clustering based * d*isjoint and * o*verlapping * c*ommunity detection ) starts by executing all base cd algorithms , each with different vertex orderings , to generate a set of community structures .it then creates a multipartite network .after this , a cd algorithm is used to partition the multipartite network .finally , a vertex - to - community association function is used to determine the membership of a vertex in a community . unlike endisco , medoc  yields both disjoint and overlapping community structures from the network .medoc  has the following four basic steps ( pseudo - code is in algorithm [ meclud ] ) :  * ( i ) constructing multipartite network .* medoc takes cd algorithms and runs each on different vertex orderings of . for each ordering , produces a community structure of varying size ( step [ algo2:perm ] ) . after running on vertex orderings , each algorithm produces different community structures .therefore at the end of step [ algo2:perm ] , we obtain community structures each from algorithms ( essentially , we have community structures ) .we now construct a -partite network ( aka meta - network ) as follows : the vertices are members of , i.e. , a community present in a community structure obtained from any of the base algorithms in and any vertex ordering , is a vertex of .we draw an edge from a community to a community and associate a weight ( step [ algo2:cons ] ) .possible definitions of will be given later in section [ algo2:parameter ] . since each is disjoint, the vertices in each partition are never connected .  *( ii ) re - clustering the multipartite network . * here we run any standard cd algorithm on the multipartite network and obtain a community structure containing ( say ) communities .note that in this step , we indeed cluster the communities obtained earlier in step 2 ; therefore each such community obtained here is called a `` meta - community '' ( or community of communities ) ( step [ algo2:run ] ) .  *( iii ) constructing an association matrix .* we determine the association between a vertex and a meta - community by using a function and construct an association matrix of size , where each entry ( step [ algo2:asso ] ) .possible definitions of will be given later in section [ algo2:parameter ] .* ( iv ) discovering final community structure . *final vertex - to - community assignment is performed by processing .the entries in each row of denote membership probabilities of the corresponding vertex in communities . for disjoint community assignment, we label each vertex by the community in which possesses the most probable membership in , i.e. , .tie - breaking is handled by assigning the vertex to the community to which most of its direct neighbors belong .note that every meta - community can not be guaranteed to contain at least one vertex , that in turn can not assure communities in the final community structure . for discovering overlapping community structure ,we assign a vertex to those communities for which the membership probability exceeds a threshold .possible ways to specify threshold will be specified later in section [ algo2:parameter ] .    * matching function ( ) * : given two communities and , we measure their matching / similarity via jaccard coefficient ( _ jc_)= and average precision ( _ ap _ ) = .  * association function ( ) * : given a meta - community consisting of ( say , ) communities , the association of with can be calculated as , where returns if is a part of , otherwise . for example , if , then .alternatively , a weighted association measure may assign a score to w.r.t . based on the co - occurrence of the other community members with , i.e. , . in our earlier example , .  * threshold ( ) : * we choose the threshold automatically as follows .we first assign each vertex to its most probable community this produces a disjoint community structure .each vertex is represented by a feature vector which is the entire row of the association matrix .we then measure the average similarity of vertices in as follows : , where is the set of edges completely internal to , is an edge , and is cosine similarity .the probability that two vertices are connected in is then defined as : }^2}}{1+e^{{[as(c)]}^2}}\ ] ] for a vertex , if , we further assign to , in addition to its current community .we compare our threshold selection method with the following method : each vertex is assigned to its top high probable communities ( we set to or ) .our experiments show that medoc delivers excellent performance with our threshold selection method ( see figures [ parameter_over](g)-(i ) ) .other input parameters and remain same as discussed in section [ algo1:paramater ] .the most expensive step of medoc  is to construct the multipartite network in step 3 .if is the number of base algorithms , is the number of vertex orderings and is the average size of a base community structure , the worst case scenario occurs when each vertex in one partition is connected to each vertex in other partitions if this happens , the total number of edges is .however , in practice the network is extremely sparse and leads to edges ( because in sparse graphs ) .further , constructing the association matrix would take iterations ( where ) .we use the lfr benchmark model to generate synthetic networks with ground - truth community structure by varying the number of vertices , mixing parameter ( the ratio of inter- and intra - community edges ) , average degree , maximum degree , minimum ( maximum ) community size ( ) , average percentage of overlapping vertices and the average number of communities to which a vertex belongs . , , , , , , , . ]note that for each parameter configuration , we generate 50 lfr networks , and the values in all the experiments are reported by averaging the results .we also use real - world networks mentioned in table [ dataset](a ) for experiments ( see detailed description in appendix ) .we compare endisco and medoc with the following algorithms : ( i ) _ modularity - based _ : fastgreedy ( fstgrdy ) , louvain ( louvain ) and cnm  ; ( ii ) _ vertex similarity - based _ : walktrap ( walktrap ) ; ( iii ) _ compression - based _ : infomap ( infomap ) ; ( iv ) _ diffusion - based _ : label propagation ( labelpr ) .these algorithms are also used as base algorithms in in our ensemble approaches .we further compare our methods with consensus clustering ( conscl ) , a recently - proposed ensemble - based framework for disjoint community detection .   as we know the ground - truth community structure , we measure performance of competing cd algorithms using the standard _ normalized mutual information _ ( _ nmi _ ) and _ adjusted rand index _ ( _ ari _ ) .we first run experiments to identify the best parameters for endisco and medoc and then present the comparative analysis among the competing algorithms .we consider the lfr networks and vary .figure [ parameter_dis](a ) shows that the accuracy of endisco is similar for both the involvement functions , while figure [ parameter_dis](b ) shows cosine similarity fully dominating chebyshev distance .figure [ parameter_dis](d ) shows that jaccard coefficient performs significantly better than average precision when medoc is considered , while figure [ parameter_dis](e ) shows that the weighted association function seems to dominate the other for and exhibits similar performance for .we further vary the number of iterations to obtain communities with different vertex orderings figures [ parameter_dis](c ) and [ parameter_dis](f ) show that for the networks with strong community structure ( such as lfr ( ) , football ) , the accuracy levels off at ; however with increasing leveling off occurs at larger values of .note that the patterns observed here for lfr network are similar for other networks .therefore unless otherwise stated , in the rest of the experiment we show the results of our algorithms with the following parameter settings for disjoint community detection : endisco : , , ; medoc : , , .   in order to assess the impact of each base algorithm in our ensemble, we measure the accuracy of endisco and medoc when that base algorithm is removed from the ensemble table [ impact ] shows that for lfr networks infomap has the biggest impact on accuracy according to both the evaluation measures ( nmi and ari ) for both endisco and medoc  ( results are same for real networks ) .  as the final step in both endisco and medoc is to run a cd algorithm for re - clustering , we also conduct experiments ( table [ impact_den ] for lfr networks and appendix for real networks ) to identify the best one .again , infomap proves to be the best .table [ performance : non](a ) reports the performance of our approaches on all networks using different algorithms in the final step of endisco and medoc .the numbers denote relative performance improvement of our algorithms ( e : endisco m : medoc ) w.r.t . a given algorithm when that algorithm is used in the final step .for instance , the first entry in the last row ( 5.06 ) means that for lfr ( ) network , the accuracy of endisco ( when labelpr is used for re - clustering in its final step ) averaged over nmi and ari ( 0.83 ) is 5.06% higher than that of labelpr ( 0.79 ) .the actual values are reported in appendix .the point to take away from this table is that irrespective of which classical cd algorithm we compare against , endisco and medoc always improve the quality of communities found .moreover , we observe from the results of lfr networks that with the deterioration of the community structure ( increase of ) , the improvement increases for all the re - clustering algorithms .further , table [ performance : non](b ) shows the average improvement of endisco and medoc when compared against consensus clustering ( conscl ) .we see that for disjoint networks , both endisco and medoc beat conscl  with medoc emerging in top place .we again use the lfr benchmark to generate synthetic networks with overlapping community structure with the following default parameter settings as mentioned in : , , , , , , , .we generate lfr networks for each parameter configuration the experiments reported averages over these networks .we further vary ( - with increment of ) , and ( both from to with increment of ) depending upon the experimental need .we also run experiments with six real - world datasets mentioned in table [ dataset](b ) ( see details in appendix ) .we compare medoc  with the following state - of - the - art overlapping community detection algorithms : ( i ) _ local expansion : _ oslom , eagle ; ( ii ) _ agent - based dynamical algorithms : _ copra , slpa ; ( iii ) _ detection using mixture model : _ moses , bigclam .we use the following evaluation metrics to compare the results with the ground - truth community structure : ( a ) overlapping normalized mutual information ( ) , ( b ) omega ( ) index ( details in appendix ) .we first try to identify the best parameter settings for medoc .these include : matching function , association function , number of iterations and threshold .figure [ parameter_over ] shows the results ( on lfr networks ) by varying , and .we observe that jaccard coefficient as matching function and weighted association measure are better than their alternative .the choice of is the same as shown in figure [ parameter_dis](f ) accuracy levels off at , and therefore we skip this result in the interest of space .we experiment with two choices of thresholding : top 5% and 10% most probable communities per vertex , and compare with the threshold selection mechanism described in section [ algo2:parameter ] .figures [ parameter_over](g)-[parameter_over](i ) show that irrespective of any network parameter selection , our choice of selecting threshold always outperforms others .as shown in table [ impact_den ] , infomap  seems to be the best choice for the re - clustering algorithm .therefore , in the rest of the experiments , we run medoc with , , , infomap  and ( selected by our method ) .the impact of the base algorithms on medoc s performance is similar to what we saw in the disjoint cd case .the results in table [ impact ] show that accuracy decreases most when we drop infomap from the base algorithm , followed by louvain  and cnm ( see more results in appendix ) .we ran medoc with the default setting on three lfr networks and five real - world networks .the performance of medoc is compared with the six baseline overlapping community detection algorithms .table [ performance : over ] shows the performance of the competing algorithms in terms of onmi and index . in all cases ,medoc is a clear winner , winning by significant margins .the absolute average of onmi ( ) for medoc  over all networks is 0.83 ( 0.86 ) , which is 3.58% ( 4.39% ) higher than bigclam , 5.90% ( 7.49% ) higher than moses , 8.31% ( 9.19% ) higher than slpa , 10.67% ( 10.95% ) higher than copra , 13.89% ( 12.95% ) higher than eagle , and 14.68% ( 15.21% ) higher than oslom .another interesting observation is that the performance improvement seems to be prominent with the deterioration of community quality .for instance , the improvement of medoc w.r.t . the best baseline algorithm ( bigclam )is 2.32% ( 7.06% ) , 3.70% ( 4.82% ) and 6.49% ( 6.33% ) in terms of onmi ( ) with the increasing value of ranging from 0.1 , 0.3 and 0.6 respectively .this once again corroborates our earlier observations in section [ comp_dis ] for disjoint communities .since ensemble approaches require the running all baseline algorithms ( which may be parallelized ) , one can not expect ensemble methods to be faster than baseline approaches . however , our proposed ensemble frameworks are much faster than existing ensemble approaches such as consensus clustering . to show this , for each ensemble algorithm , we report , the ratio between the runtime of each ensemble approach and the sum of runtimes of all base algorithms , with increasing number of vertices in lfr .we vary the number of edges of lfr by changing from to .figure [ runtime ] shows that our algorithms are much faster than consensus clustering .we further report the results of medoc for overlapping community detection which is almost same as that of disjoint case since it does not require additional steps apart from computing the threshold .cd algorithms suffer from the problem of `` degeneracy of solutions '' which states that an optimization algorithm can produce exponentially many solutions with ( nearly-)similar optimal value of the objective function ( such as modularity ) ; however the solutions may be structurally distinct from each other .figure [ example ] showed how infomap  produces many outputs for different vertex orderings of football network .we test this by considering the default lfr network and one real - world network ( appendix shows results on more real world networks ) and run the algorithms on different vertex orderings of each network .we then measure the pair - wise similarity of the solutions obtained from each algorithm .the box plots in figure [ boxplot ] show the variation of the solutions for endisco , medoc and the best baseline algorithm in both disjoint and overlapping community detections .we observe that the median similarity is high with endisco and medoc  and the variation is comparatively small .these results suggest that our algorithms provide more robust results than past work and alleviate the problem of degeneracy of solutions .in this paper , we proposed two general frameworks for ensemble community detection .endisco identifies disjoint community structures , while medoc detects both disjoint and overlapping community structures .we tested both algorithms on both synthetic data using the lfr benchmark and with several real - world datasets that have associated ground - truth community structure .we show that both endisco and medoc are more accurate than existing cd algorithms , though of course , endisco and medoc leverage them .we further show that for disjoint cd problems , endisco and medoc both beat a well known existing disjoint ensemble method called consensus clustering  both in terms of accuracy ( measured via both normalized mutual information and adjusted rand index ) and run - time . to our knowledge ,medoc is the first ensemble algorithm for overlapping community detection that we have seen in the literature . in future, we would like to develop theoretical explanation to justify the superiority of ensemble approaches compared to the discrete models .other future direction could be to make the ensemble frameworks parallelized .we will apply the proposed methods to identify communities in specific datasets , such as malware traces , protein interaction networks etc .parts of this work were funded by aro grants w911nf-16 - 1 - 0342 , w911nf1110344 , w911nf1410358 , by onr grant n00014 - 13 - 1 - 0703 , and maryland procurement ofce under contract no .h98230 - 14-c-0137 .t. chakraborty , s. sikdar , n. ganguly , and a. mukherjee , `` citation interactions among computer science fields : a quantitative route to the rise and fall of scientific research , '' _ social netw .analys . mining _ , vol . 4 , no . 1 ,, 2014 .t. chakraborty , s. sikdar , v. tammana , n. ganguly , and a. mukherjee , `` computer science fields as ground - truth communities : their impact , rise and fall , '' in _ asonam _ , niagara falls , canada , 2013 , pp . 426433 .l. g. s. jeub , p. balachandran , m. a. porter , p. j. mucha , and m. w. mahoney , `` think locally , act locally : detection of small , medium - sized , and large communities in large networks , '' _ phy .e. _ , vol .91 , p. 012821

Abstract: given a set of community detection algorithms and a graph as inputs , we propose two ensemble methods endisco  and medoc that ( respectively ) identify disjoint and overlapping communities in . endisco transforms a graph into a latent feature space by leveraging multiple base solutions and discovers disjoint community structure . medoc groups similar base communities into a _ meta - community _ and detects both disjoint and overlapping community structures . experiments are conducted at different scales on both synthetically generated networks as well as on several real - world networks for which the underlying ground - truth community structure is available . our extensive experiments show that both algorithms outperform state - of - the - art non - ensemble algorithms by a significant margin . moreover , we compare endisco and medoc with a recent ensemble method for disjoint community detection and show that our approaches achieve superior performance . to the best of our knowledge , medoc is the first _ ensemble approach _ for overlapping community detection .