private static List <KWSCellMap <WeatherCell> > InitCalcs(PlanetData PD) { List <KWSCellMap <WeatherCell> > tempMap = new List <KWSCellMap <WeatherCell> >(); for (int i = 0; i < PD.layers; i++) { tempMap.Add(new KWSCellMap <WeatherCell>(PD.gridLevel)); } float basePressure = (float)FlightGlobals.getStaticPressure(0, PD.body) * 1000; for (int AltLayer = 0; AltLayer < PD.layers; AltLayer++) { foreach (Cell cell in Cell.AtLevel(PD.gridLevel)) { WeatherCell wCell = new WeatherCell(); wCell.temperature = GetInitTemperature(PD, AltLayer, cell); if (AltLayer == 0) { wCell.CCN = 1; wCell.pressure = basePressure; wCell.relativeHumidity = PD.biomeDatas[WeatherFunctions.GetBiome(PD.index, cell)].FLC * 0.85f; //* wCell.temperature / 288.15f } else { wCell.CCN = 0; wCell.pressure = (float)(tempMap[AltLayer - 1][cell].pressure * Math.Exp(-WeatherFunctions.GetDeltaLayerAltitude(PD.index, cell) / (CellUpdater.UGC * PD.SH_correction / PD.atmoData.M / WeatherFunctions.G(PD.index, AltLayer, cell) * tempMap[AltLayer - 1][cell].temperature))); wCell.relativeHumidity = (PD.biomeDatas[WeatherFunctions.GetBiome(PD.index, cell)].FLC * wCell.temperature / 288.15f) * 0.4f; } wCell.windVector = new Vector3(0f, 0f, 0f); wCell.flowPChange = 0; tempMap[AltLayer][cell] = wCell; } } return(tempMap); }
private static List <KWSCellMap <WeatherCell> > InitStratoCalcs(PlanetData PD) { List <KWSCellMap <WeatherCell> > tempMap = new List <KWSCellMap <WeatherCell> >(); for (int i = 0; i < PD.stratoLayers; i++) { tempMap.Add(new KWSCellMap <WeatherCell>(PD.gridLevel)); } for (int layer = 0; layer < PD.stratoLayers; layer++) { foreach (Cell cell in Cell.AtLevel(PD.gridLevel)) { WeatherCell wCell = new WeatherCell(); wCell.CCN = 0; wCell.temperature = GetInitTemperature(PD, layer + layers, cell); if (layer == 0) { wCell.pressure = (float)(PD.LiveMap[layers - 1][cell].pressure * Math.Exp(-WeatherFunctions.GetDeltaLayerAltitude(PD.index, cell) / (CellUpdater.UGC * PD.SH_correction / PD.atmoData.M / WeatherFunctions.G(PD.index, layer, cell) * PD.LiveMap[layers - 1][cell].temperature))); } else { wCell.pressure = (float)(tempMap[layer - 1][cell].pressure * Math.Exp(-WeatherFunctions.GetDeltaLayerAltitude(PD.index, cell) / (CellUpdater.UGC * PD.SH_correction / PD.atmoData.M / WeatherFunctions.G(PD.index, layer, cell) * tempMap[layer - 1][cell].temperature))); } wCell.relativeHumidity = 0; wCell.windVector = new Vector3(0f, 0f, 0f); tempMap[layer][cell] = wCell; } } return(tempMap); }