//--------------------------------------------------------------
bool WeakEquationElectronMomentumDDM::N_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT &flux) const
{
  FIELD_MATS::const_iterator vField = fields.find(ELECTRON_VELOCITY);
  const DENS_MAT & velocity = vField->second;
  flux.reset(velocity.nRows(),velocity.nCols());
  thermal_stress(fields, grad_fields, material, flux);
  material->electric_displacement(fields, grad_fields, _electricForce_);


  FIELD_MATS::const_iterator nField = fields.find(ELECTRON_DENSITY);
  const DENS_MAT & n = nField->second;

  
  CLON_VEC tsx(flux,CLONE_COL,0);
  CLON_VEC tsy(flux,CLONE_COL,1);
  CLON_VEC tsz(flux,CLONE_COL,2);
  tsx += n.mult_by_element(_electricForce_[0]);
  tsy += n.mult_by_element(_electricForce_[1]);
  tsz += n.mult_by_element(_electricForce_[2]);
  return true;
}
void WeakEquationElectronMomentumDDM::thermal_stress(const FIELD_MATS &fields,
                                                     const GRAD_FIELD_MATS &gradFields,
                                                     const Material * material,
                                                     DENS_MAT &flux) const
{
  GRAD_FIELD_MATS::const_iterator dtField = gradFields.find(ELECTRON_TEMPERATURE);
  const DENS_MAT_VEC & DTe = dtField->second;

  CLON_VEC tsx(flux,CLONE_COL,0);
  CLON_VEC tsy(flux,CLONE_COL,1);
  CLON_VEC tsz(flux,CLONE_COL,2);

  // ith velocity component has thermal stress of
  // d_i n * Cp * Te
  DENS_MAT nCp(DTe[0].nRows(),DTe[0].nCols());  
  material->electron_heat_capacity(fields,nCp);
  nCp *= 2./3.;  // correction to capacity account for convection
  
  tsx += nCp.mult_by_element(DTe[0]);
  tsy += nCp.mult_by_element(DTe[1]);
  tsz += nCp.mult_by_element(DTe[2]);
  
  FIELD_MATS::const_iterator tField = fields.find(ELECTRON_TEMPERATURE);
  const DENS_MAT & Te = tField->second;
  
  material->D_electron_heat_capacity(fields,gradFields,_dnCp_);
  for (int i = 0; i < nsd_; i++)
    _dnCp_[i] *= 2./3.; // correction to capacity account for convection
  tsx += Te.mult_by_element(_dnCp_[0]);
  tsy += Te.mult_by_element(_dnCp_[1]);
  tsz += Te.mult_by_element(_dnCp_[2]);
}
Beispiel #3
0
void  ToolButton::Paint(Draw& w)
{
	LTIMING("ToolButton::Paint");
	paint_checked = checked;
	Size sz = GetSize();
	UPP::Image image = GetImage();
	Size isz = image.GetSize();
//	Ctrl *q = GetParent()->GetParent();
//	if(!q || !q->IsTransparent())
//		w.DrawRect(sz, checked && !HasMouse() ? Blend(SColorFace, SColorLight) : SColorFace);
	int li = IsEnabled() ? HasMouse() ? GetMouseLeft() ? CTRL_PRESSED
						                               : checked ? CTRL_HOTCHECKED : CTRL_HOT
				                       : checked ? CTRL_CHECKED : CTRL_NORMAL
					     : CTRL_DISABLED;
	ChPaint(w, sz, style->look[li]);
	Point off = style->offset[li];
	Point ip = (sz - isz) / 2 + off;
	Size tsz(0, 0);
	if(kind != NOLABEL)
		tsz = GetTextSize(text, style->font);
	if(kind == BOTTOMLABEL) {
		ip.y  -= tsz.cy / 2 + 1;
		w.DrawText((sz.cx - tsz.cx) / 2 + off.x, ip.y + isz.cy + 2 + off.y, text, style->font, style->textcolor[li]);
	}
	if(kind == RIGHTLABEL) {
		ip.x -= tsz.cx / 2 + 2;
		w.DrawText(ip.x + isz.cx + 3 + off.x, (sz.cy - tsz.cy) / 2 + off.y, text, style->font, style->textcolor[li]);
	}
	UPP::Image img = CachedContrast(image, style->contrast[li]);
	if(!IsEnabled())
		img = DisabledImage(img);
	if(IsEnabled() && style->light[li])
		DrawHighlightImage(w, ip.x, ip.y, img, true);
	else
		w.DrawImage(ip.x, ip.y, img);
}