Grt: Tindle

Метод расчета на 12 атомов кислорода для гранатов.

Details

Reference
Input SiO2_wtp, Al2O3_wtp, TiO2_wtp, Cr2O3_wtp, Fe2O3_wtp, FeO_wtp, MnO_wtp, MgO_wtp, CaO_wtp, Na2O_wtp, K2O_wtp, BaO_wtp, NiO_wtp, ZnO_wtp, BeO_wtp, P2O5_wtp, V2O5_wtp, CoO_wtp, GeO2_wtp, ZrO2_wtp, Cs2O_wtp, PbO_wtp, SO3_wtp, CO2_wtp, F_wtp, Cl_wtp
Results pfu, Fe_p3_pfu, Fe_p2_pfu

Использовать Проверить

  • заголовок
  • краткое описание
  • статья
  • ссылка
  • карточка
  • подробное описание
  • код
  • тест

Source

recalc.grt_tindle <- function (wtp_data, ...) {

base_names <- c("SiO2_wtp", "TiO2_wtp", "Al2O3_wtp", "Cr2O3_wtp",
                "FeO_wtp", "MnO_wtp", "MgO_wtp", "NiO_wtp",
                "ZnO_wtp", "CaO_wtp");

data <- selectNames(wtp_data,base_names);

anions_factor <- c(2 / 60.09, 2 / 79.9, 3 / 101.96, 3 / 152,
                   1 / 71.85, 1 / 70.94, 1 / 40.31, 1 / 74.708,
                   1 / 81.38, 1 / 56.08);

cations_factor <- c(1 / 60.09, 1 / 79.9, 2 / 101.96, 2 / 152,
                    1 / 71.85, 1 / 70.94, 1 / 40.31, 1 / 74.708,
                    1 / 81.38, 1 / 56.08);

raw_anions <-  rowApply(`*`, data, anions_factor);
raw_cations <- rowApply(`*`, data, cations_factor);

raw_anions_sum <- rowSums(raw_anions);
raw_cations_sum <- rowSums(raw_cations);

based_on_oxygen <- 12 * raw_cations / raw_anions_sum;

based_on_oxygen_sum <- rowSums(based_on_oxygen);

names(based_on_oxygen) <- c("Si_pfu", "Ti_pfu", "Al_pfu", "Cr_pfu",
                            "Fe_pfu", "Mn_pfu", "Mg_pfu", "Ni_pfu",
                            "Zn_pfu", "Ca_pfu");

fe3_em <- rep(5, nrow(based_on_oxygen)) -
          ( based_on_oxygen$Si_pfu + based_on_oxygen$Ti_pfu +
          based_on_oxygen$Al_pfu + based_on_oxygen$Cr_pfu );

fe3_em  <- ifelse(fe3_em < 0, 0, fe3_em);

fe2_em <- based_on_oxygen$Fe_pfu - fe3_em;

fe3 <- ifelse(fe3_em > based_on_oxygen$Fe_pfu, based_on_oxygen$Fe_pfu, fe3_em);
fe2 <- ifelse(fe3_em > based_on_oxygen$Fe_pfu, 0, fe2_em);

intermid_12 <- based_on_oxygen;
intermid_12$Fe_p2_pfu <- fe2;
intermid_12$Fe_p3_pfu <- fe3;

intermid_12 <- intermid_12[, c("Si_pfu", "Ti_pfu", "Al_pfu", "Cr_pfu",
                               "Fe_p3_pfu", "Fe_p2_pfu", "Mn_pfu", "Mg_pfu",
                               "Ni_pfu", "Zn_pfu", "Ca_pfu")];

mult_factor <- c(2, 2, 1.5, 1.5, 1.5, 1, 1, 1, 1, 1, 1);


intermid_12 <-  rowApply(`*`, intermid_12, mult_factor);
intermid_12_sum <- rowSums(intermid_12);

f_factor <- 12 / intermid_12_sum;

result_12 <- rowApply(`/`, intermid_12, mult_factor);

result_12 <- result_12 * f_factor; 

return(cbind(Name = wtp_data$Name, result_12,
             Fe_pfu = result_12$Fe_p2_pfu + result_12$Fe_p3_pfu));
}
  • recalc/grt_tindle.txt
  • Последние изменения: 2018/11/12 15:08
  • (внешнее изменение)