示例#1
0
/* Macro-XS*/
MacroXs::MacroXs(const MacroXsObject* definition, int number_groups) :
		         Material(definition), ngroups(number_groups), mfp(number_groups) {
	/* Get constants */
	map<string,vector<double> > constant = definition->getConstant();
	/* Get the number of groups and do some error checking */
	map<string,vector<double> >::const_iterator it_xs = constant.begin();
	int ngroup = number_groups;
	for(; it_xs != constant.end() ; ++it_xs) {
		string xs_name = (*it_xs).first;
		if(xs_name == "sigma_s") {
			int size = (*it_xs).second.size();
			if(size != ngroup * ngroup) {
				throw Material::BadMaterialCreation(getUserId(),
						"Inconsistent number of groups in constant *" + xs_name + "*");
			}
		} else {
			int size = (*it_xs).second.size();
			if(size != ngroup) {
				throw Material::BadMaterialCreation(getUserId(),
						"Inconsistent number of groups in constant *" + xs_name + "*");
			}
		}
	}

	/* ---- Capture reaction */
	vector<double> sigma_a = constant["sigma_a"];

	/* ---- Scattering cross section */
	vector<double> sigma_s(ngroups);
	vector<double> scattering_matrix = constant["sigma_s"];
	for(size_t i = 0 ; i < ngroups ; ++i) {
		double total_scat = 0;
		for(size_t j = 0 ; j < ngroups ; ++j)
			total_scat += scattering_matrix[i*ngroups + j];
		sigma_s[i] = total_scat;
	}

	/* ---- Calculate mean free path */
	vector<double> sigma_t(ngroups);
	for(size_t i = 0 ; i < ngroups ; ++i) {
		mfp[i] = 1.0 / (sigma_a[i] + sigma_s[i]);
		sigma_t[i] = sigma_a[i] + sigma_s[i];
	}

	/* Get NU-sigma fission cross section */
	nu_sigma_fission = constant["nu_sigma_f"];

	/* ---- Create the isotope */
	isotope = new MacroXsIsotope(getUserId(), constant, sigma_t);

	/* Set fissile flag */
	fissile = isotope->isFissile();
}
示例#2
0
Spectrum VolumeRegion::sigma_t(const Point &p, const Vector &w,
                               float time) const {
    return sigma_a(p, w, time) + sigma_s(p, w, time);
}
Spectrum VolumeRegion::sigma_t(const Point &p,
                               const Vector &w) const {
	return sigma_a(p, w) + sigma_s(p, w);
}
示例#4
0
 real Medium::absorption(const glm::vec3 & point) const
 {
     return sigma_s(point) / sigma_t(point);
 }
示例#5
0
 real Medium::sigma_t(const glm::vec3 & point) const
 {
     return sigma_a(point) + sigma_s(point);
 }