(sde:set-process-up-direction "+z")
(sdegeo:create-rectangle (position 0 0 0 )(position -10 5 0 ) "Silicon" "P_region" )
(sdegeo:create-rectangle (position 0 0 0 )(position 3 5 0 ) "Silicon" "N_region" )
(sdegeo:create-rectangle (position -11 0 0 )(position -10 5 0 ) "Aluminum" "Anode_region" )
(sdegeo:create-rectangle (position 4 0 0 )(position 3 5 0 ) "Aluminum" "Cathode_region" )
;--------- Doping -----------
(sdedr:define-refeval-window "RefEvalWin_P_region" "Cuboid" (position 0 0 0 )(position -10 5 0 ))
(sdedr:define-constant-profile "ConstantProfileDefinition_P_region" "BoronConcentration" 1e6)
(sdedr:define-constant-profile-placement "ConstantProfilePlacement_P_region" "ConstantProfileDefinition_P_region" "RefEvalWin_P_region")
(sdedr:define-refeval-window "RefEvalWin_N_region" "Cuboid" (position 0 0 0 )(position 3 5 0 ))
(sdedr:define-constant-profile "ConstantProfileDefinition_N_region" "PhosphorusConcentration" 3.5e6)
(sdedr:define-constant-profile-placement "ConstantProfilePlacement_N_region" "ConstantProfileDefinition_N_region" "RefEvalWin_N_region")
;-----------Mesh Definition---------
(sdedr:define-refeval-window "RefEvalWin_1" "Rectangle" (position -11 0 0)(position 3 5 0))
(sdedr:define-refinement-size "RefinementDefinition_1" 0.8 0.8 0.5 0.5)
(sdedr:define-refinement-placement "RefinementPlacement_1" "RefinementDefinition_1" "RefEvalWin_1" )
(sdedr:define-refinement-function "RefinementDefinition_1" "DopingConcentration" "MaxTransDiff" 1)
;-----------Contact Definition---------
(sdegeo:define-contact-set "Anode" 4 (color:rgb 1 0 0 ) "##" )
(sdegeo:set-current-contact-set "Anode")
(sdegeo:set-contact-boundary-edges (list(car (find-body-id (position -10.2 0.2 0))) ) "Anode")
(sdegeo:delete-region (list (car (find-body-id (position -10.2 0.2 0)))))
(sdegeo:define-contact-set "Cathode" 4 (color:rgb 1 0 0 ) "##" )
(sdegeo:set-current-contact-set "Cathode")
(sdegeo:set-contact-boundary-edges (list(car (find-body-id (position 3.2 0.2 0)