/// <summary> Determines whether dust is present within the effect radius of /// a specific Protoplanet. /// </summary> /// <param name="p">Protoplanet within the disc /// </param> /// <returns>s true if there is a band containing dust which this body /// can accrete. /// </returns> public virtual bool dust_available(Protoplanet p) { double inside_range = p.inner_effect_limit(cloud_eccentricity); double outside_range = p.outer_effect_limit(cloud_eccentricity); DustBand current_dust_band; bool dust_here = false; current_dust_band = dust_head; while ((current_dust_band != null) && (current_dust_band.outer_edge < inside_range)) { current_dust_band = current_dust_band.next_band; } if (current_dust_band == null) { dust_here = false; } else { dust_here = current_dust_band.dust_present; } while ((current_dust_band != null) && (current_dust_band.inner_edge < outside_range)) { dust_here = dust_here || current_dust_band.dust_present; current_dust_band = current_dust_band.next_band; } return(dust_here); }
/// <summary> Accretes dust and/or gas from all bands onto the specified protoplanet, /// iterating until the marginal mass increase approaches zero. Once the /// new mass has been calculated, the dust bands are updated to reflect the /// accretion of dust and/or gas onto the protoplanet. /// </summary> /// <param name="p">Protoplanet accreting in this cycle /// </param> public virtual void accrete_dust(Protoplanet p) { //double temp_mass; double start_mass = p.mass; double minimum_accretion = 0.0001 * start_mass; double r_inner, r_outer, gatherLast, gatherNow; DustBand db; gatherNow = 0.0; do { gatherLast = gatherNow; // calculate new mass of protoplanet, considering last calculated // quantity of accreted matter, then calculate region to be swept // based on the updated mass. p.mass = start_mass + gatherLast; p.reduce_mass(); gas = !p.accretes_gas(); r_inner = p.inner_reduced_limit(cloud_eccentricity); r_outer = p.outer_reduced_limit(cloud_eccentricity); if (r_inner < 0.0) { r_inner = 0.0; } // sweep through all dust bands, collecting matter within the // effective reach of the protoplanet's gravity. gatherNow = 0.0; for (db = dust_head; db != null; db = db.next_band) { gatherNow += db.collect_dust(r_inner, r_outer, p); } }while ((gatherNow - gatherLast) >= minimum_accretion); update_dust_lanes(p.inner_effect_limit(cloud_eccentricity), p.outer_effect_limit(cloud_eccentricity)); }
/// <summary> Accretes dust and/or gas from all bands onto the specified protoplanet, /// iterating until the marginal mass increase approaches zero. Once the /// new mass has been calculated, the dust bands are updated to reflect the /// accretion of dust and/or gas onto the protoplanet. /// </summary> /// <param name="p">Protoplanet accreting in this cycle /// </param> public virtual void accrete_dust(Protoplanet p) { //double temp_mass; double start_mass = p.mass; double minimum_accretion = 0.0001 * start_mass; double r_inner, r_outer, gatherLast, gatherNow; DustBand db; gatherNow = 0.0; do { gatherLast = gatherNow; // calculate new mass of protoplanet, considering last calculated // quantity of accreted matter, then calculate region to be swept // based on the updated mass. p.mass = start_mass + gatherLast; p.reduce_mass(); gas = !p.accretes_gas(); r_inner = p.inner_reduced_limit(cloud_eccentricity); r_outer = p.outer_reduced_limit(cloud_eccentricity); if (r_inner < 0.0) r_inner = 0.0; // sweep through all dust bands, collecting matter within the // effective reach of the protoplanet's gravity. gatherNow = 0.0; for (db = dust_head; db != null; db = db.next_band) { gatherNow += db.collect_dust(r_inner, r_outer, p); } } while ((gatherNow - gatherLast) >= minimum_accretion); update_dust_lanes(p.inner_effect_limit(cloud_eccentricity), p.outer_effect_limit(cloud_eccentricity)); }
/// <summary> Determines whether dust is present within the effect radius of /// a specific Protoplanet. /// </summary> /// <param name="p">Protoplanet within the disc /// </param> /// <returns>s true if there is a band containing dust which this body /// can accrete. /// </returns> public virtual bool dust_available(Protoplanet p) { double inside_range = p.inner_effect_limit(cloud_eccentricity); double outside_range = p.outer_effect_limit(cloud_eccentricity); DustBand current_dust_band; bool dust_here = false; current_dust_band = dust_head; while ((current_dust_band != null) && (current_dust_band.outer_edge < inside_range)) current_dust_band = current_dust_band.next_band; if (current_dust_band == null) dust_here = false; else dust_here = current_dust_band.dust_present; while ((current_dust_band != null) && (current_dust_band.inner_edge < outside_range)) { dust_here = dust_here || current_dust_band.dust_present; current_dust_band = current_dust_band.next_band; } return (dust_here); }