void iterate_surface_temp (planet_pointer *planet) { double surface_temp, effective_temp, greenhouse_rise, previous_temp, optical_depth, albedo = 0.0, water = 0.0, clouds = 0.0, ice = 0.0; optical_depth = opacity((*planet)->molecule_weight,(*planet)->surface_pressure); effective_temp = eff_temp(r_ecosphere,(*planet)->a,EARTH_ALBEDO); greenhouse_rise = green_rise(optical_depth,effective_temp,(*planet)->surface_pressure); surface_temp = effective_temp + greenhouse_rise; previous_temp = surface_temp - 5.0; /* force the while loop the first time */ while ((fabs(surface_temp - previous_temp) > 1.0)) { previous_temp = surface_temp; water = hydrosphere_fraction((*planet)->volatile_gas_inventory,(*planet)->radius); clouds = cloud_fraction(surface_temp,(*planet)->molecule_weight,(*planet)->radius,water); ice = ice_fraction(water,surface_temp); if ((surface_temp >= (*planet)->boil_point) || (surface_temp <= FREEZING_POINT_OF_WATER)) water = 0.0; albedo = planet_albedo(water,clouds,ice,(*planet)->surface_pressure); optical_depth = opacity((*planet)->molecule_weight,(*planet)->surface_pressure); effective_temp = eff_temp(r_ecosphere,(*planet)->a,albedo); greenhouse_rise = green_rise(optical_depth,effective_temp,(*planet)->surface_pressure); surface_temp = effective_temp + greenhouse_rise; } (*planet)->hydrosphere = water; (*planet)->cloud_cover = clouds; (*planet)->ice_cover = ice; (*planet)->albedo = albedo; (*planet)->surface_temp = surface_temp; }
/*--------------------------------------------------------------------------*/ void iterate_surface_temp(planets_record &planet) { double surface_temp, effective_temp = eff_temp(r_ecosphere,planet.a,EARTH_ALBEDO), greenhouse_rise, previous_temp, optical_depth = opacity(planet.molecule_weight,planet.surface_pressure), albedo, water, clouds, ice; // optical_depth = opacity((*planet)->molecule_weight,(*planet)->surface_pressure); // effective_temp = eff_temp(r_ecosphere,(*planet)->a,EARTH_ALBEDO); greenhouse_rise = green_rise(optical_depth,effective_temp,planet.surface_pressure); surface_temp = effective_temp + greenhouse_rise; // previous_temp = surface_temp - 5.0; /* force the while loop the first time */ // while ((fabs(surface_temp - previous_temp) > 1.0)) do { previous_temp = surface_temp; water = hydrosphere_fraction(planet.volatile_gas_inventory,planet.radius); clouds = cloud_fraction(surface_temp,planet.molecule_weight,planet.radius,water); ice = ice_fraction(water,surface_temp); if ((surface_temp >= planet.boil_point) || (surface_temp <= FREEZING_POINT_OF_WATER)) water = 0.0; albedo = planet_albedo(water,clouds,ice,planet.surface_pressure); optical_depth = opacity(planet.molecule_weight,planet.surface_pressure); effective_temp = eff_temp(r_ecosphere,planet.a,albedo); greenhouse_rise = green_rise(optical_depth,effective_temp,planet.surface_pressure); surface_temp = effective_temp + greenhouse_rise; }while ((fabs(surface_temp - previous_temp) > 1.0)); planet.hydrosphere = water; planet.cloud_cover = clouds; planet.ice_cover = ice; planet.albedo = albedo; planet.surface_temp = surface_temp; }