<%BANNER%>

Photoelectrochemical Energy Conversion in Nanowire-Based Dye-Sensitized Solar Cells

Permanent Link: http://ufdc.ufl.edu/UFE0041874/00001

Material Information

Title: Photoelectrochemical Energy Conversion in Nanowire-Based Dye-Sensitized Solar Cells Modeling, Optimization and Templated Fabrication
Physical Description: 1 online resource (318 p.)
Language: english
Creator: Hill, Justin
Publisher: University of Florida
Place of Publication: Gainesville, Fla.
Publication Date: 2010

Subjects

Subjects / Keywords: Chemical Engineering -- Dissertations, Academic -- UF
Genre: Chemical Engineering thesis, Ph.D.
bibliography   ( marcgt )
theses   ( marcgt )
government publication (state, provincial, terriorial, dependent)   ( marcgt )
born-digital   ( sobekcm )
Electronic Thesis or Dissertation

Notes

Abstract: The research presented in this thesis outlines engineering and scientific considerations toward the template assisted fabrication of core-shell nanowire arrays on transparent conductive oxide supports for use as nanowire array-based, dye sensitized, photoelectrochemical devices. In addition, the photoanode of this specific type of dye sensitized solar cell is modeled in order to better understand interfacial charge transfer and bulk charge transport as well as optimize device performance by variation of compositional and spacial parameters. The core nanowire structure is fabricated by first electrochemically anodizing aluminum films that have been evaporated on conductive glass to create a template for nanowire growth. This is followed by electrochemical deposition of the core nanowire material within the template and selective removal of the template to obtain a nanowire array on conductive glass. Direct fabrication of anodic aluminum oxide on conductive glass is non-trivial, thus techniques developed to obtain these templates will be discussed in detail. Furthermore, liquid based etching of the template ultimately leads to aggregation of the nanowire array which causes losses in surface area, array uniformity and substrate transparency. A simple method involving induction of an electrostatic surface charge on the array that prevents nanowire aggregation is also developed and presented. Upon completion of the core nanowire array, a semiconductive material such as anatase titanium dioxide is grown epitaxially by atomic layer deposition. Upon completion of the core-shell nanowire arrays, the photoelectrochemical device is completed by sensitizing the surface with a photoactive dye and immersion in a liquid redox couple. Two types of devices are presented in this thesis, one has a transparent nanowire core composed of indium doped zinc oxide with an anatase titania shell and the other has a highly reflective platinum nanowire core with an anatase titania shell. The performance of these two types of nanowire dye sensitized solar cells are characterized by evaluation of their respective polarization curves as well as other methods. Furthermore the nanowire length and semiconductive shell thickness is varied to understand their respective effect on device performance. Coupled with the experimental results, a detailed interfacial and bulk device model is developed and evaluated. Traditional nanoparticle based dye sensitized solar cells are widely believed to have no net interfacial electric field, whereas it has been postulated that nanowire based device do and the field positively affects device performance. The model involves an extensive numerical algorithm utilizing finite difference, non-linear fixed point iterative and Levenburg-Marquardt optimization methods. The first aim of the device model is to better understand the effect of an interfacial electric field on various factors contributing to device performance. This is evaluated by probing the effect of an interfacial electric field on charge injection efficiency, charge transport as well as charge recombination. The second aim of the device model involves engineering optimization of the device s spacial and compositional characteristics that lead to maximum photoelectrochemical performance. The model predicts interesting new experimental avenues that may lead to dye sensitized solar cells with effeciencies well exceeding the current record of 12%.
General Note: In the series University of Florida Digital Collections.
General Note: Includes vita.
Bibliography: Includes bibliographical references.
Source of Description: Description based on online resource; title from PDF title page.
Source of Description: This bibliographic record is available under the Creative Commons CC0 public domain dedication. The University of Florida Libraries, as creator of this bibliographic record, has waived all rights to it worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
Statement of Responsibility: by Justin Hill.
Thesis: Thesis (Ph.D.)--University of Florida, 2010.
Local: Adviser: Ziegler, Kirk.
Electronic Access: RESTRICTED TO UF STUDENTS, STAFF, FACULTY, AND ON-CAMPUS USE UNTIL 2012-08-31

Record Information

Source Institution: UFRGP
Rights Management: Applicable rights reserved.
Classification: lcc - LD1780 2010
System ID: UFE0041874:00001

Permanent Link: http://ufdc.ufl.edu/UFE0041874/00001

Material Information

Title: Photoelectrochemical Energy Conversion in Nanowire-Based Dye-Sensitized Solar Cells Modeling, Optimization and Templated Fabrication
Physical Description: 1 online resource (318 p.)
Language: english
Creator: Hill, Justin
Publisher: University of Florida
Place of Publication: Gainesville, Fla.
Publication Date: 2010

Subjects

Subjects / Keywords: Chemical Engineering -- Dissertations, Academic -- UF
Genre: Chemical Engineering thesis, Ph.D.
bibliography   ( marcgt )
theses   ( marcgt )
government publication (state, provincial, terriorial, dependent)   ( marcgt )
born-digital   ( sobekcm )
Electronic Thesis or Dissertation

Notes

Abstract: The research presented in this thesis outlines engineering and scientific considerations toward the template assisted fabrication of core-shell nanowire arrays on transparent conductive oxide supports for use as nanowire array-based, dye sensitized, photoelectrochemical devices. In addition, the photoanode of this specific type of dye sensitized solar cell is modeled in order to better understand interfacial charge transfer and bulk charge transport as well as optimize device performance by variation of compositional and spacial parameters. The core nanowire structure is fabricated by first electrochemically anodizing aluminum films that have been evaporated on conductive glass to create a template for nanowire growth. This is followed by electrochemical deposition of the core nanowire material within the template and selective removal of the template to obtain a nanowire array on conductive glass. Direct fabrication of anodic aluminum oxide on conductive glass is non-trivial, thus techniques developed to obtain these templates will be discussed in detail. Furthermore, liquid based etching of the template ultimately leads to aggregation of the nanowire array which causes losses in surface area, array uniformity and substrate transparency. A simple method involving induction of an electrostatic surface charge on the array that prevents nanowire aggregation is also developed and presented. Upon completion of the core nanowire array, a semiconductive material such as anatase titanium dioxide is grown epitaxially by atomic layer deposition. Upon completion of the core-shell nanowire arrays, the photoelectrochemical device is completed by sensitizing the surface with a photoactive dye and immersion in a liquid redox couple. Two types of devices are presented in this thesis, one has a transparent nanowire core composed of indium doped zinc oxide with an anatase titania shell and the other has a highly reflective platinum nanowire core with an anatase titania shell. The performance of these two types of nanowire dye sensitized solar cells are characterized by evaluation of their respective polarization curves as well as other methods. Furthermore the nanowire length and semiconductive shell thickness is varied to understand their respective effect on device performance. Coupled with the experimental results, a detailed interfacial and bulk device model is developed and evaluated. Traditional nanoparticle based dye sensitized solar cells are widely believed to have no net interfacial electric field, whereas it has been postulated that nanowire based device do and the field positively affects device performance. The model involves an extensive numerical algorithm utilizing finite difference, non-linear fixed point iterative and Levenburg-Marquardt optimization methods. The first aim of the device model is to better understand the effect of an interfacial electric field on various factors contributing to device performance. This is evaluated by probing the effect of an interfacial electric field on charge injection efficiency, charge transport as well as charge recombination. The second aim of the device model involves engineering optimization of the device s spacial and compositional characteristics that lead to maximum photoelectrochemical performance. The model predicts interesting new experimental avenues that may lead to dye sensitized solar cells with effeciencies well exceeding the current record of 12%.
General Note: In the series University of Florida Digital Collections.
General Note: Includes vita.
Bibliography: Includes bibliographical references.
Source of Description: Description based on online resource; title from PDF title page.
Source of Description: This bibliographic record is available under the Creative Commons CC0 public domain dedication. The University of Florida Libraries, as creator of this bibliographic record, has waived all rights to it worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
Statement of Responsibility: by Justin Hill.
Thesis: Thesis (Ph.D.)--University of Florida, 2010.
Local: Adviser: Ziegler, Kirk.
Electronic Access: RESTRICTED TO UF STUDENTS, STAFF, FACULTY, AND ON-CAMPUS USE UNTIL 2012-08-31

Record Information

Source Institution: UFRGP
Rights Management: Applicable rights reserved.
Classification: lcc - LD1780 2010
System ID: UFE0041874:00001


This item has the following downloads:


Full Text

PAGE 1

PHOTOELECTROCHEMICALENERGYCONVERSIONINNANOWIRE-BASEDDYE-SENSITIZEDSOLARCELLS:MODELING,OPTIMIZATION&TEMPLATEDFABRICATIONByJUSTINJOSEPHHILLADISSERTATIONPRESENTEDTOTHEGRADUATESCHOOLOFTHEUNIVERSITYOFFLORIDAINPARTIALFULFILLMENTOFTHEREQUIREMENTSFORTHEDEGREEOFDOCTOROFPHILOSOPHYUNIVERSITYOFFLORIDA2010

PAGE 2

c2010JustinJosephHill 2

PAGE 3

Tomyparents,whotaughtmetolookaroundinwonder.Andtomywife,whotaughtmetolookforwardindetermination.Iamonlyheretodaybecauseofyou. 3

PAGE 4

ACKNOWLEDGMENTS Iwouldliketothankallthosewhoaidedorguidedme.IwouldespeciallyliketothankmyadvisorKirkJ.ZieglerforhisunwaiveringsupportandMarkE.Orazemforhisguidance.ThisworkalsocomesfromthesweatofmanyundergraduateassistantsandsoIthankthem:KellyHaller,NickBanks,TimothyGeary,StevenCaliari,TravisAndersonandSonjaCotton.IhaveenjoyedworkingwiththefacultyattheMajorAnalyticalInstrumentationCenterandMicroFabTech,specicallyKerrySiebein,LuisaAmeliaDempere,WayneAcree,ValentinCraciun,MarkDavidsonandJasonRowland.Iwouldalsoliketoacknowledgethestaffofthedepartmentofchemicalengineering,especiallyDennisVinceandJimHinnant.Finally,IacknowledgeUFStartupFundsfornancingtheresearchpresentedinthisthesis.IwillalwayshavefondmemoriesofGainesvilleandTheUniversityofFlorida,thisplacehasleftmeabetterpersonandIhopethatIhaveinsomewayleftthisabetterplace. 4

PAGE 5

TABLEOFCONTENTS page ACKNOWLEDGMENTS .................................. 4 LISTOFTABLES ...................................... 8 LISTOFFIGURES ..................................... 9 ABSTRACT ......................................... 11 CHAPTER 1INTRODUCTION ................................... 13 1.1AimsandObjectives .............................. 13 1.2DyeSensitizedSolarCellOperation ..................... 14 1.3NanowireArrayFabricationandManipulation ................ 19 1.4NanowireDSSCswithTransparentandReectiveCores .......... 21 1.5ModelingofDSSCswithNanowire-basedPhotoanodes .......... 22 2DIRECTFABRICATIONOFHIGH-ASPECTRATIOANODICALUMINUMOXIDEWITHCONTINUOUSPORESONCONDUCTIVEGLASS ............ 23 2.1Introduction ................................... 23 2.2Experimental .................................. 26 2.2.1DepositionofAluminumandInterlayers. ............... 26 2.2.2AnodizationandPoreWidening. ................... 27 2.2.3ElectrochemicalNanowireSynthesis. ................. 27 2.2.4Characterization. ............................ 28 2.3Results ..................................... 28 2.3.1DirectFabricationofAAOonITOwithoutInterlayers. ........ 29 2.3.2DirectFabricationofAAOonITOusingInterlayers. ......... 30 2.4Discussion ................................... 33 2.4.1Time-resolvedCurrentResponseDuringAnodizationofAluminumonITO. .................................. 33 2.4.2AvoidingFailureDuringAnodization. ................. 38 2.5Conclusion ................................... 41 3ELIMINATINGCAPILLARYCOALESCENCEOFNANOWIREARRAYSWITHAPPLIEDELECTRICFIELDS ............................ 42 3.1Introduction ................................... 42 3.2Experimental .................................. 43 3.2.1TemplateFabrication. .......................... 43 3.2.2ElectrochemicalNanowireSynthesis. ................. 44 3.2.3NanowireElectrostaticRepulsion. ................... 44 3.3Theory ...................................... 46 5

PAGE 6

3.3.1AggregationDuetoSurfaceTension. ................. 46 3.3.2ElectrostaticRepulsion. ........................ 48 3.3.3SurfaceTensionReduction. ...................... 49 3.3.4CalculatedChangestoAggregationBehavior. ............ 49 3.4ResultsandDiscussion ............................ 52 3.4.1AggregationDuringDrying. ...................... 52 3.4.2ElectrostaticRepulsion. ........................ 55 3.5Conclusions ................................... 56 4DYE-SENSITIZEDSOLARCELLPHOTOANODESBASEDONCONDUCTIVENANOWIRESCOATEDWITHASEMICONDUCTIVESHELL .......... 57 4.1Introduction ................................... 57 4.2Experimental .................................. 59 4.2.1FabricationofTemplates. ....................... 59 4.2.2ElectrodepositionoftheNanowireArrays. .............. 60 4.2.3AtomicLayerDeposition(ALD)ofAnataseTiO2. .......... 60 4.2.4CompletionandTestingoftheDSSCCell. .............. 61 4.2.5CharacterizationTechniques. ..................... 62 4.3ResultsandDiscussion ............................ 62 4.3.1Core/ShellNanowireFabrication. ................... 62 4.3.2NW-DSSCPerformance. ........................ 65 4.3.3OpenCircuitVoltageDecayofNW-DSSCs. ............. 68 4.4Conclusion ................................... 72 5MODELINGTHEEFFECTSOFANINTERFACIALELECTRICFIELDINDYE-SENSITIZEDSOLARCELLPHOTOANODESBASEDONCONDUCTIVENANOWIRESCOATEDWITHASEMICONDUCTIVESHELL .................. 73 5.1Introduction ................................... 73 5.2ModelDevelopment .............................. 76 5.2.1OverallCellDesign ........................... 76 5.2.2InterfacialReactionsandPotentialDistribution ............ 80 5.2.3BulkChargeCarrierPhysicsintheSemiconductorandElectrolyte 86 5.2.4BoundaryConditions .......................... 89 5.2.5ConstantValuesUsedandNumericalAlgorithm ........... 90 5.3ResultsandDiscussion ............................ 91 5.3.1DevicePerformanceandExperimentalComparison ......... 91 5.3.2EffectofInterfacialElectricField ................... 97 5.4Conclusions ................................... 102 5.5ListofVariables ................................. 103 6OPTIMIZINGTHEPERFORMANCEOFDYE-SENSITIZEDSOLARCELLSBASEDONNANOWIREARRAYS ......................... 105 6.1Introduction ................................... 105 6.2ModelAdditions ................................ 107 6

PAGE 7

6.3ResultsandDiscussion ............................ 109 6.3.1TheEffectofLengthonDSSCPerformance ............. 109 6.3.2MaximizingtheSurfaceAreaofthePhotoanode .......... 112 6.4Conclusion ................................... 115 7CONCLUSIONSANDFUTUREAVENUESOFRESEARCH .......... 116 APPENDIX ASUPPLEMENTARYINFORMATIONFORCHAPTER2 .............. 118 BC++SOURCECODEFORTHENUMERICALMODEL ............. 121 B.0.1GraphicalRepresentationoftheNumericalAlgorithm ........ 121 B.0.2NumericalCode ............................ 121 REFERENCES ....................................... 309 BIOGRAPHICALSKETCH ................................ 318 7

PAGE 8

LISTOFTABLES Table page 2-1AnodizationresultsinvariousacidsforaluminumlmsofvaryingthicknessonITOusingeithertitaniumorchromiuminterlayers.Note:theaspectratio(L/D)forsuccessfulanodizationsarereportedbasedontheactualAAOlmthickness,nottheinitialaluminumlmthickness. ................. 29 5-1DSSCInterfacialReactionRates .......................... 83 5-2ConstantsfortheNumericalModel ......................... 92 5-3OverallModelParameters .............................. 103 5-4BulkModelParameters ............................... 103 5-5InterfacialModelParameters ............................ 104 8

PAGE 9

LISTOFFIGURES Figure page 1-1NP-DSSCDeviceEnergyLevelsandTransportProcesses. ........... 15 1-2InterfacialPotentialDropandNP-DSSCPhotoanodeThicknessasafunctionofDiffusion ...................................... 18 1-3ScopeofEngineeringandScienticConsiderationofPhotovoltaicViability .. 19 1-4OverallNanowireArrayFabricationProcess .................... 20 2-1PhysicalResultsforAAO/interlayer/ITOwithDifferingInterlayerComposition 31 2-2NanowireArrayfromElectrodepositionintoAAO/interlayer/ITODirectFabrication 34 2-3ChronoamperometricResponseofaTypicalAlFilmAnodization ........ 34 2-4ChronoamperometricResponseofaAlFilmAnodizationwithDifferingAluminumandInterlayerThickness' .............................. 37 2-5Ebeamvs.SputteredAluminumFilmsasaFunctionofDegreeofOxidation .. 39 3-1Apparatusforin-situMonitoringofNanowireAggregation ............ 45 3-2FundamentalForcesaffectingNanowireAggregationduringElectro-CapillaryCoalescence ..................................... 47 3-3CalculatedNanowireAggregationForcesandCriticalAggregationLength ... 51 3-4FESEMMicrographsofNanowireArrayshavingundergoneNaturalAggregation 53 3-5In-situDetectionofNanowireAggregationbySpectroscopy ........... 54 3-6FESEMMicrographsofNon-AggregatedNanowiresDuetothePresenceofanAppliedElectricFieldDuringDrying ...................... 55 4-1HRSEMImageofaNanowireArrayandaHRTEMImageofaCore/ShellNanowire 63 4-2X-rayDiffractionSpectraofAnataseTitaniaon<100>Si ............ 64 4-3PolarizationCurvesfor1SunIlluminatedNW-DSSCswith1,10,25and45nmTitaniaShellThicknesses ............................ 66 4-4Voc,isc,FFandasafunctionofsemiconductorshellthickness. ........ 67 4-5OpenCircuitVoltageDecayandCalculatedElectronLifetimeandRecombinationOrderasaFunctionofOpenCircuitVoltage .................... 70 5-1EnergyLevelsforaTraditionalIodideElectrolyte-TiO2-DyeNP-DSSC ..... 75 5-2NanowirePhotoanodeCore,ShellandElectrolyteDomainDimensions .... 77 9

PAGE 10

5-3PrimaryInterfacialReactionsattheElectrolyte-Dye-SemiconductorInterfaceinaDSSC ....................................... 81 5-4PolarizationCurvesforNW-DSSCs,ModelvsExperimental ........... 93 5-5CalculatedPotentialDistributionswithintheSemiconductor,InterfaceandElectrolyteDomains ....................................... 95 5-6CalculatedChargeCarrierConcentrationswithintheNW-DSSC ........ 96 5-7CalculatedInjectionandBackRates ........................ 98 5-8CalculatedRateofSemiconductorInterfacialElectronBackReactionwithOxidizedStateDye. ....................................... 99 5-9CalculatedNetLosstoPhoto-excitationRateandIntefacialChargeInjectionEfciency ....................................... 100 5-10CalculatedPolarizationCurveforNW-DSSCswithSimilarPhotoactiveSurfaceAreas ......................................... 101 6-1PolarizationCurvesforNW-DSSCsofVaryingLength .............. 110 6-2CalculatedEfciency,Short-CircuitCurrent,Open-CircuitVoltageandFillFactorasaFunctionofNanowireLengthforChapter4and5Devices ......... 111 6-3FluxofOx,RedandElectronsatShort-CircuitversusNanowireLength .... 112 6-4PolarizationCurvesforNW-DSSCsatOptimalLengthandSurfaceAreawithVaryingShellThickness ............................... 113 6-5CalculatedEfciency,Short-CircuitCurrent,Open-CircuitVoltageandFillFactorasaFunctionofNanowireShellThickness .................... 114 6-6InterfacialElectricFieldatOpen-CircuitversusSemiconductorShellThickness 115 A-1DelaminationandAir-SolutionDissolutionofanAlFilmhavingpartiallyUndergoneAnodization ...................................... 118 A-2DifferentFailureMechanismsindirectAAO/interlayer/ITOFabrication ..... 120 10

PAGE 11

AbstractofDissertationPresentedtotheGraduateSchooloftheUniversityofFloridainPartialFulllmentoftheRequirementsfortheDegreeofDoctorofPhilosophyPHOTOELECTROCHEMICALENERGYCONVERSIONINNANOWIRE-BASEDDYE-SENSITIZEDSOLARCELLS:MODELING,OPTIMIZATION&TEMPLATEDFABRICATIONByJustinJosephHillAugust2010Chair:KirkJeremyZieglerMajor:ChemicalEngineeringTheresearchpresentedinthisthesisoutlinesengineeringandscienticconsiderationstowardthetemplateassistedfabricationofcore-shellnanowirearraysontransparentconductiveoxidesupportsforuseasnanowirearray-based,dyesensitized,photoelectrochemicaldevices.Inaddition,thephotoanodeofthisspecictypeofdyesensitizedsolarcellismodelledinordertobetterunderstandinterfacialchargetransferandbulkchargetransportaswellasoptimizedeviceperformancebyvariationofcompositionalandspacialparameters.Thecorenanowirestructureisfabricatedbyrstelectrochemicallyanodizingaluminumlmsthathavebeenevaporatedonconductiveglasstocreateatemplatefornanowiregrowth.Thisisfollowedbyelectrochemicaldepositionofthecorenanowirematerialwithinthetemplateandselectiveremovalofthetemplatetoobtainananowirearrayonconductiveglass.Directfabricationofanodicaluminumoxideonconductiveglassisnon-trivial,thustechniquesdevelopedtoobtainthesetemplateswillbediscussedindetail.Furthermore,liquidbasedetchingofthetemplateultimatelyleadstoaggregationofthenanowirearraywhichcauseslossesinsurfacearea,arrayuniformityandsubstratetransparency.Asimplemethodinvolvinginductionofanelectrostaticsurfacechargeonthearraythatpreventsnanowireaggregationisalsodevelopedand 11

PAGE 12

presented.Uponcompletionofthecorenanowirearray,asemiconductivematerialsuchasanatasetitaniumdioxideisgrownepitaxiallybyatomiclayerdeposition.Uponcompletionofthecore-shellnanowirearrays,thephotoelectrochemicaldeviceiscompletedbysensitizingthesurfacewithaphotoactivedyeandimmersioninaliquidredoxcouple.Twotypesofdevicesarepresentedinthisthesis,onehasatransparentnanowirecorecomposedofindiumdopedzincoxidewithananatasetitaniashellandtheotherhasahighlyreectiveplatinumnanowirecorewithananatasetitaniashell.Theperformanceofthesetwotypesofnanowiredyesensitizedsolarcellsarecharacterizedbyevaluationoftheirrespectivepolarizationcurvesaswellasothermethods.Furthermorethenanowirelengthandsemiconductiveshellthicknessisvariedtounderstandtheirrespectiveeffectondeviceperformance.Coupledwiththeexperimentalresults,adetailedinterfacialandbulkdevicemodelisdevelopedandevaluated.Traditionalnanoparticlebaseddyesensitizedsolarcellsarewidelybelievedtohavenonetinterfacialelectriceld,whereasithasbeenpostulatedthatnanowirebaseddevicedoandtheeldpositivelyaffectsdeviceperformance.Themodelinvolvesanextensivenumericalalgorithmutilizingnitedifference,non-linearxedpointiterativeandLevenburg-Marquardtoptimizationmethods.Therstaimofthedevicemodelistobetterunderstandtheeffectofaninterfacialelectriceldonvariousfactorscontributingtodeviceperformance.Thisisevaluatedbyprobingtheeffectofaninterfacialelectriceldonchargeinjectionefciency,chargetransportaswellaschargerecombination.Thesecondaimofthedevicemodelinvolvesengineeringoptimizationofthedevice'sspacialandcompositionalcharacteristicsthatleadtomaximumphotoelectrochemicalperformance.Themodelpredictsinterestingnewexperimentalavenuesthatmayleadtodyesensitizedsolarcellswitheffeciencieswellexceedingthecurrentrecordof12%. 12

PAGE 13

CHAPTER1INTRODUCTION 1.1AimsandObjectivesTherstpartofthisintroductionservesasacasualoverviewoftheoperationalprinciplesandlimitationsofdye-sensitizedsolarcells(DSSCs).Theheterogeneoussystemanditsoperationareexplainedintermsofchargegeneration,transferandtransportmechanismsaswellastherelevantenergydistributionwithinthephotoelectrochemicalcell.Furthermore,theimportanceofthephotovoltaictriangleisconsideredandexplained.Morespecically,theaimofthisdissertationistonotonlybetterunderstandthephysicsofnanowire-basedDSSCsandseektoimproveuponthembutdosowhilebeingmindfulofoverallfabricationcostsshouldthesedevicesbeproducedonalargescale.Thefollowingdissertationaddressestwointerrelatedcomponents:(1)fabricationofdye-sensitizedsolarcellsbasedonnanowirearrayswhileattemptingtopreservelowfabricationcostsand(2)mathematicalmodelingofthesedevicestounderstandtheirfunctionalityandpotential.Whiletheexperimentaldataobtainedfromthefabricationofthesedevicesservestovalidatetheaccuracyofthemodel,themodelitselfultimatelyprovidesdirectionforthefabricationofnanowirearraysinthisareaofactiveresearch.Themainobjectivesofthisthesisaregivenbelow: Elucidatethebenetsoftheelectricelduniquetonanowire-basedphotoan-odes-Experimentsandcomputationswereconductedtoprovideinsightintotherolethattheinterfacialelectriceldhasontheperformanceofdifferencesbetweennanoparticle-andnanowire-basedDSSCs.Whiletheexperimentalinvestigationofthesedevicesprimarilyelucidateexternalperformancecharacteristics,thecomputationaldataiscapableofprobingtheindividualinternalprocessesthataffectperformance.Thecombinationofthesetwoperspectivesallowforabetterunderstandingofthepotentialroutesforimprovementtonanowire-basedDSSCs. Provideaclearpathforwardforthefabricationofphotoanodes-Ingeneral,experimentaleffortstoalterthemorphologyofthenanoparticle-basedphotoanodehavebeenconductedwithashotgunapproach.Mostoftheseinvestigationshavefocusedontheuseofalignednanostructuredphotoanodes;however,thesesystemsaretypicallyfaultedforhavingconsiderablylowerphotoactive 13

PAGE 14

surfacearea.Focusingthecomputationoncore/shellnanowirearrays,amorewelldenedexperimentaldirectionispresented.Theresultsshowthatdramaticincreasesinphotovoltaicperformancecanbeachievedwiththesedevices,providingmotivationforexperimentaleffortsinthedevelopmentofhigherdensityarraysofhigh-aspect-rationanowires. Developingnewfabricationprocessesforgeneratinghigh-densityar-raysofhigh-aspect-rationanowiresFromthebeginning,itwasclearthatnanowirearrayswithhighsurfacearea(highdensity)wereneededtomakeefcientDSSCs.Fabricatingthesenanowirearrays,especiallyontransparentconductiveoxidesubstrates,remainschallenging.Thesedifcultiesincludecontrollingthedimensionsofthenanowiresandpreventingaggregationofthestructures.Althoughthedesiredsurfaceareaswerenotachieved,theworkdescribedinChapters2through4laythegroundworkforfabricatingthesedevices.Thesechaptersfocusonthetemplated,electrochemicalfabricationofnanowirearraysandasimple,cheapandscalablemethodtopreventnanowireaggregation. 1.2DyeSensitizedSolarCellOperationTherstdyesensitizedsolarcell(DSSC)wasdevelopedbyGratzelandHagfeldtintheearly1980's. 1 Duringatimeofgreatinterestinthedevelopmentandunderstandingofliquid-junctionphotovoltaicdevices,DSSCsweredesignedinawaythatmimickedphotosynthesis.Insteadofconvertingsolarenergyintosugars,asplantsdobyusinganorganicphoto-activecompound,chlorophyll,DSSCsweretargetedtouseaphoto-activeorganiccompoundtodirectlyconvertsolarenergytoelectrochemicalenergy.Infact,therstattemptsatfabricatingDSSCsutilizedchlorophyllasthephoto-activecompound.Chlorophyll,however,provedunsuccessfulandmoresophisticatedphoto-activeorganicdyesweredeveloped,suchastheruthenium-basedorganicsusedtoday.TraditionalDSSCsconsistofathick(10m)lmofanatasetitaniumdioxidenanoparticles(NP-DSSCs).ThecompleteNP-DSSCphotoanodeconsistsofthisnanoporouslmwithaphotoactiveorganicdyethatischemisorbedonthenanoparticlesurface.Thisphoto-anodeisimmersedinaREDOXcouple(typicallyI)]TJ /F5 11.955 Tf 7.08 -4.34 Td[(=I)]TJ /F3 7.97 Tf -1.59 -7.97 Td[(3)tojunctionthephoto-anodewithaplatinumcounter-electrodethatactsasacatalystintheelectrochemicalREDOXprocess.Figure 1-1 depictsthefundamentalprocessesinNP-DSSCsaswellastheenergylevelsoftheheterogeneousdomain. 14

PAGE 15

Figure1-1. ThefundamentalchargetransferandtransportprocessesinaDSC. 2 Theenergyconversionprocessbeginswiththeabsorptionoflightbythegroundstatedye,So.Thedyeisthenenergizedtoanexcitedstate,S,whereanelectroninthelowestunoccupiedmolecularorbital(LUMO)ofthedyecaneitherbeinjectedintotheconductionbandofthesemiconductornanoparticle(currentproduction)orlosttotheelectrolyte(currentloss).Uponelectroninjectionthedyeisleftinanoxidizedstate,S+,andmustberegeneratedbytheelectrolytethroughanelectrochemicalreaction.Iftheexcitedstatedyeinjectsanelectronintothesemiconductor,thatelectronmusttravelthroughtherandomnetworkofnanoparticlestobecollectedatthetransparentconductiveoxide(TCO)currentcollector.Tocompletetheprocess,electronsaredrawnfromgroundtotheplatinumcounter-electrodewheretheoxidizedelectrolytespeciesisreducedanddiffusesbacktothephotoanodewhereitmayagainreduceS+.NP-DSSCspeakedtheinterestofmanyresearchersduetoseveralattractivefeaturesthatarenotfoundinsinglecrystal,silicon-basedphotovoltaicdevices.Comparativelyspeaking,NP-DSSCsperformhorriblywhentheefciencyofthedeviceisscaledtotheactualphoto-anodesurfacearea:efcienciesofabout0.012%/cm2!However,thephoto-activesurfaceareaoftheNP-DSSCdeviceisroughly1000timesgreaterthanthatoftheplanardevicearea.Thus,perunitplanararea,NP-DSSCscurrentlyhaveachievedefcienciesinthe12%range.Fromacoststandpoint, 15

PAGE 16

photovoltaicdevicesarepricedperplanarunitareaandnotbytheactualphoto-activesurfacearea.Additionally,typicalfabricationmethodsforNP-DSSCsdonotrelyonhighenergyorhighvacuumtechnologyandthushavethepotentialforcheaperfabricationcostswhencomparedtosilicon-basedphotovoltaicdevices.Thereareafewfundamentaldrawbacksassociatedwithnanoparticle-basedphotoanodeswhenutilizedtoconstructaDSSC.AsshowninFigure 1-1 ,themaximumvoltageoutputoftheDSSCisdeterminedbythedifferencebetweentheFermi-energyofthesemiconductorandtheelectrochemicalpotentialoftheREDOXcouple.TheenergyvaluesreferencedinFigure 1-1 correspondtoanatasetitaniananoparticles,aphotoactivedyecomposedofdi-tetrabutylammoniumcis-bis(isothiocyanato)bis(2,2-bipyridyl-4,4-dicarboxylato)ruthenium(II),commonlycalledN719,andanI)]TJ /F5 11.955 Tf 7.08 -4.34 Td[(=I)]TJ /F3 7.97 Tf -1.59 -7.98 Td[(3REDOXelectrolyte.Theiodide-basedelectrolyteismostcommonlyusedbecauseoftherelativelyslowkineticsofSelectronlosstoI)]TJ /F1 11.955 Tf 10.41 -4.34 Td[(whencomparedtothekineticsassociatedwithelectroninjectionintothesemiconductor,whichminimizesphoto-generatedelectronloss.ChangingtheelectrolytecompositioncanincreasethemaximumDSSCoutputvoltagebyshiftingtheelectrochemicalpotentialinapositivedirection.However,alternativeREDOXcomplexeswithlargerelectrochemicalpotentialsoftenhavefasterback-reactionkineticswithphoto-generatedelectrons,whichdiminishDSSCphotocurrent.Anotherconsequenceofelectron-electrolytebackreactionstemsfromthemorphologyofthephotoanode.Themorphologicalconsequencesaretwo-fold:grainboundarytrapsiterecombinationandselectiveelectronmigrationinthesemiconductor.Electronsinjectedintothesemiconductormustbetransportedfromnanoparticletonanoparticleuntilreachingthecurrentcollector.Indoingso,transportedelectronsmusttraversealargenumberofnanoparticle-nanoparticlegrainboundaries,increasingtheprobabilityofdirectbackreactionofconductionbandelectronstotheelectrolyte.Furthermore,AlbertandBartletthaveshownthedegreeofspacechargelayerband 16

PAGE 17

bendingwithinasemiconductivenanoparticleisproportionaltothesquareofit'sradius,r,i.e. rsc=kBT 6er Ln2(1)wherekB,T,e,LnandscaretheBoltzmannconstant,temperature,electroniccharge,electrondiffusionlengthandthepotentialinthesemiconductor,respectively.Theelectrondiffusionlengthisthedistanceinwhichinjectedelectronswilltravelbeforetheywilllikelyrecombinewithholesinthesemiconductor,withtheS+orback-reactwiththeelectrolyte.Itisrelatedtoelectrondiffusioncoefcient,De,andlifetime,,whicharematerial,morphologicalandcompositionalpropertiesofthesemiconductivephotoanodebythefollowing Ln=p De(1)ThetypicalsizeofnanoparticlesinNP-DSSCsisaround10nmandthusEquation( 1 )predictsthatthereisessentiallynointerfacialelectriceldwithinthenanoparticleitself.Consequentially,injectedelectronsexperiencenodrivingforcetotravelawayfromthesemiconductor/dye/electrolyteinterfaceandaremorepronetobackreaction.Indeed,trap-limiteddiffusionelectrontransportthatisgovernedbyasurfacesite,randomwalkmodelhasaccuratelydepictedthetransportphysicsofNP-DSSCs. 3 Figure 1-2 3 depictsthedependenceofinterfacialpotentialdropandphotoanodethicknessonelectrondiffusioncoefcientandlifetimewithinthenanoparticle-basedphotoanode.Asthediffusioncoefcientincreaseslinearly,electronlifetimedecreaseslinearly,causingtheelectrondiffusionlengthtohaveamaximumvaluearound10m.WhileNP-DSSCswithphotoanodesthinnerthan10mdonotmaximizetheamountoflightavailableforadsorption,electronsinjectedatdistancesgreaterthan10mhaveahighprobabilityofnotbeingcollected.Utilizingphotoanodesstructuredwithnanowirearrayshascertainadvantagesovertheirnanoparticlecounterparts.Recently,manyresearchershavefabricatedZnOnanowireornanotubearraysandutilizedthismorphologyfortheDSSCphotoanode. 4 7 17

PAGE 18

Figure1-2. Electrondiffusionlength,coefcientandlifetimeasafunctionofinterfacialpotentialdropandphotoanodethickness.GiventhedependencyofdiffusionlengthondiffusioncoefcientandlifetimeinEquation( 1 ),theelectrondiffusionlengthisconstantataround10mandthuselectronsgeneratedbeyondthislengthhaveapoorprobabilityofbeingcollected. 3 WhileZnONP-DSSCdevicesareknowntohavelowerefcienciesthananatasetitaniaNP-DSSCs,LawandYangfoundthatnanowireDSSCs(NW-DSSCs)composedofZnOperformedbetterorequivalenttoZnONP-DSSCs. 4 Theypostulatedthatthismorphological-basedperformanceenhancementwasduetothepresenceofanelectriceldinternaltothenanowire.ItmayalsobeduetothefactthattheradiusofthenanowireinthatstudywasgreaterthantheDebye-Huckelscreeninglength,enhancingchargescavengingintheelectrolyte. 4 Law&YanglatergrewananatasetitaniashellontheZnOnanowirestoassescore-shellNW-DSSCperformance. 8 Byadjustingthetitaniashellthickness,theywereabletotunetheopencircuitvoltageofthedevice,whichwasoptimalatashellthicknessaround10nm.Theseexperimentalstudiesclaimthattuningtitaniashellthicknesschangestheinterfacialelectriceld.Thisfurthersupportsthehypothesisthatinterfacialelectriceldaffectsdeviceperformance.Finally,anotherdrawbackassociatedwithNP-DSSCsthathasnotbeenextensivelyaddressedisthatofthe10mlimitationonphotoanodethickness.Inthisthesis,Iproposetheuseofconductivecore,semiconductiveshellnanowirearrays.Thismorphologydecouplesthedistanceaninjectedelectronmusttravelfromthephotoanode 18

PAGE 19

thickness(andthusoverallphotoactivesurfacearea),whichenableshigherpossiblepowercollectiondensities.Byoptimizingspatialparameters,themodeldiscussedinChapters5and6showsthatthephotoanodethicknesscanbeincreasedupto47mwithoutcurrentloss,yieldingdeviceswithpredictedefcienciesashighas25%(scaledtotheplanarsurfacearea). 1.3NanowireArrayFabricationandManipulationThecostpersquarefootisanimportantaspectofphotovoltaictechnology.Assuch,interestinDSSCtechnologyhasourishedduetothelowpotentialfabricationcostofNP-DSSCsystemsandtheirrelativelyhighefciencies.Fromanengineeringstandpoint,itwouldbeadisservicetodevelopanewDSSCtechnology,suchasNW-DSSCs,thatyieldedhigherefcienciesbutwereconsiderablymorecostlytofabricate.Theviabilityofaparticularphotovoltaictechnologydependsequallyonthedevicelifetime,costandpowerconversionefciency,asshowninFigure 1-3 .Thesethreeparametersareinterrelatedsothatenhancingoneparametershouldnotdiminisheitheroftheothertwo. Figure1-3. Theviabilityofanyphotovoltaictechnologydependsonthedevice'sefciency,lifetimeandcost.Thisrelationshipprovidesaninterestingprobleminbothscience/theoryandengineering. WhiletheaimofthetheoreticalandexperimentalworkistowardabetterunderstandingofthephysicsofNW-DSSCsandtooptimizetheirperformance,thisthesisfocuseson 19

PAGE 20

utilizingmostlyelectrochemicaltechniquesforthedevicefabrication.Electrochemicaltechniquesarecheap,lowenergyprocessesandarecommonindustrialpractices.Figure 1-4 outlinestheprocessdevelopedinthisthesisforthedirectfabricationofcore-shellnanowirearraysonTCOsupports. Figure1-4. Theoverallfabricationprocessinvolvesrstelectron-beam(Ebeam)evaporationofaluminumonaTCO,subsequentelectrochemicalanodizationofthealuminum,depositionwithintheporesoftheanodicaluminumoxide(AAO),selectiveetchingoftheAAOandnallyatomiclayerdepositiontocompletethecore-shellnanowirearray. Thecore-shellnanowirearraygrowthoutlinedinFigure 1-4 involvesveprimarysteps:preparationofaluminalmsontransparentconductiveoxides,electrodepositionofthenanowirecore,selectivetemplateremovalwithoutnanowireaggregation,atomiclayerepitaxy,anddeviceassembly.Whiletherstandlaststepsintheprocessinvolvehighvacuumand/orhighenergy,expensiveprocesses,itisareasonableexpectationthatuponfurtherinvestigation,thesetwoprocessescouldbealteredtoachievethesameresultatlowercost.Forexample,insteadofebeamevaporationofthemetallayers,itmaybepossibletostartwithanaluminumlmandelectrodepositorspincoattheremaininglayersandsupportdirectlyontothealuminumlm.Furthermore,therehasbeensomeinvestigationinvolvingpulsedelectrophoreticdepositionor 20

PAGE 21

electrochemicalatomiclayerepitaxy(ECALE)ofsemiconductivematerialsthatcouldbeusedtoreplaceatomiclayerdeposition. 9 10 Chapter2discussesthedirectfabricationofAAOonindiumtinoxide(ITO).Whilethisareaisbeingdeveloped,thereissomedisparityinthereproducibilityofresultsmainlyconcerningaluminumlm/ITOadhesion. 11 12 Theeffectofsubstratefabrication,adhesiveinterlayercompositionaswellasaluminumdepositionmethodsisdiscussedintermsofmaintainingadhesionofthealuminumlmtotheTCOsupportduringtheanodizationprocess.Uponnanowiregrowthviaelectrodeposition,theAAOtemplateisremovedbyimmersioninanaqueousacidbath,leavingbehindawettednanowirearray.Duringthedryingofthewettednanowirearray,thesurfacetensionoftheuidcausesthenanowirestoaggregateduetoaprocesscalledcapillarycoalescence.Thisundesirablebecauseofthereductionoflighttransmittanceandsurfacearea,whichresultsinnon-uniformepitaxialgrowthoftheshellstructure.Othershavereducedoreliminatedcapillarycoalescenceofnanowirearraysbydryingthearrayinasupercriticaluidmedium. 13 Whilethisprocessworkswell;itisnoteasilyscalableandisenergyintensive.Chapter3discussesanewmethodtoinhibitnanowireaggregationbyinducingasurfacechargeonthesubstratethatcauseselectrostaticrepulsionofthenanowiresduringdrying.Thisprocessreliesonlyonmildelectriceldsandispotentiallyscalable.Chapter3alsopresentsanin-situopticalmethodtomonitorandquantifythedegreeofnanowireaggregation. 1.4NanowireDSSCswithTransparentandReectiveCoresInordertovalidatethecomputationalmodelandassesstheviabilityofthedevicefabricationprocessaswellasprovideexperimentalvalidationforthetheoreticalmodel,NW-DSSCscomposedofbothtransparentindium-dopedzincoxide,goldandplatinumcoresarefabricatedwithanatasetitaniumdioxidesemiconductiveshellswithvaryingthickness.Chapter4discussesthefabricationandperformanceofthesedevicesasa 21

PAGE 22

functionofsemiconductorshellthickness.Inaddition,propertiesinternaltothedevicesuchaselectronlifetimeandrecombinationorderareprobedwithopen-circuitvoltagedecaymeasurements.UponcomparisonoftheseresultswithNP-DSSCsitwasfoundthattheseNW-DSSCshavelongerelectronlifetimesandalowerorderofrecombination. 1.5ModelingofDSSCswithNanowire-basedPhotoanodesIthasbeenproposedthatNW-DSSCsexhibitenhancedperformancewhencomparedtoNP-DSSCsduetothepresenceofaradialelectriceld.Chapter5investigatestheeffectthataninternalelectriceldhasoninterfacialchargetransferkinetics.Thisisaccomplishedbymodelingconductivecore,semiconductiveshellnanowirephotoanodes.Theelectriceldisonwhenmigrationofelectronsisallowedtocontributetotheinjectedelectronuxandisoffwhenthiseffectisneglected.Themostdramaticpredictionofthecomputationresultsisa10,000-foldreductionintherateofprimaryelectronlossfromtheexcitedstatedyetotheelectrolyte.Thisreductioninelectronbackreactionpositivelyeffectstripletexcitedstatedyeinjection.ItisexpectedthatNW-DSSCscomposedofconductivecoreandsemiconductiveshellnanowireswilldecouplethephotoanodethickness(overallphotoactivesurfacearea)fromtheelectroncollectiondistance.Chapter6discussesoptimizationofNW-DSSCsbyvariationofbothcompositionalandmorphologicalparametersoftheconductivecore,semiconductiveshellphotoanode.Indeed,thecomputationalresultsthatNW-DSSCsbasedonthisnanowiremorphologycanreachphotoanodethicknessesinexcessof47micronsbeforetheirperformancediminishes.Thisleadstooverallpowerconversionefcienciesinexcessof25%(perunitplanararea). 22

PAGE 23

CHAPTER2DIRECTFABRICATIONOFHIGH-ASPECTRATIOANODICALUMINUMOXIDEWITHCONTINUOUSPORESONCONDUCTIVEGLASS 2.1IntroductionFabricationofanodizedaluminumisacommonandwidespreadindustrialpractice.Anodicaluminumoxide(AAO)membranes,withcylindricalsub-micronporediameters,arereadilyproducedinthelabandarealsocommerciallyavailable. 14 19 Typically,AAOisfabricatedfromaluminumfoilorsheets 20 andtheexcessaluminumafteranodizationcanbedissolved,leavingafreestandingmembrane. 14 ThehighporedensityandsurfaceareaofAAOmembranesarebeingusedforavarietyofresearchapplications,includingcatalystsupports, 21 nano-scalelters,hierarchicalmolecularsieves, 22 andphotonics. 23 Competitivedevelopmentofmorepowerfulintegratedcircuitsrequirescosteffectivemethodsofincreasingthedevicedensity. 24 Theorderedstructures,controllableporediameters,andhighdensityofporesinAAOmembraneshasledseveralresearcherstousethemforthefabricationofnanostructures. 25 35 WhiledevicefabricationusingAAOisstillinitsinfancy,thistemplatedstructurecanprovideauniformandorderedarchitecturetofacilitatethecontrolledgrowthofdevicesforapplications,suchasphotovoltaiccells, 5 superconductivity,opticalspectroscopy,andcatalyticconversionofchemicaltomechanicalenergy, 36 aswellascore/shellnanostructuresforultra-fastchargecollection. 37 TheincorporationofthesestructuresontoasubstrateisparticularlyimportantwhenconsideringAAO-templatednanostructurefabrication.Preparingarraysofnanostructures,suchasnanowires,onvaryingsubstratesisarapidlygrowingareaofinterestinfabricatingfunctional,high-aspectandhighsurface-areadevices.Whetherelectrical,mechanicaloropticalfunctionalityisrequiredofthenanostructurearray,boththenanostructureandsubstratecompositionaredeningparametersofdeviceoperation. 23

PAGE 24

EarlyapproachesinpreparingverticalnanostructuresthroughAAOtemplatesweredonebyeitherdirectlymountingthemembraneonthesubstrate 29 38 orblockingtheporesononesideofthemembranepriortoinclusion. 39 40 TheseapproachescangiverisetodevicecontaminationfromchemicalsusedtobondtheAAOtothesubstrateandcanleadtounwantedsidereactionsifelectrochemistryisperformed. 41 Furthermore,theplanarinterfacebetweenthebondedtemplateandsupportmaynotbeconformal,leadingtogapsbetweenthesubstrateandtemplate.ThesegapseitherpreventthefabricationofnanostructureddevicesonthesupportthroughtheAAOtemplateorhindertheirperformance.DirectlyfabricatingAAOontoasubstrateeliminatestheneedtobondafreestandingtemplate. 12 26 42 AnimportantaspectuniquetodirectAAO/substrateformationiscontrollingtheinterfacebetweenthesubstrateandtheanodizedlm.Inadditiontomaintainingcontactbetweentheporoustemplateandsubstrate,theporesmustbecompletelyanodizedandtheremainingaluminumoxidebarrierlayermustberemovedifdevicecontactcharacteristicsaretobecontrolledoriffreestandingnanostructurearraysaredesired.ThedifcultywithfabricatingAAOdirectlyonasubstrate,otherthannativealuminum,isthevolumeexpansionofaluminumwhenoxidizedduringanodization.Thevolumeofthelmincreasesby40%, 15 creatingadhesionproblemsthatcanariseatanytimeduringtheanodizationprocess.DelaminationofeithertheAlorAAOfromthesubstratepreventstheporesfromformingordestroysthetemplatebecauseoflocalizedelectrochemicalreactions.Adhesionproblemsduringtheanodizationprocessarefurtherexacerbatedwhenthesubstrate(workingelectrode)isnotelectrochemicallyinerttotheanodizingsolution,asisfoundwithtransparentconductivesubstratescomposedoftin-dopedindiumoxide(ITO). 11 12 26 42 TherstexampleofdirectfabricationofAAOonITOwasdemonstratedbyChuetal. 11 TheyreportedthesuccessfulfabricationofAAOinphosphoricacidfrom2mthickaluminumlmsdepositedbyRF-sputteringresultinginlargediameterAAO 24

PAGE 25

pores. 11 26 Aloosecorrelationbetweenthetime-resolvedcurrentresponseofAl/ITOanodizationandaluminumfoilswasobserved.OnesignicantdeviationtheyobservedfromtheanodizationofaluminumfoilwasthatkinksandvoidswereobservedintheAAOpores.Thisarosefromthefactthatthealuminumwasdepositedintwosteps,creatinganaluminum/aluminumlmjunction.Inaddition,theAl/ITOanodizationsufferedend-of-anodizationsparkingandgasevolutionthatfrequentlydestroyedthelmandincreasedtheresistivityoftheITO. 11 Thisprocesscouldbepartiallymitigatedbymonitoringthetime-resolvedcurrentresponseandceasinganodizationattheappropriatetime.Choetal. 42 independentlycorroboratedthisworkbyfollowingthesameprocedure.Foongetal.recentlyenhancedtheadhesionofAAOonITOthroughtheuseoftitaniuminterlayersduringanodizationof200nmaluminumlmsineithersulfuric,oxalicorphosphoricacidsolutions. 12 Thesethreedifferentanodizingsolutionsprovidetheabilitytofabricateawiderangeofporediameters.Specically,phosphoricacidtypicallyproducesporediameters100nmandhigher,whileoxalicacidproducesporediametersbetween25and75nmandsulfuricacidproducesporediametersontheorderof10nm. 15 TheabilitytodirectlyfabricateAAOporesonITOwithvaryingporedepthanddiameterisacrucialsteptowardsthefabricationofnanostructureswithawidevarietyoftunableaspectratiosforapplicationswhereatransparentandconductivesubstrateisrequired.Foongetal.havedemonstratedthattheuseoftitaniumadhesionlayerspreventsdelaminationduringanodizationforthinaluminumlmsonITO. 12 However,theaimofthisstudyistofabricatethickAAOlmsdirectlyonatransparentconductivesupportwithdeepporesandadjustableporediameter.Thisisanimportantsteptowardsfabricatingnanostructureswithtunableaspectratios.ItisshowninthisstudythatbothinterlayersofTiandCrcanbeusedasadhesionlayersduringtheanodizationofaluminumonITO.However,onlycertaincombinationsofanodizationsolution, 25

PAGE 26

interlayerthicknessandcomposition,andaluminumthicknessarefoundtosuccessfullyfabricateAAOonITO/glasssubstrates.Inaddition,wendthatseeminglyminordeviationsduringlmdepositioncanchangetheanodizationprocess. 2.2Experimental 2.2.1DepositionofAluminumandInterlayers.PorousAAOlmswerefabricatedontransparentconductivesubstratesviatheelectrochemicaloxidationofevaporatedorRF-sputteredaluminumlms.ThetransparentconductivesubstratewascomposedofITOon0.11cmglasssubstrates,whichwereobtainedprecut(ThinFilmDevices,Inc.)withdimensionsof1.25x5cm,anITOlmthicknessof45015nm,andasheetresistance<5/cm2.Priortometaldeposition,thesubstrateswerecarefullydegreasedbysonicationfor20mineachinsoapyde-ionizedwater,acetone,ethanolandthende-ionizedwater.ThesubstrateswerethenplacedinaeitheraKurtJ.LeskerCMS-18sputterdepositionorcustomelectronbeam(ebeam)evaporationchamber.Forsputteredlms,thesubstrateswerevacuumedto2x10)]TJ /F3 7.97 Tf 6.58 0 Td[(8torrandaluminumwasdepositedat1.8A/stothedesiredthickness.Ebeamevaporationwascarriedoutat5x10)]TJ /F3 7.97 Tf 6.58 0 Td[(6torr.Chromiumortitaniuminterlayersweredepositedat1-2nm/s(monitoredbyaquartzcrystalmicrobalance)toathicknessof0.3,1,or10nm.Immediatelyfollowinginterlayerdepositionandwithoutbreakingchambervacuum,99.999%purealuminumwasevaporatedatarateof200-300nm/stoathicknessofeither0.2or2.2m.Insomecases,theebeamevaporatedlmswerethermallyoxidizedpriortoanodization.Thermaloxidationwasdoneinamufefurnace(Barnstead)attemperaturesbetween350and450Cfor5to30mintovarytheoxidethickness.Inallcases,aportionofthesubstratewasthencoveredwithaluminumfoiltoexposea1x1.25cmstrip,wherea10mlayerofsilicawasevaporatedatarateof100-200nm/s.Thissilicastripisusedtoprovideelectricalinsulationtopreventanodizationofthealuminumlmattheinterfacebetweenairandtheanodizingsolution. 26

PAGE 27

Otherwise,electrochemicaloxidationofthelmsoccurstoorapidlyatthisinterfaceandelectricalcontactwiththesubmergedportionofthelmiscutoffduetothedestructionoftheITOontheglasssubstrateattheair-solutioninterface(seeFigureA-1). 2.2.2AnodizationandPoreWidening.Followinglmdeposition,thesubstrateswereplacedineither1.3Mphosphoricacid(7C),0.3Moxalicacid(2C)or0.2Msulfuricacid(2C)solutionsheldattemperatureinajacketedbeakerbyarecirculatingchiller.Thesolutionwasstirredatarateof450rpm.Thesubstratewasinsertedsotheuidowimpingednormaltothealuminumlmandthesilicastripbridgedtheair-solutioninterface.Acarboncounter-electrodewasusedforallanodizationprocesses.Aluminumlmswithinterlayerswereanodizedataconstantvoltageof35,60,or130VusingaLambdaGen300-5powersupplyforsulfuric,oxalic,andphosphoricacidsolutions,respectively.Aluminumlmsanodizedwithoutinterlayerswereanodizedataconstantvoltageof80Vinphosphoricacid.Thepotentialwasincreasedatarateof4V/stothenalvoltageandcurrentwasmonitoredwithaLaurelsamp-meterandahomemadeLabviewcontrolprogram.UponcompleteanodizationoftheAAOonITOsubstrates,thealuminabarrierlayerwasetchedwith5wt%phosphoricacidfor330stoopenthebottomofthepore.Eachprocessconditionforpreparinglmsonthesubstratewasrepeatedaminimumofsixtimes. 2.2.3ElectrochemicalNanowireSynthesis.Goldnanowiresweresynthesizedbyelectrochemicallydepositinggoldfromsolution(Technigold25ES,TechnicInc.)ontotheexposedITOlayerwithintheporesoftheAAOtemplate.Thesolutionwasheldat60Canddepositionwasperformedpotentiostatically(VersastatV3,PrincetonAppliedResearch)againstacarboncounter-electrodeat0.5Vversusasaturatedcalomelelectrode.Thedepositioncurrentwasmonitoredcloselysothatgolddepositionwasceasedoncethecurrentbeganto 27

PAGE 28

risedramatically,resultingincompletelylledAAOtemplatepores. 43 Thetemplatewasremovedusinganewmethodthatpreventsaggregationofthenanowires. 44 2.2.4Characterization.Fieldemissionscanningelectronmicroscopy(FESEM)micrographswereobtainedonaJEOLJSM6400.Aluminumlmsthatappearedtohaveundergoneoxidationduringdeposition,especiallysputteredaluminum,wereanalyzedbyFESEMaswellasXPS(Perkin-ElmerPHI5100ESCASystem)toquantifythedegreeandtypeofoxidation.SheetresistancewasmeasuredwithaPrincetonAppliedResearchVersaSTAT3potentiostatandaluminumprobes.LighttransmittancewascollectedwithaPerkin-ElmerLambda9UV/Vis/NIRspectrophotometer. 2.3ResultsVariouslmthicknessesandanodizationconditionsareusedtofabricatehighaspectAAOporesonITO.Table 2.3 summarizestheanodizationresultsforeachcombinationofanodizationsolution,interlayermaterialandthickness,aswellasthenalAAOlmlayerthickness.Detailsoftheresultsarediscussedfurtherbelow.EachconditionpresentedinTable 2.3 wasrepeatedaminimumofsixtimestoensuretheaccuracyoftheresults.Althoughnotalldiameter/lengthcombinationsweresuccessful,aspectratiosofapproximately1.4,8.3,14,18,and47wereobtained.TheseaspectratiosofAAOonITOexpandthoseobtainedbyFoongetal., 12 accomplishingtheprimarygoalofhigh-aspectratiopores.Pre-poreformationandpost-poreformationfailurelistedinTable 2.3 referstothepointduringtheprocessatwhichanodizationfailed.Pre-poreformationfailuregenerallyoccurredduetoeitherahigherselectivityoftheinterlayertoelectrochemicalreactionthanthealuminumlmorimmediateelectricaldischargeacrossthelm.Post-poreformationfailureoccurredbecausetheinterlayerdissolved,removingtheanodizedlayerfromthesubstrate,orbecausearcingandgasevolutionlocallydestroyedthelm, 28

PAGE 29

Interlayer AlThickness(m) sulfuricacid oxalicacid phosphoricacid nointerlayer1 1 D=55nm;L/D=18 2.2 Failure2 10nmTi 0.2 D=21nm;L/D=8.3 Failure3 Failure4 2.2 Failure4 D=45nm;L/D=47 Failured 10nmCr 0.2 Failure3 Failure4 D=145nm;L/D=1.4 2.2 Failure3 Failure4 D=145nm;L/D=14 1 RF-sputterdeposition(anodizedat80Vinphosphoricacid) 2 Noporeformation 3 Post-poreformationfailure 4 Pre-poreformationfailure d Totalanodizationfailure Table2-1. AnodizationresultsinvariousacidsforaluminumlmsofvaryingthicknessonITOusingeithertitaniumorchromiuminterlayers.Note:theaspectratio(L/D)forsuccessfulanodizationsarereportedbasedontheactualAAOlmthickness,nottheinitialaluminumlmthickness. leavingonlyasmallfractionoftheAAOlmintact.Amoredetaileddescriptionofthesefailuresisoutlinedinthesupplementaryinformation. 2.3.1DirectFabricationofAAOonITOwithoutInterlayers.AluminumwasRF-sputteredinasingledepositionsteptothicknessesgreaterthan1monbareITO.Single-stepdepositionwasusedtoavoidthekinksandvoidsobservedpreviouslyattheinterfacesofmultilayerAllms. 11 TheRF-sputteredaluminumwasthenanodizedinphosphoricacidat80V.Anodizationoccurredwithoutfailureforsputteredaluminumlmsthinnerthan1.1m,althoughasmallamountofdelaminationisobservedatthesideofthesubstrate.Abovethisthickness,theanodizationresultedinthecontinuousoxidationanddissolutionofthealuminumoxide.Theselmsneverappearedtoformporesbasedonthetime-resolvedcurrentresponseandtherewasnolmleftonthesubstrateaftertheanodizationwascomplete.EbeamevaporationwasalsousedtopreparealuminumlmsdirectlyonITO.However,anodizationofebeamevaporatedaluminumlmsofanythicknessresultedinsignicantdelaminationofthelm. 29

PAGE 30

2.3.2DirectFabricationofAAOonITOusingInterlayers.GiventhelimitedsuccessofthedirectfabricationofAAOonITO,interlayerswereusedinanapproachsimilartoFoongetal. 12 TheauthorsusedTiinterlayerstofabricatethin(0.2m)AAOonITO,observingthebestresultswhentheTiinterlayerthicknesswas0.3nm.However,ourattemptstodepositandanodizelmswithTiinterlayerthicknessesofeither0.3or1nmwereunreliableduetothicknessvariations.Therefore,athickertitaniuminterlayerof10nmwasusedduringallanodizationexperimentsdescribedbelow.TheFESEMimageinFigure 2-1 aconrmsthatanodizationof0.2mAlonTi/ITOissuccessfulatmaintainingadhesionduringanodizationinsulfuricacid.AsseeninthetitaniuminterlayerwhereAAOwasscratchedaway,anodizationalsoreactswiththetitaniumlayer,resultingindimplesthatexposetheunderlyingITO.Thesizeofthedimplesisapprox.20nm,matchingtheporediameteroftheAAOpore.Ontheotherhand,theanodizationof0.2mAlonTi/ITOinoxalicandphosphoricacidfailed,contrarytothepriorworkofFoongetal. 12 Interestingly,differentanodizationresultsareobtainedwhenthickerAllmsof2.2mareusedwithTiinterlayers.AsshowninTable 2.3 ,anodizationfailsagaininphosphoricacid;however,bothoxalicandsulfuricacidhavereversedoutcomeswhencomparedtothinnerAllms.ThesethickerAllayersnowresultinfailureforsulfuricacidwhileanodizationinoxalicacidisnowsuccessful.TheFESEMimageinFigure 2-1 bisaside-viewimageoftheAAOlmobtainedfortheanodizationof2.2mAlonTi/ITOinoxalicacid.ThisimageclearlyshowsthehighdegreeofadhesionbetweentheAAOandthesubstrate,yieldingadensearrayof45nmdiameterporesdirectlyfabricatedontheITOsubstrate.Interestingly,thisporediameterismuchlowerthanexpectedforthesameanodizationconditionsconductedwithonlyanaluminumfoil.ThearrowinFigure 2-1 bpointstothebarrierlayeratthebottomoftheAAOporeandisaboutthesamethicknessastheporediameter.ItisalsoimportanttonotethattheporesarecontinuousandthattherearenovoidsintheAAOpores,asobservedinthethickerAAO 30

PAGE 31

Figure2-1. Side-viewFESEMimagesof(a)0.2mAl/10nmTi/ITOanodizedinsulfuricacid,(b)2.2mAl/10nmTi/ITOanodizedinoxalicacidand(c)2.2mAl/10nmCr/ITOanodizedinphosphoricacid.Thearrowspointingtothebarrierlayershowthatthebarrierlayerthicknessisonthesameorderastherespectiveporediameter.(d)Theopticalimageshowsthatadhesionismaintainedovertheentiresubstrate.Thetransmittanceofeachlm(e)showsthatthesubstratesretainahighdegreeoftransparencyforlms1,2and3correspondingtotheFESEMimagesin(a),(b)and(c),respectively.(f)FESEMimageafterporewideningshowsthattheAAOlmhasahighdensityofpores. 31

PAGE 32

lmsfabricatedpreviously. 11 Thecontinuityoftheporescanbeattributedtotheuseofsingle-stepratherthanmulti-stepdepositionofaluminum.InafurtherattempttobroadentherangeofporediametersandlengthsobtainedforAAOlmsonITO,anodizationexperimentswerealsoconductedfor10nmCrinterlayersineachacidsolution.AsshowninTable 2.3 ,theanodizationwassuccessfulinphosphoricacidforboth0.2and2.2maluminumlms.TheFESEMimagesinFigure 2-1 cshowthe2.2maluminumlmsanodizedinphosphoricacid.ThebarrierlayerfortheseAAOlmsisalsoonthesameorderofthicknessasthediameterofthepore.Theside-viewimageshowsthatthisanodizationalsomaintainedahighdegreeofadherencetotheCr/ITOsubstrate,yieldingadirectlyfabricatedAAOlmwithadensearrayof145nmdiameterpores.Again,theporediameterissmallerthanexpectedfortheequivalentanodizationofaluminumlmsandtheporesarecontinuous.TheimageoftheAAO/interlayer/ITOsubstrateinFigure 2-1 dshowsthatthickAAOlmsonITOmaintainhightransmittanceandthatadhesionisuniformovertheentiresubstratewithfewdefects.Theopticaltransmittance(%T)spectraforlmsanodizedindifferentacidsolutionsareshowninFigure 2-1 e.Thespectrashowoscillationsthathaveaspecicfrequency,whichareduetointerferencepatternsfromtheorderedAAOstructure. 45 AAOlmsanodizedinsulfuric,oxalic,andphosphoricacidhaveapproximatetransmittancevaluesof75,70,and65%at900nm,respectively.Asexpected,thinnerAAOlms(sulfuricacid,curve1)havehighertransmittancethanthethickerAAOlms.ThetransmittanceforthethinAAOremainsrelativelyconstantatallwavelengths;however,thetransmittanceforthickerAAOlmstendstodecreaseintransmittanceatlowerwavelengths.Theanodizationconditionsalsocontroltheporediameter(seeTable 2.3 ).Therefore,thesedecreasescouldbeduetophotonscatteringfromtheAAO,whichwouldbedependentontheporediameterandperiodicity.Indeed,largerporediametersshowmoresignicantdecreasesintransmittanceatlowerwavelengths. 32

PAGE 33

Afterbarrierlayerremovalandporewidening,thetopsoftheporesareobservedmoreclearly.Asshowninthetop-downSEMimageinFigure 2-1 f,theporesinthesethickerAAOhavehighdensity.Theporesdonotexhibituniformdiametersorspacing;however,thismaypossiblybeimprovedwithsurfacemodicationpriortoanodization 16 17 46 ortwo-stepanodization. 46 SuccessfullyanodizedAAOsubstrateswereplacedin25wt%phosphoricacidfor2htocompletelyremovetheoxidelmandtesttheresistanceofthesubstrate.Regardlessoftheconditionsofanodization,therewasonlyasmallincreaseinsubstratesheetresistanceto9/cm2fromtheoriginalsheetresistanceof5/cm2oftheITO.NanowirearraysarereadilyfabricatedwithintheAAOontheseconductivesubstrateswithnokinksoraxialdefectsthatwouldbeobservedwithmulti-stepaluminumdepositionandsubsequentanodization.Todemonstratethis,goldwaselectrochemicallydepositedintotheAAO/ITO/glasssubstratetoformagoldnanowirearray.Figure 2-2 isanFESEMimageofthegoldnanowirearrayobtainedafterapplyingasimplemethodtopreventnanowirearrayaggregationduringtemplateremoval. 44 AscanbeseeninFigure 2-2 ,thegoldnanowiresarehighlyuniformandfreeofdefectsalongtheirlength. 2.4Discussion 2.4.1Time-resolvedCurrentResponseDuringAnodizationofAluminumonITO.Thetime-resolvedcurrentresponseoftheelectrochemicalcellprovidesdetailedinformationconcerningtheprocessesthatareoccurringwithinthealuminumlmduringanodization.Oncethechangesinthecurrentoutputarecorrelatedtotheprocessesoccurringduringanodization,time-resolvedcurrentdatacanserveasanactivelitmustestindicatingwhethertheanodizationisproceedingsuccessfully.AlthoughthemechanismofAAOporeformationonsubstrateswaspreviouslyoutlinedbyChuetal., 11 itismoreclearlydepictedinthetime-resolvedcurrentresponsewheninterlayersareusedtomaintainadhesiontotheITOsubstrate,asshowninFigure 33

PAGE 34

Figure2-2. Side-viewFESEMimageofagoldnanowirearraygrownfromdirectanodizationof2.2mAlon10nmCr/ITO/glasssubstrates,yielding200nmx3mgoldnanowires.Notethatwiththesinglealuminumlmdepositioninsteadofmultipledepositionsthatthenanowiresfabricateddonothavekinksandareuniform.ThelackofaggregationofthenanowirearrayisdiscussedinChapter3. Figure2-3. Atypicalchronoamperometricresponseofathickaluminum/interlayerlmonITO(shownherefor2.2mAl/10nmCr/ITOinphosphoricacid).Thisresponsedepictstheoverallmechanismthatoccursduringanodization:(I)currentdropduetooxidegrowthandincreasingsubstrateresistancetochargetransfer;(II)poreinitiationresultinginadramaticincreaseinlmsurfacearea;(III)uniformporegrowth;and(IV)currentdecreaseduetoincreasedresistivityfromdepletionofAlbetweenthesubstrateandelectrolyte.Notethatdrawingsarenottoscale. 34

PAGE 35

2-3 .TheshapeofthecurrentoutputshowsfourdistinctprocessesoccurringduringtheanodizationofthealuminumlmonITO.TherstthreeprocessesaresimilartothoseobservedforanodizationofAlfoils.Theinitialdropincurrentdensityisduetoanegativecurrentdriftassociatedwiththelinearvoltageramptotheset-pointvoltageandisnotoneoftheseprocesses.InStageI,aplanarsurfaceoxideformsonthealuminumlm.Theresistanceoftheelectrodeincreasesasthesurfaceoxidelayercontinuestogrow,causingadramaticdecreaseinthecurrentdensity.Thissurfaceoxidelayercanpreventfurtherelectrochemicaloxidationofthealuminum;however,alargeinterfacialelectriceldforcesthesurfacemorphologytochangefromaplanarlmtoadimpledarray,whichistheonsetofStageII. 19 Thischangeinsurfacemorphologyallowsthesurfaceoxidethicknessatthebottomoftheporestoremainrelativelyconstantsothediffusionofaluminumandoxygenthroughtheoxidelayercanstillbedrivenbytheelectriceld,allowingtheelectrochemicaloxidationofaluminumtocontinue.Oncethedimplesforminthesurfacelayer,theelectrochemicalreactionpreferentiallyoccursatthesesites.Asthesedimplescontinuetoboreintothealuminumandgrowintoafullyformedpore(StageII),theactivesurfaceareaincreasessubstantially.ThisdramaticincreaseinelectrodesurfaceareagivesrisetotheincreaseincurrentdensityshowninFigure 2-3 sincethecurrentdensityisrelativetotheinitialplanarelectrodesurfacearea.Shortlyafterporeinitiation,thecontinuedgrowthoftheporesdoesnotcauseanyincreaseinactiveelectrodesurfacearea(StageIII).Duringthisstage,theporesboretowardthesubstrateandthecurrentremainsconstantbecausethereisnochangetoelectrodesurfacearea.Finally,asanodizationnearscompletion(StageIV),thecurrentfallsoffrapidly.Thisdropisduetothediminishingamountofaluminumremaininginthelmasitisthinned,whichincreasesthesheetresistance.Theremainingaluminumisoxidized,leavingbehindabarrierlayer.Atthispoint,lmarcingandgasevolutioncanoccur,asobservedbyChuetal. 11 Intheabsenceofaninterlayer,thisarcingcanbeobservedinStageIII,causingseveredamagetotheoverall 35

PAGE 36

lmbytheendofStageIV.However,thepresenceofaninterlayerdelaysthearcingandgasevolutionuntiltheendofStageIVorbeyond.Thus,thisdetrimentalbehaviorismoreeasilyavertedbymonitoringthecurrentoutputandstoppingtheprocessbeforethecurrentbeginstoincreaseattheendofStageIV.Whensuccessfulanodizationoccurs,thecharacteristicfeaturesdepictedinFigure 2-3 areindependentoftheanodizationacidsolution,appliedvoltage,interlayermaterial,andaluminumlmthickness.Thesetime-resolvedcurrentfeaturesareobservedinallsuccessfulanodizationscenariosbecauseitinvolvesprocessesoccurringwithinthealuminumoxide/aluminumlm.Deviationstotheanodizationacidsolution,appliedvoltage,andaluminumlmthicknessonlyaltertheoverallanodizationtimeandmagnitudeofthecurrentdensity.Forexample,Figure 2-4 adepictsthetime-resolvedcurrentresponseofthesuccessfulanodizationof2.2maluminumlmsinoxalicandphosphoricacidwithtitaniumandchromiuminterlayers,respectively.Thesetime-resolvedcurrentresponsesarequalitativelyequivalent,indicatingthattheoverallmechanismforAAOformationonITOinthepresenceofaninterlayerisindependentoftheinterlayercomposition,anodizationvoltage,andacidsolution.Whilethequalitativefeaturesofthetime-resolvedcurrentresponsearesimilar,therateofcurrentchangesislikelyindicativeoftheuniformityinporeinitiationandgrowthacrosstheentiresubstrate.ThechangesincurrentdensityinFigure 2-4 aassociatedwithstageIIsurfacereconstructionandstageIVbarrierlayerformation(seeFigure 2-3 )havedifferentslopesfordifferentanodizationconditions.TheAAOformedinoxalicacidhassharptransitionsbetweeneachstagewhiletheAAOformedinphosphoricacidshowsgradualtransitionsbetweeneachstageintheporeformationprocess.Thefastrateofporeformation(largepositiveslopeinStageII)inoxalicacidindicatesthatallporesformatapproximatelythesametimeandatthesamerate.Sincetheporesallstartatthesametimeandgrowatthesamerate,theanodizationprocessalsoreachesthesubstrateatthesametime,resultinginasharpdecreaseincurrentdensity.The 36

PAGE 37

Figure2-4. Thechronoamperometricresponseforanodizationof(a)2.2mAloneither10nmCrorTiinterlayersinphosphoricoroxalicacid,respectively.Thegeneraltrendisindependentofinterlayercompositionandanodizationconditions,indicatingthattheresponseisprimarilyduetointernalaluminumlm/poregrowthprocesses.(b)0.2mand2.2mAlon10nmTiinterlayersanodizedinsulfuricoroxalicacid,respectively.Theseresultsshowhowstages(II)and(IV),depictedinFigure 2-2 ,canoverlapandcanceloneanotherouttoobtainresultssimilartoFoonget.al. 12 gradualtransitionsassociatedwithanodizationinphosphoricacidindicatethatnotallporesarereachingthesubstrateatthesametime.Thesedifferencescouldbeimportantinmaintainingadhesionsincelmarcinganddelaminationcanstarttooccuroncetheanodizationprocessreachesthesubstratelocally.Theprimarydifferencesinthetime-resolvedcurrentresponsesobservedinFigures 2-3 and 2-4 afrompriorwork 11 12 26 isintheporeinitiationanduniformporegrowthstage.Chuetal. 11 observedtwopeaksincurrentatthemidpointofStageIII 37

PAGE 38

inaluminumlmswithoutaninterlayer.Thesefeaturesarelikelyrelatedtothelateraldefectsintheporescausedbythetwo-stepAldeposition.Inthisstudy,acontinualincreaseincurrentisobservedshortlyaftertheanodizationprocessbeginswhenthickeraluminumlmsareRF-sputteredinasinglestepwithoutaninterlayer.Thiscontinualincreaseincurrentislikelythecauseorresultoflmdelamination,exposingbothsidesofthedepositedaluminumlmaswellasadditionalcurrentfromcontinuallmdelamination.Foongetal. 12 didnotobserveacleartime-resolvedcurrentresponseassociatedwithporeinitiationandgrowth(StagesIIandIII)likelybecausethealuminumlmsbeinganodizedwereonly0.2mthick.Thus,theincreaseincurrentfromporeinitiationanddecreaseincurrentduetobarrierlayerformationessentiallycanceloneanother,keepingthecurrentfromrising.Figure 2-4 bdepictsthisbehaviorwhenthetime-resolvedcurrentresponseofthe0.2and2.2mlmsarecompared.Ascanbeseenforthe0.2minFigure 2-4 b,stagesIIandIVoverlapandthegalvanostaticregionthatisobservedforthethickerlmisnotpresent. 2.4.2AvoidingFailureDuringAnodization.Itwasobservedinthisstudythatminordeviationscreatedifcultiesinrepeatingsomeofthepriorworkintheeld,whichhighlightstheimportanceofITOsurfacetreatmentinthedirectfabricationofAAO.Asdescribedbelow,differentdepositionmethods(sputteringvs.ebeam),aluminumthickness,orsurfacetreatmentspriortoAllmdepositiongivedifferentresults.Whilesputteredaluminumlmsmayprovideenhancedadhesionduetothehighenergyimpactofthelmdepositionprocess, 12 thelowdepositionrategivesrisetosignicantsubstrateheatingthatmaycauseoxideformationwhendepositingmorethan1.1mofaluminum.Althoughnotexplicitlystated,thismaybethereasonthatprioraluminumlmspreparedonITObysputteringweredepositedin1msteps. 11 26 42 47 Indeed,the5mAllmshowninFigure 2-5 aiswhite,indicatingthatahighdegree 38

PAGE 39

ofoxidationhasoccurredduringthesputterdepositionprocess.Ontheotherhand,the500nmAllmshowninFigure 2-5 bishighlyreective,indicatingthatverylittlealuminumoxideispresent.Severaldifferentthicknessesofaluminumweresputteredandshowedthatlmthicknessesgreaterthan1.1mnolongerappearpristineorreective.ThisissupportedbytheFESEMimageinFigure 2-5 cofasputtered,1.1maluminumlmshowinggrainsofaluminum,aluminumoxideandpossiblymixedaluminum/aluminumoxidegrains.ThepresenceofaluminumandaluminumoxideinthelmwasalsoconrmedwithXPS. Figure2-5. Sputteredaluminumlmsdepositedcontinuouslyuptothicknessesof(a)5mand(b)0.5m.The5mlmshowsthatasignicantamountofoxidationhasoccurredasaresultofthesputterdeposition,whichisnotpresentwiththethinner0.5,mlm.FESEMimaging(c)showsatlmthicknessesgreaterthan1.1mthataluminumoxidegrainsaredispersedthroughoutthelm,whichhindersanodization.However,theside-viewFESEMimagein(d)showsthatsurfaceoxidation(30min,450C)ofebeamdepositedAllmscanbesuccessfullyanodized. Anodizationofsputteredaluminumlmsthickerthan1.1mbegantoshowdelaminationproblems.Atthicknessesgreaterthan1.5m,anodizationwasunsuccessful.Giventhataluminumoxidebegantoformwhenlmthicknessexceeded1.1m,itisbelievedthatanodizationfailureforsputteredlmsisaresultofrandommechanical 39

PAGE 40

stressesimposedbythealuminumoxidegrainsdispersedwithinthebulkofthelm(seeFigure 2-5 c).Tosupportthisconclusion,pristineebeamevaporated2.2mAlonCrlmswerethermallyoxidizedtoproduceathickaluminumoxidelmonthesurfacebeforeanodization.ThesesubstratesappearedwhitefromaluminumoxideandweresimilarinappearancetothoseinFigure 2-5 a.However,Figure 2-5 dshowsthatthesesubstratesweresuccessfullyanodizedinphosphoricacidfollowingthethermalgrowthofathicksurfacealuminumoxidefor30minat450C.Thus,thicksurfaceoxidesdonotpreventAAOformation,indicatingthattheanodizationfailureobservedforsputteredaluminumlmsisduetoaluminumoxidegrainsdispersedwithinthebulklm.Whiletherequirementoflmhomogeneitycouldhavebeenanticipated,thesensitivityofanodizationtothethicknessoftheAllmwasunexpected.Thesechangestoanodizationwiththicknessmaybeduetochangesintheadditionalelectrochemicalresistance(i.e.,potentialdrop)alongthelengthofthepore.Thiselectrochemicalresistanceincreaseswitheitherdecreasingporediameterorincreasingporelength.Anodizationinsulfuricacidyieldsverysmallpores,resultinginlargepotentialdrops.Thelargepotentialdropcouldpossiblyslowelectrochemicaldiffusion/reaction,resultinginchargebuildup.ThiseffectwouldnotbeproblematicforAlfoilsbutcouldleadtoelectricaldischarge(pre-poreformationfailure)wheninterlayersareused.Similarly,changesinelectrochemicalresistancemayalsoexplainthedifferentbehaviorobservedduringanodizationinoxalicacid.Inthiscase,largerporesareformedinoxalicacidthansulfuricacid.AtthesameAlthickness,oxalicacidwouldhavelessresistance.Therefore,attheendofporeformation,thereisagreaterdrivingforceforelectrochemicaldiffusion/reactioninoxalicacid.Thisincreaseddrivingforcecancausearcingandgasevolution(post-poreformationfailure).Increasingthethicknessofthealuminumreducesthedrivingforceattheendofporeformation,minimizingthepotentialdamagefromtheseeffects.Theseresultssuggestthattheremaybethicknessregimes 40

PAGE 41

forsuccessfulanodizationorthattheelectrochemicalreactionsneedtobecarefullycontrolled.Finally,theinabilitytoreproducealloftheworkofFoonget.al.for0.2mAllmsmaybeduetothedifferenceinITOdegreasingandsurfacetreatments. 12 ThedegreasingprocedureusedherewasbenignincomparisontotheplasmasurfacetreatmentusedbyFoonget.al.Thishighenergycleaningmethodmaybewhyadhesionwithtitaniuminterlayerscouldbemaintainedinallthreeanodizationacidsolutions. 2.5ConclusionThisstudydemonstratesthedependenceofinterlayercompositionandthethicknessofthealuminumlayerontheadhesionofAAOdirectlyfabricatedonITO/glasssubstrates.Chromiuminterlayersprovideexcellentadhesionduringanodizationinphosphoricacidsolutionsbutfailinoxalicandsulfuricacid.Ontheotherhand,titaniuminterlayersfailduringanodizationinphosphoricacidandsucceedineitheroxalicorphosphoricacid.However,theseanodizationprocessesarenotonlydependentontheacidsolutionbutalsothethicknessofthealuminum.Forexample,anodizationof0.2mAllmsinoxalicacidfailwhilethickerAllmsaresuccessful.Despitethesedifculties,longerporeshavebeenformedonITOwithoutdelaminationofAAO.Thehighestaspectratioofporeswasobtainedwhenanodizedinoxalicacid.Thedifferencesbetweenthisstudyandpriorworkcouldalsohighlighttheimportanceofsurfacetreatment/cleaninginthisprocess.TheadhesionofAAOonITOappearstobeextremelysensitivetothesurfacetreatmentoftheITO,regardlessoftheadhesionlayerused. 41

PAGE 42

CHAPTER3ELIMINATINGCAPILLARYCOALESCENCEOFNANOWIREARRAYSWITHAPPLIEDELECTRICFIELDS 3.1IntroductionElasto-capillarycoalescenceofhighaspectratiostructuresisaphenomenonthathaslongexistedinnatureandarticialsystems. 48 49 Chandraet.al.studiedthisaggregationphenomenaforhydrogelmicropillarsandfoundthatthepillarsclusteredinpredictablysizedaggregates. 50 Additionally,Pokroyet.al.foundthereisacriticalnanowirelengththatcausesepoxynanopillararraystoundergoirreversibleaggregationduetotheshort-rangevanderWaalsforces. 50 Bytuningthenanopillardimensionsandseparationdistances,theywereabletoobtaincomplexandhighlyperiodicchiralaggregates,whichhavepotentialapplicationsinstoringelasticenergy,enhancingadhesion,orcapturingandreleasingparticles. 50 Whiletheaggregationofhighaspectratiostructurescanbeadvantageous,thisphenomenonisgenerallyundesirable, 7 especiallyinthefabricationofverticallyorientednanowiresonasubstratewithhighdensity. 26 27 30 32 51 54 Forexample,whennanowiresaredepositedinporoustemplates,suchasanodicaluminumoxide(AAO) 26 27 30 orself-assembledblockcopolymers, 55 thetemplatemustoftenberemovedwithaliquidetchanttoobtainafreestandingnanowirearray. 26 28 30 55 56 Whenthearrayiscomposedofsufcientlyhighdensityandhighaspectrationanowires,thesurfacetensionbetweentheresidualuidlmandnanowiresleadstoaggregation.Thedynamicsofnanowireaggregationinducedbysurfacetensionisquitecomplex.Thisprocessinvolvesmanyfactors,includingtheperiodicity,dimensions,separationdistance,andtensilestrengthofthenanowire,aswellastheevaporationrateandthesurfacetensionoftheuid.Thetendencyforthenanowirestoaggregateduringdryingisonlysufcientlyminimizedinthespecialcaseswherenouid-solidmeniscusispresent,uidswithzerosurfacetension,ortheobviouscasewherethenanowireisstiffenoughtoovercometheforces. 29 50 Currently,supercriticaluiddrying(nearzero 42

PAGE 43

surfacetensionuid)istheonlymethodthatcaninhibittheaggregationofnanowiresbysurfacetension. 29 Eventhoughdryingnanowirearraysinsupercriticaluidsisaneffectivewaytopreventaggregation,theprocessreliesonhigh-pressurevessels,isrestrictedtobatch-typeprocesseswithlimitedthroughput,andisenergy-intensive.Inthispaper,electriceldsareusedtominimizetheaggregationofgoldnanowirearraysduringdrying.GoldiselectrochemicallydepositedinAAOtemplates,yieldingarraysofnanowireswithhighsurfaceenergy 57 andlowtensilestrength.Thevoltagebiasbetweenthenanowire-andcounter-electrodebuildsacapacitancelayeroneachnanowire,providingCoulombicrepulsionwhiledrying.Thesurfacechargealsoaltersthesurfacetensionoftheuid,asdescribedbytheLippmannEquation. 58 59 Thenanowireswerefabricateddirectlyontin-dopedindiumoxide(ITO)substrates 60 sothatlighttransmissionthroughthenanowirearraycoulddetectaggregationduringthedryingprocess.Experimentalmeasurementsandtheoreticalcalculationsshowthatsmallelectriceldscompensatefortheaggregationforceduetosurfacetension,providingasimple,scalableandeconomicalmethodtoprepareanon-aggregatedarrayofhigh-densitynanowires. 3.2Experimental 3.2.1TemplateFabrication.Porousanodicaluminumoxide(AAO)templateswerefabricatedontransparentconductivesubstrates,composedoftin-dopedindiumoxide(ITO)onglass,asdescribedinChapter2. 60 Briey,theITOonglasswasobtainedprecutfromThinFilmDevices,Inc.withalmthicknessof45015nmandasheetresistance<5/cm2.Layersofchromiumandaluminum(10nmand2.2m)weredepositedatratesof0.1nm/sand20nm/s,respectively,usingacustomelectron-beamevaporationchamberoperatingatapressureof5x10)]TJ /F3 7.97 Tf 6.58 0 Td[(6torr.Followinglmdeposition,aluminumanodizationwascarriedoutatconstantvoltagebyincreasingthepotentialatarateof100V/mintoanalvoltageof130VusingaLambdaGen300-5powersupplyandacustomLabview 43

PAGE 44

controlprogram.Aftercompleteanodization,thealuminabarrierlayerwasetchedwith5wt%phosphoricacidfor330stoexposetheporebottomstotheunderlyingITOsubstrate. 3.2.2ElectrochemicalNanowireSynthesis.Goldnanowiresweresynthesizedbyelectrochemicallydepositinggoldfromsolution(Technigold25ES,TechnicInc.)ontotheexposedITOlayerwithintheporesoftheAAOtemplate.Thesolutionwasheldat60oCanddepositionwasperformedpotentiostatically(VersastatV3,PrincetonAppliedResearch)againstacarboncounter-electrodeat0.5Vversusasaturatedcalomelelectrode.Thedepositioncurrentwasmonitoredcloselysothatgolddepositionwasceasedoncethecurrentbegantorisedramatically,resultingincompletelylledAAOtemplatepores. 43 Theaveragediameterandlengthofthenanowireswas165nmand2.8m,respectively,andtheaveragespacingbetweennanowireswas150nm.Immediatelyafterdeposition,thetemplatedgoldnanowireswererinsedwithde-ionizedwaterandthenplacedin25wt%phosphoricacidfor1-2htofacilitatetheselectiveremovalofthealuminatemplate.Thefreestandingarrayofverticalgoldnanowireswereremovedfromtheacidsolution,rinsedbyimmersioninde-ionizedwaterandsubsequentlyplacedinfreshde-ionizedwaterforstorage.Thenanowirearrayswerestoredinde-ionizedwatertopreventnanowireaggregationuntilfurtheranalysiswasperformed. 3.2.3NanowireElectrostaticRepulsion.Double-sidedtapewasusedtoattachthenanowirearraysubstratetoacustom-builtviewcelllledwithde-ionizedwater,asdepictedinFigure 3-1 .Thearraywasquicklytransferredtotheviewcelltominimizetheexposuretimetoairbeforeanalysis;typically,ittooklessthan10stotransferthearray.Thisapparatuswasthenmountedinsideaspectrophotometer(Perkin-ElmerLambda9UV/VIS/NIR)forspectralanalysisduringlmdrying.Oppositeofthenanowirearray,ablankITOsubstratewaspositionedat 44

PAGE 45

variableworkingdistanceswiththeconductivesidefacingthenanowiresurface,asshowninFigure 3-1 .ElectrodeswereconnectedtoboththeblankITOandthenanowirearraysubstrateandarangeofvoltages(0to10V)wereappliedwithanInstekPSH2018powersupply.Avoltagebiaswasappliedjustaftertheuidwasdrainedfromtheviewcell(within5s).Lighttransmittancedatawascollectedatawavelengthof550nmoncetheuidstarteddraininguntilthesubstratewascompletelydry.Theextentofnanowireaggregationwasalsoconrmedbyeldemissionscanningelectronmicroscopy(JEOLJSM-6335F). Figure3-1. Custom-madeviewcellformonitoringthechangeintransmittedlightthroughthegoldnanowirearraysduetonanowireaggregation.ThetransparentandconductiveITOsubstratepositionedoppositeofthenanowiresubstrateenablesavariableelectriceldbyeitherchangingtheworkingdistance(D)oradjustingtheappliedbias(V)betweentheITOandgoldsubstrates.Adrainholeremovesthewaterandstartsthenanowiredryingprocess.Theviewcellismountedonarotationalstagetoensuretheincidentlightisparalleltonanowireorientation,maximizingtheinitiallighttransmittance.Thelightinteractingwiththenanowirearraycaneither(a)passthroughthesubstrate,(b)scatteroffofthenanowires,(c)reectofthesubstrate,orbeabsorbedbythegold,ITO,glassandwater(notshown). 45

PAGE 46

3.3Theory 3.3.1AggregationDuetoSurfaceTension.Theaggregationofnanowirearraysduetosurfacetensionarisesfromperturbationsinthedryingprocessandinhomogeneitiesinnanowiresizesandspacing.Dependingonthecontactangleofthemeniscusbetweentwonanowires,eitherarepulsiveoranattractiveforcecanbeexertedbetweenthem.Ifthisforceoverwhelmsthestiffnessofthenanowire,thenthenanowirewillbendtowardstheothersurroundingnanowires.ThisbendingforcecanplasticallydeformthenanowireiftheforceisgreaterthanthetensilestrengthofthematerialorpushthenanowirescloseenoughthatsurfaceenergiesorshortrangevanderWaalsinteractionskeepthemincontact. 29 34 Neglectingtheshort-rangevanderWaalsattractiveforcesbetweenthenanowires,Figure 3-2 showsthataforcebalancedescribestherelationbetweentheopposingforcesfromsurfacetension,Fst,theelasticbendingforceofthenanowire,Felas,andanyelectrostaticrepulsion,Fesr,fromchargebuilduponthenanowires: XF=Fst)]TJ /F11 11.955 Tf 11.95 0 Td[(Felas)]TJ /F11 11.955 Tf 11.95 0 Td[(Fesr(3)Ifthesumoftheforcesispositive,thenthenanowirebendsuntiltheforcesbalance,resultinginirreversiblenanowireaggregation.Theforceexertedbetweentwonanowiresbysurfacetensionisrelatedtotheliquid-airsurfacetension,la,by 61 62 Fst=2laR2cos2()1 p d(4R+d)(3)whereRisthenanowireradius,distheseparationdistancebetweennanowires,andisthemeniscuscontactangle(atzeroappliedeld=o=46degrees).Themaximumbendingtorqueoccurswhenthemeniscusisatthetopofthenanowireorthebeginningofthedryingprocess.Theforcerequiredtobendthe 46

PAGE 47

Figure3-2. Schematicrepresentationofthefundamentalforcesactingonapairofwettednanowiresinthepresenceofanelectriceld.Ameniscusformswhentheuidlmdriesbelowthetipsofthenanowires.Atthispoint,theforceduetothesurfacetension(Fst)mustbecounterbalancedbytheelasticforceofthebentnanowire(Felas)andtheelectrostaticrepulsiveforce(Fesr).Theelectrostaticforceisduetothesurfacechargeonthenanowiresfromtheelectriceld,whichisdependentontheeldstrength(V=D)andthedielectricconstantofair("air).Theelectrostaticrepulsiveforceincreasesasthenanowiresapproacheachother,providingenoughforcetoeliminateaggregationundertheproperconditions. nanowireis Felas=3ER4 4L3(3)whereE,LandareYoungsmodulus,nanowirelengthandbendingdisplacement,respectively.Eqns. 3 3 canbeusedtoestimatetheattractiveorrepulsiveforcesonthenanowires.Intheabsenceofsurfacecharge,i.e.,Fesr=0,andassumingYoungsmodulusof78GPa,thegoldnanowiresfabricatedinthisstudywillhaveanaggregationforceofapproximately1.3x10)]TJ /F3 7.97 Tf 6.58 0 Td[(8N/nmofdeection.Therefore,thenanowire-nanowire 47

PAGE 48

repulsiveforceduetosurfacechargingmustbeontheorderofatleast10)]TJ /F3 7.97 Tf 6.59 0 Td[(8Ntoovercometheaggregationforcefromthesurfacetensionoftheuid. 3.3.2ElectrostaticRepulsion.Fortwoatplateelectrodesseparatedbyadistance,D,inamaterialwithrelativepermittivity,"r,andanappliedbias,V,betweenthetwoelectrodes(seeFigure 3-2 ),thecapacitance,C,presentoneachelectrodeisgivenbythefollowingtwoequations: C=Q V(3) and C="o"airAfp D(3)whereAfpistheareaoftheatplateelectrode,"oisthepermittivityofvacuum,andQisthetotalchargeontheelectrode.Thecapacitancehasbeencalculatedtoincreasesubstantiallywithincreasingsurfaceroughnessofoneelectrode 63 ,however,giventhelargeseparationdistancesusedinthisstudy(relativetotheroughnessamplitude),thisincreaseincapacitanceisneglectedandasimpleatplatemodelofcapacitanceisused.CombiningEqns.( 3 )and( 3 )yieldstherelationbetweenthetotalelectriceld,=V=D,andthetotalchargedensity: Q Afp="o"airV D(3)Additionally,theCoulombicforcebetweentwodiscretepointchargesofmagnitude,q,andequalsignisgivenby: FCoul=q2 4"o"rjrj2(3)whereristheseparationdistancebetweenthetwopointsandqcanbeapproximatedasq=Q AfpA,providedthechargesareinnitelysmall.Inwritingtheexpressionfor,isthesurfaceareaofasphericaltipattheendofthenanowireanditisassumedthatthechargecollectsatthesesphericaltips.Therefore,thetotalelectrostaticrepulsiveforce 48

PAGE 49

betweentwonanowiresincloseproximitytooneanotherbecomes Fesr=4"o"airR2 d)]TJ /F6 11.955 Tf 11.95 0 Td[(22V D2(3)AsseenbyEqn.( 3 ),theelectrostaticrepulsiveforcebecomessignicantasthenanowiresdeecttowardseachother. 3.3.3SurfaceTensionReduction.Atconstantelectrochemicalpotentialandtemperature,theLippmannEquationdescribesthechangesinliquid-solidsurfacetensionwithrespecttochangingelectriceld,i.e.,theliquid-solidsurfacetensionchangesaschargebuildsuponthenanowiresurface, 58 59 whichuponutilizingEqn.( 3 )becomes @ls @V=)]TJ /F11 11.955 Tf 10.49 8.09 Td[(Q A=)]TJ /F5 11.955 Tf 9.3 0 Td[("o"airV D(3)IntegratingEqn.( 3 anduseoftheYoung-DupreEquationyields 64 cos()=cos(o)+"o"air 2laV2 D(3)whichshowsthatthecontactangle,,changeswiththesquareoftheappliedvoltage.TheadjustedcontactanglefromEqn.( 3 )isinsertedintoEqn.( 3 )toyieldamorecompleteexpressionfortheforceduetosurfacetension,showingthatFstscaleswithV4andR. 3.3.4CalculatedChangestoAggregationBehavior.Despitethefactthattheforcesmodeledherefortwonanowiresdonotincludethenetworkofmulti-bodyinteractionsfoundinactualnanowirearrays,themodelillustratesthefundamentalprocessandprovidesaguidelineforpreventingaggregation,asshowninFigure 3-3 .Figure 3-3 aoutlinesthedependenceofnanowirelengthonthecalculatedforcesinvolvedinthistwo-bodymodel.AsseeninEqn.( 3 ),theforceduetosurfacetension,Fst,istheonlyattractiveforce.ForagivenR,thisforceisconstantatanylength,L.Intheabsenceofanelectriceld,theonlyforcecounteringFstistheelastic 49

PAGE 50

bendingforce,Felas.TheintersectionofthesetwocurvesinFigure 3-3 adenesthecriticalnanowirelength,Lc,wheretheseforcesbalance.NanowirelengthsshorterthanLchavesufcientelasticenergytoresistaggregationwhilethoselongerthanLcwillaggregate.Theapplicationofasmallelectriceld,o,providesadditionalelectrostaticrepulsiveforces,Fesr,resultinginanewLc(o),asseeninFigure 3-3 a;however,thissmalleldhasaminorinuenceontheaggregationbehavior.Higherelectricelds,,providesubstantialFesr,raisingthesummedrepulsiveforceshigherthanFst.Atthiseldstrength,nanowiresofanylengthareforcedapart,eliminatingaggregationbehaviorduetosurfacetension.AlthoughtheeldaltersFst()throughtheLippmannEquation,theeffectisminimal(notshown).TheintersectingpointsbetweenthecurvesforFstandFelas+FesrinFigure 3-3 acanbeplottedforarangeofnanowirediametersandspacingtounderstandtheoveralleffectofanappliedelectriceldonaggregationbehavior,asshowninFigures 3-3 band 3-3 c.Withoutanelectriceld,themaximumlengthbeforethenanowiresaggregateincreasesalmostlinearlyasthenanowireradiusbecomeslarger,asshowninFigure 3-3 bforconstantratioofnanowirespacingtoradius.Thisreductioninaggregationbehaviorisbecauseoftheincreasedelasticbendingforceassociatedwithstiffernanowires,whichdominatesovertheminorchangesinzofromincreasednanowireradius.Theapplicationofanelectriceldprovidesadditionalrepulsiveinteractions,indicatingthatawiderrangeofnanowirelengthswillresistaggregation.Theeffectisminimalatsmallradiibutbecomesmoresubstantialatlargerradii.Figure3cdescribesthepointwheretheFstandFelas+FesrcurvesinFigure 3-3 anolongerintersect.Thispointdenesthecriticalelectriceldwherenanowiresofanylengthwillnotaggregate.Smallelectriceldsarerequiredtopreventaggregationfornanowireswithlargeradii;however,therequiredelectriceldincreaseswithR1=2.Thisstrongdependencyonnanowireradiushighlightsthestrongforcesassociatedwithsurfacetensioninnanostructures. 50

PAGE 51

Figure3-3. Calculatedchangesinaggregationbehaviorbasedontheforcesactingontwonanowires.(a)Thedependenceofthesurfacetensionforce(Fst),elasticbendingforce(Felas),andtheoverallrepulsiveforce(Felas+Fesr)asafunctionofnanowirelengthandelectriceldstrength.Thedottedlinesaretheforcesatverylowappliedelectriceldandthesolidlinesrepresenttheforcesathigherelectricelds,excludingthebendingforce,whichisindependentofappliedeld.Theintersectionoftherepulsiveforcecurves(eitherFelasorFelas+Fesr)withFstdesignatesthecriticallength,Lc,wheretheforcesbalanceandachangeinaggregationbehavioroccurs,i.e.,maximumlengthbeforeaggregation.Nanowirelengthslongerthanthispointwillaggregate.(b)Themaximumlengthbeforeaggregation,Lc,asafunctionofnanowireradiusataspacingofd=2R.(c)Thecriticalelectriceldrequiredtopreventaggregationofnanowiresofanylengthasafunctionofnanowireradius.ElectriceldsbelowthecurvesrequirenanowirelengthsshorterthanLctopreventaggregation. 51

PAGE 52

Thesecalculationsshowthatanappliedvoltageof0.15Vbetweenthenanowire-andcounter-electrodeinair,electrodeseparationdistances(D)ontheorderofamillimeterandnanowireswithdimensionssimilartothosefabricatedinthisstudywillcompletelyovercometheforceduetosurfacetensionandpreventtheaggregationoftwonanowires.However,thisanalysisonlyconsiderstheforcesbetweentwolonenanowiresandeliminatesthemulti-bodyeffectofthesurroundingnanowires.Theseadditionaleffectswouldreducethenetaggregationforce,minimizingtherequiredelectriceldandimprovingtherangeoflengthsanddiameterswheretheeldwillinhibitaggregation. 3.4ResultsandDiscussion 3.4.1AggregationDuringDrying.TheSEMimagesinFigure 3-4 showtheextentofnanowireaggregationafterremovingtheAAOtemplateanddryingthesubstrate.Thetop-downviewinFigure 3-4 ashowstheaggregationofnanowiresisquitesevereandpersistentthroughoutthesubstrate.Figures 3-4 band 3-4 cshowthatnanowiresremainattachedtothesubstrateafterdrying.Theaverageclusterofnanowirescontainsapproximately35nanowires,whichishighlightedinFigure 3-4 b.Thedeectionlengthofindividualnanowiresdependsonthenanowiredensityandcanbeaslargeas750nm,asshowninFigure 3-4 b.Inordertoobtainreal-timeanalysisoftheaggregationbehavior,thenanowireswerefabricatedontransparentsubstratessothatlighttransmittance(%T)couldbemonitoredasthenanowirearraydried.Thebenetisthattheopticalmethodprobesasignicantnumberofnanowire-nanowireinteractions(estimatedtobeontheorderof1010nanowires).AsshowninFigure 3-1 ,thetransmissionoflightthroughthenanowirearrayisaffectedbytheabsorptionfromgold,ITO,glassandwater,reectionfromthelm,orscattering.Anydeectionsinthepositionofthenanowireswill,therefore,inuencelighttransmittance.PriortodrainingtheviewcelldepictedinFigure 3-1 ,the 52

PAGE 53

Figure3-4. SEMimageofagoldnanowirearraythatdriednormally,i.e.,withoutanelectriceldpresent.Wide-viewtop-down(a),highmagnication(b)andsideviewimages(c)showthenanowireshaveundergoneirreversibleaggregationacrosstheentiresubstrate. substratewasplacedperpendiculartotheincomingradiationandthetransmittedlightwasmaximized(usuallytoavalueofabout60%T)byadjustingthecellorientationwitharotationalstage.Thiswasdonetopositionthenanowiresparalleltotheincomingradiation.Oncethewaterisdrainedfromtheviewcellandtheuidlmonthearraydries,nanowiresbegintoaggregate.TheaggregationofthenanowiresshowninFigure 3-4 alterslighttransmissionthroughthenanowirearray,asshowninFigure 3-5 for2mlonggoldnanowires(curve1).Thenanowiresareinitiallywettedandnochangeintransmissionisobservedaswaterbeginstoevaporatefromthesystem.Thetransmittancethenfallsrapidlyafter5min.Inthisregion,thewaterlmhasevaporatedtothepointwherethewaterlineisjustbelowthetopofthenanowiresandtheforceduetosurfacetensionisbeginningtodeectthenanowires.Asthenanowiresbendtowardseachother,lesslightcanpassthroughthenanowirearray.Therefore,the 53

PAGE 54

Figure3-5. Fractionalchangeintransmittedlight(=550nm)throughthenanowirearraysduringdryingforappliedelectricelds(of(1)0;(2)102;(3)103;and(4)104V/m.Whennoeldisapplied,thetransmissionshowsnochangeswhilethenanowiresremainsubmergedunderwater(seecartoon).Oncethewaterlevelfallsbelowthetipofthenanowires,surfacetensionbeginstodeectthenanowirestowardseachother.Thenaldriedstateisseverelyaggregatedasindicatedbythedecreaseinthetransmittance.Thereisnodecreaseintransmissionthroughthesubstrateinthepresenceofanelectriceld,indicatingthatminimalaggregationhasoccurred. fractionalchangeintransmittedlightisrelatedtothenanowireaggregationdensitywhiletheslopeofthetransmittancecurveisrelatedtotherateofnanowireaggregationandtheevaporationrate,whichisafunctionofroomtemperatureandhumidity.Thetransmittancefallstoaminimumvaluecorrespondingtothepointofmaximumnanowireaggregation.Atthispoint,asmalllayerofwaterlikelycoatseachnanowire.Asthislayerevaporates,thetransmittanceslightlyincreasestoaplateauregionthatremainssignicantlybelowtheinitialtransmittance.TheSEMimagesinFigure 3-4 indicatethatthispermanentdropintransmittanceisduetonanowireaggregation.EithertheslightincreaseintransmittancefromtheminimuminFigure 3-5 couldbeduetoareductioninlightabsorptionbywaterorbynanowirerelaxationfromtheelasticforceaftersurfacetensionisremoved.ThenanowiresthatremainaggregatedafterthisrelaxationareeitherplasticallydeformedorthebendingforceisbalancedbyvanderWaalsforcesorthesurfaceenergyofthegold. 54

PAGE 55

3.4.2ElectrostaticRepulsion.ThedryingprocesswasalsomonitoredspectroscopicallywithanappliedelectriceldbetweentheblankITOsubstrateandnanowirearray.Theelectriceldcouldbeadjustedbyvaryingeithertheappliedvoltageorworkingdistance(D).Figure 3-5 showsthetransmittancewhiledryinga2mlonggoldnanowirearrayusingaworkingdistanceof1mmandappliedvoltagesof0.1,1,and10V,correspondingtoelectriceldstrengthsof102,103,and104V/m,respectively.Assessingthelowereldthresholdwasattempted,howevereldsaslowas10)]TJ /F3 7.97 Tf 6.59 0 Td[(1V/m(in-situexperimentallimit)sporadicallyinhibitednanowireaggregation.Itisapparentthatthisrangeofelectriceldseliminatesthereductionintransmissionobservedwithnoappliedbias,maintainingnearlyconstantlighttransmissionthroughoutthedryingprocess. Figure3-6. SEMimageofagoldnanowirearraythatdriedinthepresenceofa104V/melectriceld.Bothtop-down(aandb)andsideview(c)imagesshowthattheelectricelddiminishesnanowireaggregation.Afewsmallaggregatesof25nanowirescanbeobservedinthesubstrate(circledinimage).Note:thesideviewimage(inset)appearsmoreaggregatedthanthetop-downviewandcouldpossiblybeduetoperturbationsfrombreakingthelmforimageanalysis. 55

PAGE 56

Thespectroscopicmeasurementssuggestthatalloftheappliedelectriceldshaveinhibitednanowireaggregation.TheSEMimagesinFigure 3-6 conrmthatnanowireaggregationwasdiminishedduringthedryingofeacharray.Theimagesshowthatmostofthenanowiresarenoworientedvertically.Therearesomeareasofnanowireaggregationbutthesearelimitedto25nanowiresandaccountforlessthan5%ofthesubstrate.Althoughthemodelshowedthereshouldbeachangeinaggregationstateattheseappliedvoltages,nosignicantdifferencesinaggregationstatewereobservedforanyoftheeldstrengths.Thelackofaggregationchangesintheexperimentssuggeststhemodelunderestimatestheelectrostaticrepulsiveforcesoroverestimatesthesurfacetensionforces.Thisisreasonablegiventhatonlytheinteractionbetweentwonanowiresatthepointofmaximumaggregationforcewereconsidered,neglectingthenetinteractiveforcesbetweenanarrayofnanowires. 3.5ConclusionsElectriceldsaslowas102V/mconsistentlyinhibittheaggregationofgoldnanowireswhendriedinwater,providingasimple,generalized,andscalableapproachtopreventtheaggregationofnanowiresonlarge-areasubstrates.Theaggregationprocesscanalsobeobservedwithopticaltransmissionthroughthenanowirearray.Theseresultsshowthataggregationsignicantlydecreaseslighttransmissionthroughthenanowirearray.Whenelectriceldsareapplied,onlyminorchangestothetransmissionareobservedduringthedryingprocess,conrmingthatthenanowiresalwaysremainseparatedwhiledrying.Asimplemodelbasedontheforcesactingontwonanowiresshowedthatthedominantfactorineliminatingaggregationisfromelectrostaticrepulsionbetweenthenanowires.Themodelalsoshowsthataggregationinmosttypicalnanowirearrayscanbeavoidedwitheldsof102V/m.Theseresultshighlightthechallengesassociatedwithfabricationofhigh-densityarraysoffreestandingnanowireswithsmalldiameter. 56

PAGE 57

CHAPTER4DYE-SENSITIZEDSOLARCELLPHOTOANODESBASEDONCONDUCTIVENANOWIRESCOATEDWITHASEMICONDUCTIVESHELL 4.1IntroductionInterestindyesensitizedsolarcells(DSSCs)hasgrowndramaticallyoverthelastfewdecadesasmanyresearchersbelievethattheymaybeapromisingalternativetosinglecrystallinesiliconphotovoltaics.ThisisprimarilyduetothelowcostfabricationmethodsoftraditionalDSSCsrelativetotheirmoderatelyhighoverallconversionefciencies. 65 TraditionalDSSCsarecomposedofathick(10m)nanoporouslmofanatasetitaniumdioxidenanoparticles(10nmdiameter).Thislmactsasthephotoanodeinthephotoelectrochemicalcell.Photonsarecollectedwithaphotoactiveorganicdyethatischemisorbedontothenanoparticlesurface.Thecompletedcellisconnectedbetweenaplatinumcounter-electrodewithaiodide/tri-iodideREDOXelectrolyte.Photo-generatedchargeprimarilyoccurswithinthedyemolecule,wherephotoexciteddyeelectronsareeitherinjectedintothesemiconductivenanoparticleorlosttotheelectrolyte.Aselectronsareinjectedintotheconductionbandofthenanoparticle,theymusttransportthroughthenanoporousphotoanodetoacurrentcollector.Afterelectroninjectionorloss,thedyeisleftinanoxidizedstatewhereitcaneitherberegeneratedbyreactingwithelectrolyteionsorbyscavenginginjectedelectronsfromthenanoparticle.Finally,oxidizedelectrolytemoleculesarereducedbytransporttotheplatinumcounter-electrode. 1 Therefore,theefcienciesofDSSCsarelargelydictatedbytheamountofelectronsgeneratedandtheirtransportthroughthephotoanode.ThemaximumpossiblephotovoltageofDSSCsisdeterminedbythedifferencebetweentheFermienergyofthesemiconductorandtheelectrochemicalpotentialoftheREDOXelectrolyte. 2 However,NP-DSSCssufferfrominterfacialelectronlosstotheelectrolytethatreducesthephotovoltageofthecell. 66 ThislossmechanismisparticularlyproblematicinNP-DSSCsbecauseoftheabsenceofaninternalelectric 57

PAGE 58

eldwithinthenanoparticlethatwouldaidinchargeseparation. 4 67 Thelackofaninterfacialelectriceldalsopreventsinjectedelectronsfrombeingsweptawayfromtheinterfaceandpreferentiallydriventothecurrentcollector.ThislackofamigrationaldrivingforceforelectrontransportinNP-DSSCshasbeendescribedastrap-limiteddiffusionthroughthenanoporousphotoanode. 3 68 72 Someresearchershaveaddedlayerstothetitaniasurfacetoblockphoto-generatedchargefrombackreactingwiththeelectrolyte;theselayersaredesignedtocreateanelectrontunnelingbarrieratthenanoparticlesurface. 73 75 Nanowire-basedDSSCs(NW-DSSC)smayprovideadvantagesoverNP-DSSCs,suchasdecouplingtheelectrondiffusiondistancefromthephotoanodethicknessandprovidinganinterfacialelectrideld.Theseadvantagesimprovephotocurrentandinterfacialchargetransfer,whichmayleadtoenhancedphotovoltage. 4 6 8 76 Indeed,manyresearchershaveshownthatphotoanodescomposedofone-dimensionalstructuresprovidearadialelectriceldthatsweepsinjectedchargefromtheinterfaceandimproveschargetransport. 4 5 8 77 80 Coatingtheseone-dimensionalnanostructureswithathincoatingoftitaniaalsolimitselectrondiffusionlengthstothethicknessoftheshell. 8 Thisdecouplingofelectrondiffusionlengthfromthephotoanodethicknessmayallowthickerphotoanodes,providinghigherphotocurrent.WhileNW-DSSCshavebettertransportcharacteristicsthantheirnanoparticlecounterparts,overallperformanceremainslowbecauseofthesubstantialreductioninphotoactivesurfaceareathatleadstopoorlightharvesting. 4 81 ThelowsurfaceareaofNW-DSSCsisprimarilybecauseofthecurrentfabricationapproachesthatresultindisordered,low-densityarraysofnanowires.Researchershaveattemptedtoincreasethesurfaceareaofthesenanowirearraysbyusingbranchednanowirestructures 82 83 ormixturesofnanoparticlesandnanowires 84 .However,itisclearthatahigherdensityofnanowireswouldprovidefurtherimprovement.Anadditionalbenetofnanowirearraysarisesfromthepotentialtotraplightwithinthephotoanode,asrecently 58

PAGE 59

demonstratedinNP-DSSCs 85 86 NW-DSSCs 81 andalsoSi-basedphotovoltaics 87 .NW-DSSCphotoanodescomposedoforderedand/orreectivecorestructuresmayalsocompensateforthelowphotoactivesurfaceareaofnanowirearrays.Inthischapter,IpresentastudyofDSSCsconsistingofindium-dopedZnOcorenanowirescoatedwithananataseTiO2shell.Thecorenanowirearrayisfabricatedinanodicaluminumoxide(AAO)templatesdirectlyattachedtoITO,asdescribedinChapter2.Theadvantageofthisapproachisthatthetemplateprovidesadensearrayofporesforfabricatingnanowires.Nanowiresapproximately3minlengthareelectrochemicallydepositedinthearrays.Afterthetemplateisremoved,thenanowiresarecoatedwithvaryingthicknessesoftitaniausingatomiclayerdeposition.Thelifetimeofelectronswithinthecore/shellnanowirestructureismeasuredbyopen-circuitvoltagedecay(OCVD)andcomparedtotheelectronlifetimeinNP-DSSCs.TheoverallperformanceofeachDSSCisevaluatedviapolarizationcurvesunderAM1.5simulatedillumination. 4.2Experimental 4.2.1FabricationofTemplates.Directfabricationoftheanodicaluminumoxide(AAO)templateshasbeendescribedinChapter2.Briey,aluminumlmsareelectron-beamevaporatedat20nm/stoathicknessof2.2montocommerciallyfabricatedITO/glasssubstrates(5/cm2)usinga10nmCradhesioninter-layer(ebeamevaporatedat0.2nm/s).TheAl/Cr/ITOsubstratesareelectrochemicallyanodizedat130Vinan8.5wt%H3PO4,heldat7oCtoformasemi-orderedporoustemplatewithameanporediameter,densityandlengthof180nm,1011cm)]TJ /F3 7.97 Tf 6.59 0 Td[(2and3.1m,respectively.Theporesarethenwidenedin5wt%H3PO4for330storemovethebarrierlayer,facilitatingadhesionofthedepositednanowiretothesubstrate. 59

PAGE 60

4.2.2ElectrodepositionoftheNanowireArrays.Allelectrodepositionwascarriedoutina500mLelectrochemicalcellconsistingofacarboncounter-electrode,saturatedcalomelreferenceelectrodeandaPrincetonAppliedResearchVersastat3potentiostat.Anaqueoussolutionof0.1MhydratedZn(NO3)2and0.75-1.0mMInCl3waspH-adjustedto2.56withHCl.Indium-dopedZnO(IZO)waselectrodepositedfromthissolutionpotentiostaticallyat-0.8Vand75C.Theelectrodepositioncurrentwasmonitoredcloselyanddepositionwasstoppedoncethecurrentrosesharply,indicatingthatthenanowireswereoverllingtheAAOpore.DependingontheparticularAAO/ITOsubstrate,1-2C/cm2waspassedthroughthecellduringthedepositionprocess.Typically,theamountofchargepriortothecurrentspikewasdirectlyproportionaltothedensityofthenanowirearray.PlatingsolutionsforAuandPtwerepurchasedfromTechnicInc.andelectrodepositedateither60Cand-0.5Vor80Cand-0.6V,respectively.Afterelectrodepositionofthenanowirecore,theAAOtemplatewasselectivelyetchedwith25wt%H3PO4for2h,leavingbehindanarrayofnanowiresontheITO/glasssubstrate.Theanodization/etchingprocessalsoremovedtheCrinterlayer.Inordertopreventaggregationofthenanowirearray,anelectriceldwasappliedbetweenthenanowirearrayandanITOcounterelectrodeduringdrying.Thenanowirearraywasdriedina1V/cmelectriceldfor2h,asdescribedinChapter3. 4.2.3AtomicLayerDeposition(ALD)ofAnataseTiO2.Thenanowirearraywasplacedinacustom,atomiclayerdepositionchamber(PlanarSystems,Inc.)forgrowthofthesemiconductorshellaroundeachnanowire.Thechamberwasevacuatedtoabasepressureof2mTorrandushedwithdrynitrogen.Thechamberwasthenheateduniformlyto400Cwhiledrynitrogenowedthroughthechamberat3sccm.Itisimportanttonotethatthetemperatureof400C(requiredtoformanatase-phaseTiO2)ischamberdependent.Thechamberwasmaintainedat400Cfor2htoreachthermalequilibriumbeforedeposition.TheTiO2shellswere 60

PAGE 61

depositedbycyclingTiCl4andH2Opulsesseparatedbydrynitrogenpurgesat10sccm.Eachprecursorwasvaporizedbyvacuumoftheliquid,whichareheldatroomtemperature.Thesystemiscomputer-automatedandtheprocessiscontinueduntilthedesirednumberofcyclesisreached,where1cyclerepresentsthesequenceconsistingof1sH2O/1spurge/1sTiCl4/1spurge.AdegreasedSi<100>substrate,withalinedrawnfromapermanentmarkerforstepheightmeasurements,wasalsoplacedinthechamberandusedtoassesslmthicknessandcrystallinitybyprolometryandX-raydiffraction.ThenominalgrowthrateofthetitaniaontheSisubstratewasapproximately0.86A/cycle. 4.2.4CompletionandTestingoftheDSSCCell.TheN719organicdye(Solaronix)waschemi-sorbedontothecore/shellnanowirearraybyheatingthenanowirearrayto200Candimmersingitin0.3mMN719/ethanolfor12h.Thesubstratesweresubsequentlyrinsedwithdryethanolandstoredinanargongloveboxuntilused.ThecellwascompletedbyimmersingitinaniodideREDOXcouple(Iodolyte,Solaronix)andconnectingittoeitheraPtwireorthermallyplatinizedcounter-electrode.WhenaPt-wirewasusedasthecounter-electrode(voltagerelatedmeasurements),thewirewaspositionedoverthenanowirephotoanodewithamicro-positionerandasmalldropoftheelectrolytewasdroppedontothewire.SurfacetensionheldasmallamountoftheelectrolytebetweenthePt-wireandthephotoanode;thesizeofthedropwasapproximatelydoubletheareaofthePt-wire(diameterof0.23mm).Whenthermallyplatinizedcounter-electrodeswhereused,40mhotmeltspacers(Surlyn1702,DuPont)wereusedtosandwichandsealthecounterelectrodetothephotoanode.Theelectrolytewasintroducedviacapillaryaction.Regardlessofthecounterelectrode,thedevicesweretestedimmediatelyafterelectrolyteimmersionunderAM1.5simulatedsunlight(SolarLight,Inc.)usingapotentiostat(PrincetonAppliedResearch,Versastat3).OCVDmeasurementswere 61

PAGE 62

obtainedbymeasuringthetemporalvoltageatopencircuitcurrentafterthesimulatedsunlightwasextinguishedwithashutter. 4.2.5CharacterizationTechniques.X-raydiffractionwasperformedwithXRDPhilipsAPD3720Powder-XRDontheSisubstrateswiththeALDgrowntitania.ScanningelectronmicroscopywasperformedwithJEOLJSM-6335FFEGSEMwithoutcoatingofaconductivelayeratanacceleratingvoltageof5kV.Finally,transmissionelectronmicroscopywasperformedwithJEOLTEM200CX.ThenanowireswereliberatedfromthesubstrateforHRTEMimagingbyscrapingthenanowiresfromthesubstratewitharazorintoavialwithde-ionizedwater,alsoplacingtherazorinthevial,andsonicatingfor5minutes.Thedispersednanowiresweredrop-coatedontoalaceycarbonTEMgridandimagedatanacceleratingvoltageof200kV. 4.3ResultsandDiscussion 4.3.1Core/ShellNanowireFabrication.ThedirectfabricationofAAOonITOisdescribedinChapter2.ThenanowirecorewasdepositedpotentiostaticallyfromaqueoussolutionsintotheseAAOtemplates.TheoptimaldepositionvoltageforeachnanowirematerialwasdeterminedbyperformingcyclicvoltammetryontheAAO/ITOsubstrates.ThisprocedurewasacriticalstepsincethecathodiccurrentpeakfordepositionintemplatesoccurredatslightlylargerappliedpotentialsthanbareITOsubstrates.ThevoltagewasalsofoundtobeafunctionoftheporediameterandlengthoftheAAOtemplate.ThisrelationshipcouldindicatearesistivepotentialdropalongthelengthoftheporeorincreasedsubstrateresistancefromthefabricationofAAOontothesubstrate.Theinitialdepositionvoltagewaschosentobeslightlymorecathodicthanthemaximumcathodiccurrenttominimizeanodicdissolutionofthedepositanddecreasevoidswithinthenanowire.Afterdepositionofthenanowirecore,thetemplatewasremovedandthenanowireswereanalyzedbyHRSEMtodeterminetheirdensity,structureandmorphology.Aniterativeprocesswasusedto 62

PAGE 63

optimizethenanowiredensityforAu,PtandIZO(typicallyontheorderof1010cm)]TJ /F3 7.97 Tf 6.59 0 Td[(2).Depositionvoltagesof-0.5,-0.6and-0.8VyieldedthehighestnanowiredensitiesforAu,PtandIZO,respectively. Figure4-1. HRSEMimageofagoldnanowirearray(a).ThearraywasfabricatedbydirectanodizationofAllmsonITOfollowedbyelectrodepositionoftheAuandselectiveetchingoftheAAOtemplateunderanelectriceldtopreventnanowireaggregation.AthinsemiconductiveshellisgrownepitaxiallyonthenanowiresurfacesbyALD.NotethatPtandIZOHRSEMimagesappearedsimilar,howeverAuprovidedthebestcontrastforSEMimaging.HRTEMimageofatitania-shell,IZO-corenanowire(b).Thesenanowiresweregrownsimilartothosein(a)onlywerecleavedfromthesubstratewitharazorforHRTEMimaging.Notethepoorcrystallinityofthetitaniashellin(b),whichwilllikelyleadtopoordeviceperformance. Figure 4-1 aisaHRSEMimageofanAunanowirearrayfabricatedwithintheAAOtemplatethathasadensityof1010cm)]TJ /F3 7.97 Tf 6.59 0 Td[(2.TheAunanowireswithinthearrayhaveadensity,length,anddiameterofapproximately1010cm)]TJ /F3 7.97 Tf 6.59 0 Td[(2,2.5m,180nmand150nm,respectively.SimilarresultsareobtainedforPtandIZOtemplate-depositednanowires.ItisimportanttonotethateventhoughthenanowireswereliberatedfromtheAAOtemplatetheyremaininannon-aggregatedstate,whichisimportanttoDSSCperformance, 88 byusingtheelectrostaticrepulsionmethoddescribedinChapter3.Ifthenanowireswereallowedtoaggregate,subsequentgrowthofthesemiconductiveshellwouldbenon-uniformwithaloweroverallsurfaceareaofthephotoanode.TheHRTEMoftheIZOnanowirewitha45nmtitaniashellisshowninFigure 4-1 b.Notethatthepoorcrystallinityofthetitaniashellwilllikelyleadtoloweredvoltagesatopencircuit. 8 Thenon-aggregatedarrayofnanowiresarethencoatedwithanataseTiO2by 63

PAGE 64

ALD.X-raydiffraction(XRD)wasperformedatvariousdepositiontemperaturesand400Cproducedthebestanataselms. Figure4-2. XRDdatashowingtherstvedominantanatasetitaniadiffractionpeaks(A).Alsoshownisaweakrutilephasediffractionpeak(R)andthefalsesum-peakfor<100>Si Figure 4-2 therstveprimarydiffractionpeakscorrespondingtothe<101>,<103>,<004>,<112>andthe<200>crystallographicplanesofanatasetitaniaontheSicalibrationsubstrate.Thelowfull-width-at-half-maximumvalueforthepeaksindicatesthat,atleastonSi,theTiO2lmishighlycrystalline.Thetitanialmsmayalsohaveasmallamountofrutiletitania.Thepeakatapproximately33degreesisafalse,sum-peakfor<100>Si.NotethatthoughtheXRDoftitaniagrownonSiprovestobecrystallineinFigure 4-2 ,theshellsobservedthroughTEMinFigure 4-1 bareatbestpoorlycrystalline.Thedifferenceinsurfaceproperties,energyandcurvatureofthenanowireswhencomparedtoatsiliconmaybetheresultofthepoorcrystallinenatureoftheshellsshowninFigure 4-1 b.However,otherresearchershavegrownanatasetitaniaonsimilardiameterZnOnanowirewithsuccess. 8 ItislikelythattheexperimentalALDprocedureshouldbefurtheroptimizedtoobtainhighlycrystallinetitaniashellsonIZOnanowires. 64

PAGE 65

FilmresistancemeasurementswereconductedonelectrodepositedIZOlmsbyplacingtwotungstenprobesonthelmuntilcurrentwasdetectedandthenconductingalinearvoltametryscan.Theresistancewasfoundtodropbyafactorof10ormorewhencomparedtoablankITOsubstratewithasheetresistanceof5/cm2.Thislowconductivitywilllikelyleadtodiminisheddeviceperformance.Inordertotrulydecouplethephotoanodethicknessfromtheinjectedelectrontransportlength,electrodepositionoftransparentoxideswithbetterelectricalconductivitiesshouldbeapriority. 4.3.2NW-DSSCPerformance.Therelevantparametersassociatedwiththeperformanceofaparticularsolarcellcanbeobtainedbymeasuringthepolarizationcurve(iVcurve)andbyvaryingtheresistanceacrossthedevicetondthemaximumpoweroutput(Pmp).TheiVcurveyieldsthecurrentdensityatzerobias(isc)andthevoltageatzerocurrent(Voc).Thesolarcellllfactor(FF=iscVoc/Pmp)isagoodmeasureofphotovoltaicperformancesinceitisameasureofhowcloselythesolarcellproducesitsparticularmaximumtheoreticalpoweroutput.Fillfactorscanrangefrom0to1butavalueofunityisthermodynamicallyandquantummechanicallyimpossible.Theoverallpowerconversionefciency()iscalculatedastheratioofPmptotheincomingradiationenergy(AM1.5).Figure 4-3 showstheeffectofdifferenttitaniashellthicknessesonthepolarizationcurvesforNW-DSSCsbasedonIZOnanowires.ThebestiVcurvesareobtainedforNW-DSSCswithshellthicknessesof10nm:yieldingthehighestllfactorandVoc.Eachdevicewastestedataminimumofthreedifferentregionsandatleastveidenticaldeviceswerefabricatedforeachshellthickness.Theaverageperformanceparameters(Voc,isc,FFand)asafunctionoftitaniashellthicknessisshowninFigure 4-4 .Alloftheaveragevaluesgothroughamaximumat10nm.AlthoughtheiVcurvesinFigures 4-3 donotcorrespondexactlytopreviousworkbyYangandco-workers 8 ,thesamespecictrendsassociatedwithVoc,isc,FFandasafunctionofshellthicknesswereobserved.Theopencircuitvoltageisbelievedtovarywithshellthicknessbecausethe 65

PAGE 66

Figure4-3. Thepolarization(iV)curvesforNW-DSSCswithdifferentshellthicknesses.TheIZOnanowireshavediameters,lengths,andspacingof180nm,2.5mand1010cm)]TJ /F3 7.97 Tf 6.58 0 Td[(2,respectively.ThecalculatedFFandofeachdevicearelistednexttoeachpolarizationcurve.NW-DSSCswith10nmshellthicknessesprovidethebestperformancewiththehighestVoc,FFand. interfacialpotentialdropwithinthesemiconductorisstronglyaffectedbythethicknessofthesemiconductor(SeeChapter5).OthersresearchershavealsoshowedthisresultbutitisinterestingthatVoccanbetunedbyalteringtheinterfacialelectriceld(controlledbytitaniashellthickness). 8 LookingmorecloselyatthespecicinformationthatcanbeextractedfromtheiVcharacteristicofFigure 4-3 ,onecanobtaintheshuntresistance(Rsh=(di/dV))]TJ /F3 7.97 Tf 6.59 0 Td[(1V=0)andtheseriesresistance(Rs=(di/dV))]TJ /F3 7.97 Tf 6.59 0 Td[(1i=0)forthese4shellthicknesses.Theshuntresistanceissimilarforthe1,10and25nmshelldevices,withthe10nmdevicebeingslightlyhigherandRshdropssubstantiallyforthe45nmshelldevices.FurthermoretheRsishighestforboththe1and45nmdevicesandlowestforthe10and25nmdevices.Leakagecurrentwithinorexternaltothedevices(i.e.externalcontacts)givesrisetoRshandRsresultsfrominternaldeviceorlineresistance.ThuslowervaluesofRshindicatehigherleakagecurrentwhilehighervaluesofRsindicatehigherresistance,andifbothareinternaltothedevice,indicatedeviceperformanceissues. 66

PAGE 67

Figure4-4. AveragevaluesfortheVoc,isc,FFandofNW-DSSCswithdifferentsemiconductorshellthicknesses.TheIZOnanowireshavediameters,lengths,andspacingof180nm,2.5mand1010cm)]TJ /F3 7.97 Tf 6.59 0 Td[(2,respectively.Atleast15differentdevices/regionsweretestedateachthickness.Allvalueshaveamaximumat10nm. ThehighvaluesofRsforthe45nmdevicearelikelythecauseofelectrolyteregionconnementduetoovergrowthofthetitaniashellwhichwasobservedunderSEM(notshown).ThiscouldresultinthedominantcurrentbeingleakageandgiverisetotheloweredvaluesforRsh.TheraisedvaluesofRsforthe1nmdevicesarelikelytheresultofpoortitaniacoatingandcrystallinity.Thiswouldgiverisetolimitinginterfacialchargetransferkineticsandtheobservedincreaseinseriesresistance.Ineithercasetheultimateresultforthe1and45nmdevicesisaloweredFFandthusapoorpowerconversionefciency.Between10and25nmshellthicknessesinFigure4-5,onlythell-factorchangesdramatically.ThedropinFFat25nmappearstobemostlytheresultofanincreaseinRs.Thisincreaseintheseriesresistancecouldbeduetothepoorcrystallinenatureofthetitaniashell.Withtheshellbeingpoorlycrystalline,anincreaseinshellthicknessfrom10to25nmwouldresultinahigherresistancetochargetransportthroughthesemiconductorlayer. 67

PAGE 68

ThebestefciencyandFFachievedthusfaris0.54%and0.621,respectively.EventhoughtheefcienciesoftheseNW-DSSCsarelow,itisimportanttonotethatthesedevicesarecomposedofshorternanowiresthantypicallyused.Iftheefciencywerescaledlinearlywithnanowirelength,theperformanceiscomparabletootherNW-DSSCs. 4 6 8 76 80 88 91 Ifperformancescaledlinearlywithnanowirelengththiswouldcorrespondto15mnanowirelengthdeviceswithefcienciesof3.11%.Though,showninChapters5and6,itisknownthatdeviceperformancedoesnotscalelinearlywithnanowirelength.NanowirewireDSSCsthatwerefabricatedwithmetallic,reectivecorematerialofbothAuandPtprovedtobeeitherunsuccessfulorhaveextremelypoorperformance.ThosecomposedofAu-corenanowiresfailedduetoasurprisinglyrapidphoto-dissolutionoftheAucoreuponilluminationandclosureoftheelectricalcircuit.Thisislikelyduetothehighphotoactivityassociatedwiththetitaniumdioxide.NW-DSSCscomposedofPtcorenanowiresexhibitedextremelypoorperformancewithVoc100mV,isc0.1mA/cm2,andFF0.2.HRTEMimagingshowedpooradhesionofthesemiconductiveshelltothePt-corenanowire,thisislikelythecauseofthemaladyinperformance. 4.3.3OpenCircuitVoltageDecayofNW-DSSCs.ItiswellunderstoodthatnanoparticleswithinNP-DSSCs(10nm)havenointernalelectriceldand,thus,theinjectedelectronsinthesemiconductorregiongainnotransportbenetfrommigration. 3 92 93 Nanowire-basedDSSCsareexpectedtohavethismigrationcomponentinadditiontothediffusionofelectrons.Theimprovedtransportshouldincreaseelectrolytescavengingandreducetheoverallkineticsofelectronlossattheinterface.Whileintensity-modulatedphotocurrentandphotovoltagespectroscopyprovideverysensitivemeasurementsoftheseinterfacialprocesses,OCVDisasimpletechniquethatcanprobethesumoftheinterfacialprocessesandelucidateelectronlifetimewithinthephotoanode.Theprocessinvolvesfullsunilluminationofthesample 68

PAGE 69

whileholdingtheDSSCatopencircuit.Oncethedevicehasreachedequilibriumatopencircuit,ashuttercutsoffilluminationandthevoltagedecay(dV/dt)ismeasured.Electronlifetimeiscalculatedasthethermalvoltage(Vth)timesthereciprocaloftherateofchangeofvoltagewithtime 94 ,or n=Vth@V @t)]TJ /F3 7.97 Tf 6.59 0 Td[(1(4)whereVth=kBT=eandkB,eandTareBoltzmannsconstant,thechargeofanelectronandtemperature,respectively.Atroomtemperaturethethermalvoltageisapproximately0.026V.Thevoltagedecayisdeterminedbyeitherdirectlycalculatingtheslopeorttingthecurvetopolynomialortranscendentalandcalculatingthederivative.Inthiswork,thelatteroptionwaschosen.Theelectronrecombinationrateisdistributednon-linearlywithelectronconcentration(i.e.,rrecomb=krCe)whererrecombistherateofrecombination,kristhenetrecombinationrateconstant,Ceistheconcentrationofelectrons,andistherecombinationorder.Zabanet.al.showedthatinthecaseofnon-linearrecombinationtheorderoftherecombinationrateisgivenby 94 =1+Vth@ln()]TJ /F3 7.97 Tf 6.58 0 Td[(1n) @Voc(4)Equation 4 showsthattheorderofrecombinationdeviatesfromunitywheneverelectronlifetimechangeswithVocisnon-zero(i.e.@ln()]TJ /F3 7.97 Tf 6.59 0 Td[(1n)=@Vocisnon-zero).Figure 4-5 showstheODVDcharacteristicsforNW-DSSCswithdifferenttitaniashellthicknesses.AsshowninFigure 4-5 a,thedecayinVocisrapid,fallingfasterthanDSSCsbasedonnanoparticles.Thevoltagebecomesvirtuallyconstantafterabout10s.Interestingly,thevoltagedecaycharacteristicsforNW-DSSCsbasedontitaniashellthicknessesof10and25nmarenearlyidenticaldespitehavingdifferentperformancecharacteristics.Atrstglance,onemightconcludethatphotogeneratedelectronsinNW-DSSCsareeitherrelaxingbacktothegroundstatewithinthedyeor 69

PAGE 70

Figure4-5. (a)Thedecayofvoltageatopencircuit(OCVD)forNP-andNW-DSSCdevices.TheOCVDshowstherapidinitialdecreaseinvoltageafterilluminationisceased.(b)TheelectronlifetimecalculatedfromOCVDasafunctionofopencircuitvoltageshowsNW-DSSCshavealongerelectronlifetimeathigherinterfacialpotentialdropsthanNP-DSSCs.(c)TherecombinationordercalculatedfromOCVDshowsthatNW-DSSCshavelowerrecombinationratesthanNP-DSSCsatmoderatetohighvoltages.(TheNP-DSSCdatainthesethreeplotswerereproducedfromtheworkofZaban&co-workers. 94 ) 70

PAGE 71

backreactingfasterthanNP-DSSCs.ThedependenceofnontheopencircuitvoltageshowninFigure 4-5 bshowsthatndecreasessharplyforbothNP-andNW-DSSCsatlowinterfacialpotentialdrops.However,theelectronlifetimeofNW-DSSCswithoptimalthicknessofthetitaniashellplateautoavalueofabout100mswhileNP-DSSCscontinuallydecaytovaluesaslowas10ms. 94 95 ThisprovidesclearevidencethatelectronlifetimeisenhancedinNW-DSSCs.AlthoughtheNW-DSSCswith45nmthicktitaniashellsdidnothavegoodperformance,theyprovideaninterestingdifferencewiththemeasuredelectronlifetime.EventhoughVocislowerinthesedevices,theelectronlifetimeistwoordersofmagnitudehigherthanthe10and25nmdevices.Duetotheconnedelectrolyteregion,itislikelythatthisregionisrichincounter-ions(i.e.I)]TJ /F3 7.97 Tf 0 -7.97 Td[(3)afterterminatingillumination.Themostkineticallyfavorablepathwayforelectronloss/recombinationinthedarkiswiththeelectrolytecounter-ion.Sinceanincreaseinelectronlifetimeisobservedinsteadofadecreasefor45nmshelldevices,itislikelythatinjectedexcitedelectronsareslowertobackreactwiththeelectrolyteduetothepresenceofaninterfacialelectriceld.Therefore,theimprovedelectronlifetimeinNW-DSSCsisprobablyduetoareductioninbackreactions/recombination.Finally,Figure 4-5 cpresentsthecalculatedrecombinationorderfromFigure 4-5 aand 4-5 bdata.NP-DSSCstypicallyhaveameanvalueforof1.4andthisvalueisknowntogenerallyincreasewithincreasinginterfacialpotentialdrop.InContrast,therecombinationorderinFigure 4-5 casymptoticallydecreaseswithincreasinginterfacialpotentialdroptowardvaluesofunity.ThisdataisfurtherevidencethattherecombinationrateinNW-DSSCsislowerthanNP-DSSCs.Thesimilarityoftheresultsforboththe10and25nmshellthicknessessuggeststhattheimprovedbehaviorisrelatedtophotoanodestructureratherthandifferencesindyecoverageortitaniamorphology. 71

PAGE 72

4.4ConclusionDSSCsbasedoncore/shellnanowireshavebeensuccessfullyfabricatedthroughanAAO/ITO-templatedapproach.ThedevicesbasedonIZOcoresperformcomparablytosimilardeviceswhenscaledtophotoanodesurfacearea(nanowirelength). 8 Thedeviceperformancewasdependentonthesemiconductorshellthickness,whichaffectedtheopencircuitvoltage,shortcircuitcurrent,ll-factorand,thus,overallpowerconversionefciency.Similartopriorstudies,theperformancewasmaximizedwithtitaniashellthicknessesofapproximately10nm.Theopencircuitvoltagedecay(OCVD)measurementsshowthatthecore/shellnanowirestructureexhibitslongerelectronlifetimesandslowernetbackreaction/recombinationkineticsthanNP-DSSCs.Theseeffectsareindependentofsemiconductorshellthickness(atmoderatethicknesses)andappeartobeafunctionofthephotoanodemorphology.AttemptedfabricationofAu-andPt-coreNW-DSSCsprovedgenerallyunsuccessfuldueto(i)photo-catalyticdissolutionoftheAunanowirecoreuponilluminationand(ii)pooradhesionofthesemiconductorshelltothePtnanowire.However,itisstillbelievedthatreectiveandperiodicstructuresshouldbefurtherstudiedgiventheirpotentialtotrapphotons.Othersuitablenanowirematerialsshouldalsobeinvestigatedtoimprovetheconductivityofthedevices. 72

PAGE 73

CHAPTER5MODELINGTHEEFFECTSOFANINTERFACIALELECTRICFIELDINDYE-SENSITIZEDSOLARCELLPHOTOANODESBASEDONCONDUCTIVENANOWIRESCOATEDWITHASEMICONDUCTIVESHELL 5.1IntroductionTraditionaldye-sensitizedsolarcells(DSSCs)owetheirrelativelygoodperformancetotheextremelyhighphoto-activesurfaceareaoftheirnanoparticle-basedphotoanodesaswellastherelativelyslowbackreactionkineticsofphotogeneratedelectronswiththeI)]TJ /F1 11.955 Tf 7.09 -4.34 Td[(/I)]TJ /F3 7.97 Tf 0 -7.97 Td[(3REDOXelectrolyte. 65 Additionally,nanoparticle-basedDSSCs(NP-DSSCs)canpotentiallybefabricatedatlowcostwhencomparedtosiliconbasedphotovoltaics,furtherincreasingtheirviabilityfortheproductionoflowcost,cleanenergy. 1 2 67 DSSCshavealsobeenshowntooutperformsilicon-basedphotovoltaicsondayswhenthereissomecloudcover. 96 Basedonactualphotoactivesurfacearea,NP-DSSCdevicesdonotproduceasufcientlylargephotocurrent.Anysubstantialphotocurrent,asstatedabove,isduetothemassivesurfaceareaofthenanoparticlephotoanode;typicallya10mthicklmcomposedof10nmnanoparticlesyieldsasurfaceareathatisroughly1000timesthatoftheprojectedarea.Duetotheporous,nanocrystallinenatureoftheNP-DSSCphotoanode,electrontransportisgovernedbytrap-limiteddiffusivetransport. 3 71 97 100 Unfortunately,thecompetingrelationshipbetweenelectrondiffusionandlifetimelimitstheelectrondiffusionlengthtoabout10m. 3 Fabricatingnanoparticlephotoanodesinexcessof10minanattempttoincreasephotocurrentisoftenfruitlessbecausealmostalloftheelectronsgeneratedinthisregionarenevercollected. 3 68 101 102 TheinterfacialkineticsandenergylevelsoftheheterogeneouscomponentsoftraditionalNP-DSSCsaredesignedtooptimizeperformancegiventhelimitationsstemmingfromthenanoparticlemorphology. 2 65 103 AsshownintheenergydiagraminFigure 5-1 ,themaximumoutputvoltage,Vmax,isdeterminedbythedifferencebetweentheFermienergyofthesemiconductorandtheelectrochemicalpotentialof 73

PAGE 74

theelectrolyte,Eredox.Onceanelectronisphoto-excitedfromthehighestoccupiedmolecularorbitalofthedye(HOMO)tothelowestunoccupiedmolecularorbital(LUMO)state,theelectroncaneitherbeinjectedintothesemiconductorlayerorbackreactwiththeelectrolyte.Thediagramshowsthatwhileitisenergeticallymorefavorableforphoto-generatedelectronstobelosttotheelectrolyte,itiskineticallymorefavorableforphoto-generatedelectronstobeinjectedintotheconductionbandofthesemiconductor(reactionrateconstantsof1013vs.102s)]TJ /F3 7.97 Tf 6.59 0 Td[(1).ThesignicantdifferenceinkineticsisrequiredtomaketheDSSCoperationalinthesenanoparticle-baseddevices.However,thecostofgainingthiskineticbenetisareductioninthemaximumvoltageoutputofthecell(Vlost).Forexample,asthecompositionoftheelectrolytecanbemodiedtoincreasetheREDOXpotentialupto0.8V,butthistypicallyincreasestherateofback-reactionwiththeelectrolyte. 104 EvenelectrolytecompositionsthathaveelectrochemicalpotentialsthatextendbeyondtheHOMOstatewillstillspontaneouslyregeneratetheoxidizeddyemoleculeandallowlargeroutputvoltages.IncreasingtheREDOXpotentialoftheelectrolytecouldpotentiallyyieldopen-circuitvoltagesashighas1.45VwiththeN3/titaniasystem.Althoughincreasingtheopen-circuitvoltagebytuningtheelectrolytecompositionremainsaninterestingandactiveareaofresearch,problemsassociatedwiththeincreasedback-reactionkineticsresultsinpoordeviceperformancethusfar. 104 WhileNP-DSSCsareapromisingavenueforphotovoltaicresearch,nanowire-basedDSSCs(NW-DSSCs)arebeingrecognizedashavingcertainadvantagesovertheirnanoparticlecounterparts.Theseadvantagesincludetheintroductionofanelectriceldinthesemiconductorthataidsininterfacialchargetransferandminimizesphotogeneratedorphotoinjectedelectronloss. 4 8 89 Thepresenceofaninterfacialelectriceldhasbeenpostulatedtoincreaseinterfacialchargecollectionefciencybyreducingtherateofphotogeneratedelectronbackreaction.??ThisadvantagemayallowforDSSCswithelectrolytesthatimprovephotovoltage 104 withoutsuffering 74

PAGE 75

Figure5-1. Theenergylevelsshowthatphotogeneratedelectronscaneitherbeinjectedintothesemiconductororbackreactwiththeelectrolyte.AlthoughtheenergydropisgreaterforLUMO-statedyeelectronlosstotheREDOXcouple,thekineticsofLUMO-statedyeelectroninjectionintotheconductionbandofthesemiconductoris1011timesfasterthanlosstotheelectrolyte. loweredphotocurrentsfromincreasedelectronlosstotheelectrolyte.Furthermore,someresearchersbelievethatDSSCphotoanodeswithlayeredandorientedstructures,suchasconductivecore/semiconductiveshellnanowires,canovercomeoneofthemaincomplaintsofthesetypesofstructures:lowphotoactivesurfaceareacomparedtoNP-DSSCs. 76 77 Thesetypesofstructuresdecouplethelengthphotoinjectedelectronsmusttraveltobecollectedfromthephotoanodethickness,allowingforincreasedphotoactivesurfaceareawithoutadeclineinphotocurrent.Fromamodelingstandpoint,thedynamicsofNP-DSSCsarebeginningtobecomewelldened.Interfacialreactiondynamicsandenergylevelshavebeenmodeledinconjunctionwithdynamicresponsemeasurements. 94 95 101 104 Thetransportofelectronswithinthenanoparticlephotoanodeisnowunderstoodtobepurelydiffusivethroughbothdiscreteandcontinuumbasedcomputations. 3 71 99 100 Furthermore,theNP-DSSCasawholehasbeenaccuratelypredictedthroughbothacontinuummodelofthephotoanodeandanelectricalmodelofthephotoelectrochemicalcell. 98 100 .ThoughalargeamountofefforthasbeenputforthtounderstandandpredictthebehaviorofNP-DSSCs,verylittleifanyhasbeendonetounderstandwhatsomebelieveisan 75

PAGE 76

optimalmorphology:orientednanostructureswithasemiconductivelayerovertopaconductivenanostructure.RecentlytherehasbeenintensiveexperimentalworkintheareaofNW-DSSCs, 4 6 8 76 80 88 91 105 howeverobtainingsufcientlyhighdensityandlengthnanowirearraysremainsahurdle.Furthermore,theimprovementofphotovoltageinNW-DSSCsthroughalteredelectrolytecompositionhasbeengivenverylittleinterest.TheaimoftherstpartofthemodelpresentedinthischapteristorstdevelopamathematicalalgorithmthatcanpredicttheoverallbehaviorofNW-DSSCswithnanowirescomposedofaconductivecoreandasemiconductiveshell.Secondly,thecomputationwillbeusedtounderstandhowtheinterfacialprocessesareeffectedbythepresenceofanelectriceldwithinthenanowire.Thisisdonebyarticiallyeliminatingtheelectriceldandcomparingthedynamicsoftheinterfacialprocesses.TheaimofthecomputationspresentedinthischapteristoquantifythebenetsofthepresenceofanelectriceldsothatsomeincitecanbegainedtowardexperimentalimprovementstoNW-DSSCs.Accompanyingthischapter,inChapter6,isanextensionofthemodeltoanidealsystemthatprobestheoptimalnanowirephotoanodeconguration.Chapter6ismeanttoprovidedirectionandmotivationforexperimentalworkgiventheobstaclesassociatedwiththefabricationofultra-highsurfaceareananowirearrays. 5.2ModelDevelopment 5.2.1OverallCellDesignFigure 5-2 adepictsthelengthscalesassociatedwiththeoverallNW-DSSC.Here,thecoaxialnanowirehasaconductivecoreofradiusroandlength`o,asemiconductingshellthatisboundedbetweenr2[ro,sc+ro]andz2[0,`o]andtheelectrolyteregionisboundedbetweenr2[sc+ro,el+sc+ro]andz2[0,`o],whereelishalfofthenanowire-nanowirespacing,scisthesemiconductorshellthicknessand`)]TJ /F5 11.955 Tf 12.79 0 Td[(`oisthedistancefromthecounterelectrodetothetopofthenanowire,respectively.TomaintainthehighsurfaceareascomparabletoNP-DSSCs,thenanowirearrayshould 76

PAGE 77

consistofnanowireswithhighaspectratiosanddensity.Therefore,anycontributionstophotovoltaicperformancefromthetipsofthenanowiresoratthesemiconductor/TCOsubstrate(i.e.theprojectedareaofthephotoanode)isneglectedastheplanarsurfaceareacontributesonlyaminorfractionofthetotalphotoactivesurfacearea. Figure5-2. (a)isaside-viewofthenanowirephotoanodedepictingthedimensionsofinterest,(b)isthetop-viewofan(assumed)hexagonallyclosedpackednanowirearraydepictingthedimensionsandtheneglectedregionsoftheelectrolytedomain. ThoughthedomaindepictedinFigure 5-2 istwo-dimensional,scalingargumentsaremadetosimplifythemathematicsanddecreasecomputationalexpense.Thedifferentialoperator,r=@ @r+@ @z,isapproximatedgiventhehighaspectratioofthenanowirestructuresmodelledinthissystem.Thisoperatorispresentintheequationsofbulkchargetransportinboththeelectrolyteandthesemiconductor.ScalingthespacialvariablesasZ=z=`oandRel=r)]TJ /F5 11.955 Tf 11.95 0 Td[(sc)]TJ /F11 11.955 Tf 11.95 0 Td[(ro elandRsc=r)]TJ /F11 11.955 Tf 11.96 0 Td[(ro sc,whereZisthenon-dimensionallengthscaleinthez-directionandRelandRscarethenon-dimensionallengthscalesintheradialdirectionforelectrolyteandsemiconductor, 77

PAGE 78

respectively.rbecomes: rF=1 j@ @Rj+1 aj@ @ZF(5)similarly r2F=1 (j)2@ @R2j+1 (aj)2@ @Z2F(5)whereaj=`o=jistheaspectratioassociatedwiththesemiconductorandelectrolyteregionsandjreferstoelorsc.Inthisstudy,thelengthsscalesforthenanowirewillbeontheorderof1-100mfor`oandontheorderof10nmforscandel,respectively.Thisgivesvaluesforajontheorderof102to104andthusfortheseaspectratios,randr2canbeapproximatedas: rF'1 j@ @RjF(5)and r2F'1 (j)2@2 @R2jF(5)Ofcourse,Equations( 5 )and( 5 )areonlyreasonableapproximationsifchangeswithrespecttothestatevariablesintheaxialdirectionareonthesameorderorsmallerthanchangestothosevariablesintheradialdirection.Thus,ifthegradientofanystatevariableintheaxialdirectionistoolargewithrespecttothetotalaxiallength,theapproximationsofEquations( 5 )and( 5 )arenotreasonable.Thethicknessinwhichlargechangesinthestatevariables(i.e.potential,concentration,etc.)arelargeisdeterminedbytheregionoverwhichchargedensityvariesdramatically.ThisthicknesscanbecorrelatedtotheDebyelength.Inboththesemiconductiveorelectrolyteregion,theDebyelengthisrelatedtotheoveralchargedepletion/accumulationregionwidth.Thisregionisgovernedbybothmigrationalanddiffusionaltransportofchargecarriersinthesystemanddictatesthe 78

PAGE 79

interfacialpotentialdrop.TheDebyelength,el,foranelectrolytecanbewrittenas: el=2664"elRT F2Xiz2iCi,137751=2(5)whereCi,1,"jandziarethebulkorreferenceconcentrationsoftheelectrolyteions,theelectrolytepermittivityandthechargenumberoftheelectrolytespecies,respectively.Thethicknessoverwhichchargedensityvariesistypically20elandisconsideredthediffuseregionwheretheelectrolyteisnotelectricallyneutral(i.e.XiziCi6=0). 106 GiventhevalueslistedinTable 5-2 ,Equation( 5 )dictatesthatel=0.945nm,thustheregionoverwhichelectroneutralitydoesnothold(i.e.thespacechargeregionoftheelectrolyte)isapproximately20nm.FromEquation( 5 ),theDebyelengthforthesemiconductor,sc,canbeobtained: sc="scRT F2(Nd)]TJ /F11 11.955 Tf 11.95 0 Td[(Na)1=2(5)whichdictatessc=28.2nminthesemiconductorfromthevalueslistedinTable 5-2 .ThewidthofthespacechargeregionislargerthantheDebyelengthbyafactorof(2FV=RT)1=2,whichhasavalueof6.84foraninterfacialpotentialdropof0.6V(thedarkinterfacialpotentialdifferenceofaNP-DSSC). 97 Thus,thewidthofthespacechargeregionisapproximately200nminthesemiconductiveshellofthenanowire.Ofcourse,itiswellunderstoodthatthedepletionregioninasemiconductorismuchlargerthanthatofanelectrolytewhenthetwoareinelectricalcontact.GiventhevaluesobtainthroughEquations( 5 )and( 5 )forthedepletionregionsoftheelectrolyteandsemiconductor,theapproximationsgivenbyEquations( 5 )and( 5 )maynotbevalidinthesemiconductorwithinaround200nmfromtheITOcurrentcollectororwithinabout20nmfromtheITOintheelectrolyte.However,giventhelengthofthenanowiresandthehighdegreeofsurfacearea,theseregionsonlyencompassasmallportionoftheoverallphotoactivesurfacearea.Forexample,thisregiononly 79

PAGE 80

encompassesaround1%ofthetotalphotoactivesurfaceareainthecaseofcore-shellnanowireswithlengthsof10m. 5.2.2InterfacialReactionsandPotentialDistributionTheinterfacialgenerationandtransferofchargeattheelectrolyte-dye-semiconductorinterfaceinvolvesacomplexarrangementofseriesandparallelreactionpathwaysasdepictedinFigure 5-3 .Theuniquecombinationofenergylevelsassociatedwiththeanatasetitaniasemiconductor,thedye'sLUMOelectronicstate,andtheREDOXlevelaswellasthechargetransferkineticsoftheI)]TJ /F5 11.955 Tf 7.09 -4.34 Td[(=I)]TJ /F3 7.97 Tf -1.59 -7.97 Td[(3electrolyteallowforveryefcientchargegenerationandtransferperformanceaswellasminimizebackreactionofphotogeneratedcharge.Reactions1through7willbeconsideredinthisstudy(markedinredinFigure 5-3 )astheyhavebeendevelopedpreviouslyforNP-DSSCsandproducedagoodcorrelationwithexperimentaldata.ThereactionslistedinFigure 5-3 havebeendevelopedpreviously 99 butwillbeoutlinedinageneralnotation,accordingtothenotationofOrazemandNewman,foreaseofreading. 107 Asidefromthereactionassociatedwithdyephotoexcitationandrelaxation,theoverallrateofthereactionsinFigure 5-3 canbewrittenasthedifferencebetweentherespectiveforwardandbackwardrates.Ifthereactionfurtherdependsonapotentialdifferenceoversomespacialdomain,thisreactioncangenerallybewrittenas: rl=kf,leba4lYiCpi,li)]TJ /F6 11.955 Tf 11.95 0 Td[(kb,le)]TJ /F3 7.97 Tf 6.59 0 Td[(bc4lYiCqi,li(5)wheretherateofreaction,l,isexpressedashavingButler-Volmerkinetics.Thegeneralreactionisintermsoftheconstantsassociatedwiththeforwardandbackwardrate,kf,l&kb,landtheanodicandcathodicexponentialconstants,ba=(1)]TJ /F5 11.955 Tf 12.88 0 Td[()nF=RTandbc=nF=RT,whicharerelatetotheTafelslopeforthereaction.Thereactionenergeticsareassumedtobesymmetricabouttheactivationenergyi.e.thesymmetrycoefcient,=1=2,andba=bc=19.47nV)]TJ /F3 7.97 Tf 6.59 0 Td[(1.Theordersoftheanodic,pi,lorcathodic,qi,l,reactionarerelatedtothestoichiometiccoefcients,si,l,and,inthis 80

PAGE 81

Figure5-3. Thechargegeneration,interfacialtransferandbulktransportisshownintheuppercartoon,theinterfacialreactionsdepictedinthelowerdiagramaccountforallinterfacialchargetransfereventsthoughonlythoseinredarecurrentlybeingincludedinthemodell. 81

PAGE 82

notation,havebeenpreviouslydenedbyOrazemandNewman. 107 si,l=8>>>>>><>>>>>>:pi,lforsi,l>0)]TJ /F6 11.955 Tf 9.29 0 Td[(qi,lforsi,l<00otherwiseTheinterfacialreactionsmodeledbyPennyet.al.arelistedinTable 5-1 .ThisinterfacialmodelneglectsthesurfacechargeduetoadsorbedchargecarriersandionsthatwouldotherwisebeaccountedforinamodeloftheinnerandouterHelmholtzaswellasthespacechargelayersattheinterfaceintheelectrolyteandsemiconductor,respectively.Giventhatthephotoactivedyemaynotcompletelycoverthesurfaceofthesemiconductor,therearetworeactiveinterfacestoconsider:theelectrolyte-dye-semiconductorandtheelectrolyte-semiconductorinterface(shownintheuppercartoonofFigure 5-3 .Thisinitialstudyisnotconsideringsurfacetrapstatesandtakingtheconcentrationofholesattheinterfacetobebalancedbythedensityofstatesandconcentrationofelectrons,Ch=)]TJ /F2 11.955 Tf 22.05 0 Td[()]TJ /F6 11.955 Tf 11.96 0 Td[(Ce.Thoughthesereactionsandcorrespondingratesofreactionhavebeenpresentedelswhere 99 ,thefollowingparagraphshighlightthefundamentalcomponentstoaidinunderstandingthemodelasawhole.TheprimarydifferenceinTable 5-1 fromtheworkofPennyet.al.isthat,insteadofscalingthereactionratesbythesurfaceareatovolumeratio,theseratesaremultipliedbythenanowirelength.Ifnanowiredensityisconstant,itisexpectedthattheseratesshouldincreasewithincreasingnanowirelength.Furthermore,increasesinnanowiredensityshouldalsocorrespondtoanincreaseinthetotalratesofreactionandthuscurrent.Thisisaccountedforlaterwhenintegratingoverthenanowirelengthtoobtainthetotalcurrentdensity.Reaction(1)representstheonlydirectsemiconductor-electrolytechargetransferpathwayandthusistheonlyreactionthatispresentundernoilluminationconditionand 82

PAGE 83

Table5-1. DSSCInterfacialReactionRates #ReactionRate (1)bRed+nh+kf,1)439()]TJ /F5 11.955 Tf 8.1 0 Td[(*))439()]TJ /F7 7.97 Tf -2.47 -7.53 Td[(kb,1dOx+ne)]TJ /F6 11.955 Tf 29.27 3.75 Td[(_1 _o1,ref=Cred Cred,1bCh Ch,1nexp[ba(sc)]TJ /F5 11.955 Tf 11.95 0 Td[(el)]TJ /F5 11.955 Tf 11.96 0 Td[(o1)])]TJ /F13 11.955 Tf 11.29 16.86 Td[(Cox Cox,1dCe Ce,1nexp[)]TJ /F6 11.955 Tf 9.3 0 Td[(bc(sc)]TJ /F5 11.955 Tf 11.96 0 Td[(el)]TJ /F5 11.955 Tf 11.96 0 Td[(o1)](2)S+h)166(!S1r2=R()`oCS()ln(10)ho()exp()]TJ /F5 11.955 Tf 9.3 0 Td[(()CSln(10)loZ)d(3a)S1k3a)292(!S3r3a=k3a`oCS1(3b)S3k3b)275(!Sr3b=k3b`oCS3(4a)S1+h+k4a)292(!S++e)]TJ /F6 11.955 Tf 38.49 -4.34 Td[(r4a=ko4a`oCS1exp[ba(sc)]TJ /F5 11.955 Tf 11.95 0 Td[(oe1)](4b)S3+h+k4b)275(!S++e)]TJ /F6 11.955 Tf 38.38 -4.34 Td[(r4b=ko4b`oCS3exp[ba(sc)]TJ /F5 11.955 Tf 11.95 0 Td[(oe3)](5)S++e)]TJ /F2 11.955 Tf 10.41 -4.33 Td[()275(!k5bh++Sr5=)]TJ /F6 11.955 Tf 9.3 0 Td[(ko5`oCeCS+ CDtexp)]TJ /F6 11.955 Tf 9.3 0 Td[(bc(sc)]TJ /F5 11.955 Tf 11.95 0 Td[(oS+)(6a)dOx+nS1)314()315(!kb,6anS++bRedr6a=)]TJ /F6 11.955 Tf 9.3 0 Td[(kob,6a`o)]TJ /F6 11.955 Tf 5.48 -9.68 Td[(CS1nexp[)]TJ /F6 11.955 Tf 9.3 0 Td[(bc(oe1)]TJ /F5 11.955 Tf 11.96 0 Td[(el)](6b)dOx+nS3)305()306(!kb,6bnS++bRedr6b=)]TJ /F6 11.955 Tf 9.3 0 Td[(kob,6b`o)]TJ /F6 11.955 Tf 5.48 -9.68 Td[(CS3nexp[)]TJ /F6 11.955 Tf 9.3 0 Td[(bc(oe3)]TJ /F5 11.955 Tf 11.96 0 Td[(el)](7)bRed+nS+kf,7)450()452(!dOx+nSr7=kof,7`o(CS+)nCred Cred,1dexpba(oS+)]TJ /F5 11.955 Tf 11.95 0 Td[(el) givesrisetothedarkcurrent.Thisreactioncanonlytakeplaceatsemiconductorsurfacesitesthatarenotoccupiedbydyemoleculesandsothevariablehasbeendenedastheportionofthesemiconductorsurfacesitesthatareoccupiedbychemi-adsorbeddyemolecules.Thus1)]TJ /F5 11.955 Tf 12.93 0 Td[(isthefractionofthetotalsurfaceareaavailableforthedark-currentReaction(1)totakeplace.Reaction(2)accountsforthephotoexcitationofagroundstatedyemolecule,S,totheprimaryexcitedelectronicdyestate,S1.Therateofthisreactionisafunction 83

PAGE 84

ofthewavelengthdependentphotonux,ho(),molarextinctioncoefcientofthedyemolecule,(),andquantumyieldofthedyemolecule,(),respectively.Thesolarradiationintermsofho()wasobtainedfromtheNationalRenewableEnergyLaboratoriesdatabase,theextinctioncoefcientwasobtainexperimentallythroughspectroscopyandthequantumyieldwasobtainfromtheliterature. 108 TherateofthisreactionalsodecaysalongthenanowirelengthaccordingtoBeer'sLawandisafunctionofS.Itisimportanttonotethatthisabsorbancemodelneglectstheabsorbanceofthenanowirecoreandshellmaterialaswellastheelectrolytethatpermeatesthephotoanodebutwillbeincludedinasubsequentpublication.Additionally,r2doesnotincludeanyadditionalphotonicorplasmonicinteractionsthatwouldbeuniquelyfoundinorderedstructuresthatotherwisearenotpresentinnanocrystallinelms. 87 Reactions(3a)and(3b)representtherelaxationoftheexciteddyemoleculethroughanintermediatetripletelectronicstate,S3.Reactions(4a)and(4b)representtheinjectionofanelectronfromeitherS1orS3intotheconductionbandofthesemiconductor.Otherwise,photo-generatedelectronscanbelosttotheelectrolyte,theseeventsaregivenbyReactions(6a)and(6b).TheratesassociatedwithReactions(4a),(4b),(6a)and(6b)havebeenassumedtobedependentonlyontheconcentrationoftherespectiveexciteddyestate(S1orS3)duetothelowconcentrationofdyeintheseelectronicsstatesgivenbytheultrafastelectroninjectionanddyerelaxationrates.RatesforReactions(4a)and(4b)areassumedtobeonlyanodicindirectionwiththepotentialdrivingforcegivenbythedifferencebetweentheinterfacialpotentialinthesemiconductorandthepotentialoftheS1orS3electronicstate,i.e.(sc)]TJ /F5 11.955 Tf 12.49 0 Td[(e1)and(sc)]TJ /F5 11.955 Tf 12.49 0 Td[(e3),respectively.Similarly,RatesforReactions(6a)and(6b)areconsideredtobepurelycathodicandrepresenttwolossmechanismstothephotogeneratedcurrent.ThedrivingforceforReactions(6a)and(6b)arethatofthedifferencebetweentherespectiveexciteddyepotentialandthatoftheinterfacialpotentialoftheelectrolyte,i.e.(e1)]TJ /F5 11.955 Tf 11.95 0 Td[(el)and(e3)]TJ /F5 11.955 Tf 11.95 0 Td[(el),respectively. 84

PAGE 85

Reaction(5)istheonlyotherphotogeneratedcurrentlossmechanismconsideredinthisstudy.Uponexcitedstatedyeelectroninjectionintotheconductionbandofthesemiconductor,theelectroncanbelosttoanoxidizedstatedye.ThisreactionrateisdependentonboththeinterfacialconcentrationofelectronsaswellastheconcentrationofS+.TheRateofReaction(5)istakentobepurelycathodicindirectionandthereactionisdrivenbythedifferencebetweentheinterfacialsemiconductorpotentialandthatoftheS+,i.e.(sc)]TJ /F5 11.955 Tf 11.95 0 Td[(S+).Reaction(7)accountsfortheregenerationoftheoxidizedstatedye,S+,followingaS1orS3electrontransferreaction(r4a,r4b,r6aorr6b)throughelectrondonationbyareducedstateion,Red,intheelectrolyte.TherateofReaction(7)isdependentonboththeconcentrationofRedandS+andisconsideredtobepurelyanodic.ThedrivingpotentialofthisreactionisthatofthedifferencebetweenthepotentialofS+andtheinterfacialpotentialintheelectrolyte,i.e.(S+)]TJ /F5 11.955 Tf 11.95 0 Td[(oel).Accordingtotheexpressionforr5,thislossmechanismismostpronouncedwhenthereexistsahighinterfacialconcentrationofelectronsaswellasmoderatetolargenegativeinterfacialpotentialsinthesemiconductor.Thishighlightstheimportanceofdevelopingasystemwheretheelectronsarepreferentiallydrivenawayfromtheinterfacetopreventthislossmechanismandincreasedeviceperformance.Furthermore,thepresenceofaninterfacialelectriceldwithinthesemiconductorwouldincreaser4aandr4b,whichwoulddecreasetheamountofS1andS3availableforthelossreactionsr6aandr6b.Inordertosolvefortheinterfacialdyeconcentrations,amaterialbalanceontheindividualelectronicdyestateconcentrationshasbeenpresented. 99 Thenetrateofproductionand/orconsumptionofSgisequaltozero: r2=r3b+jr5j+nr7(5) 85

PAGE 86

Theabsolutevaluearoundr5inEquation( 5 )isinplaceduetothefactthattherateisthatofproductionofSbuttherateitselfisnegativegiventhatthereactioniscathodic(representingthelossofanelectroninthesemiconductortoanoxidizeddyemolecule).Furthermore,balancesonCe1andS3yield: r2=r3a+r4a)]TJ /F6 11.955 Tf 11.95 0 Td[(njr6aj(5) r3a=r3b+r4b)]TJ /F6 11.955 Tf 11.96 0 Td[(njr6bj(5)wheretheabsolutevaluestakeninEquations( 5 )and( 5 )areinplaceforthesamereasonasinEquation( 5 ).AddingEquations( 5 )through( 5 )yieldsamoreconvenientequationthatequatestheuxofchargeoneithersideoftheinterface: r4a+r4b+jr5j=n(jr6aj+jr6bj+r7)(5)Thusiftheinterfacialvaluesforsc,el,Ce,CoxandCredareknownthenEquations( 5 )through( 5 )aresufcienttosolveforthedyestateconcentrationsattheinterfacegiventhattheinterfacialpotentialsinthesemiconductorandelectrolytearespecied. 99 5.2.3BulkChargeCarrierPhysicsintheSemiconductorandElectrolyteEquilibriuminthesystemcanbedenedbyequatingtheelectrochemicalpotentialofchargecarriersinthesemiconductortoionsintheelectrolyte.Theelectrochemicalpotential,iforchargedspecies,i,isdenedas: i=refi+RTln(Cifi)+ziFj(5)wherejdenotestheregion(i.e.,semiconductororelectrolyte)inwhichthepotentialjisbeingevaluated.Equation( 5 )alsoservestodenetheactivitycoefcient,fi,whichisassumedtobeunityinthisstudy. 86

PAGE 87

ThroughEquation( 5 )theuxofspeciesiisproportionaltotheproductofthespeciesconcentrationandthegradientoftheelectrochemicalpotential,i.e.: Ni=)]TJ /F6 11.955 Tf 9.3 0 Td[(uiCiri(5)wherethechargecarrier/ionicmobility,ui,ofspeciesiin( 5 )iscommonlyrelatedtothediffusioncoefcientthroughtheEinsteinSmoluchowskirelation: ui=Di RT(5)writtenherewithunitsasamacroscopicquantity.Giventhehighdegreeofconnementassociatedwiththesemiconductiveshell,thisregionisconsideredtobenon-electricallyneutral.ThusthepotentialisgivenbyPoisson'sEquation. r2j=)]TJ /F6 11.955 Tf 11 8.08 Td[(F "jj(5)where"jandjisthepermitivittyandthechargedensityinregionj.Thechargedensityisgivenby j=Xizi,jCi,j(5)Foranelectricallyneutralregionj=0,inthiscasethepotentialdistributionisgivenby rj=)]TJ /F14 11.955 Tf 12.33 8.08 Td[(i )]TJ /F6 11.955 Tf 13.15 8.08 Td[(F XiziDirCi(5)wherethecurrentisgivenbyi=XiziNiandtheconductivityisgivenby,=F2Xiz2iuiCi.Finally,thegradientoftheuxwithinthesemiconductorortheelectrolyteisdistributedaccordingtothenetrateofhomogeneousproductionand/orconsumptionofeachchargedspecies. rNi=RH,net(5) 87

PAGE 88

TheroperatorinEquations( 5 ),( 5 )and( 5 )arescaledtoaonedimensionalderivativeaccordingtoEquations( 5 )and( 5 ).Thustheequationsgoverningchargetransportandthepotentialdistributionwithinthesemiconductorare: @2sc @R2=)]TJ /F6 11.955 Tf 9.3 0 Td[((sc)2F "sc(Nd)]TJ /F6 11.955 Tf 11.96 0 Td[(Ce)(5) Ne,R=De sc)]TJ /F5 11.955 Tf 10.5 8.09 Td[(@Ce @R+fCe@sc @R(5) @Ne,R @R=scRH,net,e(5)wheretheNe,Ristheuxsolelyintheradialdirection.ForthisstudyholetransportisnotmodelledastheholeconcentrationistakentobeCh=()]TJ /F2 11.955 Tf 9.43 0 Td[()]TJ /F11 11.955 Tf 11.96 0 Td[(Ce)andthusRH,netisgivenbyasimpleband-to-bandkineticmodel. 109 Fortheelectrolyte,againutilizingEquations( 5 )through( 5 ),theequationsthatgovernconcentrationandpotentialdistributionwithinthediffusionlayerare: @el @R=)]TJ /F5 11.955 Tf 9.3 0 Td[(el_R )]TJ /F6 11.955 Tf 13.15 8.08 Td[(F XiziDi@Ci @R(5) Nox,R=Dox el)]TJ /F5 11.955 Tf 10.49 8.09 Td[(@Cox @R+fCox@el @R(5) Nred,R=Dred el)]TJ /F5 11.955 Tf 10.49 8.08 Td[(@Cred @R+fCred@el @R(5) @Nox,R @R=0(5) @Nred,R @R=0(5)and @Csup @R+fCsup@el @R=0(5)becauseNsup,R=0.Becauseofthescalingofthepreviousequations,thetransportofionsintheaxialdirection(Z-direction)hasbeenneglected.ContributionstoowofionsintheZ-directioncanbeaddedtoEquations 5 and 5 by,insteadofequatingthese 88

PAGE 89

equationstozero,equatingtheseequationstoahomogeneoussourcetermthataccountsfortheaxialowofions.ThisbecomesmoreimportantwhenmodelinglongernanowirephotoanodesandwillbeincludedinChapter6. 5.2.4BoundaryConditionsAttheinterfacetheboundaryconditionsareincorporatedintothemodeloftheinterface: Ne,R=)]TJ /F6 11.955 Tf 11.29 -.16 Td[(((1)]TJ /F5 11.955 Tf 11.95 0 Td[()nr1+(r4a+r4b+r5))(5) Nox,R=((1)]TJ /F5 11.955 Tf 11.95 0 Td[()dr1+(r6a+r6b+r7))(5) Nred,R=)]TJ /F6 11.955 Tf 11.3 -.17 Td[(((1)]TJ /F5 11.955 Tf 11.96 0 Td[()br1+(r6a+r6b+r7))(5) Nsup=0(5)Thus,thecurrentasafunctionoftheaxialdirectioncanbegivenbyi(Z,V)=)]TJ /F11 11.955 Tf 9.29 0 Td[(nNe,R=nNox,R=)]TJ /F11 11.955 Tf 9.3 0 Td[(nNred,R.ThepotentialdropattheinterfacecanbeapproximatedbyGauss'sLawwhichdictatesthatthedifferencebetweenthegradientofpotentialdropinthetworegionsmustbebalancedbythenetinterfacialchargeineachregion. "sc sc(osssc)]TJ /F5 11.955 Tf 11.96 0 Td[(dye))]TJ /F5 11.955 Tf 13.15 8.09 Td[("el eldye)]TJ /F5 11.955 Tf 11.96 0 Td[(ohpel=F SVCS+(5)wherejisthedoublelayerthicknessinregionjandthepotentialsarereferencedtotheouterspacechargelayerandtheouterHelmholtzplanesforthesemiconductorandelectrolyte,respectively.Equation( 5 )denesthepotentialdropattheinterfaceinboththesemiconductorandtheelectrolytesuchthat: @sc(R=1) @R=scdye)]TJ /F5 11.955 Tf 11.95 0 Td[(osssc sc(5)and @el(R=0) @R=elohpel)]TJ /F5 11.955 Tf 11.96 0 Td[(dye el(5)Theboundaryconditionsintheelectrolytearethatthepotentialatthenanowire-nanowiresymmetricboundaryiszeroandattheouterboundaryofthediffusionlayerall 89

PAGE 90

concentrationshavetheirbulkvalues.Thepotentialatthesemiconductor-metalcontactistheappliedpotentialandtheconcentrationofelectronsisproportionaltotheratioofelectronuxandelectriceld: Ce(R=0)=scRTNe,R FDe@sc @R(5)Furthermorethepotentialatthemetal-semiconductorinterfaceistheappliedpotentialanditisassumedtobeanidealohmiccontactwithnobuild-upofcharge,i.e.theelectriceldiszero.Theelectrolytepotential20Debyelengthsawayfromthenanowiresurfaceistakentobezeroforthisstudy. 5.2.5ConstantValuesUsedandNumericalAlgorithmThenumericalvaluesfortheconstantsusedinthismodelarelistedinTable 5-2 .Mostareobtainedfromtheliteraturethoughsomeareexperimentallycalculatedorassumed.TheabovemodelandboundaryconditionswerediscretizedusingacentraldifferenceapproximationandsolvedusingamodiedLevenburg-Marquardtrootndingapproach.Thesystemofequationswerebrokenintotwosets:thoseconcerningtheinterfacialmodel(i.e.Equations 5 5 )andthoseconcerningbulkchargecarriertransportinboththesemiconductorandelectrolyte(i.e.Equations 5 through 5 & 5 through 5 ).Additionally,thestatevariablesineachsystemwerescaledtobeontheorderof1throughaneigen-valuematrix.Theinterfacialboundaryconditionscoupledtothetwosystemsofequationsand,aseachsystemconvergedtoanacceptabletolerance(10)]TJ /F3 7.97 Tf 6.59 0 Td[(39),axedpointiterationwasperformedbetweenthetwosystemsofequations.Thexedpointiterationcontinueduntilboththeinterfacialboundaryconditionsweresatisedandsharedinterfacialvariablesconvergedtoequivalentvaluesabouteachxedpointtoatoleranceof10)]TJ /F3 7.97 Tf 6.58 0 Td[(10.AgraphicalrepresentationofthealgorithmcanbefoundinAppendixB.Furthermore,initialguesseswerechosenbasedoneitherknownxedconstantssuchasbulk 90

PAGE 91

concentrationsorassumptionsconcerningwhattherelativecurrentoutputofthedeviceshouldbe.Inputofmodelparameterssuchastolerances,variedconstantsanddimensionsaswellasdiscretizationandresolutionparametersisdonethroughacustomgraphicaluserinterface(GUI)thatalsoplotsrelaventoutputdataasthesolutionproceeds.Thesolutionprocessbeginsatadesignatedappliedvoltageandsolvesthesystemforsubsequentvoltagepointsusingthesolutionforthepreviousvoltagepointastheinitialguessforthenewvoltagepoint.Thecurrentisobtainedbyintegratingthelocalcurrent,i(Z,V),overthelengthofthenanowireusingvariablepointGaussianquadraturethrough i(V)=103SV"pZ`o0i(Z,V)dZ(5)where"pisthephotoanodeporosity(assumedtobe0.5inthischapter)andi(V)hasunitsofmA/cm2.Furthermore,thesurfaceareatovolumeratioisrelatedtothenanowiredensity,nwby SV=Dnw+1 `o(5)whereDisthetotalnanowirediameter(ro+sc+el)andthetwotermsinEquation 5 arefromthesurfaceareaofthenanowireandtheprojectedsurfacearea.NotethatEquation 5 isindependentofnanowireordering. 5.3ResultsandDiscussion 5.3.1DevicePerformanceandExperimentalComparisonThemodeloutlinedaboveprobesthesteadystatedynamicsofNW-DSSCs.Therefore,themoststraightforwardandconclusivewaytodetectmodelaccuracyisbycomparisonoftheexperimentalandcalculatedpolarizationcurveswithDSSCsbasedonwell-denednanowirearrays.Thestandardrateconstantsforthefortheinterfacial 91

PAGE 92

Table5-2. ConstantsfortheNumericalModel ConstantValueNotes Ce,1/Na1.66x10)]TJ /F3 7.97 Tf 6.58 0 Td[(8mol/cm3Bulkelectronconcentration/DopantLevel 97 110 Cox,15x10)]TJ /F3 7.97 Tf 6.59 0 Td[(5mol/cm3Oxconcentration(Solaronix)CRed,14.5x10)]TJ /F3 7.97 Tf 6.59 0 Td[(4mol/cm3Redconcentration(Solaronix)CSt7.5 SVx10)]TJ /F3 7.97 Tf 6.59 0 Td[(5mol/cm2TotaldyesurfaceconcentrationDe5cm2/sElectrondiffusioncoefcientinsingle-crystalanataseTiO2DOx&DRed5x10)]TJ /F3 7.97 Tf 6.59 0 Td[(5cm2/sAssumedOxandReddiffusioncoefcientio1,ref5x10)]TJ /F3 7.97 Tf 6.59 0 Td[(13mA/cm2Reaction1exchangecurrentdensity 1 ko3a6.67x1012s)]TJ /F3 7.97 Tf 6.59 0 Td[(1Standardrateconstantforr3a 111 ko3b1.67x106s)]TJ /F3 7.97 Tf 6.59 0 Td[(1Standardrateconstantforr3b 112 ko4a1.0x1013s)]TJ /F3 7.97 Tf 6.58 0 Td[(1Standardrateconstantforr4a 1 111 ko4b5.0x1010s)]TJ /F3 7.97 Tf 6.58 0 Td[(1Standardrateconstantforr4b 111 ko55.0x104s)]TJ /F3 7.97 Tf 6.59 0 Td[(1Standardrateconstantforr5 1 ko6a1.0x102s)]TJ /F3 7.97 Tf 6.59 0 Td[(1Standardrateconstantforr6a 113 ko6b1.0x102s)]TJ /F3 7.97 Tf 6.59 0 Td[(1Standardrateconstantforr6b 113 ko71.0x108s)]TJ /F3 7.97 Tf 6.59 0 Td[(1Standardrateconstantforr7 113 )]TJ /F1 11.955 Tf 71.45 0 Td[(1.125x10)]TJ /F3 7.97 Tf 6.59 0 Td[(3mol/cm3AnataseTiO2densityofstates 114 sc0.2nmSemiconductorinterfacialplaneofchargewidthel1nmSemiconductorinterfacialplaneofchargewidthnw1010cm)]TJ /F3 7.97 Tf 6.59 0 Td[(2orcalculatedNanowiredensitySe1-1.3Vvs.SCEDyeprimaryexcitedstateenergylevel 115 Se30.0Vvs.SCEDyetripletstateenergylevel 116 S+0.5Vvs.SCEOxidizedDyeenergylevel 115 reactionslistedinTable 5-1 forNP-DSSCs;valuesforthestandardrateconstantscanbefoundinTable 5-2 andareassumedtonotdeviateinNW-DSSCsforthisstudy.PolarizationcurveswerecalculatedbasedonthismodelandcomparedtoDSSCsbasedontheindium-dopedZnO(IZO)nanowirearraysdevelopedinChapter4,alsotitania-coatedZnOnanowirearraysdevelopedbyLawet.al. 8 Figure 5-4 showsthepredictedandactualbehaviorforeachofthesedevices.Bothofthesedeviceshaveatitaniashellthicknessof10nm,whichwasfoundtobetheoptimalthickness,buttheZnOnanowiresaresixtimeslongerthantheIZOnanowires.ThedyesurfacecoveragewasobservedtobequitegoodforthedeviceinFigure 5-4 aandsoavalueof0.85was 92

PAGE 93

usedfor.Lawet.al.citedpoordyecoverageasareasonfordiminishedperformanceoftheZnO-basedDSSCbutdidnotreportavaluefor;therefore,avalueof0.77wasusedtotthedatainFigure 5-4 b. Figure5-4. ComparisonofexperimentalandcalculatediVcurvesforNW-DSSCsbasedontitania-coated(a)2.5mlongIZO(Chapter4)and(b)15mlongZnOnanowires. 8 ThemodelcapturesthequalitativefeaturesoftheIZO-basedDSSCs,includingtheshuntandseriesresistance,andadequatelypredictstheshort-circuitcurrentandopen-circuitvoltageoftheZnO-basedDSSCs.ThelargedeviationfromVocinpart(a)islikelyduetothepoorcrystallinenatureofthetitaniashellforthedevicesdiscussedinChapter4,whichhasbeenobservedbefore. 8 Deviationsfromthemid-rangeiVvaluesinbothNW-DSSCsarelikelybecauseofthesemiconductiveratherthanconductivenatureofthecorenanowirematerialassumedbythemodel.TheincreasedresistancefromthesemiconductivecoreisexpectedtoreducethecurrentintheiVcurves.ThisissupportedbythefactthattheseriesresistanceofcurvesmorecloselymatchforthebetterconductingIZOnanowires. 93

PAGE 94

Themodelisabletocapturesomeofthequalitativeandquantitativefeaturesoftheexperimentalpolarizationcurves.Inbothdevices,theshort-circuitcurrentispredictedbythemodel.Thedisparityinisccouldbeduetoerrorsinmeasurementofthedevicearea.Surprisingly,theloweredshuntresistancefoundintheIZO-basedDSSCsofFigure 5-4 aispredictedbythemodel.ThiswasanunexpectedresultgiventhatthesimplestformofGausssLawwasusedtomodeltheinterfacialpotentialdrop:oxidizeddyemoleculeswereassumedtobetheonlychargedsurfacespecies,andtheinnerplanesofchargewereneglected.WhilethemodelwasabletopredicttheVocfortheNW-DSSCsbasedonZnO(within2%),asshowninFigure 5-4 b,asignicantdeviationwasobservedfortheNW-DSSCsbasedonIZO.ThelargedeviationinVocforthesedevicesislikelyduetoapoorlycrystallinetitaniashell(seeChapter4),whichisacommonproblem. 8 ThemajordifferenceinthepolarizationcurvesofFigure5-4isthellfactor,whichisameasureofdeviceperformance.Inbothnanowiredevices,themodelpredictshighllfactors(0.7and0.74forIZOandZnONW-DSSCs,respectively).Theexperimentaldata,however,haslowerllfactorsof0.62and0.58forIZOandZnONW-DSSCs,respectively.Thesedeviationsinllfactorareprobablyassociatedwiththefactthatthemodelisassumingaconductivenanowirecorewhilethenanowiresintheexperimentsarecertainlysemiconductiveinnature.Thusinthecaseofthecomputation,theelectronsinjectedintothesemiconductorregionarequicklybeingsweptaway,allowingbetterchargetransport.Interestingly,theseriesandshuntresistanceofthecurvesfortheNW-DSSCsbasedonIZOarequitesimilar,whichisexpectedsincetheIZOnanowiresaremoreconductivethantheZnOnanowires.Infact,theratiooftheexperimentaltomodeledllfactorfortheNW-DSSCsbasedonIZOaremuchhigherthanthosebasedonZnO(0.89vs.0.78,respectively).ThisprovidesfurtherevidencethattheNW-DSSCsbasedonIZOcouldprovidepotentialbenetsoverZnOifmorecrystallinetitaniacoatingscanbefabricatedonIZO. 94

PAGE 95

Figure5-5. ThecalculatedpotentialdistributionswithinthedifferentdomainsoftheNW-DSSC.Thevoltageisassumedtobeappliedat0Debyelengthswithinthesemiconductor.Thepotentialwouldbeconstantwithinthesemiconductorregionintheabsenceofaeldandmostofthepotentialdropwouldoccurattheinterface. ThemodelcanalsoprovidepotentialdistributionsandconcentrationprolesfortherelevantspecieswithintheNW-DSSCs.Nochangeinpotentialwithinthesemiconductiveregionisexpectedinnanoparticle-baseddevices.Therefore,mostofthepotentialdropoccursacrossthesemiconductor-dye-electrolyteinterface.However,Figure 5-5 clearlyshowsthatNW-DSSCshavepotentialchangesacrossthesemiconductorregion,whichgeneratelargeelectricelds(slopeofFigure 5-5 ).Becausetheinterfacialelectriceldisnegative,injectedelectronswillhaveatendencytomigrateawayfromtheinterfaceandtowardthecurrentcollector.Animportantfeatureofthesepotentialdistributionsisthattheinterfacialelectriceldwithinthesemiconductor(slopeofFigure 5-5 )matchestheeldinthesemiconductor-dyeinterface,furtherindicatingthatthemodelissolvingthesystemcorrectly.Asshownintheinset,theelectriceldalsomatchesatthedye-electrolyteinterface.Figure 5-6 showsthedistributionofthenormalizedconcentrationofelectronsaswellastheoxidizedandreduceddye(Ce,COxandCRed,respectively)withintheirrespectivedomains.Theconcentrationofelectronsinthesemiconductiveregiondo 95

PAGE 96

Figure5-6. Theconcentrationprolesof(a)electrons,(b)oxidized(Ox),and(c)reduced(Red)electrolytescaledtotheirrespectivereferencevalues.TheconcentrationsofOxandReddonotdeviatemuchfromtheirreferenceconcentrationsbecauseofthehighconcentrationofelectrolyterelativetotheconsumption/productionofphoto-generatedelectrons.Incontrast,thedopantlevelinthesemiconductorislowrelativetotheamountofphoto-generatedandinjectedelectronsandtheconcentrationofelectronsdeviatesstronglyfromthereferenceconcentration. 96

PAGE 97

notdeviatestronglyfromthedopantlevelatshort-circuitcurrent(i.e.,zeroappliedbias).Itisimportanttonotethatthisdopantlevelislowincomparisontothemassiveuxofinjectedelectronsfromtheinterface.BecausethesemiconductiveregiononlyencompassesasmallfractionoftheDebyelength(sc=28.2nm),largedeviationsfromthereferenceelectronconcentrationareobservedatMid,whichisthemaximumpowerpoint,andVoc.Ontheotherhand,theelectrolyteregionisroughly20timeslargerthantheDebyelength(el=0.945nm)andtheconcentrationsofthedyespeciesarelargerelativetotheratesoftheirproduction/consumptionattheinterface.Therefore,COxandCRedbarelydeviatefromtheirbulkreferencevalues,asshowninpart(b)and(c)ofFigure 5-6 .Thetwoactiveelectrolytespeciesdisplayoppositebehaviorateachofthethreeappliedvoltages,whichisexpectedsincethereduceddyeisconsumedandtheoxidizeddyeisproducedattheinterface. 5.3.2EffectofInterfacialElectricFieldAninterestingfeatureofthemodelthatcannototherwiseeasilybeperformedexperimentallyisthattheelectriceld(ortheeffectofit)canbeturnedOFF.Thisisdonesimplybyeliminatingthemigrationterminthesemiconductoruxequationinthemodel,effectivelyforcingelectrontransporttobedrivenpurelybydiffusion.TheadvantageisthattheeffectoftheinterfacialelectriceldonthespecicprocesseswithintheDSSCcanbeprobed.ThemostcriticalprocesswithinallDSSCsisthetransferofexciteddye-electronstoeithertheelectrolyte(backreaction)orthesemiconductor(injection).Obviously,theaimofalldevicesistomaximizeinjectionandminimizebackreactions.ThiscompetitionlargelylimitstheelectrolytesthatcanbeusedinDSSCs.Althoughdifferentelectrolytescouldenhanceopen-circuitvoltage,electronbackreactionratesaretypicallyincreased.Theinjectionandbackreactionaredescribedbyratesr4a=4bandr6a=6b,respectively.ByturningtheelectriceldintheseNW-DSSCsOFF,theeffectoftheeldonchargetransfercanbeseen. 97

PAGE 98

Figure5-7. Comparisonoftheinjection(r4aandr4b)andbackreaction(r6aandr6b)ratesfortheONandOFFstatesoftheelectriceld.TheenhancementratiorelatestheONandOFFstates(writtenintheforwarddirection)tocharacterizetheeffectoftheinterfacialelectriceldontheperformanceofNW-DSSCs.Thereisessentiallynoenhancementintheinjectionrateofprimaryexcitedstates(4a)buta100-folddecreaseinelectronloss(6a)fromthisstate.Althoughthetripletstateinjectionrate(4b)decreasesbyafactorof100,theassociatedbackreactionrate(6b)decreasesbyafactorashighas10,000. Figure 5-7 showstheenhancementratiofortheprimary(4a)andtriplet(4b)photo-generatedelectroninjectionratesaswellastheprimary(6a)andtriplet(6b)back-reactionrates.Theenhancementratioforeachreactioniswrittenforelectrontransportintheforwarddirection.Therefore,theenhancementratioforthebackreactions(ratioofOFF/ONstates)isoppositeoftheinjectionreaction(ON/OFF).Anenhancementratioofunityindicatesthattheeldhasnoeffectontheprocesswhilevaluesgreaterthanunityindicateimprovementstochargetransferfromtheinterfacialelectriceld.AscanbeseenfromFigure 5-7 ,theprimaryinjectionrateremainsessentiallyunchangedwhilethebackreactionratedecreasesbyafactorofabout100inthepresenceofanelectriceld.Thisindicatesthatbackreactionforprimaryelectronsis100timesslowerinthepresenceofaninterfacialelectriceld,providingsubstantialbenetstochargetransport.Thedecreaseinelectroninjectionfromthetripletstateis 98

PAGE 99

surprising.However,chargetransportfromthetripletstateislessimportantthantheprimarydyestatesincethemajorityofthechargeisconcentratedintheprimaryexciteddyestate.Further,thisdecreaseisonly100timessmallerwhilethecorrespondingbackreactionrateshowsa10,000-foldimprovementtochargetransfer.Thiseffectivelyresultsina100-foldimprovementtothechargetransportofphoto-generatedelectronsfromthetripletstateofthedyetothesemiconductor. Figure5-8. ComparisonoftheinterfacialelectronbackreactionwithoxidizedstatedyemoleculesfortheONandOFFstatesoftheelectriceld. Anotherelectronlossmechanismisthedirecttransferofelectronsfromthesemiconductorconductionbandtotheoxidizedstateofthedye(Reaction5).AsshowninTable5-1,thisrateisafunctionoftheconcentrationofconductionbandelectronsatthesurfaceofthesemiconductor.Therefore,therateisexpectedtoincreaseastheconcentrationofelectronsatthesurfaceincrease.Interestingly,Figure 5-8 showsthatthiselectronlossrateincreaseswhenaninterfacialelectriceldispresentwithinthesemiconductor.However,thelossmechanismplateausatappliedvoltagesabove0.5V.Thisplateauislikelybecausetheoxidizeddyemoleculesarecompletelyreducedattheinterface,formingamasslimitedregime.Ingeneral,theincreaseinthisbackreactionin 99

PAGE 100

thepresenceofaninterfacialelectriceldcouldbebecausethesemiconductorcontainsanexcessofelectronsfromthelowerbackreactionwiththeelectrolyte. Figure5-9. Shownhereisthecalculatednetrateoftotalphoto-generatedelectronbackreactionscaledtothetotalrateofphoto-excitation(a)andtheinterfacialchargeinjectionefciency(b),denedasthetotalrateofelectron-to-semiconductorinjectionscaledbythetotalnetrateofelectronloss.Both(a)and(b)showmarkedimprovementswiththepresenceofaninterfacialelectriceldwithinthesemiconductor.Therateatwhichphoto-generatedelectronsislostisupwardsof500timessmaller(a),lendingtoa500-foldimprovementininterfacialinjectionefciency. Thevariousreactionpathwaysdescribedabovecanbesummarizedbylookingattheinternalefciencyofphoto-generatedelectronsthatgeneratecurrent.Figure 5-9 shows(a)thenetrateoflossofphoto-generatedelectronsscaledtotherateofphoto-excitationand(b)theinterfacialefciencydenedastheproportionofnetinjectiontonetbackreaction.Calculatedforbotheldonandnoeld,theadvantage 100

PAGE 101

oftheinterfacialelectriceldisapparentinbothFigures 5-9 aand 5-9 b.Asappliedvoltagereachesopen-circuit,thepresenceofaninternalelectriceldhasa500-foldpositiveeffectonbothcurves.ThisisanimportantconsiderationwhenconsideringusageofdifferentelectrolytesthatmaylendtowardshigherVocbuthaveanincreasedincidentofphoto-generatedelectronlosstotheelectrolyte.AlthoughitisnotcurrentlypossibletoconstructnanowiredeviceswithphotoactivesurfaceareaequivalenttotheirnanoparticlecounterpartsbythemethodsdescribedinChapter4,themodelcanestimatetheperformanceofNW-DSSCsifthissurfaceareawereobtained.NP-DSSCshaveoverallsurfaceareasaround1000timesgreaterthantheprojectedsurfacearea.Whilemanynanowiredensitiesanddimensionscanachievethissurfacearea,however,forthesakeofthiscomputationahexagonally-close-packedarrayofconductivenanowires,whichwere10nmindiameterand30minlengthwitha10nmtitaniashell,wereusedforthiscalculation. Figure5-10. Predictedpolarization(iV)curveforaDSSCbasedonahexagonally-close-packedarrayofnanowireswithadensityofapproximately3x1010cm)]TJ /F3 7.97 Tf 6.58 0 Td[(2.Thenanowireswithinthearrayconsistaconductivecore10nmindiameterand30minlengthcoatedwitha10nmtitaniashell.Thecalculateddeviceefciencyof13.9%iscomparabletoNP-DSSCswithsimilarphotoactivesurfaceareawhilethellfactorof0.75ishigher. 101

PAGE 102

TheiVcurvecomputedforthisNW-DSSCisshowninFigure 5-10 andcorrespondstoadeviceefciencyof13.9%andallfactorof0.75.WhileNW-DSSCscomposedofsemiconductivenanowiresoftenhavehigherllfactorsthanNP-DSSCs,thisisespeciallyhighforNW-DSSCs.Althoughthehighllfactormaybeduetoidealitiesassumedinthemodel,itisbelievedthatthehigherperformanceisduetotheconductiveratherthansemiconductivenanowirecore.Theimprovedconductivityhelpstomorequicklycollectelectronsfromthesemiconductor,reducinglosstotheelectrolyte.ThecalculatedefciencyforthisNW-DSSCismuchhigherthanaNP-DSSCwithanidenticalphotoactivesurfacearea(13.9%vs.12%,respectively).Evenifallfactorof0.6isused,whichiscommonforNW-DSSCs(seeChapter4andP.Yangandco-workers 8 ),theefciencywouldbeapproximately11%. 5.4ConclusionsThischapterintroducesacontinuum-basedmathematicalmodelofNW-DSSCsthatadequatelypredictsobservedexperimentalbehaviordespitetheassumptionofaconductivenanowirecore.GiventheabilitytoarticiallyswitchtheeffectofaninternalnanowireelectriceldOFF,thespeciccontributionstotheindividualinterfacialchargetransferratescanberealized.Notonlydoesthepresenceofanelectriceldinthesenanowiresdramaticallydecreasetheincidentofphoto-excitedelectronbackreaction,butitdoessowithoutasignicantdecreaseinelectroninjection.ThisiscompellingevidencefortheexperimentalinvestigationofNW-DSSCsthatarejunctionedwithanelectrolytethatisknowntoenhancephotovoltagebutsuffersfromincreasedinterfacialelectronbackreaction.Furthermore,thecalculatedeffectontheoverallinterfacialchargecollectionefciency,throughanenhancementfromelectriceldalone,isincreasedbyafactorof500.ThisenhancementmayallowNW-DSSCstohavelowerphotoactivesurfaceareascomparedtoNP-DSSCs,yetstillachievethesameefciencies. 102

PAGE 103

5.5ListofVariables Table5-3. OverallModelParameters SymbolSymbolNameUnits CiConcentrationofSpeciesi(mol=cm3)fF/RTV)]TJ /F3 7.97 Tf 6.59 0 Td[(1FFaraday'sConstant(96,485C=equiv)_CurrentDensity(mA=cm2)RGasConstant(8.314J=molK)jLocalPotentialofRegionj(V) Table5-4. BulkModelParameters SymbolSymbolNameUnits DiDiffusionCoefcientofSpeciesi(cm2=s)`oNanowireLength(cm)Ni,mMolarFluxofSpeciesiinDirectionm(mol=cm2s)OxOxidizedStateElectrolyte(I)]TJ /F3 7.97 Tf -1.59 -7.97 Td[(3)()RScaledRadialCoordinate()rjRadiusofRegionj(cm)RedReducedStateElectrolyte(I)]TJ /F1 11.955 Tf 7.08 -4.34 Td[()()SupSupportingElectrolyte(Li+)()ZScaledAxialCoordinate()ziChargeNumberofSpeciesi()"jPermittivityofRegionj(F=cm)LocalConductivity(S=cm)jDebyeLengthofRegionj(cm)iElectrochemicalPotentialofSpeciesi(J=mol)jChargeDensityofRegionj(mol=cm3)jThicknessofRegionj(cm) 103

PAGE 104

Table5-5. InterfacialModelParameters SymbolSymbolNameUnits ba,bcAnodicandCathodicInverseThermalVoltageV)]TJ /F3 7.97 Tf 6.59 0 Td[(1_oExchangeCurrentDensity(mA=cm2)ho()IncidentPhotonFlux(mol=cm2s)km,RateConstantofReactioninDirectionm(s)]TJ /F6 11.955 Tf 7.08 -4.34 Td[(1Ri,netNetHomogeneousReactionRateofSpeciesi(mol=cm2s)r`RateofReaction`(mol=scm2)S1ExcitedStateDye(primary)()S3ExcitedStateDye(triplet)()SgGroundStateDye()S+OxidizedStateDye()SVSurfaceAreatoVolumeRatio(cm)]TJ /F3 7.97 Tf 6.58 0 Td[(1))]TJ /F1 11.955 Tf 36.93 0 Td[(DensityofConductionBandStates(mol=cm3)iActivityCoefcientofSpeciesi(cm3=mol)jInterfacialPlaneofChargeThicknessofSpeciesi(cm)()MolarExtinctionCoefcient(cm2=mol)FractionDyeSurfaceCoverage()WavelengthofIncidentLight(cm)()DyeQuantumYield()o1ReferencePotentialforDarkCurrent(V) 104

PAGE 105

CHAPTER6OPTIMIZINGTHEPERFORMANCEOFDYE-SENSITIZEDSOLARCELLSBASEDONNANOWIREARRAYS 6.1IntroductionSeveralresearchershaveinvestigateddifferentphotoanodemorphologiesforapplicationindye-sensitizedsolarcells(DSSCs).Thesenewmorphologieshaveshownimprovedllfactor,currentperunitofphoto-activesurfacearea,andchargeinjection.SomeexamplesincludethefabricationofZnOnanotiparrays 89 ,ZnOandcore/shellnanowirearrays 4 8 ,TiO2nanotubes 90 91 ,ZnOnanotubes 5 ,coatedAAOmembranes 76 ,TiO2nanowiresandribbons 80 andtitaniananoparticlecoatedAAOmembranes 82 .InthecaseoftheZnOnanowiresishasbeenshownthattheinterfacialelectroncollectionisimprovedduetothepresenceofaninterfacialelectriceld. 4 8 89 Thiswasalsotrueinthecaseoftitaniananowires. 80 andradialelectroncollectionwasimprovedinnanotubearrays. 76 Furthermore,Chapter5showshowbenecialthepresenceaninterfacialelectriceldisontheinterfacialprocesses.Allofthesestudiesndthatelectronbackreactionislowered,resultinginanincreasedchargecollectionefciency.Thesebenetsareattributedtoenhancedchargescavengingandseparationfromthenewmorphology.Whilethenewmorphologyofnanowire-basedphotoanodesimproveschargetransport,DSSCsbasedonthesestructuresdonotoutperformnanoparticle-basedDSSCs(NP-DSSCs).Thelowerperformanceistypicallyassociatedwiththesubstantiallylowersurfaceareaofthephotoanode 117 ;typically,NP-DSSCshavesurfaceareasof1000cm2perplanarcm2. 1 Infact,ifyouscaletheefciencyofthesedevicestotheirtruephoto-activesurfaceareaofthephotoanode(Aphoto),thenNP-DSSCshaveefcienciesof0.012%/cm2whileNW-DSSCsbasedonIZO(Chapter4)orZnO(Yangandco-workers 8 )haveefcienciesof0.032and0.034%/cm2,respectively.Thisprovidesaclearincentivetoincreasethesurfaceareaofthenanowirephotoanodes.Insomecases,nanowirephotoanodeswithlargesurfaceareacanbeeasilyobtained;however,thelengththattheelectronmusttraveltothecurrentcollectoralsoincreases. 105

PAGE 106

Becauseelectronlifetimewithinthesemiconductorisnite 3 68 ,manyofthephoto-generatedelectronswouldbelost,providingnobenettoperformance.Themoststraightforwardoptiontoachievetheultra-highphoto-activesurfaceareasofNP-DSSCswithNW-basedphotoanodestructuresistodecouplethedistancetheelectrontravelstothecurrentcollectorfromthephotoanodethickness.Thesestructurescanbeachievedbyconstructingverticalarraysofconductivenanowirescoatedwithasemiconductiveshell.WhilemanyVLSsyntheticmethodscangeneratethesearrays,theytypicallydonothavethehighphoto-activesurfaceareaneededforNW-DSSCs. 118 121 However,thetemplatedgrowthofnanowiresinanodicaluminumoxide(AAO),suchasthoseoutlinedinChapter2,providesameanstoconstructhighsurfaceareananowirearrayswithtunablelengthsanddiameters. 16 Toachievethesamephoto-activesurfaceareaasNP-DSSCs,anAAOtemplatewithporediametersbetween2050nmarrangedinahexagonally-close-packed(HCP)structurewouldbeneededtofabricatenanowires2060minlength.AlthoughnotdemonstratedforAAOonITOyet,porelengthsuptohundredsofmicronshavebeenfabricatedinpurealuminumsubstratesandarecommerciallyavailable.Anotherpotentialhurdlewiththesehighsurfaceareastructuresistheaggregation/coalescenceofthenanowiresduringtheremovalofthetemplate.However,supercriticaldrying 13 orelectricelds,asdescribedinChapter3,havebeenshowntopreventaggregation.Althoughitisanticipatedthatlargerphoto-activesurfaceareas(determinedbynanowirelength,diameter,density,andsemiconductorshellthickness)willprovideimprovedperformancetoNW-DSSCs,itisnotclearhowchangingthesedimensionswilleffecttheinterfacialelectriceldandelectrolytetransportinthedevice.Chapter5describedthedevelopmentofachargetransportmodelforDSSCsbasedonnanowires.ThemodelwasabletogenerateiVcurvesthatweresimilartoexperimentaldata.Furthermore,thecalculationsshowedthataninternalelectriceldwithinthenanowireshadasignicanteffectontheindividualinterfacialprocesses.Thischapterextendsthis 106

PAGE 107

modeltondtheoptimaldimensionsofaphotoanodebasedonaconductivearrayofnanowirescoatedwithasemiconductiveshellthatmaximizetheperformanceoftheDSSC.Todecreasetheparameterspacebeingprobed,aHCPstructureisassumedbecauseitistheclosestpackingofnanowiresthatcanbeachievedand,thus,thelargestphoto-activesurfaceareaatagivendiameter.TheDSSCperformanceisrstoptimizedbyadjustingthenanowirelengthforaconstantshellthickness,whichwaschosentobe10nmbasedontheoptimalthicknessfoundintheexperimentalworkinChapter4andbyLawet.al. 8 Oncetheoptimallengthisfound,theshellthicknessandnanowirediameterarevariedtofurtherenhancedeviceperformance.TheresultsofthiscomputationalstudyareintendedtoguidesyntheticdevelopmentofnanowirearraystowardsstructuresthatwillprovidesignicantimprovementtoDSSCs. 6.2ModelAdditionsTheparameterspacethatcontrolsthesurfaceareofthephotoanodeisthenanowirelengthanddiameter,thicknessofthetitaniashell,andthespacinganddensityofthearray.Tominimizetheparameters,thenanowirearrayisassumedtobeaHCPstructure(i.e.,maximumdensityarrangement).AHCPstructurehasthreenanowiresperunitcellandanareaof(2p 3=3)(D+d)2,whichyieldsananowiredensityof nw=2p 3 3(D+d)2(6)whereDisthetotalnanowirediameter(corediameterplustwicetheshellthickness)anddisthespacingbetweennanowiresurfaces.Theaimistomaximizethesurfaceareawithintheplanarareaoftheunitcell,therefore,Aphotocanbewrittenas Aphoto=2p 3 3D (D+d)2`o+1(6)or Aphoto=D`onw+1(6)where`oandnwisthenanowiredensity 107

PAGE 108

Thesurfacearea,Aphoto,canbeshowntobeamaximumwhenD=d,i.e.,whenthenanowirespacingandtotaldiameterareequivalent.Therefore,theonlyparametersthatneedbevariedtooptimizeperformancearelengthanddiameterofthenanowire,andthethicknessofthetitaniashell.Fromtheseequations,themodelinputofsurfaceareatovolumeratio(SV)is SV=2p 3 3D (D+d)2`o+1 `o=Dnw+1 `o(6)Theincreasednanowire(orphotoanode)lengthsusedforthecalculationsinthisstudymeansthattheattenuationoflightandthediffusionofelectrolyteintheaxialdirectionmustbeincludedinthemodel.Theadditionalabsorptionoflightbytheelectrolytewasincludedinrate2oftheinterfacialreactionsdescribedinChapter5(Table 5-1 ),yielding r2(Z)=Z()"()`oCSln(10)ho()exp()]TJ /F6 11.955 Tf 9.3 0 Td[(("SCS+"elCel)Zln(10))d(6)wheretheterm"elCeliscalculatedasawholethroughspectroscopy.ThescalingoftheequationsinChapter5excludedthetransportofionsintheaxialdirection(Z-direction).However,thistransportmechanismisimportantbecauseitcarriesionstoandawayfromthephotoanodeandcounter-electrode.Thisuxisincludedhereasapseudohomogeneousrateofproduction(Rj,net),i.e.,asuxsourcetermsintheelectrolytecontinuityequationssothatEquation 5 and 5 inChapter5become @Ni @R=elRi,net(6)Thenetrateofproduction/consumptionforeachelectrolytecomponentisassumedtobepurelydiffusionalandlinear,suchthattheuxofOxorRedintheZ-directionisgivenby Ri,net=Ni,Z=)]TJ /F11 11.955 Tf 9.3 0 Td[(Di@Ci @Z=1Z+2(6)withtheconstraintthat drNox+brNred=0(6) 108

PAGE 109

whereiiseitherOxorRedandjareconstants.Inwritingtheseequations,itisassumedthattheuxofionsaresolelyintheradialdirectionattheinterface,solelyintheaxialdirectionatthesymmetricboundaryintheelectrolyte,solelyintheaxialdirectionatZ=0andpurelyintheaxialdirectionforZ>1.FurthermoreNOx=NRedatthemidpointbetweentwonanowiresurfacesandCOx=COx,refandCRed=CRed,refat`o8R. 6.3ResultsandDiscussion 6.3.1TheEffectofLengthonDSSCPerformanceTheintroductionofaxialtransportoftheelectrolyteandattenuationoftheincomingirradiationtothemodelenablestheperformanceoflongernanowire-basedDSSCstobecalculated.Foraxednanowirediameteranddensity,increasingthelengthofthenanowirearraywilldirectlyandlinearlyincreasethephotoactivesurfacearea.However,itisexpectedthatphotocurrentwillnotbeproducedatsomepointalongthelengthofthenanowirebecauseofthecombinedeffectsofhinderedaxialtransportintheelectrolyteandlightattenuation.Furthermore,thispointshouldbeidentiablebylookingforaninversionintheradialuxofeachchargecarrierspeciesattheinterface.Tondtheoptimalnanowirelength,westartedwithananowirearraywiththesamedimensionsasthenanowirearraysusedinChapters4and5.Specically,ananowirewithadiameterof150nmcoatedwitha10nmshelloftitania.Recallthatthisshellthicknessalreadyshowedoptimalperformance.Furthermore,thenanowiredensityiscalculatedtobeontheorderof1010cm)]TJ /F3 7.97 Tf 6.58 0 Td[(2.Figure 6-1 showsthecalculatedcurrent-voltagecharacteristicsforthesedevices.Ascanbeseeninthegure,short-circuitcurrentdependsstronglyonthenanowirelengthbecauseofthelinearincreaseinphotoactivesurfacearea.However,short-circuitcurrentdoesnotincreaselinearlyandasymptoticallyconvergestoavalueofabout4mA/cm2asthenanowirelengthincreases.Furthermore,thereisaminordecreaseinopen-circuitvoltageasthenanowiregetslonger. 109

PAGE 110

Figure6-1. Calculatedcurrent-voltagecharacteristicsforDSSCsbasedontheIZOnanowiresdescribedinChapter4and5withvaryingnanowirelength(i.e.photoanodethickness). TherelevantperformanceparametersoftheNW-DSSCsareplottedasafunctionoflengthinFigure 6-2 .Theisc,Vocandinitiallyincreasedramaticallywithnanowirelengthandthenplateaubeforeslowlydecreasing.Thismaximumoccursatnanowirelengthsofapproximately40m.Ontheotherhand,thellfactor(FF)monotonicallydecreasesasthenanowiresbecomelonger.ThedecreaseinFFislikelyfromthediminishedtransportofelectrolyteionsduetotheincreasedphotoanodethickness.ThedecreasingperformanceoftheNW-DSSCasnanowirelengthincreasescanbeexplainedbyplottingtheradialuxofeachchargecarrierattheinterface(interfacialux)asafunctionofdistancealongthenanowire.Figure 6-3 istheinterfacialuxofchargecarrierswithinthesemiconductorandelectrolyteatshort-circuitcurrentfora100mlengthnanowirearraywitha10nmtitaniashell.Short-circuitcurrentidentiesthepointofmaximumcurrentand,hence,requiresthehighestuxofelectrolyte,providinganidealpointinthecurrent-voltagecharacteristicstoobservethecombinedeffectsoflightattenuationandaxialtransportoftheelectrolyte.Asseeninthegure,themagnitudeoftheuxofeachspeciesinitiallydecreasesdramaticallyasthedistancefromthebaseofthe 110

PAGE 111

Figure6-2. Thecalculated(a)short-circuitcurrent,efciency,(b)open-circuitvoltage,andllfactorforNW-DSSCsasafunctionoflength.Bothisc,andVocgothroughamaximumatapproximately40m.Thenanowiresmodeledherehaveacorediameter,shellthicknessandelectrolytethicknessof180nm,10nmand200nm,respectively nanowireincreases.Thelargeuxatthebaseofthenanowireisexpectedsincetheamountofphoto-generatedlightislargest.Aslightisattenuatedthroughthedevice,theconcentrationofphoto-generatedelectronsdecreases.Theseuxestaperoffatlengthsof30-40mandeventuallyinvertdirectionatapproximately47malongthewire.Thisinversionsignalsthatanyphotogeneratedchargebeyond47mleadssolelytocurrentlosseswithinthedevices.Althoughtheattenuationoflightisclearlyhavinganeffectonperformance,theamountoflightpassingthroughthedeviceatthispointremainshigh(0.9Io).At72m,however,thelightisattenuatedto1%ofIo.TheNW-DSSCsbaseinIZO(Chapter4)orZnO(Yangandco-workers 8 )appeartohaveamaximum 111

PAGE 112

Figure6-3. Thecalculateduxofelectrolyteionsandelectronsatshort-circuitcurrentasafunctionofdistancealongthenanowireaxis.Atdistancesfurtherawayfromtheincominglight,themagnitudeoftheuxofeachspeciesfallsdramatically.Thedirectionisinvertedatapproximately47mandcorrespondstothedeclineinperformanceshowninFigure 6-2 performanceatlengthsofapproximately40m.Thismaximumlengthistheresultofaninversionintheowofcurrentatlengthsexceeding47mbecauseoflowerlevelsofirradiation,thebalanceofinterfacialreactions,andthetransportofelectrolyteionswithinthephotoanode.Itisimportanttonotethattheselongerdeviceswouldstillonlyreactefcienciesof4%becauseofthelackofsurfacearea. 6.3.2MaximizingtheSurfaceAreaofthePhotoanodeFigure 6-1 showsthatphotocurrentincreaseswithlargerphotoactivesurfacearea.Therefore,increasingthenanowiredensity(photoactivesurfacearea)willenhanceperformancefurther.Toobtainthemaximumpossiblenanowiredensity,aHCPstructureisassumedwiththespacingbetweennanowireskeptequaltothetotalnanowirediameter(core+shell).Forthecalculations,welimitourselvesto40mlengthnanowireswithacorenanowirediameterof10nm.Thesedimensionsrepresentachallengingbutfeasiblegoalforfabricatingananowirearray.Figure 6-4 showsthecurrent-voltagecharacteristicsforNW-DSSCdevicesbasedonaHCPnanowirearrayconsistingof40mlongnanowireswithadiameterof10 112

PAGE 113

Figure6-4. Current-voltagecharacteristicsforDSSCsbasedon40mlongnanowiresarrangedinaHCPstructure.Thediameterofthenanowirecoreis10nmandtheshellthicknessisvaried.Notethatthespacingalsochangeswithshellthickness.Therefore,surfaceareaisamaximumforallcurves.Notethatshort-circuitcurrentchangesdramaticallybecauseoflargechangesinsurfaceareaandtheopen-circuitvoltageismorestronglydependentonshellthicknessthannanowirelength(seeFigure 6-1 ). nmandavaryingsemiconductorshellthickness.Thespacingbetweennanowiresisadjustedasthethicknesschangestomaintainthemaximumsurfaceareaofthedevice.Asshowninthegure,bothiscandVocarestronglydependentonsemiconductorshellthickness.Thehighestsurfaceareacorrespondstothelowestshellthickness,leadingtosignicantdropsiniscastheshellthicknessisincreased.Interestingly,theVocincreasesdramaticallywithincreasingshellthicknesswhileVocdecreasedwithincreasingnanowirelengthinFigure 6-1 .TherelevantperformanceparametersoftheNW-DSSCsareplottedasafunctionoflengthinFigure 6-5 .Ascanbeseeninthegure,iscandbecomequitelargeforhighsurfaceareaNW-DSSCs.TheefciencyoftheseNW-DSSCsatashellthicknessof5-10nmisnearlydoublethatofNP-DSSCs!However,thehighfallsquicklyastheshellthicknessand,hence,surfaceareadecreases.Whilethiscalculationmayover-predictdeviceperformance,itislikelythatNW-DSSCsconsistingofconductive 113

PAGE 114

Figure6-5. Thecalculated(a)short-circuitcurrent,efciency,(b)open-circuitvoltage,andllfactorforNW-DSSCsasafunctionofsemiconductorshellthickness.Thediameterofthenanowirecoreis10nmandthelengthis40m.NotethatNW-DSSCswithshellthicknessesaround5-10nmhavenearlydoubletheefciencyofNP-DSSCs. coresandsemiconductiveshellsmayoutperformtheirnanoparticlecounterparts.Thellfactorremainsmostlyunchangedwithaweakminimumatshellthicknessesofapproximately32nm.Interestingly,thebestperformingdeviceshavethelowestVoc,whichasymptoticallyapproachesapproximately800mVwithincreasingshellthickness.Whilethedecreaseinefciencyastheshellthicknessincreasescanbeexplainedbythecorrespondingdecreaseinsurfacearea,thisdoesnotexplaintheincreaseinVoccannot.TounderstandtheincreaseinVoc,Figure 6-6 showstheinterfacialelectriceldatopen-circuitvoltagefordifferentshellthicknessesataspecicdistance(20m)fromthebaseofthenanowire.Thegureclearlyshowsthattheelectriceldislarge 114

PAGE 115

Figure6-6. Thecalculatedinterfacialelectriceldforananowirewithadiameterof10nmmeasured20mfromthebasedofthenanowirewhileheldattheopen-circuitvoltage. forthickersemiconductiveshells.ThistrendcorrespondswellwiththebehaviorofVocwithshellthicknessshowninFigure 6-5 .ThisprovesthatalteringtheshellthicknessofNW-DSSCschangestheinterfacialelectriceldaffectingthebalancebetweeninterfacialchargetransferandtransportreactions,asspeculatedbymanyresearchers. 4 6 8 76 89 6.4ConclusionInconclusion,themodelshowsthatthedevicesofChapter4and5aswellasthoseofLawet.al. 8 wouldhaveamaximumperformanceifconstructedofnanowires40mlongcoatedwithsemiconductorshells10-20nmthick.WhilethislengthmaximizestheNW-DSSCperformance,thediameterofthenanowireresultsinlowsurfacearea,limitingtheefciencytoamaximumof4%.However,optimizingthesurfaceusing40mlongnanowiresarrangedinaHCPstructureresultsinefcienciesmorethandoublethetypicalefciencyofNP-DSSCs.TheseefciencieswouldmakeNW-DSSCscomparableinperformancetosilicon-basedphotovoltaicswiththeaddedbenetoflowercostfabrication.Althoughtheseefcienciescouldbeviewedasatheoreticalmaximum,thereisclearmotivationtopursuethefabricationofNW-DSSCsbasedonconductivenanowireswithlongerlengthsandsmallerdiameters. 115

PAGE 116

CHAPTER7CONCLUSIONSANDFUTUREAVENUESOFRESEARCHTheworkpresentedinthisthesishighlightspotentiallycosteffective,electrochemicalnanowirefabricationtechniquesfortheconstructionofNW-DSSCphotoanodes.DirectgrowthofAAOtemplatesonconductiveglassisstudiedandtheeffectofanadhesiveinterlayerisanalyzed.While,withcertaincombinationsofanodizingsolution,interlayercompositionandappliedvoltage,successfulanodizationispossible,ultra-highaspectratiosareyettobeobtained.ItisbelievedthatthisisduetotheEbeamevaporationstepintheoverallprocess.EithermoresophisticatedEbeamevaporatorsortop-downAllmgrowthtechniquesmayresolvethisproblem.Forinstance,beginningwithathickaluminumfoilandthenevaporatingtheinterlayer,TCOandusingspin-onglassmayallowforhigheraspectratioAAOtemplatefabrication.Themodelinvolvingnanowireaggregationandelectrostaticrepulsionpredictsthatthisprocesswillalsoworkforhigheraspectrationanowires.Itdemonstratesthatitisveryeffectiveforthenanowirelengthsstudiedandisbelievedtoworkwellforlongernanowires.Thisprocessisbelievedtobescalableandislessenergyintensivethanusingsupercriticaluids,suchasCO2.ForNW-DSSCfabrication,itisimperativethatnanowireaggregationdoesnotoccurduetoexcessiveelectronlossesatthenanowiretipswhentheyareincontact.FurtherworkshouldbedonetomorebroadlyprobetheentireparameterspaceconcerningtheESRconditionstopreventorminimizeaggregation.Finally,thenumericalalgorithmpresentedseemstoaccuratelypredictthebehaviorofNW-DSSCs.Thiscomputationalsocorroboratesexperimentaldataconcerningtheoptimalshellthicknessofthesemiconductivenanowireshellaswellaselucidatesthedrasticeffectoftheinternalelectriceld.Comparatively,whentheelectriceldisontheelectronlossratesdecreasebyasmuchasafactorof10,000.ThismodelshouldfurtherbeusedtoinvestigatetheperformanceofNW-DSSCswithdifferingelectrolyte 116

PAGE 117

anddyecompositionstooptimizeperformance.Furthermore,themodelalsopredictsthatthephotoanodethicknesscanbeincreasedtoasmuchas45microns,nearlydoublingthecurrentNP-DSSCsexperimentalefciency.Whenexperimentallyviable,experimentsshouldbeconductedtoconrmthisresult. 117

PAGE 118

APPENDIXASUPPLEMENTARYINFORMATIONFORCHAPTER2TheanodizationofaluminumonITOhasseveralpotentialpitfallsthathindereitherporeformationorthequalityoftheporouslm.Thissectionoutlinestheseproblemsandwhereverpossible,describesthepossiblecausesormeanstomitigatethem.Therstsectiondiscussestheexcessiveoxidationthatoccursattheair-solutioninterface.Issuesregardingaluminumlmdelaminationintheabsenceofadhesiveinterlayersarethendiscussed.Theremainingsectiondescribesthefailuremechanismswhenadhesiveinterlayersarepresent.Reactionsattheair-solutioninterface.Inanefforttoobtainthelargestpossiblelmarea,substratesoftenbridgedtheair-solutioninterface.Figure A-1 showsthatthissetupresultedinexcessiveoxidationatthisinterface,regardlessofthepresenceofaninterlayer.TheexcessiveoxidationpossiblyincreasestheresistivityoftheITOordissolvesitcompletely,eventuallyreachingapointwheretheelectricalcontactwiththeunderlyingportionofthealuminumlmiscompletelyseveredandanodizationceases.Thisproblemwasresolvedbydepositinga10mthickSiO2strip(1cm)onthealuminumtoelectricallyinsulatethelmattheair-solutionregion. FigureA-1. Whenthealuminumlmsbridgetheair-solutioninterface,thereactionproceedsmuchmorerapidlyandeventuallypreventsfurtheranodization.Delaminationismoreprevalentwhenadhesionlayersarenotused.Theprocesstypicallyoccursattheedgeofthelmandgenerallyoccursateitherthestartortheendofanodization. Delaminationwithoutadhesiveinterlayers.Delaminationreadilyoccurswhenaluminumlmsareanodizedwithoutaninterlayer.ThedelaminationshowninFigure A-1 isquitesevereandinitiatesattheverybeginningofanodization.Itbeginsatthe 118

PAGE 119

lmedgeandpropagatesuntiltheentirelmhasdetachedfromthesubstrate.ThisphenomenonwasnotmentionedintheoriginalworkofdirectAAOfabricationonITO 11 andcouldbeduetodifferencesinthesurfacepropertiesoftheITOlms,i.e.,commerciallyavailable(thisstudy)vs.preparedsubstrates(Chuetal.).Foongetal.postulatedthattherecouldbeimprovedphysicalbondingbetweentheITO/Alduetothehighenergyimpactofthesputteredaluminumatoms. 12 Indeed,weobservedthatebeamevaporatedAllmshadexcessiveandwidespreaddelaminationduringanodization.Ashighlightedinthemanuscript,thisdelaminationcanbeavoidedbyusinganappropriateadhesiveinterlayerofeithertitaniumorchromium,dependingontheanodizationprocessselected.Anodizationfailureinthepresenceofadhesiveinterlayers.Aspreviouslystatedinthemanuscript,thickAAOlmswithvaryingthicknessandporediameterhavebeenfabricateddirectlyonITOusinginterlayers.However,thesuccessoftheseprocessesaredependentontheinterlayerandaluminumthickness,interlayercomposition,themethodofaluminumdeposition,andpossiblythecleaning/surfacetreatmentofITOpriortoaluminumdeposition.SpecicexamplesofAAOlmsthatmaintainexcellentadhesionaregiveninTable 2.3 .Underanyotherconditions,theabilityoftherespectiveinterlayertomaintainadhesionduringanodizationfaileddramatically.Thefailuremechanismforanodizationinthepresenceofadhesivelayersisdenedrelativetoporeformationprocess,i.e.,pre-orpost-poreformationfailure.Forexample,pre-poreformationfailureindicatesthatitoccurredpriortoStageIIoftheanodization,asdescribedinFigure 2-3 .Pre-poreformationfailureintheanodizationprocesswilloccurduetoeithera(i)higherselectivityoftheinterlayertoelectrochemicalreactionor(ii)violentelectricaldischarge,destroyingportionsofthelm.Post-poreformationfailureoccursbecauseof(i)dissolutionoftheinterlayer,(ii)electricaldischargeacrossgaspocketsonthesurfaceofthelmduetoevolutionofoxygen,or(iii)reductionof 119

PAGE 120

theITO.Thelatterofthesethreetypesofpost-failurecanbeavoidedbymonitoringthechronoamperometricresponseduringanodization. FigureA-2. ExamplesofaluminumanodizationfailureonITO.(a)Low-and(b)high-resolutionFESEMimagesofpre-poreformationfailureduetoelectricalsparking.Post-poreformationfailuredueto(c)dissolutionoftheITOand(d)uncontrollablearcingbetweentheinterlayer/barrierlayerjunctionandtheanodizingsolution. Figure A-2 showspre-poreformationfailureduetoelectricaldischargeacrossthelmandtwotypesofpost-poreformationfailure.Theothertypeofpre-poreformationfailure,ahigherselectivityoftheinterlayertoelectrochemicalreaction,resultsindelamination.ThisresultappearssimilartotheimagedepictedinFigure A-1 .Showninthe(a)lowand(b)highmagnicationimagesareregionsofthealuminumlmthathavebeenblastedawayfromthesubstratebecauseofelectricaldischarge.Part(c)ofthisgureshowsthatalargeportionoftheAAOlmhasbeenremovedfromdissolutionoftheITOattheendofanodization.Thisdissolutionoccurswhenelectricaldischargeacrossasurfacegaslayeroccursduetooxygenevolutionattheendofanodizationandischaracterizedbywildinstabilitiesinoutputcurrent.ThelmshowninFigure A-2 (d)showshowthelocaldestructionoftheAAOlmprogressesuntiltheentiresubstrateisaffected. 120

PAGE 121

APPENDIXBC++SOURCECODEFORTHENUMERICALMODELThenumericalmodelfollowsthepictorialalgorithmshownbelow. B.0.1GraphicalRepresentationoftheNumericalAlgorithm B.0.2NumericalCodeTheglobalclasslesFlux.cpp&Constants.h,Kinetics.cpp,SolveState.cpp,SystemEquations.cpp,SystemIO.cppandSystem.cpphandletheexperimentalandcalculatedinputparameters,thesolvermethod(Newton's/Gradient/SteepestDescent),thefundamentalbulkphysics,thealgorithmdatastorageandtheoverallsend/receiveclass,respectively.DifferentscenariosaremodelledandincorporatedintotheGUI.MainSystem.cpp:Accountsforanon-electricallyneutralelectrolyteandsemiconductor.Electroneutrality.cpp:Assumestheelectrolyteiselectricallyneutral.ElectrolyteInterface.cpp:Modelsonlythecontributionsfromtheelectrolyteandinterface.SemiconductorInterface.cpp:Modelsonlythecontributionsfromthesemiconductorandinterface.Furthermore,anyclasslesthatincludeNoFieldareidenticaltotheircounterpartsbuthaveneglecteddriftcontributionstotheelectronux.Inallcases,theinterfacialmodeldoesnotdeviatefromthatwhichisdescribedinthetext. 121

PAGE 122

FigureB-1 122

PAGE 123

1#pragmaonce 2#include 3//Gauss)]TJ /F20 7.97 Tf 6.2 0 Td[(LegendreQuadrature 4// 5//Thismethodofcalculatingtheintegralofafunctionfollowstheformula: 6// 7//Integral(f(x),x,)]TJ /F20 7.97 Tf 7.27 0 Td[(1,1)=Sum(w if(x i),i,0,n) 8// 9//wherenisthenumberofGaussianpointsusedinevaluatingtheintegral. 10//Thepoints(x i)andwieghts(w i)havebeenhardcodedintothefunctions, 11//andasaresult,thenumberofpointstobeusedcanonlybebetween1and12, 12//inclusive.Sincenoerrorchechingisused,andvalueoutsidethisrangewill 13//causethefunctionstocrash.With6pointsusedthetotalwillgetapprox 14//15decimalplacesofvalue.Inmostcases,using7or8pointsdoesnotincrease 15//theaccuracy. 16//Definesthemaxnumberofintegrationpoints 17#defineGuassPointMax12 18classGuassLegendreQuadrature 19f 20public: 21//Returnsthepointsthatthefunctionmustbeevaluatedat. 22//Iftheintegraldoesnothavelimitsofintegration)]TJ /F20 7.97 Tf 6.22 0 Td[(1to1, 23//theresultantpointsmustbepassedintotheShiftPointsfunction 24//inordertocorrectforthelimits. 25staticconstdoubleSetup(constintpoints); 26//Thistakesthevaluescalculatedfromthefunctionusingasinput 27//thepointsrecievedfromSetup.Again,ifthelimitsofintegration 28//arenot)]TJ /F20 7.97 Tf 6.23 0 Td[(1to1,thistotalmustalsobepassedintotheShiftTotal 29//method. 30staticdoubleIntegrate(constdoublef[],constintpoints); 31staticdoubleIntegrate(conststd::vector&f); 32//Thesefunctionsareusedtocorrectforthelimitsofintegration 33// 34//Integral(f(x),x,a,b)=0.5(b)]TJ /F20 7.97 Tf 6.75 0 Td[(1)Sum(w if(0.5(x i(b)]TJ /F20 7.97 Tf 5.86 0 Td[(a)+(b+a))),i,0,n) 35// 36staticinlinedoubleShiftPoints(constdoubleval,constdoublelowLim,constdoubleupLim) 37freturn0.5((upLim+lowLim)+val(upLim)]TJ /F10 7.97 Tf 6.25 0 Td[(lowLim));g 38staticinlinedoubleShiftTotal(constdoubletotal,constdoublelowLim,constdoubleupLim) 39freturn0.5(upLim)]TJ /F10 7.97 Tf 6.25 0 Td[(lowLim)total;g 123

PAGE 124

40g; 41//Typedefusedtodecreaseamountoftypingrequired 42typedefGuassLegendreQuadratureGLQ; 43//Thismethodofintegrationisveryinaccurateincomparisontothe 44//methodabove.Intheabovemethod6pointswillachieve15decimalplaces, 45//butwith10,000pointsthiswillonlyachieveabout6decimalplacesof 46//accuracy. 47doubleTrapazoidalIntegration(constdoublef[],constdoubleinterval,constintcount); 1#includeIntegration.h 2#includeGlobals.h 3constintindices[]= 4f 50, 61, 73, 86, 910, 1015, 1121, 1228, 1336, 1445, 1555, 1666, 17g; 18constdoublepoints[]= 19f 20//1 210, 22//2 23)]TJ /F10 7.97 Tf 7.16 0 Td[(sqrt(1.0/3.0), 24sqrt(1.0/3.0), 25//3 260, 27)]TJ /F10 7.97 Tf 7.16 0 Td[(sqrt(3.0/5.0), 28sqrt(3.0/5.0), 29//4 30)]TJ /F10 7.97 Tf 7.16 0 Td[(sqrt((3.0)]TJ /F10 7.97 Tf 11.53 0 Td[(2.0sqrt(6.0/5.0))/7.0), 31sqrt((3.0)]TJ /F10 7.97 Tf 11.53 0 Td[(2.0sqrt(6.0/5.0))/7.0), 32)]TJ /F10 7.97 Tf 7.16 0 Td[(sqrt((3.0+2.0sqrt(6.0/5.0))/7.0), 33sqrt((3.0+2.0sqrt(6.0/5.0))/7.0), 124

PAGE 125

34//5 350, 36)]TJ /F10 7.97 Tf 7.55 0 Td[((1.0/3.0)sqrt(5.0)]TJ /F10 7.97 Tf 11.53 0 Td[(2.0sqrt(10.0/7.0)), 37(1.0/3.0)sqrt(5.0)]TJ /F10 7.97 Tf 11.53 0 Td[(2.0sqrt(10.0/7.0)), 38)]TJ /F10 7.97 Tf 7.55 0 Td[((1.0/3.0)sqrt(5.0+2.0sqrt(10.0/7.0)), 39(1.0/3.0)sqrt(5.0+2.0sqrt(10.0/7.0)), 40//6 41)]TJ /F10 7.97 Tf 6.99 0 Td[(0.238619186083197, 420.238619186083197, 43)]TJ /F10 7.97 Tf 6.99 0 Td[(0.661209386466265, 440.661209386466265, 45)]TJ /F10 7.97 Tf 6.99 0 Td[(0.932469514203152, 460.932469514203152, 47//7 480, 49)]TJ /F10 7.97 Tf 6.99 0 Td[(0.405845151377397, 500.405845151377397, 51)]TJ /F10 7.97 Tf 6.99 0 Td[(0.741531185599394, 520.741531185599394, 53)]TJ /F10 7.97 Tf 6.99 0 Td[(0.949107912342759, 540.949107912342759, 55//8 56)]TJ /F10 7.97 Tf 6.99 0 Td[(0.183434642495650, 570.183434642495650, 58)]TJ /F10 7.97 Tf 6.99 0 Td[(0.525532409916329, 590.525532409916329, 60)]TJ /F10 7.97 Tf 6.99 0 Td[(0.796666477413627, 610.796666477413627, 62)]TJ /F10 7.97 Tf 6.99 0 Td[(0.960289856497536, 630.960289856497536, 64//9 650, 66)]TJ /F10 7.97 Tf 6.98 0 Td[(0.3242534234038089290385380, 670.3242534234038089290385380, 68)]TJ /F10 7.97 Tf 6.98 0 Td[(0.6133714327005903973087020, 690.6133714327005903973087020, 70)]TJ /F10 7.97 Tf 6.98 0 Td[(0.8360311073266357942994298, 710.8360311073266357942994298, 72)]TJ /F10 7.97 Tf 6.98 0 Td[(0.9681602395076260898355762, 730.9681602395076260898355762, 74//10 125

PAGE 126

75)]TJ /F10 7.97 Tf 6.98 0 Td[(0.1488743389816312108848260, 760.1488743389816312108848260, 77)]TJ /F10 7.97 Tf 6.98 0 Td[(0.4333953941292471907992659, 780.4333953941292471907992659, 79)]TJ /F10 7.97 Tf 6.98 0 Td[(0.6794095682990244062343274, 800.6794095682990244062343274, 81)]TJ /F10 7.97 Tf 6.98 0 Td[(0.8650633666889845107320967, 820.8650633666889845107320967, 83)]TJ /F10 7.97 Tf 6.98 0 Td[(0.9739065285171717200779640, 840.9739065285171717200779640, 85//11 860, 87)]TJ /F10 7.97 Tf 6.98 0 Td[(0.2695431559523449723315320, 880.2695431559523449723315320, 89)]TJ /F10 7.97 Tf 6.98 0 Td[(0.5190961292068118159257257, 900.5190961292068118159257257, 91)]TJ /F10 7.97 Tf 6.98 0 Td[(0.7301520055740493240934163, 920.7301520055740493240934163, 93)]TJ /F10 7.97 Tf 6.98 0 Td[(0.8870625997680952990751578, 940.8870625997680952990751578, 95)]TJ /F10 7.97 Tf 6.98 0 Td[(0.9782286581460569928039380, 960.9782286581460569928039380, 97//12 98)]TJ /F10 7.97 Tf 6.98 0 Td[(0.1252334085114689154724414, 990.1252334085114689154724414, 100)]TJ /F10 7.97 Tf 6.98 0 Td[(0.3678314989981801937526915, 1010.3678314989981801937526915, 102)]TJ /F10 7.97 Tf 6.98 0 Td[(0.5873179542866174472967024, 1030.5873179542866174472967024, 104)]TJ /F10 7.97 Tf 6.98 0 Td[(0.7699026741943046870368938, 1050.7699026741943046870368938, 106)]TJ /F10 7.97 Tf 6.98 0 Td[(0.9041172563704748566784659, 1070.9041172563704748566784659, 108)]TJ /F10 7.97 Tf 6.98 0 Td[(0.9815606342467192506905491, 1090.9815606342467192506905491, 110g; 111constdoubleweights[]= 112f 113//1 1142, 115//2 126

PAGE 127

1161, 1171, 118//3 1198.0/9.0, 1205.0/9.0, 1215.0/9.0, 122//4 123(18.0+sqrt(30.0))/36.0, 124(18.0+sqrt(30.0))/36.0, 125(18.0)]TJ /F10 7.97 Tf 11.93 0 Td[(sqrt(30.0))/36.0, 126(18.0)]TJ /F10 7.97 Tf 11.93 0 Td[(sqrt(30.0))/36.0, 127//5 128128.0/225.0, 129(322.0+13.0sqrt(70.0))/900.0, 130(322.0+13.0sqrt(70.0))/900.0, 131(322.0)]TJ /F10 7.97 Tf 11.46 0 Td[(13.0sqrt(70.0))/900.0, 132(322.0)]TJ /F10 7.97 Tf 11.46 0 Td[(13.0sqrt(70.0))/900.0, 133//6 1340.467913934572691, 1350.467913934572691, 1360.360761573048139, 1370.360761573048139, 1380.171324492379170, 1390.171324492379170, 140//7 1410.417959183673469, 1420.381830050505119, 1430.381830050505119, 1440.279705391489277, 1450.279705391489277, 1460.129484966168870, 1470.129484966168870, 148//8 1490.362683783378362, 1500.362683783378362, 1510.313706645877887, 1520.313706645877887, 1530.222381034453374, 1540.222381034453374, 1550.101228536290376, 1560.101228536290376, 127

PAGE 128

157//9 1580.3302393550012597631645251, 1590.3123470770400028400686304, 1600.3123470770400028400686304, 1610.2606106964029354623187429, 1620.2606106964029354623187429, 1630.1806481606948574040584720, 1640.1806481606948574040584720, 1650.0812743883615744119718922, 1660.0812743883615744119718922, 167//10 1680.2955242247147528701738930, 1690.2955242247147528701738930, 1700.2692667193099963550912269, 1710.2692667193099963550912269, 1720.2190863625159820439955349, 1730.2190863625159820439955349, 1740.1494513491505805931457763, 1750.1494513491505805931457763, 1760.0666713443086881375935688, 1770.0666713443086881375935688, 178//11 1790.2729250867779006307144835, 1800.2628045445102466621806889, 1810.2628045445102466621806889, 1820.2331937645919904799185237, 1830.2331937645919904799185237, 1840.1862902109277342514260976, 1850.1862902109277342514260976, 1860.1255803694649046246346943, 1870.1255803694649046246346943, 1880.0556685671161736664827537, 1890.0556685671161736664827537, 190//12 1910.2491470458134027850005624, 1920.2491470458134027850005624, 1930.2334925365383548087608499, 1940.2334925365383548087608499, 1950.2031674267230659217490645, 1960.2031674267230659217490645, 1970.1600783285433462263346525, 128

PAGE 129

1980.1600783285433462263346525, 1990.1069393259953184309602547, 2000.1069393259953184309602547, 2010.0471753363865118271946160, 2020.0471753363865118271946160, 203g; 204constdoubleGuassLegendreQuadrature::Setup(constint points) 205f 206returnpoints+indices[ points)]TJ /F10 7.97 Tf 7.32 0 Td[(1]; 207g 208doubleGuassLegendreQuadrature::Integrate(constdoublef[],constint points) 209f 210doubletotal=0; 211fori( points) 212total+=f[i]weights[indices[ points)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+i]; 213returntotal; 214g 215doubleGuassLegendreQuadrature::Integrate(conststd::vector&f) 216f 217constint points=f.size(); 218doubletotal=0; 219fori( points) 220total+=f[i]weights[indices[ points)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+i]; 221returntotal; 222g 223doubleTrapazoidalIntegration(constdoublef[],constdoubleinterval,constintcount) 224f 225doubletotal=0; 226total+=0.5f[0]; 227total+=0.5f[count)]TJ /F10 7.97 Tf 7.32 0 Td[(1]; 228for(inti=1;i
PAGE 130

7//Constructor 8Flux(constdouble lambda1,constdouble lambda2); 9//Integratesthefunctions 10constdoubleIntegrate(constdoubleC d g,constdoublez,constdoublea)const; 11//Differentiateswithrespecttoc d g 12constdoubleDerivative(constdoubleC d g,constdoublez,constdoublea)const; 13private: 14//Variables 15constintpoints; 16constdoublelambda1,lambda2; 17//Loadsinthefiles 18staticboolloadedFiles; 19staticdoubleflux[800)]TJ /F10 7.97 Tf 7.2 0 Td[(340],yield[(800)]TJ /F10 7.97 Tf 7.18 0 Td[(340)/10]; 20staticvoidLoadFiles(); 21//IncidentFlux 22staticconstdoubleF1(constdoublelambda); 23//MolarAbsorptivity 24staticconstdoubleF2(constdoublelambda); 25//QuantumYield/IPCE 26staticconstdoubleF3(constdoublelambda); 27g; 1#includeFlux.h 2#includeConstants.h 3#includeIntegration.h 4#includeGlobals.h 5#include 6#include 7boolFlux::loadedFiles=false; 8doubleFlux::flux[800)]TJ /F10 7.97 Tf 7.25 0 Td[(340]; 9doubleFlux::yield[(800)]TJ /F10 7.97 Tf 7.18 0 Td[(340)/10]; 10// 11//Constructor 12// 13Flux::Flux(constdouble lambda1,constdouble lambda2) 14:points(GuassPointMax), 15lambda1( lambda1), 16lambda2( lambda2) 17f 18if(!loadedFiles) 19LoadFiles(); 20g 130

PAGE 131

21// 22//Integrate 23// 24constdoubleFlux::Integrate(constdoubleC d g,constdoublez,constdoublea)const 25f 26doublef=newdouble[points]; 27constdoublep=GuassLegendreQuadrature::Setup(points); 28constdoubletemp=C d glog(10.0); 29fori(points) 30f 31constdoublelambda=GuassLegendreQuadrature::ShiftPoints(p[i],lambda1,lambda2); 32constdoublef1=F1(lambda); 33constdoublef2=F2(lambda); 34constdoublef3=F3(lambda); 35constdoublev=f3/af2f1tempexp()]TJ /F10 7.97 Tf 7.64 0 Td[(f2tempz); 36f[i]=v; 37g 38doubletotal=GuassLegendreQuadrature::Integrate(f,points); 39deletef; 40total=GuassLegendreQuadrature::ShiftTotal(total,lambda1,lambda2); 41returntotal; 42g 43// 44//Derivative 45// 46constdoubleFlux::Derivative(constdoublec d g,constdoublez,constdoublea)const 47f 48doublef=newdouble[points]; 49constdoublep=GuassLegendreQuadrature::Setup(points); 50constdoubletemp=c d glog(10.0)z; 51fori(points) 52f 53constdoublelambda=GuassLegendreQuadrature::ShiftPoints(p[i],lambda1,lambda2); 54constdoublef1=F1(lambda); 55constdoublef2=F2(lambda); 56constdoublef3=F3(lambda); 57f[i]=f3/af2f1exp()]TJ /F10 7.97 Tf 7.64 0 Td[(f2temp)(log(10.0))]TJ /F10 7.97 Tf 11.74 0 Td[(f2temp); 58g 59doubletotal=GuassLegendreQuadrature::Integrate(f,points); 131

PAGE 132

60deletef; 61returnGuassLegendreQuadrature::ShiftTotal(total,lambda1,lambda2); 62g 63//IncidentFlux 64//PhotonFlux 65//SolarFlux 66constdoubleFlux::F1(constdoublelambda) 67f 68constdoublel=lambda)]TJ /F10 7.97 Tf 11.5 0 Td[(340; 69constintindex=int(l); 70constdoubleperc=l)]TJ /F10 7.97 Tf 11.58 0 Td[(index; 71returnflux[index](1)]TJ /F10 7.97 Tf 7.85 0 Td[(perc)+flux[index+1]perc; 72g 73//MolarAbsorptivity 74constdoubleFlux::F2(constdoublelambda) 75f 76constdoublel=lambda; 77return2.0854e+07)]TJ /F10 7.97 Tf 11.1 0 Td[(21094l; 78g 79//QuantumYield/IPCE 80constdoubleFlux::F3(constdoublelambda) 81f 82constdoublel=(lambda)]TJ /F10 7.97 Tf 11.4 0 Td[(340)0.1; 83constintindex=int(l); 84constdoubleperc=l)]TJ /F10 7.97 Tf 11.58 0 Td[(index; 85return0.01(yield[index](1)]TJ /F10 7.97 Tf 7.85 0 Td[(perc)+yield[index+1]perc); 86g 87// 88//LoadFiles 89// 90voidFlux::LoadFiles() 91f 92ifstreamfile(..nndatannsolarflux.txt); 93if(!file.is open())return; 94intj=0; 95fori(800)]TJ /F10 7.97 Tf 7 0 Td[(340) 96f 97doublex,y; 98file>>x; 99file>>y; 100if(int(x)==x) 132

PAGE 133

101flux[j++]=y; 102g 103file.close(); 104file.open(..nndatannipce.txt); 105if(!file.is open())return; 106fori((800)]TJ /F10 7.97 Tf 7.14 0 Td[(340)/10) 107f 108doublex; 109file>>x; 110file>>yield[i]; 111g 112file.close(); 113loadedFiles=true; 114g 1#pragmaonce 2//Usedforkineticsolving 3#defineUSE THREADS0 4#defineOUTPUT KINETICS1 5//Usedforsemiconductorsolving 6#defineMAX SC SOLVE1 7//Regularizewithmu 8#defineREGULARIZE MU0 9constdoubleF=96485.3399; 10constdoubleR=8.314; 11constdoubleT=298; 12constdoubleK=1.38e)]TJ /F10 7.97 Tf 6.88 0 Td[(23; 13constdoubleC inf=4.5E)]TJ /F10 7.97 Tf 6.87 0 Td[(5; 14constdoublen=1; 15constdoubleb=1.5; 16constdoubled=0.5; 17//Rateconstantsforkineticequations[1/s] 18constdoubleK 3a=6.67E)]TJ /F10 7.97 Tf 6.87 0 Td[(12; 19constdoubleK 3b=1.67E6; 20constdoubleK f4a=1E13; 21constdoubleK f4b=5E10; 22constdoubleK b5=5E4; 23constdoubleK b6a=1E2; 24constdoubleK b6b=1E2; 25constdoubleK f1=1E4; 26constdoubleK b1=1E4; 27constdoubleK f7=1E8; 133

PAGE 134

28//Concentrationconstants 29constdoubleC I ref=4.5E)]TJ /F10 7.97 Tf 6.87 0 Td[(4; 30constdoubleC I3 ref=5.0E)]TJ /F10 7.97 Tf 6.87 0 Td[(5; 31constdoubleC e neg ref=1.66E)]TJ /F10 7.97 Tf 6.87 0 Td[(8;//N a+ 32constdoubleN a=C e neg ref; 33constdoubleC d t=7.5E)]TJ /F10 7.97 Tf 6.87 0 Td[(5; 34//Ratioconstans 35constdoublegamma=1.125E)]TJ /F10 7.97 Tf 6.86 0 Td[(3;//tau 36constdoublebeta=0.5; 37//Phivoltageconstants 38constdoublephi ref=0.03; 39constdoublephi dye=)]TJ /F10 7.97 Tf 7.16 0 Td[(0.9; 40constdoublephi d plus=0.8; 41constdoubleD e=0.5; 42constdoubleD h=0.5; 43constdoubleD red=5E)]TJ /F10 7.97 Tf 6.86 0 Td[(5; 44constdoubleD ox=4.5E)]TJ /F10 7.97 Tf 6.87 0 Td[(5; 45constdoubleD el=25; 46constdoubleq=1.602E)]TJ /F10 7.97 Tf 6.88 0 Td[(19; 47constdoubleQ=q/(KT); 48constdoubleE f=)]TJ /F10 7.97 Tf 7.14 0 Td[(0.45; 49constdoublen i=1.66E)]TJ /F10 7.97 Tf 6.86 0 Td[(8; 50constdoubleF n=0.45; 51//Semiconductorconstant 52constdoubleE sc=1148.854e)]TJ /F10 7.97 Tf 6.88 0 Td[(14; 53constdoubleE el=368.854e)]TJ /F10 7.97 Tf 6.88 0 Td[(14; 54constdoubledell Sc=2e)]TJ /F10 7.97 Tf 6.87 0 Td[(8; 55constdoubledell El=1e)]TJ /F10 7.97 Tf 6.87 0 Td[(7; 56constdoublef=F/(RT); 57constdoublei ref=5E)]TJ /F10 7.97 Tf 6.88 0 Td[(10; 58constdoublec2=betanF/(RT); 1#pragmaonce 2#includeGlobals.h 3#includeConstants.h 4//Prototypes 5classSystem; 6classMatrix; 7classSaveState; 8classSubState; 9// 10//TheKineticBoundries 134

PAGE 135

11// 12classKinetic 13f 14public: 15//Constructor 16Kinetic(Systemstate,int numberOfZ,constdouble a,constdouble porocity); 17//Solvessomeoftheconstants,basedonvoltage 18voidSolveCurrent(SaveState&save,SaveStatelast)const; 19//Getsthepointsusedforintegration 20staticvectorGetIntegrationPoints(intnumberOfZ,doublenanorodLength); 21private: 22//CurrentSystem 23SystemmainState; 24//Numberofgaussianpointsforintegration 25constintnumberOfZ; 26//Thedyecoveragearea 27constdoublea; 28//Theporocityofthenanorod 29constdoubleporocity; 30//Solvesconstantsasafunctionofz 31constdoubleIntegrateCurrent(SaveState&save,SaveStatelast)const; 32//Solvesallthemodesforasystem 33staticvoidSolveModes(SubStatesub,Systems,constdoublez); 34//Solvestheequationforvaluesofz,variesthroughdifferentdelSigma 35staticvoidSolve(SubStatesub,Systems,constdoublez); 36//Variesthemuvalueandattemptstofindasolution 37//Returnstrueifitsolvedforanerrorbetterthanthecurrent 38#ifREGULARIZE MU 39staticconstboolSolveVaryingMu(Systems,constdoublez,Systembest,double&bestError,double&initialError); 40#endif 41//Variesthesigmavalueandattemptstofindasolution 42//Returnstrueifthesolvedforerrorisbetterthanthecurrenterror 43staticconstboolBuildAndSolve(Systems,constdoublez,SystembestState,double&bestStateError,double&bestSigma); 44g; 1#includeConsole.h 2#includeIntegration.h 3#includeSolveState.h 4#includeKinetics.h 5#includeThread.h 135

PAGE 136

6#includeSystem.h 7#includeEvent.h 8// 9//Constructor 10// 11Kinetic::Kinetic(Systemstate,int numberOfZ,constdouble a,constdouble porocity) 12:numberOfZ( numberOfZ),a( a),porocity( porocity) 13f 14mainState=state; 15g 16// 17//GetIntegrationPoints 18// 19vectorKinetic::GetIntegrationPoints(intnumberOfZ,doublenanorodLength) 20f 21vectorvalues; 22constdoublep=GLQ::Setup(numberOfZ); 23fori(numberOfZ) 24values.push back(GLQ::ShiftPoints(p[i],0,nanorodLength)); 25returnvalues; 26g 27// 28//SolveCurrent 29// 30voidKinetic::SolveCurrent(SaveState&save,SaveStatelast)const 31f 32//IntegratesandchangesunitstomA 33save.current=aporocityIntegrateCurrent(save,last); 34g 35// 36//IntegrateCurrent 37// 38constdoubleKinetic::IntegrateCurrent(SaveState&save,SaveStatelast)const 39f 40constdoublep=GLQ::Setup(numberOfZ); 41#ifUSE THREADS 42//Threadvariables 43Arraythreads(numberOfZ); 44Arraystates(numberOfZ); 45//Createthreads 46fori(numberOfZ) 136

PAGE 137

47f 48save.subStates[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>z=GLQ::ShiftPoints(p[i],0,mainState)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>nanorodLength);//[cm] 49//Createcopyofstate 50states[i]=mainState)]TJ /F16 7.97 Tf 4.78 0 Td[(>CreateCopy(); 51//Resetthevariables 52states[i])]TJ /F16 7.97 Tf 6.23 0 Td[(>Reset(save.voltage,last==0?0:last)]TJ /F16 7.97 Tf 4.78 0 Td[(>subStates[i]); 53threads[i]=htnewThread(NewEvent(0,Dispatch(&Kinetic::Solve),save.subStates[i],states[i],save.subStates[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>z)); 54threads[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>SetDeleteOnFinish(false); 55threads[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>Start(); 56g 57//Waitonthreads 58fori(numberOfZ) 59f 60threads[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>Wait(); 61deletethreads[i]; 62deletestates[i]; 63g 64#else 65//Createthreads 66fori(numberOfZ) 67f 68save.subStates[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>z=GLQ::ShiftPoints(p[i],0,mainState)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>nanorodLength);//[cm] 69//Resetthevariables 70mainState)]TJ /F16 7.97 Tf 4.78 0 Td[(>Reset(save.voltage,last==0?0:last)]TJ /F16 7.97 Tf 4.78 0 Td[(>subStates[i]); 71SolveModes(save.subStates[i],mainState,save.subStates[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>z); 72g 73#endif 74//Compactcurrentsintoanarray 75vectorcurrents; 76fori(numberOfZ)currents.push back(save.subStates[i])]TJ /F16 7.97 Tf 6.24 0 Td[(>current); 77//Integrateandshiftthetotal 78doubletotal=GLQ::Integrate(currents); 79returnGLQ::ShiftTotal(total,0,mainState)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>nanorodLength); 80g 81// 82//SolveModes 83// 84voidKinetic::SolveModes(SubStatesub,Systems,constdoublez) 137

PAGE 138

85f 86//Solvethingsforoneormultiplemodes 87if(s)]TJ /F16 7.97 Tf 4.79 0 Td[(>Modes()==1) 88Solve(sub,s,z); 89else 90f 91//Settheinitialmodestate 92s)]TJ /F16 7.97 Tf 4.79 0 Td[(>ResetMode(); 93//Tolerancevalue 94constdoubletolerance=1e)]TJ /F10 7.97 Tf 6.86 0 Td[(6; 95//Solveuntilconvergance 96doubleerror=0; 97intlastSolve=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>CurrentMode(); 98boolfirst=true; 99do 100f 101if(first&&lastSolve!=s)]TJ /F16 7.97 Tf 4.79 0 Td[(>CurrentMode()) 102first=false; 103WriteLine(##################################################); 104WriteLine(ntCurrent Convergence Error: ,error); 105WriteLine(##################################################nn); 106Solve(sub,s,z); 107//Newerror 108error=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>ModeConverganceError(); 109//Goneacompletecycleandtherewasnochange 110if(error==0) 111f 112if(!first&&lastSolve==s)]TJ /F16 7.97 Tf 4.78 0 Td[(>CurrentMode()) 113break; 114g 115elselastSolve=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>CurrentMode(); 116//Nextmode 117s)]TJ /F16 7.97 Tf 4.78 0 Td[(>SwitchMode(); 118gwhile((error>tolerancejjerror==0)&&!s)]TJ /F16 7.97 Tf 4.78 0 Td[(>ShouldSkipPoint());//Makesurenottostopifnothingchanged!!! 119WriteLine(##################################################); 120WriteLine(ntFinal Convergence Error: ,error); 121WriteLine(##################################################nn); 122g 123//Calculatesthecurrentandincreasetheprogressbar 124s)]TJ /F16 7.97 Tf 4.78 0 Td[(>IncreaseProgress(); 138

PAGE 139

125sub)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(s); 126g 127// 128//Solve 129// 130voidKinetic::Solve(SubStatesub,Systems,constdoublez) 131f 132//InitializeErrortoHUGE,sofirstloopwillalwaysrun 133s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>maxError=1e300; 134s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError=1e300; 135s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>initialError=1e300; 136#ifREGULARIZE MU 137s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>mu=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>muMin; 138#endif 139s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>ResetSigma(); 140//doublelastBestError=1e299; 141//unsignedintlastBestErrorCount=0; 142//Setthevalidflagtofalse 143s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>isValid=false; 144//Debugoutput 145WriteLine()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()225()226()225()225()225()]TJ /F10 7.97 Tf 2.86 -15.67 Td[(); 146WriteLine(V = ,s)]TJ /F16 7.97 Tf 4.79 0 Td[(>phi applied,ntZ = ,z,ntMode = ,s)]TJ /F16 7.97 Tf 4.79 0 Td[(>CurrentMode()); 147boolbetterThanCurrent=false; 148//Initialverification 149s)]TJ /F16 7.97 Tf 4.78 0 Td[(>InitialVerification(z,0); 150//Usedformaximumtimeinthisalgorithm 151s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>timer.Start(); 152while(!s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsWithinError()) 153f 154Systembest=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>CreateRef(); 155doublebestError=1e300; 156bool betterThanCurrent=false; 157while(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>IsWithinDelSigma()&&!s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsOverTime()) 158f 159Clocktimer; 160doublesigma=1; 161#ifREGULARIZE MU 162if(SolveVaryingMu(s,z,best,bestError)) 163#else 139

PAGE 140

164if(BuildAndSolve(s,z,best,bestError,sigma)) 165#endif 166f 167//Writeouttheerrorfound 168WriteLine( New error: ,bestError,ntsigma[,sigma,]ntTime: ,timer.ElapsedSeconds(), secs); 169 betterThanCurrent=true; 170s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>delSigma=min(0.1,s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>delSigma10); 171s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>SetSigma(sigma); 172break; 173g 174#ifREGULARIZE MU 175elses)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mu=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>muMin; 176#endif 177s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>delSigma=0.1; 178s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>SetSigma(sigma); 179g 180//Settheconstantstothebestencountered,if 181//wefindsomethingbetterthantheinitialguess 182if( betterThanCurrent) 183f 184betterThanCurrent= betterThanCurrent; 185s)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(best); 186g 187//Wentovertime 188if(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsOverTime()) 189f 190s)]TJ /F16 7.97 Tf 4.78 0 Td[(>BuildF(z); 191WriteLine(Exceeded time allowed.); 192deletebest; 193break; 194g 195//Wedidn'tfindanygoodsolutions 196if(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>delSigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>delMin) 197f 198#ifREGULARIZE MU 199s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mu=s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>muMin; 200s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>delSigma=0.001; 201#else 202WriteLine(Exceeded tolerance for delSigma.); 203break; 140

PAGE 141

204//s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>ResetSigma(); 205#endif 206g 207//Checkforrecurrentloops(Startoutputafter1000loops) 208/if(bestError)]TJ /F20 7.97 Tf 6.84 0 Td[(lastBestError<=1e)]TJ /F20 7.97 Tf 6.81 0 Td[(100) 209if(++lastBestErrorCount>=1000&&(lastBestErrorCount&1023)==0) 210WriteLine(Uncontrollerloop!Repeatederrror,lastBestErrorCount,times!); 211elseflastBestError=bestError;lastBestErrorCount=0;g/ 212//Donewithvariable 213deletebest; 214g 215//Erroroutputs 216if(s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsWithinError()) 217WriteLine(Solved to allowed error!); 218elseif(!s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>isValid) 219WriteLine(Could not solve for any valid solution!); 220elseif(!betterThanCurrent) 221WriteLine(Couldn't find anything better than current guess!); 222//Infooutputs 223WriteLine(nnTime: ,s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>timer.ElapsedSeconds(), of ,s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>waitTime, secs used.); 224WriteLine(Std error: ,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 225WriteLine(Max error: ,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>maxError); 226WriteLine(Percent error: ,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError/s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>initialError,nn); 227g 228// 229//SolveVaryingMu 230// 231#ifREGULARIZE MU 232constboolKinetic::SolveVaryingMu(Systems,constdoublez,Systembest,double&bestError) 233f 234while(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsWithinMu()&&!s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsOverTime()) 235f 236SystembestState=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>CreateRef(); 237doublebestStateError=1e300; 238if(BuildAndSolve(s,z,bestState,bestStateError,initialError)) 239f 240s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mu=0.1; 241best)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(bestState); 242bestError=bestStateError; 141

PAGE 142

243deletebestState; 244//Foundabetteranswer 245returntrue; 246g 247elseif(bestStateErrorSet(bestState); 250bestError=bestStateError; 251g 252s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mu=10; 253g 254//Donewithvariable 255deletebestState; 256//Didn'tfindabetteranswer 257returnfalse; 258g 259#endif 260// 261//BuildAndSolve 262// 263constboolKinetic::BuildAndSolve(Systems,constdoublez,SystembestState,double&bestStateError,double&bestSigma) 264f 265//BuildFmatrix 266s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>miniTimer.Start(); 267s)]TJ /F16 7.97 Tf 4.78 0 Td[(>BuildF(z); 268s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>fTime+=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>miniTimer.ElapsedSeconds(); 269//BuildJmatrix 270s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>miniTimer.Start(); 271s)]TJ /F16 7.97 Tf 4.78 0 Td[(>BuildJ(z); 272s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>jTime+=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>miniTimer.ElapsedSeconds(); 273//JoinandSolvethesystem 274s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>miniTimer.Start(); 275s)]TJ /F16 7.97 Tf 4.78 0 Td[(>SolveJ(); 276s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>solveTime+=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>miniTimer.ElapsedSeconds(); 277//Initializeerrors 278s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>InitializeSigma(); 279constdoublecurError=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError; 280while(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsWithinSigma()&&!s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsOverTime()) 281f 282//Solvefortemporarystate 142

PAGE 143

283SystemtempState=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>CreateRef(); 284tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>NewtonStep(); 285s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>miniTimer.Start(); 286tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>BuildF(z); 287s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>fTime+=s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>miniTimer.ElapsedSeconds(); 288//Debugoutput 289/WriteLine(sigma,,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigma); 290WriteLine(standardError,,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 291//WriteLine(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiEl[1]); 292//WriteLine(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1); 293WriteLine(tempstandardError,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 294WriteLine(C sup[INT],,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC sup()); 295WriteLine(C ox[INT],,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC ox()); 296WriteLine(C e[INT],,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC e()); 297WriteLine(phiEl[INT],,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetPhiEl()); 298WriteLine(PhiSc[INT],,tempState)]TJ /F16 7.97 Tf 4.79 0 Td[(>GetPhiSc()); 299WriteLine(C d e1,,tempState)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e1); 300WriteLine(C e e3,,tempState)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e3); 301WriteLine(C d pos,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos); 302WriteLine(C d g,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g); 303WriteLine(r1,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r1); 304WriteLine(r4a,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4a); 305WriteLine(r4b,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4b); 306WriteLine(r5,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r5); 307WriteLine(r6a,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6a); 308WriteLine(r6b,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6b); 309WriteLine(r7,,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r7); 310Write(nn); 311system(pause);/ 312printf(%dnt%lfnn,(int)tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsValid(),log10(tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError)); 313if(!tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsValid()) 314f 315printf(ntStdError =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 316printf(ntMaxError =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>maxError); 317printf(ntr1 =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r1); 318printf(ntr2 =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r2); 319printf(ntr3a =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r3a); 320printf(ntr3b =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r3b); 321printf(ntr4a =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4a); 322printf(ntr4b =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4b); 143

PAGE 144

323printf(ntr5 =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r5); 324printf(ntr6a =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6a); 325printf(ntr6b =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6b); 326printf(ntr7 =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>r7); 327printf(ntPhiEl =%lfnn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetPhiEl()); 328printf(ntPhiSc =%lfnn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetPhiSc()); 329printf(ntPhiD =%lfnn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiD); 330printf(ntC e =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC e()); 331printf(ntC red =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC red()); 332printf(ntC ox =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC ox()); 333printf(ntJ red =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetJ red()); 334printf(ntJ ox =%Enn,tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetJ ox()); 335//system(pause); 336g 337//Onlycheckvalidstates 338if(tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>IsValid()) 339f 340//Foundavalidsolution 341s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>isValid=true; 342///Debugoutput 343WriteLine(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 344WriteLine(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>C ox[0]); 345WriteLine(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiEl[10]); 346system(pause);/ 347//tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>WriteData(DataPath(validF.csv)); 348//WriteLine(writingfileforIsValid); 349//system(pause); 350//Betterthananyintermediateerrorsofar 351if(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardErrorSet(tempState); 354bestStateError=s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError; 355bestSigma=s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigma; 356//Betterthancurrenterror 357if(s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError
PAGE 145

364g 365else 366f 367tempState)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>WriteData(DataPath(invalidF.csv)); 368//WriteLine(ntWritingfilefornotIsValid); 369//system(pause); 370g 371deletetempState; 372s)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>NextSigma(); 373g 374//Didnotfindanerrorbetterthanthecurrenterror 375returnfalse; 376g 1#pragmaonce 2#includeClock.h 3#includeMatrix.h 4#includeConstants.h 5#includeFlux.h 6//Thisstateisusedforsolvingtheequations 7classSolveState 8f 9private: 10//Constructor 11SolveState(double shellThickness,double nanorodLength, 12double porocity,double dyeCoverage, 13double waitTime,double maxAllowedError, 14int semiWidth,int elecWidth); 15//Destructor 16SolveState(); 17//OnlyallowfriendtocreateaSolveState 18friendclassSystem; 19public: 20//Setstheerrorsfrom 21voidCalculateError(); 22//Resetssigma 23voidResetSigma(); 24//Initializessigma 25voidInitializeSigma(); 26//Setsthenextsigma 27voidNextSigma(); 28//setstherangearoundit 145

PAGE 146

29voidSetSigma(doublesigma); 30//Returnsiftheerrorislessthanthemaxallowed 31boolIsWithinError()constfreturnstandardError=)]TJ /F20 7.97 Tf 6.22 0 Td[(1 33boolIsWithinDelSigma()constfreturndelSigma>=delMin;g 34//Returnsifmuislessthanthemaxmu 35#ifREGULARIZE MU 36boolIsWithinMu()constfreturnmu=)]TJ /F20 7.97 Tf 6.22 0 Td[(1 39boolIsWithinSigma()constfreturnsigma>=curSigmaMin;g 40//Checkstoseeifclockhasbeenrunningtoolong 41#ifUSE THREADS 42boolIsOverTime()constfreturntimer.ElapsedSeconds()numZ>waitTime;g 43#else 44boolIsOverTime()constfreturntimer.ElapsedSeconds()>waitTime;g 45#endif 46//Clockusedfortiming 47Clocktimer; 48doublewaitTime; 49ClockminiTimer; 50doublejTime,fTime,solveTime; 51//Usedtosaveifavalidsolutionwasfound 52boolisValid; 53//Temporarymatricesusedforsolvingsystems 54Matrixf,j; 55//ErrorsfortheFmatrix 56doublestandardError,maxError,initialError; 57constdoublemaxAllowedError; 58//Fluxintegration 59constFluxflux; 60//Thicknessofthenanorod 61constdoubleshellThickness; 62constdoublenanorodLength; 63constdoubleporocity; 64constdoubledyeCoverage; 65constintsemiWidth; 66constintelecWidth; 67constdoublehSemi; 68constdoublehElec; 69//UsedinsolvingNewton'smethod 146

PAGE 147

70constdoublesigmaRestriction; 71doublesigma,delSigma; 72doublecurSigmaMin,curSigmaMax; 73#ifREGULARIZE MU 74doublemu; 75#endif 76//Thecurrentsolvingmode 77intmode; 78//Numberofz 79intnumZ; 80//Acountofthenumberofinnerloopcompletions 81intcount; 82//Constants 83#ifREGULARIZE MU 84constdoublemuMin,muMax; 85#endif 86constdoubledelMin; 87g; 1#includeSolveState.h 2#includeArrayMatrix.h 3#includeSparseMatrix.h 4// 5//Contstructor 6// 7SolveState::SolveState(double shellThickness,double nanorodLength,double porocity,double dyeCoverage, 8double waitTime,double maxAllowedError,int semiWidth,int elecWidth): 9#ifREGULARIZE MU 10muMin(1e)]TJ /F10 7.97 Tf 6.79 0 Td[(50),muMax(1e50), 147

PAGE 148

11#endif 12delMin(1e)]TJ /F10 7.97 Tf 6.79 0 Td[(30), 13sigmaRestriction(0.1), 14//Integrationoftheflux,limitsofintegrationpassedin 15flux(340,800), 16maxAllowedError( maxAllowedError), 17shellThickness( shellThickness), 18nanorodLength( nanorodLength), 19porocity( porocity), 20dyeCoverage( dyeCoverage), 21semiWidth( semiWidth), 22elecWidth( elecWidth), 23hSemi(shellThickness/double(semiWidth)]TJ /F10 7.97 Tf 6.75 0 Td[(1)), 24hElec(shellThickness/double(elecWidth)]TJ /F10 7.97 Tf 6.75 0 Td[(1)) 25f 26//Timeusedforcalculations 27waitTime= waitTime; 28jTime=0; 29fTime=0; 30solveTime=0; 31//Setupmatrices 32j=htnewArrayMatrix(); 33f=htnewArrayMatrix(); 34//Numberofloops 35count=0; 36//Currentmode 37mode=0; 38g 39// 40//Destructor 41// 42SolveState::SolveState() 43f 44deletej; 45deletef; 46g 47// 48//CalculateError 49// 50voidSolveState::CalculateError() 51f 148

PAGE 149

52standardError=f)]TJ /F16 7.97 Tf 4.78 0 Td[(>StandardError(); 53maxError=f)]TJ /F16 7.97 Tf 4.78 0 Td[(>MaxError(); 54g 55// 56//ResetSigma 57// 58voidSolveState::ResetSigma() 59f 60curSigmaMin=)]TJ /F10 7.97 Tf 6.83 0 Td[(10; 61curSigmaMax=10; 62delSigma=1; 63g 64// 65//InitializeSigma 66// 67voidSolveState::InitializeSigma() 68f 69sigma=curSigmaMax; 70g 71// 72//NextSigma 73// 74voidSolveState::NextSigma() 75f 76sigma)]TJ /F10 7.97 Tf 6.17 0 Td[(=delSigma; 77//Donottestforsigma=0,becausethatgivescurrentsolution 78if(fabs(sigma)
PAGE 150

93curSigmaMax=sigmaRestriction; 94g 95else 96f 97curSigmaMin= sigma)]TJ /F10 7.97 Tf 6.47 0 Td[(10delSigma; 98curSigmaMax= sigma+10delSigma; 99g 100g 1#includeConsole.h 2#includeSystem.h 3#includeSolveState.h 4#includeConstants.h 5#includeGlobals.h 6// 7//SystemEquations 8// 9// 10//Rates 11// 12constdoubleSystem::R1()const 13f 14returni ref/(nF)(pow(GetC red()/C I ref,b)pow((gamma)]TJ /F10 7.97 Tf 6.08 0 Td[(GetC e())/(gamma)]TJ /F10 7.97 Tf 6.62 0 Td[(C e neg ref),n)exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.75 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)) 15)]TJ /F10 7.97 Tf 10.7 0 Td[(pow(GetC ox()/C I3 ref,d)pow(GetC e()/C e neg ref,n)exp()]TJ /F10 7.97 Tf -16.86 -15.67 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf -7.6 -15.66 Td[(GetPhiEl())]TJ /F10 7.97 Tf -7.02 -15.67 Td[(phi ref))); 150

PAGE 151

16g 17constdoubleSystem::R2(constdoublez)const 18f 19returnIntegrateConc(z); 20g 21constdoubleSystem::R3a()const 22f 23returnK 3aC d e1/a; 24g 25constdoubleSystem::R3b()const 26f 27returnK 3bC d e3/a; 28g 29constdoubleSystem::R4a()const 30f 31returnK f4aC d e1exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.88 0 Td[(phi dye))/a; 32g 33constdoubleSystem::R4b()const 34f 35returnK f4bC d e3exp(c2(GetPhiSc()))/a; 36g 37constdoubleSystem::R5()const 38f 39return)]TJ /F10 7.97 Tf 6.4 0 Td[(K b5GetC e()C d posexp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 7.11 0 Td[(phi d plus))/(C d ta); 40g 41constdoubleSystem::R6a()const 42f 43return)]TJ /F10 7.97 Tf 6.39 0 Td[(K b6apow(C d e1,n)exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(phi dye)]TJ /F10 7.97 Tf 6.44 0 Td[(GetPhiEl()))/a; 44g 45constdoubleSystem::R6b()const 46f 47return)]TJ /F10 7.97 Tf 6.39 0 Td[(K b6bpow(C d e3,n)exp(c2GetPhiEl())/a; 48g 49constdoubleSystem::R7()const 50f 51returnK f7pow(C d pos,n)pow(GetC red()/C I ref,d)exp(c2(phi d plus)]TJ /F10 7.97 Tf 6.45 0 Td[(GetPhiEl()))/a; 52g 53// 54//SemiConductor 55// 56constdoubleSystem::PoissonSc(constinti)const 151

PAGE 152

57f 58//Oldstuff 59returnphiSc[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1])]TJ /F10 7.97 Tf 11.07 0 Td[(2phiSc[i]+phiSc[i+1]+Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)(F/(E sc))(N a)]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]); 60g 61constdoubleSystem::ElectronFlux(constinti)const 62f 63//Oldstuff 64return(1/D e)J e[i)]TJ /F10 7.97 Tf 6.86 0 Td[(1]+(C e[i])]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)]TJ /F10 7.97 Tf 12.05 0 Td[(f(C e[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])(phiSc[i+1])]TJ /F10 7.97 Tf -394.25 -15.66 Td[(phiSc[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi); 65g 66constdoubleSystem::PotentialFieldSc(constinti)const 67f 68returnphiSc[i+1])]TJ /F10 7.97 Tf 11.43 0 Td[(phiSc[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1])]TJ /F10 7.97 Tf 11.52 0 Td[((2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)fieldSc[i];//CentralDerivative 69g 70constdoubleSystem::PoissonFieldSc(constinti)const 71f 72returnfieldSc[i+1])]TJ /F10 7.97 Tf 11.96 0 Td[(fieldSc[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1]+(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)(F/(E sc))(N a)]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i]);//CentralDerivative 73g 74constdoubleSystem::ElectronFlux2(constinti)const 75f 76return(1/D e)J e[i]+(C e[i+1])]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi))]TJ /F10 7.97 Tf 12.05 0 Td[(f(C e[i])(phiSc[i+1])]TJ /F10 7.97 Tf 11.43 0 Td[(phiSc[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//CentralDerivative 77g 78constdoubleSystem::ElectronFlux3(constinti)const 79f 80return(1/D e)J e[i]+(C e[i+1])]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//CentralDerivative 81g 82constdoubleSystem::ElectronContinuity(constinti)const 83f 84returnJ e[i+1])]TJ /F10 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F10 7.97 Tf 7.32 0 Td[(1]; 85g 86constdoubleSystem::PotentialFieldSc 0(constinti)const 87f 88returnphiSc[i+1])]TJ /F10 7.97 Tf 11.43 0 Td[(phiSc[i])]TJ /F10 7.97 Tf 11.69 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemifieldSc[i];//BoundaryRightDerivative 89g 90constdoubleSystem::PoissonFieldSc 0(constinti)const 91f 92returnfieldSc[i+1])]TJ /F10 7.97 Tf 11.96 0 Td[(fieldSc[i]+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i]);//BoundaryRightDerivative 152

PAGE 153

93g 94constdoubleSystem::ElectronFlux2 0(constinti)const 95f 96return(1/D e)J e[i]+(C e[i+1])]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)]TJ /F10 7.97 Tf 12.05 0 Td[(f(C e[i])(phiSc[i+1])]TJ /F10 7.97 Tf -375.12 -15.66 Td[(phiSc[i])/(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//BoundaryRightDerivative 97g 98constdoubleSystem::ElectronFlux3 0(constinti)const 99f 100return(1/D e)J e[i]+(C e[i+1])]TJ /F10 7.97 Tf 11.09 0 Td[(C e[i])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi;//BoundaryRightDerivative 101g 102constdoubleSystem::ElectronContinuity 0(constinti)const 103f 104returnJ e[i+1])]TJ /F10 7.97 Tf 11.53 0 Td[(J e[i]; 105g 106// 107//Electrolyte 108// 109constdoubleSystem::PoissonEl(constinti)const 110f 111returnphiEl[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1])]TJ /F10 7.97 Tf 11.07 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F10 7.97 Tf 10.7 0 Td[(Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)(F/(E el))(C red[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1])]TJ /F10 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1]/exp()]TJ /F20 7.97 Tf 7.95 0 Td[(f(phiEl[i])]TJ /F20 7.97 Tf 7.81 0 Td[(phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth]))/); 112g 113constdoubleSystem::PoissonEl2(constinti)const 114f 115returnphiEl[i)]TJ /F10 7.97 Tf 6.87 0 Td[(1])]TJ /F10 7.97 Tf 11.07 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F10 7.97 Tf 10.7 0 Td[(Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)(F/(E el))(0/C I ref+C I3 ref)]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]/); 116g 117constdoubleSystem::OhmEl(constinti)const 118f 119return(phiEl[i])]TJ /F10 7.97 Tf 11.8 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec+RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))()]TJ /F10 7.97 Tf 7.44 0 Td[(J ox[i])]TJ /F10 7.97 Tf 11.69 0 Td[(J red[i]+(D ox(C sup[i])]TJ /F10 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))]TJ /F10 7.97 Tf 11.18 0 Td[(D ox(C ox[i])]TJ /F10 7.97 Tf 11.19 0 Td[(C ox[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))]TJ /F10 7.97 Tf 11.4 0 Td[(D red(C red[i])]TJ /F10 7.97 Tf 11.39 0 Td[(C red[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 120g 121constdoubleSystem::RedFlux(constinti)const 122f 123if(useMigration) 124returnJ red[i]/D red+(C red[i+1])]TJ /F10 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F10 7.97 Tf 12.05 0 Td[(fC red[i]0.5(phiEl[i+2])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec; 125else 126returnJ red[i]/D red+D red(C red[i+1])]TJ /F10 7.97 Tf 7.42 0 Td[(C red[i])/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec; 127g 153

PAGE 154

128constdoubleSystem::RedFlux2(constinti)const 129f 130if(useMigration) 131returnJ red[i+1]/D red+(C red[i+1])]TJ /F10 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F10 7.97 Tf 12.05 0 Td[(fC red[i](phiEl[i+1])]TJ /F10 7.97 Tf 7.83 0 Td[(phiEl[i]))/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec; 132else 133returnJ red[i+1]/D red+D red(C red[i+1])]TJ /F10 7.97 Tf 7.43 0 Td[(C red[i])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec; 134g 135constdoubleSystem::OxFlux(constinti)const 136f 137if(useMigration) 138returnJ ox[i]/D ox+(C ox[i+1])]TJ /F10 7.97 Tf 7.21 0 Td[(C ox[i])]TJ /F10 7.97 Tf 12.05 0 Td[(fC ox[i]0.5(phiEl[i+2])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec; 139else 140returnJ ox[i]/D ox+D ox(C ox[i+1])]TJ /F10 7.97 Tf 7.21 0 Td[(C ox[i])/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec; 141g 142constdoubleSystem::OxFlux2(constinti)const 143f 144if(useMigration) 145returnJ ox[i+1]/D ox+(C ox[i+1])]TJ /F10 7.97 Tf 7.22 0 Td[(C ox[i])]TJ /F10 7.97 Tf 12.05 0 Td[(fC ox[i](phiEl[i+1])]TJ /F10 7.97 Tf 7.83 0 Td[(phiEl[i]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec; 146else 147returnJ ox[i+1]/D ox+D ox(C ox[i+1])]TJ /F10 7.97 Tf 7.21 0 Td[(C ox[i])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec; 148g 149constdoubleSystem::SupFlux(constinti)const 150f 151if(useMigration) 152returnC sup[i+1])]TJ /F10 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i]0.5(phiEl[i+2])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i]); 153else 154returnC sup[i+1])]TJ /F10 7.97 Tf 7.2 0 Td[(C sup[i]; 155g 156constdoubleSystem::SupFlux2(constinti)const 157f 158if(useMigration) 159returnC sup[i+1])]TJ /F10 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i](phiEl[i+1])]TJ /F10 7.97 Tf 7.83 0 Td[(phiEl[i]); 160else 161returnC sup[i+1])]TJ /F10 7.97 Tf 7.2 0 Td[(C sup[i]; 162g 163constdoubleSystem::RedContinuity(constinti)const 164f 165returnJ red[i+1])]TJ /F10 7.97 Tf 11.69 0 Td[(J red[i]/)]TJ /F20 7.97 Tf 15.07 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec/; 154

PAGE 155

166g 167constdoubleSystem::OxContinuity(constinti)const 168f 169returnJ ox[i+1])]TJ /F10 7.97 Tf 11.54 0 Td[(J ox[i]/+10e)]TJ /F20 7.97 Tf 6.11 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec/; 170g 171// 172//SystemDerivatives 173// 174// 175//R1 176//i ref/(nF)(pow(GetC red()/C I ref,b)pow((gamma)]TJ /F20 7.97 Tf 6.08 0 Td[(GetC e())/(gamma)]TJ /F20 7.97 Tf 6.62 0 Td[(C e neg ref),n)exp(c2(GetPhiSc())]TJ /F20 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F20 7.97 Tf 7.32 0 Td[(phi ref)) 177//)]TJ /F20 7.97 Tf 10.69 0 Td[(pow(GetC ox()/C I3 ref,d)pow(GetC e()/C e neg ref,n)exp()]TJ /F20 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F20 7.97 Tf 6.75 0 Td[(GetPhiEl())]TJ /F20 7.97 Tf 7.32 0 Td[(phi ref))) 178// 179constdoubleSystem::dR1(constVarvar)const 180f 181switch(var) 182f 183case C e: 184returni ref/(nF)(()]TJ /F10 7.97 Tf 7.25 0 Td[(n)pow(GetC red()/C I ref,b)pow((gamma)]TJ /F10 7.97 Tf 6.09 0 Td[(GetC e()),n)]TJ /F10 7.97 Tf 6.76 0 Td[(1)/pow((gamma)]TJ /F10 7.97 Tf 6.62 0 Td[(C e neg ref),n)exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)) 185)]TJ /F10 7.97 Tf 10.94 0 Td[(npow(GetC ox()/C I3 ref,d)pow(GetC e(),n)]TJ /F10 7.97 Tf 6.75 0 Td[(1)/pow(C e neg ref,n)exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)));break; 186case C red: 187returni ref/(nF)(bpow(GetC red(),b)]TJ /F10 7.97 Tf 6.75 0 Td[(1)/pow(C I ref,b)pow((gamma)]TJ /F10 7.97 Tf 6.08 0 Td[(GetC e())/(gamma)]TJ /F10 7.97 Tf 6.62 0 Td[(C e neg ref),n)exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)));break; 188case C ox: 189returni ref/(nF)()]TJ /F10 7.97 Tf 11.62 0 Td[(dpow(GetC ox(),d)]TJ /F10 7.97 Tf 6.75 0 Td[(1)/pow(C I3 ref,d)pow(GetC e()/C e neg ref,n)exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)));break; 190case phiSc: 191returni ref/(nF)c2(pow(GetC red()/C I ref,b)pow((gamma)]TJ /F10 7.97 Tf 6.08 0 Td[(GetC e())/(gamma)]TJ /F10 7.97 Tf -351.25 -15.66 Td[(C e neg ref),n)exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)) 192)]TJ /F10 7.97 Tf 11.24 0 Td[(()]TJ /F10 7.97 Tf 7.06 0 Td[(1)pow(GetC ox()/C I3 ref,d)pow(GetC e()/C e neg ref,n)exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)));break; 193case phiEl: 194returni ref/(nF)c2(()]TJ /F10 7.97 Tf 7.29 0 Td[(1)pow(GetC red()/C I ref,b)pow((gamma)]TJ /F10 7.97 Tf 6.08 0 Td[(GetC e())/(gamma)]TJ /F10 7.97 Tf 6.62 0 Td[(C e neg ref),n)exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)) 195)]TJ /F10 7.97 Tf 11.92 0 Td[((1)pow(GetC ox()/C I3 ref,d)pow(GetC e()/C e neg ref,n)exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.74 0 Td[(GetPhiEl())]TJ /F10 7.97 Tf 7.32 0 Td[(phi ref)));break; 155

PAGE 156

196default: 197return0; 198g 199g 200// 201//R2 202// 203constdoubleSystem::dR2(constVarvar,constdoublez)const 204f 205switch(var) 206f 207case C d g: 208returnDerivativeConc(z);break; 209default:return0; 210g 211g 212// 213//R3a 214//K 3aC d e1/a 215// 216constdoubleSystem::dR3a(constVarvar)const 217f 218switch(var) 219f 220case C d e1: 221returnK 3a/a;break; 222default:return0; 223g 224g 225// 226//R3b 227//K 3bC d e3/a 228// 229constdoubleSystem::dR3b(constVarvar)const 230f 231switch(var) 232f 233case C d e3: 234returnK 3b/a;break; 235default:return0; 236g 156

PAGE 157

237g 238// 239//R4a 240//K f4aC d e1exp(c2(GetPhiSc())]TJ /F20 7.97 Tf 6.87 0 Td[(phi dye))/a 241// 242constdoubleSystem::dR4a(constVarvar)const 243f 244switch(var) 245f 246case C d e1: 247returnK f4aexp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.87 0 Td[(phi dye))/a;break; 248case phiSc: 249returnK f4aC d e1c2exp(c2(GetPhiSc())]TJ /F10 7.97 Tf 6.87 0 Td[(phi dye))/a;break; 250default:return0; 251g 252g 253// 254//R4b 255//K f4bC d e3exp(c2(GetPhiSc()))/a 256// 257constdoubleSystem::dR4b(constVarvar)const 258f 259switch(var) 260f 261case C d e3: 262returnK f4bexp(c2(GetPhiSc()))/a;break; 263case phiSc: 264returnK f4bC d e3c2exp(c2(GetPhiSc()))/a;break; 265default:return0; 266g 267g 268// 269//R5 270//)]TJ /F20 7.97 Tf 6.4 0 Td[(K b5GetC e()C d posexp()]TJ /F20 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F20 7.97 Tf 7.11 0 Td[(phi d plus))/(C d ta) 271// 272constdoubleSystem::dR5(constVarvar)const 273f 274switch(var) 275f 276case C d pos: 277return)]TJ /F10 7.97 Tf 6.4 0 Td[(K b5GetC e()exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 7.11 0 Td[(phi d plus))/(C d ta);break; 157

PAGE 158

278case C e: 279return)]TJ /F10 7.97 Tf 6.4 0 Td[(K b5C d posexp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 7.11 0 Td[(phi d plus))/(C d ta);break; 280case phiSc: 281return)]TJ /F10 7.97 Tf 6.71 0 Td[(()]TJ /F10 7.97 Tf 6.71 0 Td[(1)K b5GetC e()C d posc2exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(GetPhiSc())]TJ /F10 7.97 Tf 7.11 0 Td[(phi d plus))/(C d ta);break; 282default:return0; 283g 284g 285// 286//R6a 287//)]TJ /F20 7.97 Tf 6.39 0 Td[(K b6apow(C d e1,n)exp()]TJ /F20 7.97 Tf 7.05 0 Td[(c2(phi dye)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))/a 288// 289constdoubleSystem::dR6a(constVarvar)const 290f 291switch(var) 292f 293case C d e1: 294return)]TJ /F10 7.97 Tf 6.67 0 Td[((n)K b6apow(C d e1,n)]TJ /F10 7.97 Tf 6.75 0 Td[(1)exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(phi dye)]TJ /F10 7.97 Tf 6.44 0 Td[(GetPhiEl()))/a;break; 295case phiEl: 296return)]TJ /F10 7.97 Tf 7.06 0 Td[((1)K b6apow(C d e1,n)c2exp()]TJ /F10 7.97 Tf 7.05 0 Td[(c2(phi dye)]TJ /F10 7.97 Tf 6.44 0 Td[(GetPhiEl()))/a;break; 297default:return0; 298g 299g 300// 301//R6b 302//)]TJ /F20 7.97 Tf 6.39 0 Td[(K b6bpow(C d e3,n)exp(c2GetPhiEl())/a 303// 304constdoubleSystem::dR6b(constVarvar)const 305f 306switch(var) 307f 308case C d e3: 309return)]TJ /F10 7.97 Tf 6.67 0 Td[((n)K b6bpow(C d e3,n)]TJ /F10 7.97 Tf 6.75 0 Td[(1)exp(c2GetPhiEl())/a;break; 310case phiEl: 311return)]TJ /F10 7.97 Tf 7.06 0 Td[((1)K b6bpow(C d e3,n)c2exp(c2GetPhiEl())/a;break; 312default:return0; 313g 314g 315// 316//R7 317//K f7pow(C d pos,n)pow(GetC red()/C I ref,d)exp(c2(phi d plus)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))/a 158

PAGE 159

318// 319constdoubleSystem::dR7(constVarvar)const 320f 321switch(var) 322f 323case C d pos: 324return(n)K f7pow(C d pos,n)]TJ /F10 7.97 Tf 6.76 0 Td[(1)pow(GetC red()/C I ref,d)exp(c2(phi d plus)]TJ /F10 7.97 Tf -346.63 -15.66 Td[(GetPhiEl()))/a;break; 325case C red: 326return(d)K f7pow(C d pos,n)pow(GetC red(),d)]TJ /F10 7.97 Tf 6.76 0 Td[(1)/pow(C I ref,d)exp(c2(phi d plus)]TJ /F10 7.97 Tf 6.44 0 Td[(GetPhiEl()))/a;break; 327case phiEl: 328return()]TJ /F10 7.97 Tf 7.05 0 Td[(c2)K f7pow(C d pos,n)pow(GetC red()/C I ref,d)exp(c2(phi d plus)]TJ /F10 7.97 Tf -346.63 -15.66 Td[(GetPhiEl()))/a;break; 329default:return0; 330g 331g 1#pragmaonce 2#includeGlobals.h 3#includeConstants.h 4//Prototypes 5classStateController; 6classMatrix; 7classSolveState; 8classSaveState; 9classSubState; 10namespaceArafclassString;g 11//Enumerationforthevariablesnames 12enumVarf C d g, C d pos, C d e1, C d e3, C e, C red, C ox, C sup, J e, J red, J ox, phiSc, phiElg; 13//Systemclasscontrolsthecurrentstateofthesystem, 14//includingthevariables 15classSystem 16f 17public: 18//Constructor 19System(StateController controller, 20doubleshellThickness,intshellIterations,intelecIterations, 21doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 22doubleporocity,doubledyeCoverage, 23doublemaxError,doublemaxTime); 159

PAGE 160

24System(StateController controller,SolveState solver,constdouble a); 25System(constSystemstate); 26//Destructor 27System(); 28//Name 29constStringName()constfreturnDSCModel System;g 30//Createsacompletecopy 31virtualSystemCreateCopy()const=0; 32//Createsareference 33virtualSystemCreateRef()const=0; 34//SetsthevariablesfromtheotherSystem 35voidSet(constSystemstate); 36//Solvesthesystem)]TJ /F20 7.97 Tf 12.08 0 Td[(startswiththekinetics 37voidSolve(constString&folderName,constintpoints,constdoublevStart,constdoublevEnd,constintguassPoints,boolextendFirst,intmigrationType); 38// 39//IOMethods)]TJ /F20 7.97 Tf 12.14 0 Td[(AllThreadSafe 40// 41//Updatesthetimingstatus(ThreadSafe) 42voidUpdateStatus(); 43//Settingprogress(ThreadSafe) 44voidInitializeProgress(); 45voidIncreaseProgress(); 46voidFinishProgress(); 47//Addspointstotheplots(ThreadSafe) 48voidAddPlotPoints(SaveStatesave); 49//Writesoutthedatatofiles(ThreadSafe) 50voidWriteData(constString&folderPath,constArraysaves); 51//Shouldskipthecurrentpoint(ThreadSafe) 52boolShouldSkipPoint(); 53// 54//InitializationMethods 55// 56//Resetsthevariables 57voidReset(constdoublev,SubStatelast); 58//Initializestheconcentrations 59virtualvoidInitializeConc(SubStatelast); 60//Initializesthevoltages 61voidInitializeVoltages(constdoublev,SubStatelast); 62//InitializedtheTotalArrayforphiSc,C e&J e 63virtualvoidInitializeTotal(SubStatelast)=0; 160

PAGE 161

64//Attemptstodorandomchangestocreateabetterinitialguess 65voidInitialVerification(constdoublez,constdoubletime); 66// 67//CalculationMethods 68// 69//Returnsthetotalofalltherates 70constdoubleRateTotal(constdoubledyeCoverage)const 71freturn(1)]TJ /F10 7.97 Tf 7.16 0 Td[(dyeCoverage)r1+dyeCoverage(r4a+r4b+r5);g 72//Calculatesthecurrent 73constdoubleCalculateCurrent()const; 74//Checkstoseeifthecurrentstateispossible(valid) 75virtualboolIsValid()const=0; 76// 77//Newton'sMethods 78// 79//GeneratestheratesusedinKinetics 80voidGenerateRates(constdoublez); 81//IntegrationsandDerivativeequationsforC d g 82constdoubleIntegrateConc(constdoublez)const; 83constdoubleDerivativeConc(constdoublez)const; 84//Buildsmatricesforsystem 85virtualvoidBuildJ(constdoublez)=0; 86virtualvoidBuildF(constdoublez)=0; 87//SolvetheequationJp=)]TJ /F20 7.97 Tf 7.46 0 Td[(f 88voidSolveJ(); 89//Doesthenewtonstepforthesystem 90virtualvoidNewtonStep()=0; 91// 92//Differentsolvingmodes 93// 94virtualintModes()constfreturn1;g 95virtualdoubleModeConverganceError()constfreturn)]TJ /F10 7.97 Tf 7.16 0 Td[(1.0;g 96virtualvoidUpdateMode()fg 97intCurrentMode()const; 98voidSwitchMode(); 99voidResetMode(); 100//Printstheconvergancestufftotheconsole 101virtualvoidPrintConvergance()fg 102// 103//Variables 104// 161

PAGE 162

105//ConstantSurfacearea 106constdoublea; 107//RateConstantsusedtosolvethekinetics 108doubler1,r2,r3a,r3b,r4a,r4b,r5,r6a,r6b,r7; 109//Voltagesfortheelectrolyte 110doublephi applied; 111//Theseconcentrationsarethevariablestosolvefor 112doubleC d g,C d pos,C d e1,C d e3,phiD; 113doubleC I,C I3; 114//Listsforsolving 115vectorphiSc,fieldSc,phiEl; 116vectorC e,C red,C ox,C sup; 117vectorJ e,J red,J ox; 118//Genericaccesforallvariables 119virtualdouble&GetVar(inti); 120virtualintSize()constfreturn4;g 121//Functionsforgettingthecorrectinterfacevalues 122virtualconstdoubleGetPhiSc()constfreturn0;g 123virtualconstdoubleGetPhiEl()constfreturnphi applied;g 124virtualconstdoubleGetC e()const;//Definedin.cpp(N a) 125virtualconstdoubleGetC red()constfreturnC I;g 126virtualconstdoubleGetC ox()constfreturnC I3;g 127virtualconstdoubleGetC sup()constfreturnC I3+C I;g 128virtualconstdoubleGetJ e()constfreturn0;g 129virtualconstdoubleGetJ red()constfreturn0;g 130virtualconstdoubleGetJ ox()constfreturn0;g 131//Functionsforgettingthecorrectinterfacederivatives 132virtualconstdoubleGetPhiSc P()constfreturn0;g 133virtualconstdoubleGetC e P()constfreturn0;g 134virtualconstdoubleGetJ e P()constfreturn0;g 135virtualconstdoubleGetJ red P()constfreturn0;g 136virtualconstdoubleGetJ ox P()constfreturn0;g 137//SystempassedaroundtotemporaryStates 138SolveStatesolver; 139protected: 140//Initializesthedirectory 141voidSetupDir(constString&ath); 142//Writethefluxdata 143voidWriteFlux(constString&folderPath,constArraysaves); 144//Writetheratedata 145voidWriteRates(constString&folderPath,constArraysaves); 162

PAGE 163

146//Writetheconcentrationdata 147voidWriteConcs(constString&folderPath,constArraysaves); 148//Getsflagfromthecontroller 149boolskipPoint; 150voidGetSkipPoint(); 151//ControllerisusedforupdatingGUI(notthreadsafe,mustcheckfirst) 152StateControllercontroller; 153//Deleteondone 154booldeleteSolver; 155//Usesthemigration 156booluseMigration; 157//Functionsusedforcalculatingequations 158//Rates 159constdoubleR1()const; 160constdoubleR2(constdoublez)const; 161constdoubleR3a()const; 162constdoubleR3b()const; 163constdoubleR4a()const; 164constdoubleR4b()const; 165constdoubleR5()const; 166constdoubleR6a()const; 167constdoubleR6b()const; 168constdoubleR7()const; 169//Semiconductor 170constdoublePoissonSc(constinti)const; 171constdoubleElectronFlux(constinti)const; 172constdoublePotentialFieldSc(constinti)const; 173constdoublePoissonFieldSc(constinti)const; 174constdoubleElectronFlux2(constinti)const; 175constdoubleElectronFlux3(constinti)const;//Nofield 176constdoubleElectronContinuity(constinti)const; 177constdoublePotentialFieldSc 0(constinti)const; 178constdoublePoissonFieldSc 0(constinti)const; 179constdoubleElectronFlux2 0(constinti)const; 180constdoubleElectronFlux3 0(constinti)const;//Nofield 181constdoubleElectronContinuity 0(constinti)const; 182//Electrolyte 183constdoublePoissonEl(constinti)const; 184constdoublePoissonEl2(constinti)const; 185constdoubleOhmEl(constinti)const; 186constdoubleRedFlux(constinti)const; 163

PAGE 164

187constdoubleRedFlux2(constinti)const; 188constdoubleOxFlux(constinti)const; 189constdoubleOxFlux2(constinti)const; 190constdoubleSupFlux(constinti)const; 191constdoubleSupFlux2(constinti)const; 192constdoubleRedContinuity(constinti)const; 193constdoubleOxContinuity(constinti)const; 194//Functionsusedforcalculatingderivatives 195constdoubledR1(constVarvar)const; 196constdoubledR2(constVarvar,constdoublez)const; 197constdoubledR3a(constVarvar)const; 198constdoubledR3b(constVarvar)const; 199constdoubledR4a(constVarvar)const; 200constdoubledR4b(constVarvar)const; 201constdoubledR5(constVarvar)const; 202constdoubledR6a(constVarvar)const; 203constdoubledR6b(constVarvar)const; 204constdoubledR7(constVarvar)const; 205g; 206// 207//SaveState)]TJ /F20 7.97 Tf 10.88 0 Td[(Usedforsavingdatatobewritentofilelater 208// 209classSubState 210f 211public: 212//Constructor 213SubState()fg 214//Set 215voidSet(Systemstate); 216//Addsrateconstants 217voidAddRates(Array&rates); 218//Addsflux 219voidAddFlux(Array&flux,constdoublea,constdoubledyeCoverage); 220//Addsconcentrations 221voidAddConc(Array&conc); 222//Returnsthetotalofalltherates 223constdoubleRateTotal(constdoubledyeCoverage)const 224freturn)]TJ /F10 7.97 Tf 6.71 0 Td[(((1)]TJ /F10 7.97 Tf 7.14 0 Td[(dyeCoverage)nr1+dyeCoverage(r4a+r4b+r5));g 225//Returnsthetotalofalltherates 226constdoubleRateTotal2(constdoubledyeCoverage)const 227freturn(1)]TJ /F10 7.97 Tf 7.16 0 Td[(dyeCoverage))]TJ /F10 7.97 Tf 10.71 0 Td[(r1+dyeCoverage()]TJ /F10 7.97 Tf 6.84 0 Td[(3r6a)]TJ /F10 7.97 Tf 6.36 0 Td[(3r6b+r7);g 164

PAGE 165

228//Returnsthetotalofalltherates 229constdoubleRateTotal3(constdoubledyeCoverage)const 230freturnd((1)]TJ /F10 7.97 Tf 7.5 0 Td[(dyeCoverage)r1+dyeCoverage(r6a+r6b+r7));g 231//Error 232doublestdError,maxError,perError; 233//TheZvalue 234doublez; 235//RateConstants 236doubler1,r2,r3a,r3b,r4a,r4b,r5,r6a,r6b,r7; 237doubleJ e P,J e,J e neg,J red,J ox,J red P,J ox P; 238//DyeConcentrations 239doubleC d g,C d pos,C d e1,C d e3,C e,C red,C ox,C sup; 240//CalculatedCurrent 241doublecurrent; 242//CalculatedphiSc 243doublephiSc; 244doublephiEl; 245doublephiD; 246//ListsforsolvingSemiconductor 247vectorphiScList; 248vectorfieldScList; 249vectorC eList; 250vectorJ eList; 251//ListforsolvingElectrolyte 252vectorphiElList; 253vectorC redList; 254vectorC oxList; 255vectorC supList; 256vectorJ redList; 257vectorJ oxList; 258g; 259classSaveState 260f 261public: 262//Constructor 263SaveState()fg 264SaveState(); 265//Set 266voidSet(doublev,intn); 267//Totalvaluescalculatedfromsubstates 268doublevoltage,current; 165

PAGE 166

269//Sub)]TJ /F20 7.97 Tf 6.55 0 Td[(States 270ArraysubStates; 271g; 1#includeAraMath.h 2#includeConsole.h 3#includeFlux.h 4#includeSystem.h 5#includeKinetics.h 6#includeConstants.h 7#includeSolveState.h 8#include//for isnan 9// 10//Constructor 11// 12System::System(constSystemstate) 13:C I(C I ref),C I3(C I3 ref), 14a(state)]TJ /F16 7.97 Tf 4.78 0 Td[(>a) 15f 16deleteSolver=false; 17useMigration=false; 18Set(state); 19solver=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>solver; 20g 21System::System(StateController controller,SolveStates,constdouble a) 22:C I(C I ref),C I3(C I3 ref), 23a( a) 24f 25controller= controller; 26solver=htnewSolveState(s)]TJ /F16 7.97 Tf 4.78 0 Td[(>shellThickness,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>nanorodLength,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>porocity,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>waitTime,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>maxAllowedError,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,s)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth); 27deleteSolver=true; 28useMigration=false; 29g 30System::System(StateController controller, 31doubleshellThickness,intshellIterations,intelecIterations, 32doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 33doubleporocity,doubledyeCoverage, 34doublemaxError,doublemaxTime) 35:C I(C I ref),C I3(C I3 ref), 36a((1+pi(nanorodDiameter+2shellThickness)nanorodLengthnanorodDensity)/nanorodLength) 37f 166

PAGE 167

38WriteLine(A = ,a); 39controller= controller; 40solver=htnewSolveState(shellThickness,nanorodLength,porocity,dyeCoverage,maxTime,maxError,shellIterations,elecIterations); 41deleteSolver=true; 42useMigration=false; 43g 44// 45//Destructor 46// 47System::System() 48f 49if(deleteSolver)deletesolver; 50g 51// 52//Solve 53// 54voidSystem::Solve(constString&folderName,constintpoints,constdoublevStart,constdoublevEnd,constintguassPoints,boolextendFirst,intmigrationType) 55f 56//Folderpath 57constStringpath=..nndatann+folderName+nn; 58SetupDir(path); 59//Variables 60Arraysaves(points+1); 61Kinetickinetics(this,guassPoints,a,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>porocity); 62constdoubleiNumb=(vEnd)]TJ /F10 7.97 Tf 6.81 0 Td[(vStart)/double(points); 63solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>numZ=guassPoints; 64//Starttheprogressbar 65InitializeProgress(); 66intcount=0; 67intt=solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>waitTime; 68doublefTime=0,jTime=0,solveTime=0; 69//Kinetics 70fori(points+1) 71f 72SaveState&save=saves[i]; 73save.Set(vStart+iNumbdouble(i),guassPoints); 74solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>fTime=0; 75solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>jTime=0; 76solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>solveTime=0; 167

PAGE 168

77//Solvethesystem 78solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>count=0; 79if(extendFirst&&i==0)solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>waitTime=10t; 80elsesolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>waitTime=t; 81//Solvewithcertainmigration 82if(migrationType==0) 83f 84useMigration=false; 85//updatesall 86kinetics.SolveCurrent(save,i==0?0:&saves[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]); 87//neverupdates 88//kinetics.SolveCurrent(save,0); 89g 90elseif(migrationType==1) 91f 92useMigration=true; 93kinetics.SolveCurrent(save,i==0?0:&saves[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]); 94g 95else 96f 97useMigration=false; 98kinetics.SolveCurrent(save,i==0?0:&saves[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]); 99useMigration=true; 100kinetics.SolveCurrent(save,&saves[i]); 101g 102count+=solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>count; 103//Timing 104fTime+=solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>fTime; 105jTime+=solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>jTime; 106solveTime+=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>solveTime; 107//Addpointstograph 108AddPlotPoints(&save); 109g 110//Finalizetheprogressbar 111FinishProgress(); 112WriteLine(Finished Solving Kinetics with ,count, inner loops!); 113WriteLine(Time in BuildF: ,fTime, seconds.); 114WriteLine(Time in BuildJ: ,jTime, seconds.); 115WriteLine(Time in SolveJ: ,solveTime, seconds.); 116//Writeoutthedatatofile 168

PAGE 169

117WriteData(path,&saves); 118g 119// 120//Set 121// 122voidSystem::Set(constSystemstate) 123f 124//Variables 125phiSc=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiSc; 126fieldSc=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>fieldSc; 127phiEl=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiEl; 128phi applied=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>phi applied; 129phiD=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 130J e=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>J e; 131J red=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>J red; 132J ox=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>J ox; 133C e=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C e; 134C red=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C red; 135C ox=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C ox; 136C sup=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C sup; 137C d g=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 138C d pos=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d pos; 139C d e1=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e1; 140C d e3=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e3; 141//Rates 142r1=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r1; 143r2=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r2; 144r3a=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r3a; 145r3b=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r3b; 146r4a=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4a; 147r4b=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4b; 148r5=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r5; 149r6a=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6a; 150r6b=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6b; 151r7=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r7; 152useMigration=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>useMigration; 153g 154// 155//Reset 156// 157voidSystem::Reset(constdoublev,SubStatelast) 169

PAGE 170

158f 159InitializeVoltages(v,last); 160InitializeConc(last); 161g 162// 163//InitializeConc 164// 165voidSystem::InitializeConc(SubStatelast) 166f 167if(last==0) 168f 169C d pos=(2e)]TJ /F10 7.97 Tf 6.8 0 Td[(16)exp(19.487phi applied); 170phiD=0.03; 171C d e3=2.54e)]TJ /F10 7.97 Tf 6.88 0 Td[(44; 172C d e1=1.9e)]TJ /F10 7.97 Tf 6.88 0 Td[(22; 173C d g=7.5e)]TJ /F10 7.97 Tf 6.86 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 174g 175else 176f 177C d pos=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos; 178phiD=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 179C d e3=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e3; 180C d e1=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1; 181C d g=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 182g 183//Same,nomatterwhat 184//C d pos=(2e)]TJ /F20 7.97 Tf 6.8 0 Td[(16)exp(19.487phi applied);//functionofphi applied 185//phiD=0.06phi applied; 186g 187// 188//InitializeVoltages 189// 190voidSystem::InitializeVoltages(constdoublev,SubStatelast) 191f 192phi applied=v; 193InitializeTotal(last); 194g 195// 196//InitialVerification 197// 198voidSystem::InitialVerification(constdoublez,constdoubletime) 170

PAGE 171

199f 200Clocktimer; 201Systemtemp=CreateRef(); 202inti=0; 203BuildF(z); 204doubleerror=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError; 205solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>initialError=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError; 206WriteLine(Initial Verification )]TJ ET q .398 w 197.3 -121.6 m 197.3 -120.35 l S Q q .398 w 197.5 -121.4 m 199.89 -121.4 l S Q q .398 w 200.09 -121.6 m 200.09 -120.35 l S Q BT /F10 7.97 Tf 201.88 -121.6 Td[(Error: ,error); 207while(timer.ElapsedSeconds()Set(this); 210temp)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetVar(i++)=Random(0.7,1.3); 211temp)]TJ /F16 7.97 Tf 4.78 0 Td[(>BuildF(z); 212if(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardErrorstandardError; 215Set(temp); 216g 217if(i>=Size())i=0; 218g 219WriteLine( New error: ,error); 220deletetemp; 221g 222// 223//Modes 224// 225intSystem::CurrentMode()constfreturnsolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mode;g 226voidSystem::SwitchMode()fUpdateMode();solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mode=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>mode+1)%Modes();g 227voidSystem::ResetMode()fsolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>mode=0;UpdateMode();g 228// 229//CalculateCurrent 230// 231constdoubleSystem::CalculateCurrent()const 232f 233constdoublecurrentEL=(1)]TJ /F10 7.97 Tf 7.66 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7); 234constdoublecurrentSC=(1)]TJ /F10 7.97 Tf 7.66 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5); 235return(/currentEL+/currentSC)nF; 236g 237// 171

PAGE 172

238//GenerateRates 239// 240voidSystem::GenerateRates(constdoublez) 241f 242r1=R1(); 243r2=R2(z); 244r3a=R3a(); 245r3b=R3b(); 246r4a=R4a(); 247r4b=R4b(); 248r5=R5(); 249r6a=R6a(); 250r6b=R6b(); 251r7=R7(); 252g 253// 254//IntegrateConc 255// 256constdoubleSystem::IntegrateConc(constdoublez)const 257f 258returnsolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>flux.Integrate(C d g,z,a); 259g 260// 261//DerivativeConc 262// 263constdoubleSystem::DerivativeConc(constdoublez)const 264f 265returnsolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>flux.Derivative(C d g,z,a); 266g 267// 268//SolveJ 269// 270voidSystem::SolveJ() 271f 272#ifREGULARIZE MU 273solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Regularize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>mu); 274solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>addNegColumn(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f); 275solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>WriteData(DataPath(j before.csv)); 276solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>rref(); 277solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>WriteData(DataPath(j after.csv)); 278#endif 172

PAGE 173

279solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>addNegColumn(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f); 280solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>WriteData(DataPath(j before.csv)); 281solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>rref(); 282solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>WriteData(DataPath(j after.csv)); 283//system(pause); 284solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>count++; 285g 286constdoubleSystem::GetC e()constfreturnN a;g 287// 288//Var 289// 290double&System::GetVar(inti) 291f 292if(i==0)returnC d g; 293elseif(i==1)returnC d pos; 294elseif(i==2)returnC d e1; 295elseif(i==3)returnC d e3; 296elsereturnphiD; 297g 298// 299//SaveState 300// 301voidSubState::Set(Systemstate) 302f 303//Variables 304C d g=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 305C d pos=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d pos; 306C d e1=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e1; 307C d e3=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e3; 308phiD=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiD; 309C e=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC e(); 310C red=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC red(); 311C ox=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC ox(); 312C sup=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetC sup(); 313J e P=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetJ e P(); 314J e=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>GetJ e(); 315J red=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetJ red(); 316J ox=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetJ ox(); 317J red P=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>GetJ red P(); 318J ox P=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetJ ox P(); 319//Rates 173

PAGE 174

320r1=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r1; 321r2=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r2; 322r3a=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r3a; 323r3b=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r3b; 324r4a=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4a; 325r4b=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r4b; 326r5=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r5; 327r6a=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6a; 328r6b=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r6b; 329r7=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>r7; 330//Current 331current=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateCurrent(); 332//Current 333phiSc=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetPhiSc(); 334phiEl=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetPhiEl(); 335//Lists 336phiScList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiSc; 337fieldScList=state)]TJ /F16 7.97 Tf 4.79 0 Td[(>fieldSc; 338phiElList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiEl; 339C eList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C e; 340C redList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C red; 341C oxList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C ox; 342C supList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>C sup; 343J eList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>J e; 344J redList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>J red; 345J oxList=state)]TJ /F16 7.97 Tf 4.78 0 Td[(>J ox; 346//Error 347stdError=log10(state)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 348maxError=log10(state)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>maxError); 349perError=log10(state)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError/state)]TJ /F16 7.97 Tf 4.78 0 Td[(>solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>initialError); 350g 351// 352//Add 353// 354voidSubState::AddRates(Array&rates) 355f 356rates[0]+=r1; 357rates[1]+=r2; 358rates[2]+=r3a; 359rates[3]+=r3b; 360rates[4]+=r4a; 174

PAGE 175

361rates[5]+=r4b; 362rates[6]+=r5; 363rates[7]+=r6a; 364rates[8]+=r6b; 365rates[9]+=r7; 366g 367voidSubState::AddFlux(Array&flux,constdoublea,constdoubledyeCoverage) 368f 369flux[0]+=J e P; 370flux[1]+=0;//aRateTotal(dyeCoverage); 371flux[2]+=J e; 372flux[3]+=RateTotal(dyeCoverage); 373flux[4]+=)]TJ /F10 7.97 Tf 6.91 0 Td[(J red; 374flux[5]+=J ox; 375flux[6]+=RateTotal3(dyeCoverage); 376flux[7]+=0;//RateTotal2(dyeCoverage); 377g 378voidSubState::AddConc(Array&conc) 379f 380conc[0]+=C d g; 381conc[1]+=C d pos; 382conc[2]+=C d e1; 383conc[3]+=C d e3; 384conc[4]+=C e; 385conc[5]+=C red; 386conc[6]+=C ox; 387conc[7]+=C sup; 388g 389SaveState::SaveState() 390f 391fori(subStates.Size())deletesubStates[i]; 392g 393voidSaveState::Set(doublev,intn) 394f 395voltage=v; 396fori(n)subStates.Append(htnewSubState); 397g 1#pragmaonce 2#includeSystem.h 3//TheMainSystemisthemostcurrentversionofthedevelopment 4classMainSystem:publicSystem 175

PAGE 176

5f 6public: 7//Constructor 8MainSystem(StateController controller, 9doubleshellThickness,intshellIterations,intelecIterations, 10doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 11doubleporocity,doubledyeCoverage, 12doublemaxError,doublemaxTime); 13MainSystem(StateController controller,SolveState solver,constdouble a); 14MainSystem(constMainSystemstate); 15//Createsacompletecopy 16SystemCreateCopy()const; 17//Createsareference 18SystemCreateRef()const; 19//InitializedtheTotalArrayforphiSc,C e&J e 20voidInitializeTotal(SubStatelast); 21voidInitializeConc(SubStatelast); 22//Buildsmatricesforsystem 23voidBuildJ(constdoublez); 24voidBuildF(constdoublez); 25//Doesthenewtonstepforthesystem 26voidNewtonStep(); 27//Checkstoseeifthecurrentstateispossible(valid) 28boolIsValid()const; 29//Genericaccesforallvariables 30double&GetVar(inti); 31intSize()const; 32//Modes 33intModes()constfreturn2;g 34doubleModeConverganceError()const; 35voidUpdateMode(); 36//Printstheconvergancestufftotheconsole 37virtualvoidPrintConvergance(); 38protected: 39//Functionsforgettingthecorrectinterfacevalues 40constdoubleGetPhiSc()const; 41constdoubleGetPhiEl()const; 42constdoubleGetC e()const; 43constdoubleGetC red()const; 44constdoubleGetC ox()const; 45constdoubleGetC sup()const; 176

PAGE 177

46constdoubleGetJ e()const; 47constdoubleGetJ red()const; 48constdoubleGetJ ox()const; 49//Functionsforgettingthecorrectinterfacederivatives 50constdoubleGetJ e P()const; 51//Savedvaluesusedforerrorcalculations 52doubleoldC e; 53doubleoldRateTotal; 54doubleoldPhiSc; 55doubleoldphiD; 56doubleoldJ e,oldJ red,oldJ ox; 57g; 1#includeAraMath.h 2#includeConsole.h 3#includeMainSystem.h 4#includeConstants.h 5#includeSolveState.h 6#includeLine.h 7#includeThreadCheck.h 8#include//for isnan 9// 10//Constructor 11// 12MainSystem::MainSystem(constMainSystemstate) 13:System(state) 14f 15g 16MainSystem::MainSystem(StateController controller,SolveStates,constdouble a) 17:System( controller,s, a) 18f 19g 20MainSystem::MainSystem(StateController controller, 21doubleshellThickness,intshellIterations,intelecIterations, 22doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 23doubleporocity,doubledyeCoverage, 24doublemaxError,doublemaxTime) 25:System( controller,shellThickness,shellIterations,elecIterations,nanorodLength,nanorodDiameter,nanorodDensity, 26porocity,dyeCoverage,maxError,maxTime) 27f 28g 177

PAGE 178

29// 30//CreateCopy 31// 32SystemMainSystem::CreateCopy()const 33f 34returnhtnewMainSystem(controller,solver,a); 35g 36// 37//CreateRef 38// 39SystemMainSystem::CreateRef()const 40f 41returnhtnewMainSystem(this); 42g 43// 44//InitializephiSc[n],C e[n]&J e[n] 45// 46voidMainSystem::InitializeTotal(SubStatelast) 47f 48//Solvingfunctions 49constPolynomialbetaC e()]TJ /F10 7.97 Tf 7.19 0 Td[(0.0575,1.2794,)]TJ /F10 7.97 Tf 7.05 0 Td[(1.6917,0.7721); 50if(last) 51f 52//Semiconductor 53phiSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiScList; 54fieldSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>fieldScList; 55//phiEl=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiElList; 56//C e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C eList; 57J e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J eList; 58//Electrolyte 59C red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C redList; 60C ox=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C oxList; 61C sup=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C supList; 62J red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J redList; 63J ox=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>J oxList; 64g 65else 66f 67//Semiconductor 68phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+2,1e)]TJ /F10 7.97 Tf 6.75 0 Td[(6); 69fieldSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,0); 178

PAGE 179

70C e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1); 71ExponentialinitialC e(1e)]TJ /F10 7.97 Tf 6.81 0 Td[(8,betaC e(phi applied)); 72fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)C e[i]=initialC e(double(i+1)); 73J e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,)]TJ /F10 7.97 Tf 6.85 0 Td[(1.75e)]TJ /F10 7.97 Tf 6.76 0 Td[(7); 74//Electrolyte 75C red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref); 76//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)C red[i]=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4)]TJ /F20 7.97 Tf 11.45 0 Td[(double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)(5e)]TJ /F20 7.97 Tf 5.94 0 Td[(4)]TJ /F20 7.97 Tf 6.81 0 Td[(C I); 77//C ox.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,C I3 ref/+7e)]TJ /F20 7.97 Tf 7.22 0 Td[(7/); 78C ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I3 ref); 79//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)C ox[i]=double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)C I3+1e)]TJ /F20 7.97 Tf 6.87 0 Td[(7; 80C sup.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref+C I3 ref); 81J red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 82J ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 83g 84//phiEl.clear(); 85phiSc.clear(); 86//phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2,phi applied); 87phiSc.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,phi applied); 88//phiSc[1]=0.03; 89//phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth]=phi applied; 90//J e.clear(); 91//J red.clear(); 92//J ox.clear(); 93//J e.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1,)]TJ /F20 7.97 Tf 6.84 0 Td[(1.49e)]TJ /F20 7.97 Tf 6.76 0 Td[(7); 94//J red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,)]TJ /F20 7.97 Tf 7.03 0 Td[(39.59e)]TJ /F20 7.97 Tf 6.79 0 Td[(16); 95//J ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,9.59e)]TJ /F20 7.97 Tf 6.79 0 Td[(16); 96//phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=phi applied; 97//phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth]=phi applied; 98//phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1]=phi applied; 99//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2)phiEl[i]=(1)]TJ /F20 7.97 Tf 11.45 0 Td[(double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1))phi applied; 100g 101// 102//InitializeConc 103// 104voidMainSystem::InitializeConc(SubStatelast) 105f 106if(last==0) 107f 179

PAGE 180

108C d pos=1.26e)]TJ /F10 7.97 Tf 6.88 0 Td[(16; 109C d e3=2.54e)]TJ /F10 7.97 Tf 6.88 0 Td[(44; 110C d e1=1.9e)]TJ /F10 7.97 Tf 6.88 0 Td[(22; 111C d g=7.5e)]TJ /F10 7.97 Tf 6.86 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 112phiD=0.15; 113g 114else 115f 116C d pos=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos; 117C d e3=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e3; 118C d e1=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1; 119C d g=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 120phiD=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 121g 122//Same,nomatterwhat 123//C d pos=(2e)]TJ /F20 7.97 Tf 6.8 0 Td[(16)exp(18.31phi applied);//functionofphi applied 124g 125// 126//IsValid 127// 128boolMainSystem::IsValid()const 129f 130if(CurrentMode()==0) 131returnIsPositive(C d pos)&& 132IsPositive(C d e1)&& 133IsPositive(C d e3)&& 134(C d g>0)&& 135(C d g<=7.5e)]TJ /F10 7.97 Tf 6.76 0 Td[(5)&& 136! isnan(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError); 137else 138f 139for(inti=0;istandardError); 147g 148g 180

PAGE 181

149// 150//ModeConverganceError 151// 152doubleMainSystem::ModeConverganceError()const 153f 154//Calculatealltheerror 155doubleerror1=fabs((GetC e())]TJ /F10 7.97 Tf 11.48 0 Td[(oldC e)/GetC e()); 156doubleerror2=fabs((RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 11.7 0 Td[(oldRateTotal)/RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 157doubleerror3=fabs((GetPhiSc())]TJ /F10 7.97 Tf 11.53 0 Td[(oldPhiSc)/GetPhiSc()); 158doubleerror4=fabs((phiD)]TJ /F10 7.97 Tf 11.58 0 Td[(oldphiD)/phiD); 159doubleerror5=fabs((GetJ e())]TJ /F10 7.97 Tf 11.73 0 Td[(oldJ e)/GetJ e()); 160doubleerror6=fabs((GetJ red())]TJ /F10 7.97 Tf 11.8 0 Td[(oldJ red)/GetJ red()); 161doubleerror7=fabs((GetJ ox())]TJ /F10 7.97 Tf 11.72 0 Td[(oldJ ox)/GetJ ox()); 162//Returnthelargesterror 163returnmax(max(max(error1,error2),max(error3,error4)),max(max(error5,error6),error7)); 164g 165// 166//PrintConvergance 167// 168voidMainSystem::PrintConvergance() 169f 170ThreadCheck(MainSystem::PrintConvergance); 171WriteLine(ntntR tot ,oldRateTotal, => ,RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 172WriteLine(ntntPhiSc ,oldPhiSc, => ,GetPhiSc()); 173WriteLine(ntntPhiD ,oldphiD, => ,phiD); 174WriteLine(ntntC e ,oldC e, => ,GetC e()); 175WriteLine(ntntJ e ,oldJ e, => ,GetJ e()); 176WriteLine(ntntJ red ,oldJ red, => ,GetJ red()); 177WriteLine(ntntJ ox ,oldJ ox, => ,GetJ ox()); 178g 179voidMainSystem::UpdateMode() 180f 181//Savealltheoldvalues 182oldC e=GetC e(); 183oldRateTotal=RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage); 184oldPhiSc=GetPhiSc(); 185oldphiD=phiD; 186oldJ e=GetJ e(); 187oldJ red=GetJ red(); 181

PAGE 182

188oldJ ox=GetJ ox(); 189g 190// 191//BuildJ 192// 193voidMainSystem::BuildJ(constdoublez) 194f 195//SetupthesizeoftheJacobian 196constintsize=Size(); 197solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(size,size); 198if(CurrentMode()==0) 199f 200//Indicesforderivatives 201constintconcStart=0; 202constintphiDStart=4; 203constintJ eStart=5; 204constintJ redStart=6; 205constintJ oxStart=7; 206constintfieldStart=8; 207// 208//Interface 209// 210//Equation4 211//r2)]TJ /F20 7.97 Tf 11.47 0 Td[(r3a)]TJ /F20 7.97 Tf 11.48 0 Td[(r4a+nr6a=0 212//d/dC d g 213solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart,dR2( C d g,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d g))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( C d g)+ndR6a( C d g)); 214//d/dC d pos=0 215//d/dC d e1 216solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart+2,dR2( C d e1,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4a( C d e1)+ndR6a( C d e1)); 217//Equation5 218//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b+nr6b=0//maybeshouldbe+r6b???1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 219//d/dC d e1 220solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+2,dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e1)+ndR6b( C d e1)); 221//d/dC d e3 222solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+3,dR3a( C d e3))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e3)+ndR6b( C d e3)); 223//Equation6 182

PAGE 183

224//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0//Addedr5b/citshouldhavebeenthere?1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 225//d/dC d pos 226solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+1,dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos))); 227//d/dC d e1 228solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+2,dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1))); 229//d/dC d e3 230solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+3,dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3))); 231//Equation7 232//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 233for(inti=0;i<4;i++) 234solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,concStart+i,1); 235//Gauss'sequationattheinterface 236//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 237//d/dphiD 238solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 239//d/dC d pos 240solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,concStart+1,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/a); 241//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 242//C d pos[n] 243solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos)))); 244//C d e1[n] 245solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+2,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1)))); 246//C d e3[n] 247solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+3,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3)))); 248//J e[n] 249solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart,1); 250//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 251//d/dC d pos 252solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 253//d/dC d e1 254solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+2,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 183

PAGE 184

255//d/dC d e3 256solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+3,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 257//d/dJ red 258solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,1); 259//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 260//d/dC d pos 261solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 262//d/dC d e1 263solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+2,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 264//d/dC d e3 265solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+3,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 266//d/dJ red 267solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 268//field[0]=fieldINT 269//fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F20 7.97 Tf 11.84 0 Td[((phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc 270solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart,1); 271solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/dell Sc); 272//fieldEl=fieldINT 273//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart+1,fieldStart+1,1); 274//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart+1,phiDStart,2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec/dell El); 275g 276else 277f 278//Indicesforderivatives 279constintphiStart=0; 280constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 281constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 282constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 283constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 284constintphiElStart=phiDStart+1; 285constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2; 286constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 287constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 288constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 289constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 290// 184

PAGE 185

291//Semiconductor 292// 293//Phiboundaryconditions: 294//phiSc[0]=0 295solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,phiStart,1);//ChangedcolumnfromphiStarttophiStart+1,jjh 296//fieldSc[0]=0 297solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth,1); 298solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1/dell Sc); 299solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/dell Sc); 300//C eboundaryconditions: 301//C e[0]=N a 302solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,C eStart,/)]TJ /F20 7.97 Tf 10.77 0 Td[(1/)]TJ /F10 7.97 Tf 12.05 0 Td[(f(phiSc[1])]TJ /F10 7.97 Tf 11.43 0 Td[(phiSc[0])); 303//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart+1,1); 304solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/D e); 305solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,phiStart,fC e[0]); 306solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,phiStart+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(fC e[0]); 307//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F20 7.97 Tf 6.81 0 Td[(1,N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf -361.23 -15.66 Td[(GetPhiSc())/(RT))); 308//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiDStart,)]TJ /F20 7.97 Tf 6.3 0 Td[(N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf 6.19 0 Td[(GetPhiSc())/(RT))); 309//RightBoundaryCondition 310//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 311//JacobianEntries 312//phiSc[n] 313solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiSc)+dR4b( phiSc)+dR5( phiSc)))); 314//C e[n] 315solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C e)+dR4b( C e)+dR5( C e)))); 316//phiEl[n] 317solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,phiElStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiEl)+dR4b( phiEl)+dR5( phiEl)))); 318//C ox[n] 319solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,oxStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C ox)+dR4b( C ox)+dR5( C ox)))); 320//C red[n] 321solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,redStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C red)+dR4b( C red)+dR5( C red)))); 322//J e[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 185

PAGE 186

323//J e[n+1] 324solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1); 325//LeftBoundary 326//Equation1 327//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 328solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart+1,1); 329solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 330solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 331//Equation2 332//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 333solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart+1,1); 334solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 335solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,C eStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemiF/(E sc)); 336//Equation3 337//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/hSemi)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/hSemi=0 338solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,phiStart+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 339solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,phiStart,f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 340solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart+1,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi); 341solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)]TJ /F10 7.97 Tf 12.05 0 Td[(f(phiSc[1])]TJ /F10 7.97 Tf 7.86 0 Td[(phiSc[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 342solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,J eStart,1/D e); 343//Equation4 344//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=0,R net=0fornow 345solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart+1,1); 346solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 347//Restofcentralarea 348for(inti=1;isemiWidth;i++) 349f 350//Equation1 351//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemifieldSc[n]=0 352//d/dphi[n+1] 353solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i+1,1); 354//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 355solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 356//d/dfield[n] 357solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,fieldStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 358//Equation2 359//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+2hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 360//d/dfield[n+1] 361solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i+1,1); 186

PAGE 187

362//d/dfield[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 363solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 364//d/dC e[n] 365solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)F/(E sc));//thisstartsatthe0'thtermsono+1,jjh 366//Equation3 367//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/(2hSemi))]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/(2hSemi)=0 368//d/dphi[n+1] 369solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 370//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 371solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 372//d/dC e[n+1] 373solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i+1,1/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 374//d/dC e[n] 375solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(phiSc[i+1])]TJ /F10 7.97 Tf 7.45 0 Td[(phiSc[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 376//d/dC e[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 377solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 7.1 0 Td[(1/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 378//d/dJ e[n] 379solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,J eStart+i,1/D e); 380//Equation4 381//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=0,R net=0fornow 382//d/dJ e[n+1] 383solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i+1,1); 384//d/dJ e[n] 385solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 386//d/dC e[n] 387//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i,C eStart+i]=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi1e5;//Commentedout12)]TJ /F20 7.97 Tf 6.45 0 Td[(09)]TJ /F20 7.97 Tf 6.45 0 Td[(09 388g 389//Gauss'sequationattheinterface 390//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 391//d/dphiSc 392solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,E sc/dell Sc); 393//d/dphiD 394solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 395//d/dphiEl 396solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiElStart+1,E el/dell El); 187

PAGE 188

397// 398//Electrolye 399// 400//PhiEl 401//phi=v 402solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 403//dPhi=0 404//phiEl[2])]TJ /F20 7.97 Tf 11.8 0 Td[(phiEl[0])]TJ /F20 7.97 Tf 11.07 0 Td[(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec(phiEl[1])]TJ /F20 7.97 Tf 7.75 0 Td[(phiD)/dell El 405solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,1); 406//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,phiElStart+1,)]TJ /F20 7.97 Tf 6.41 0 Td[(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec/dell El); 407solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 408//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,phiDStart,2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec/dell El); 409//J red 410//C red=C I ref 411solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 412//J ox 413//C sup=C I3 ref 414solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 415//C 416//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 417solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 418//BC 419//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 420//d/dphiSc 421solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 422//d/dC e 423solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 424//d/dphiEl 425solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiElStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 426//d/dC red 427solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,redStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 188

PAGE 189

428//d/dC ox 429solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,oxStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 430//d/dJ red 431solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,1); 432//BC 433//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 434//d/dphiSc 435solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 436//d/dC e 437solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 438//d/dphiEl 439solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiElStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 440//d/dC red 441solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,redStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 442//d/dC ox 443solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,oxStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 444//d/dJ red 445solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 446//C ox=1e)]TJ /F20 7.97 Tf 6.11 0 Td[(7 447//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,oxStart,1); 448for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth;i++) 449f 450//Equation8 451//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.06 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.71 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])=0 452solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1); 453solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.72 0 Td[(2); 454solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i+1,1); 455solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 456solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart)]TJ /F10 7.97 Tf 6.32 0 Td[(1+i,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 457solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 458//Equation9 189

PAGE 190

459//J red[i]+D red(C red[i])]TJ /F20 7.97 Tf 7.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 7.19 0 Td[(1]0.5f(phiEl[i+1])]TJ /F20 7.97 Tf -316.56 -15.66 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 460solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J redStart+i,1/D red); 461solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,redStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 462if(!useMigration) 463f 464solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 465g 466else 467f 468solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1(1+0.5f(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 469solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,)]TJ /F10 7.97 Tf 6.41 0 Td[(1C red[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 470solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C red[i)]TJ /F10 7.97 Tf 7.19 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 471g 472//Equation10 473//J ox[i]+D ox(C ox[i])]TJ /F20 7.97 Tf 7.2 0 Td[(C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.18 0 Td[(C ox[i)]TJ /F20 7.97 Tf 7.34 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1]))/h=0 474solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J oxStart+i,1/D ox); 475solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,oxStart+i,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 476if(!useMigration) 477f 478solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 479g 480else 481f 482solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.82 0 Td[(1(1+0.5f(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 483solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,)]TJ /F10 7.97 Tf 6.41 0 Td[(1C ox[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 484solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C ox[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 485g 486//Equation11 487//C sup[i])]TJ /F20 7.97 Tf 7.18 0 Td[(C sup[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+C sup[i)]TJ /F20 7.97 Tf 7.35 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 488solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,supStart+i,1); 489if(!useMigration) 490f 491solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 190

PAGE 191

492g 493else 494f 495solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 496solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,()]TJ /F10 7.97 Tf 6.72 0 Td[(1+0.5f(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))); 497solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,)]TJ /F10 7.97 Tf 6.39 0 Td[(C sup[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f); 498solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C sup[i)]TJ /F10 7.97 Tf 7.19 0 Td[(1]0.5f); 499g 500//Equation12 501//J red[i])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 502solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i,1); 503solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 504//Equation13 505//J ox[i])]TJ /F20 7.97 Tf 11.54 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 506solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i,1); 507solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 508g 509g 510g 511// 512//BuildF 513// 514voidMainSystem::BuildF(constdoublez) 515f 516//GenerateRateconstants 517//Makesurethisiscalledorrestofthefunctionwillnotworkproperly!!! 518GenerateRates(z); 519//SetupthesizeoftheFvector 520constintsize=Size(); 521//InitializesizeofFmatrix 522solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(1,size); 523if(CurrentMode()==0) 524f 525constintconcStart=0; 526constintphiDStart=concStart+4; 527constintjStart=phiDStart+1; 528constintfieldStart=jStart+3; 529// 530//KENETICINTERFACEPART 531// 191

PAGE 192

532//Equation4 533//r2)]TJ /F20 7.97 Tf 11.48 0 Td[(r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r4a+nr6a=0 534solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,0,r2)]TJ /F10 7.97 Tf 11.47 0 Td[(r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r4a+nr6a); 535//Equation5 536//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b)]TJ /F20 7.97 Tf 10.94 0 Td[(nr6b=0 537solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,0,r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r3b)]TJ /F10 7.97 Tf 11.47 0 Td[(r4b+nr6b); 538//Equation6 539//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0 540solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,0,r4a+r4b+r5)]TJ /F10 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)); 541//Equation7 542//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 543solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,0,C d g+C d pos+C d e1+C d e3)]TJ /F10 7.97 Tf 11.73 0 Td[(C d t); 544//Gauss'sLawattheinterface 545//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 546solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.67 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 547//J eBC 548//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 549solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart,0,GetJ e())]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 550//J redBC 551//J red=1.5rNet(@interface) 552solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+1,0,GetJ red()+b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 553//J oxBC 554//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 555solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+2,0,)]TJ /F10 7.97 Tf 6.65 0 Td[(GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 556//field[0]=fieldINT 557solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.83 0 Td[((phiD)]TJ /F10 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 558//fieldEl=fieldINT 559//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart+1,0,phiEl[1])]TJ /F20 7.97 Tf 11.89 0 Td[(phi applied/phiEl[2])]TJ /F20 7.97 Tf 11.8 0 Td[(phiEl[0])]TJ /F20 7.97 Tf -356.36 -15.67 Td[(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec(phiEl[1])]TJ /F20 7.97 Tf 7.75 0 Td[(phiD)/dell El/); 560g 561else 562f 563constintphiStart=0; 564constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 192

PAGE 193

565constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 566constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 567constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 568constintphiElStart=phiDStart+1; 569constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2; 570constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 571constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 572constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 573constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 574// 575//SEMICONDUCTORPART 576// 577//PhiScBC's 578//phiSc[0]=0 579solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,0,phiSc[0]/)]TJ /F20 7.97 Tf 15.96 0 Td[(phi applied/); 580//phiSc[2])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0]=0 581//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(1,0,phiSc[2])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[0]); 582//field[0]=0 583solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.83 0 Td[((phiD)]TJ /F10 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 584//C eBC 585//C e[0]=N a 586solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,0,/C e[1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[0]/+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/D eJ e[0])]TJ /F10 7.97 Tf 12.05 0 Td[(fC e[0](phiSc[1])]TJ /F10 7.97 Tf 7.86 0 Td[(phiSc[0])); 587//J eBC 588//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 589solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,0,GetJ e())]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 590//LeftBoundary 591solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,0,PotentialFieldSc 0(0)); 592solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,0,PoissonFieldSc 0(0)); 593solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,0,ElectronFlux2 0(0)); 594solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,0,ElectronContinuity 0(0)); 595for(inti=1;isemiWidth;i++) 596f 597//Equation1 598//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 599solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,0,PotentialFieldSc(i)); 600//Equation2 601//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 193

PAGE 194

602solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,0,PoissonFieldSc(i)); 603//Equation3 604//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi)]TJ /F20 7.97 Tf 12.05 0 Td[(fSq(C e[i])(phiSc[i+1])]TJ /F20 7.97 Tf 7.45 0 Td[(phiSc[i])/(hSemi))=0 605solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,0,ElectronFlux2(i)); 606//Equation4 607//J e[i+1])]TJ /F20 7.97 Tf 11.54 0 Td[(J e[i])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemiR net=0,R net=0fornow 608solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,0,ElectronContinuity(i)); 609g 610//Gauss'sLawattheinterface 611//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 612solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.66 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 613// 614//ELECTROLYTEPART 615// 616//PhiElBC(1) 617//phiEl)]TJ /F20 7.97 Tf 11.17 0 Td[(v=0 618solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 11.88 0 Td[(phi applied); 619//PhiElBC(2) 620//phiEl p=0 621solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1])]TJ /F10 7.97 Tf 11.8 0 Td[(phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)]TJ /F10 7.97 Tf 6.86 0 Td[(1]/)]TJ /F20 7.97 Tf 19.91 0 Td[(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec(phiEl[1])]TJ /F20 7.97 Tf 7.75 0 Td[(phiD)/dell El/); 622//C redBC 623//C red=C I ref 624solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C red[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 12.07 0 Td[(C I ref); 625//C oxBC 626//C ox=C I3 ref 627solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0,C ox[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 11.96 0 Td[(C I3 ref); 628//C supBC 629//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 630solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C sup[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 10.94 0 Td[(5e)]TJ /F10 7.97 Tf 6.76 0 Td[(4); 631//J redBC 632//J red=1.5rNet(@interface) 633solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,0,GetJ red()+b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 634//J oxBC 635//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 636solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,0,)]TJ /F10 7.97 Tf 6.66 0 Td[(GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 194

PAGE 195

637for(inti=0;ielecWidth;i++) 638f 639//Equation8 640//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.06 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.71 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])=0 641solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i+1,0,PoissonEl(i+1)); 642//Equation9 643//J red[i+1]+D red(C red[i+1])]TJ /F20 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC red[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf -316.56 -15.67 Td[(phiEl[i]))/h=0 644solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+i,0,RedFlux(i)); 645//Equation10 646//J ox[i+1]+D ox(C ox[i+1])]TJ /F20 7.97 Tf 7.21 0 Td[(C ox[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC ox[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i]))/h=0 647solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+i,0,OxFlux(i)); 648//Equation11 649//C sup[i+1])]TJ /F20 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i])=0 650solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+i,0,SupFlux(i)); 651//Equation12 652//J red[i+1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec 653solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i+1,0,RedContinuity(i)); 654//Equation13 655//J ox[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J ox[i]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec 656solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i+1,0,OxContinuity(i)); 657g 658g 659//Calculatetheerrorofthefmatrix 660solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateError(); 661g 662// 663//NewtonStep 664// 665voidMainSystem::NewtonStep() 666f 667constintsize=Size(); 668if(CurrentMode()==0) 669f 670//Concentrations 671C d g+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(0,size)); 672C d pos+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(1,size)); 195

PAGE 196

673C d e1+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(2,size)); 674C d e3+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(3,size)); 675//PhiD 676phiD+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(4,size)); 677//Flux 678J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.86 0 Td[(1]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(5,size)); 679J red[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(6,size)); 680J ox[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(7,size)); 681fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(8,size)); 682//phiEl[1]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(9,size)); 683g 684else 685f 686constintphiStart=0; 687constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 688constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 689constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 690constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 691constintphiElStart=phiDStart+1; 692constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2; 693constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 694constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 695constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 696constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 697//Semiconductor 698for(inti=0;isemiWidth+1;i++) 699f 700phiSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiStart+i,size)); 701fieldSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(fieldStart+i,size)); 702C e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(C eStart+i,size)); 703J e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J eStart+i,size)); 704g 705//PhiD 706phiD+=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(phiDStart,size)); 707//PhiEl 196

PAGE 197

708for(inti=0;ielecWidth+2;i++) 709phiEl[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiElStart+i,size)); 710//TheRest 711for(inti=0;ielecWidth+1;i++) 712f 713C red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(redStart+i,size)); 714C ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(oxStart+i,size)); 715C sup[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(supStart+i,size)); 716J red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J redStart+i,size)); 717J ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J oxStart+i,size)); 718g 719g 720g 721constdoubleMainSystem::GetPhiSc()constfreturnphiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 722constdoubleMainSystem::GetC e()constfreturnC e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 723constdoubleMainSystem::GetJ e()constfreturnJ e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 724constdoubleMainSystem::GetPhiEl()constfreturnphiEl[1];g 725constdoubleMainSystem::GetC red()constfreturnC red[1];g 726constdoubleMainSystem::GetC ox()constfreturnC ox[1];g 727constdoubleMainSystem::GetC sup()constfreturnC sup[1];g 728constdoubleMainSystem::GetJ red()constfreturnJ red[0];g 729constdoubleMainSystem::GetJ ox()constfreturnJ ox[0];g 730constdoubleMainSystem::GetJ e P()constfreturn(J e[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.53 0 Td[(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.24 0 Td[(2])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);g 731// 732//size 733// 734intMainSystem::Size()const 735f 736if(CurrentMode()==0) 737return4+4+1/+1/; 738else 739return4(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)+1+(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2)+5(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 740g 741// 742//Var 743// 744double&MainSystem::GetVar(inti) 745f 746if(CurrentMode()==0) 197

PAGE 198

747f 748if(i==0) 749returnC d g; 750elseif(i==1) 751returnC d pos; 752elseif(i==2) 753returnC d e1; 754elseif(i==3) 755returnC d e3; 756else 757returnphiD; 758g 759else 760f 761constintw1=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth; 762constintw2=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth; 763if(i
PAGE 199

6public: 7//Constructor 8MainSystemNoField(StateController controller, 9doubleshellThickness,intshellIterations,intelecIterations, 10doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 11doubleporocity,doubledyeCoverage, 12doublemaxError,doublemaxTime); 13MainSystemNoField(StateController controller,SolveState solver,constdouble a); 14MainSystemNoField(constMainSystemNoFieldstate); 15//Createsacompletecopy 16SystemCreateCopy()const; 17//Createsareference 18SystemCreateRef()const; 19//InitializedtheTotalArrayforphiSc,C e&J e 20voidInitializeTotal(SubStatelast); 21voidInitializeConc(SubStatelast); 22//Buildsmatricesforsystem 23voidBuildJ(constdoublez); 24voidBuildF(constdoublez); 25//Doesthenewtonstepforthesystem 26voidNewtonStep(); 27//Checkstoseeifthecurrentstateispossible(valid) 28boolIsValid()const; 29//Genericaccesforallvariables 30double&GetVar(inti); 31intSize()const; 32//Modes 33intModes()constfreturn2;g 34doubleModeConverganceError()const; 35voidUpdateMode(); 36//Printstheconvergancestufftotheconsole 37virtualvoidPrintConvergance(); 38protected: 39//Functionsforgettingthecorrectinterfacevalues 40constdoubleGetPhiSc()const; 41constdoubleGetPhiEl()const; 42constdoubleGetC e()const; 43constdoubleGetC red()const; 44constdoubleGetC ox()const; 45constdoubleGetC sup()const; 46constdoubleGetJ e()const; 199

PAGE 200

47constdoubleGetJ red()const; 48constdoubleGetJ ox()const; 49//Functionsforgettingthecorrectinterfacederivatives 50constdoubleGetJ e P()const; 51//Savedvaluesusedforerrorcalculations 52doubleoldC e; 53doubleoldRateTotal; 54doubleoldPhiSc; 55doubleoldphiD; 56doubleoldJ e,oldJ red,oldJ ox; 57g; 1#includeAraMath.h 2#includeConsole.h 3#includeMainSystemNoField.h 4#includeConstants.h 5#includeSolveState.h 6#includeLine.h 7#includeThreadCheck.h 8#include//for isnan 9// 10//Constructor 11// 12MainSystemNoField::MainSystemNoField(constMainSystemNoFieldstate) 13:System(state) 14f 15g 16MainSystemNoField::MainSystemNoField(StateController controller,SolveStates,constdouble a) 17:System( controller,s, a) 18f 19g 20MainSystemNoField::MainSystemNoField(StateController controller, 21doubleshellThickness,intshellIterations,intelecIterations, 22doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 23doubleporocity,doubledyeCoverage, 24doublemaxError,doublemaxTime) 25:System( controller,shellThickness,shellIterations,elecIterations,nanorodLength,nanorodDiameter,nanorodDensity, 26porocity,dyeCoverage,maxError,maxTime) 27f 28g 200

PAGE 201

29// 30//CreateCopy 31// 32SystemMainSystemNoField::CreateCopy()const 33f 34returnhtnewMainSystemNoField(controller,solver,a); 35g 36// 37//CreateRef 38// 39SystemMainSystemNoField::CreateRef()const 40f 41returnhtnewMainSystemNoField(this); 42g 43// 44//InitializephiSc[n],C e[n]&J e[n] 45// 46voidMainSystemNoField::InitializeTotal(SubStatelast) 47f 48//Solvingfunctions 49constPolynomialbetaC e()]TJ /F10 7.97 Tf 7.19 0 Td[(0.0575,1.2794,)]TJ /F10 7.97 Tf 7.05 0 Td[(1.6917,0.7721); 50if(last) 51f 52//Semiconductor 53phiSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiScList; 54fieldSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>fieldScList; 55//phiEl=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiElList; 56//C e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C eList; 57J e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J eList; 58//Electrolyte 59C red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C redList; 60C ox=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C oxList; 61C sup=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C supList; 62J red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J redList; 63J ox=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>J oxList; 64g 65else 66f 67//Semiconductor 68phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+2,1e)]TJ /F10 7.97 Tf 6.75 0 Td[(6); 69fieldSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,0); 201

PAGE 202

70C e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1); 71ExponentialinitialC e(1e)]TJ /F10 7.97 Tf 6.81 0 Td[(8,betaC e(phi applied)); 72fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)C e[i]=initialC e(double(i+1)); 73J e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,)]TJ /F10 7.97 Tf 6.85 0 Td[(1.75e)]TJ /F10 7.97 Tf 6.76 0 Td[(7); 74//Electrolyte 75C red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref); 76//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)C red[i]=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4)]TJ /F20 7.97 Tf 11.45 0 Td[(double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)(5e)]TJ /F20 7.97 Tf 5.94 0 Td[(4)]TJ /F20 7.97 Tf 6.81 0 Td[(C I); 77//C ox.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,C I3 ref/+7e)]TJ /F20 7.97 Tf 7.22 0 Td[(7/); 78C ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I3 ref); 79//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)C ox[i]=double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)C I3+1e)]TJ /F20 7.97 Tf 6.87 0 Td[(7; 80C sup.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref+C I3 ref); 81J red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 82J ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 83g 84//phiEl.clear(); 85//phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2,phi applied); 86phiSc.clear(); 87phiSc.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,phi applied); 88g 89// 90//InitializeConc 91// 92voidMainSystemNoField::InitializeConc(SubStatelast) 93f 94if(last==0) 95f 96C d pos=1.26e)]TJ /F10 7.97 Tf 6.88 0 Td[(16; 97C d e3=2.54e)]TJ /F10 7.97 Tf 6.88 0 Td[(44; 98C d e1=1.9e)]TJ /F10 7.97 Tf 6.88 0 Td[(22; 99C d g=7.5e)]TJ /F10 7.97 Tf 6.86 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 100phiD=0.15; 101g 102else 103f 104C d pos=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos; 105C d e3=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e3; 106C d e1=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1; 107C d g=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 108phiD=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 202

PAGE 203

109g 110//Same,nomatterwhat 111//C d pos=(2e)]TJ /F20 7.97 Tf 6.8 0 Td[(16)exp(18.31phi applied);//functionofphi applied 112g 113// 114//IsValid 115// 116boolMainSystemNoField::IsValid()const 117f 118if(CurrentMode()==0) 119returnIsPositive(C d pos)&& 120IsPositive(C d e1)&& 121IsPositive(C d e3)&& 122(C d g>0)&& 123(C d g<=7.5e)]TJ /F10 7.97 Tf 6.76 0 Td[(5)&& 124! isnan(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError); 125else 126f 127for(inti=0;istandardError); 135g 136g 137// 138//ModeConverganceError 139// 140doubleMainSystemNoField::ModeConverganceError()const 141f 142//Calculatealltheerror 143doubleerror1=fabs((GetC e())]TJ /F10 7.97 Tf 11.48 0 Td[(oldC e)/GetC e()); 144doubleerror2=fabs((RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 11.7 0 Td[(oldRateTotal)/RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 145doubleerror3=fabs((phiD)]TJ /F10 7.97 Tf 11.58 0 Td[(oldphiD)/phiD); 146doubleerror4=fabs((GetJ e())]TJ /F10 7.97 Tf 11.73 0 Td[(oldJ e)/GetJ e()); 147doubleerror5=fabs((GetJ red())]TJ /F10 7.97 Tf 11.8 0 Td[(oldJ red)/GetJ red()); 148doubleerror6=fabs((GetJ ox())]TJ /F10 7.97 Tf 11.72 0 Td[(oldJ ox)/GetJ ox()); 203

PAGE 204

149//Returnthelargesterror 150returnmax(max(max(error1,error2),max(error3,error4)),max(error5,error6)); 151g 152// 153//PrintConvergance 154// 155voidMainSystemNoField::PrintConvergance() 156f 157ThreadCheck(MainSystemNoField::PrintConvergance); 158WriteLine(ntntR tot ,oldRateTotal, => ,RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 159WriteLine(ntntPhiSc ,oldPhiSc, => ,GetPhiSc()); 160WriteLine(ntntPhiD ,oldphiD, => ,phiD); 161WriteLine(ntntC e ,oldC e, => ,GetC e()); 162WriteLine(ntntJ e ,oldJ e, => ,GetJ e()); 163WriteLine(ntntJ red ,oldJ red, => ,GetJ red()); 164WriteLine(ntntJ ox ,oldJ ox, => ,GetJ ox()); 165g 166voidMainSystemNoField::UpdateMode() 167f 168//Savealltheoldvalues 169oldC e=GetC e(); 170oldRateTotal=RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage); 171oldPhiSc=GetPhiSc(); 172oldphiD=phiD; 173oldJ e=GetJ e(); 174oldJ red=GetJ red(); 175oldJ ox=GetJ ox(); 176g 177// 178//BuildJ 179// 180voidMainSystemNoField::BuildJ(constdoublez) 181f 182//SetupthesizeoftheJacobian 183constintsize=Size(); 184solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(size,size); 185if(CurrentMode()==0) 186f 187//Indicesforderivatives 188constintconcStart=0; 189constintphiDStart=4; 204

PAGE 205

190constintJ eStart=5; 191constintJ redStart=6; 192constintJ oxStart=7; 193constintfieldStart=8; 194// 195//Interface 196// 197//Equation4 198//r2)]TJ /F20 7.97 Tf 11.47 0 Td[(r3a)]TJ /F20 7.97 Tf 11.48 0 Td[(r4a+nr6a=0 199//d/dC d g 200solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart,dR2( C d g,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d g))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( C d g)+ndR6a( C d g)); 201//d/dC d pos=0 202//d/dC d e1 203solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart+2,dR2( C d e1,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4a( C d e1)+ndR6a( C d e1)); 204//Equation5 205//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b+nr6b=0//maybeshouldbe+r6b???1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 206//d/dC d e1 207solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+2,dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e1)+ndR6b( C d e1)); 208//d/dC d e3 209solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+3,dR3a( C d e3))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e3)+ndR6b( C d e3)); 210//Equation6 211//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0//Addedr5b/citshouldhavebeenthere?1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 212//d/dC d pos 213solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+1,dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos))); 214//d/dC d e1 215solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+2,dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1))); 216//d/dC d e3 217solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+3,dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3))); 218//Equation7 219//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 220for(inti=0;i<4;i++) 221solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,concStart+i,1); 222//Gauss'sequationattheinterface 205

PAGE 206

223//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 224//d/dphiD 225solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 226//d/dC d pos 227solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,concStart+1,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/a); 228//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 229//C d pos[n] 230solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos)))); 231//C d e1[n] 232solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+2,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1)))); 233//C d e3[n] 234solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+3,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3)))); 235//J e[n] 236solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart,1); 237//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 238//d/dC d pos 239solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 240//d/dC d e1 241solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+2,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 242//d/dC d e3 243solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+3,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 244//d/dJ red 245solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,1); 246//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 247//d/dC d pos 248solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 249//d/dC d e1 250solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+2,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 251//d/dC d e3 252solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+3,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 206

PAGE 207

253//d/dJ red 254solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 255//field[0]=fieldINT 256//fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F20 7.97 Tf 11.84 0 Td[((phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc 257solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart,1); 258solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/dell Sc); 259//fieldEl=fieldINT 260//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart+1,fieldStart+1,1); 261//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart+1,phiDStart,2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec/dell El); 262g 263else 264f 265//Indicesforderivatives 266constintphiStart=0; 267constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 268constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 269constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 270constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 271constintphiElStart=phiDStart+1; 272constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2; 273constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 274constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 275constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 276constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 277// 278//Semiconductor 279// 280//Phiboundaryconditions: 281//phiSc[0]=0 282solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,phiStart,1);//ChangedcolumnfromphiStarttophiStart+1,jjh 283//fieldSc[0]=0 284solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth,1); 285solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1/dell Sc); 286solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/dell Sc); 287//C eboundaryconditions: 288//C e[0]=N a 289solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,C eStart,/)]TJ /F20 7.97 Tf 10.77 0 Td[(1/)]TJ /F10 7.97 Tf 12.05 0 Td[(f(phiSc[1])]TJ /F10 7.97 Tf 11.43 0 Td[(phiSc[0])); 290//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart+1,1); 291solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/D e); 292solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,phiStart,fC e[0]); 207

PAGE 208

293solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,phiStart+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(fC e[0]); 294//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F20 7.97 Tf 6.81 0 Td[(1,N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf -361.23 -15.66 Td[(GetPhiSc())/(RT))); 295//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiDStart,)]TJ /F20 7.97 Tf 6.3 0 Td[(N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf 6.19 0 Td[(GetPhiSc())/(RT))); 296//RightBoundaryCondition 297//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 298//JacobianEntries 299//phiSc[n] 300solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiSc)+dR4b( phiSc)+dR5( phiSc)))); 301//C e[n] 302solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C e)+dR4b( C e)+dR5( C e)))); 303//phiEl[n] 304solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,phiElStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiEl)+dR4b( phiEl)+dR5( phiEl)))); 305//C ox[n] 306solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,oxStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C ox)+dR4b( C ox)+dR5( C ox)))); 307//C red[n] 308solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,redStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C red)+dR4b( C red)+dR5( C red)))); 309//J e[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 310//J e[n+1] 311solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1); 312//LeftBoundary 313//Equation1 314//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 315solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart+1,1); 316solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 317solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 318//Equation2 319//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 320solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart+1,1); 321solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 322solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,C eStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemiF/(E sc)); 323//Equation3 324//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/hSemi)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/hSemi=0 208

PAGE 209

325solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,phiStart+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 326solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,phiStart,f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 327solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart+1,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi); 328solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)]TJ /F10 7.97 Tf 12.05 0 Td[(f(phiSc[1])]TJ /F10 7.97 Tf 7.86 0 Td[(phiSc[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 329solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,J eStart,1/D e); 330//Equation4 331//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=0,R net=0fornow 332solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart+1,1); 333solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 334//Restofcentralarea 335for(inti=1;isemiWidth;i++) 336f 337//Equation1 338//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemifieldSc[n]=0 339//d/dphi[n+1] 340solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i+1,1); 341//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 342solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 343//d/dfield[n] 344solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,fieldStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 345//Equation2 346//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+2hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 347//d/dfield[n+1] 348solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i+1,1); 349//d/dfield[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 350solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 351//d/dC e[n] 352solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)F/(E sc));//thisstartsatthe0'thtermsono+1,jjh 353//Equation3 354//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/(2hSemi))]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/(2hSemi)=0 355//d/dphi[n+1] 356solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 357//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 358solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 359//d/dC e[n+1] 360solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i+1,1/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 361//d/dC e[n] 209

PAGE 210

362solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(phiSc[i+1])]TJ /F10 7.97 Tf 7.45 0 Td[(phiSc[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 363//d/dC e[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 364solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 7.1 0 Td[(1/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 365//d/dJ e[n] 366solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,J eStart+i,1/D e); 367//Equation4 368//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=0,R net=0fornow 369//d/dJ e[n+1] 370solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i+1,1); 371//d/dJ e[n] 372solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 373//d/dC e[n] 374//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i,C eStart+i]=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi1e5;//Commentedout12)]TJ /F20 7.97 Tf 6.45 0 Td[(09)]TJ /F20 7.97 Tf 6.45 0 Td[(09 375g 376//Gauss'sequationattheinterface 377//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 378//d/dphiSc 379solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,E sc/dell Sc); 380//d/dphiD 381solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 382//d/dphiEl 383solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiElStart+1,E el/dell El); 384// 385//Electrolye 386// 387//PhiEl 388//phi=v 389solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 390//dPhi=0 391//phiEl[2])]TJ /F20 7.97 Tf 11.8 0 Td[(phiEl[0])]TJ /F20 7.97 Tf 11.07 0 Td[(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec(phiEl[1])]TJ /F20 7.97 Tf 7.75 0 Td[(phiD)/dell El 392solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,1); 393//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,phiElStart+1,)]TJ /F20 7.97 Tf 6.41 0 Td[(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec/dell El); 394solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 395//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,phiDStart,2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec/dell El); 210

PAGE 211

396//J red 397//C red=C I ref 398solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 399//J ox 400//C sup=C I3 ref 401solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 402//C 403//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 404solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 405//BC 406//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 407//d/dphiSc 408solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 409//d/dC e 410solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 411//d/dphiEl 412solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiElStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 413//d/dC red 414solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,redStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 415//d/dC ox 416solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,oxStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 417//d/dJ red 418solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,1); 419//BC 420//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 421//d/dphiSc 422solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 423//d/dC e 424solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 425//d/dphiEl 211

PAGE 212

426solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiElStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 427//d/dC red 428solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,redStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 429//d/dC ox 430solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,oxStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 431//d/dJ red 432solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 433//C ox=1e)]TJ /F20 7.97 Tf 6.11 0 Td[(7 434//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,oxStart,1); 435for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth;i++) 436f 437//Equation8 438//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.06 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.71 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])=0 439solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1); 440solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.72 0 Td[(2); 441solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i+1,1); 442solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 443solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart)]TJ /F10 7.97 Tf 6.32 0 Td[(1+i,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 444solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 445//Equation9 446//J red[i]+D red(C red[i])]TJ /F20 7.97 Tf 7.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 7.19 0 Td[(1]0.5f(phiEl[i+1])]TJ /F20 7.97 Tf -316.56 -15.66 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 447solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J redStart+i,1/D red); 448solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,redStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 449if(!useMigration) 450f 451solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 452g 453else 454f 455solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1(1+0.5f(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 456solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,)]TJ /F10 7.97 Tf 6.41 0 Td[(1C red[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 457solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C red[i)]TJ /F10 7.97 Tf 7.19 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 458g 212

PAGE 213

459//Equation10 460//J ox[i]+D ox(C ox[i])]TJ /F20 7.97 Tf 7.2 0 Td[(C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.18 0 Td[(C ox[i)]TJ /F20 7.97 Tf 7.34 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1]))/h=0 461solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J oxStart+i,1/D ox); 462solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,oxStart+i,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 463if(!useMigration) 464f 465solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 466g 467else 468f 469solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.82 0 Td[(1(1+0.5f(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 470solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,)]TJ /F10 7.97 Tf 6.41 0 Td[(1C ox[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 471solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C ox[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 472g 473//Equation11 474//C sup[i])]TJ /F20 7.97 Tf 7.18 0 Td[(C sup[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+C sup[i)]TJ /F20 7.97 Tf 7.35 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 475solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,supStart+i,1); 476if(!useMigration) 477f 478solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 479g 480else 481f 482solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 483solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,()]TJ /F10 7.97 Tf 6.72 0 Td[(1+0.5f(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))); 484solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,)]TJ /F10 7.97 Tf 6.39 0 Td[(C sup[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f); 485solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C sup[i)]TJ /F10 7.97 Tf 7.19 0 Td[(1]0.5f); 486g 487//Equation12 488//J red[i])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 489solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i,1); 490solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 491//Equation13 492//J ox[i])]TJ /F20 7.97 Tf 11.54 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 493solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i,1); 494solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 213

PAGE 214

495g 496g 497g 498// 499//BuildF 500// 501voidMainSystemNoField::BuildF(constdoublez) 502f 503//GenerateRateconstants 504//Makesurethisiscalledorrestofthefunctionwillnotworkproperly!!! 505GenerateRates(z); 506//SetupthesizeoftheFvector 507constintsize=Size(); 508//InitializesizeofFmatrix 509solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(1,size); 510if(CurrentMode()==0) 511f 512constintconcStart=0; 513constintphiDStart=concStart+4; 514constintjStart=phiDStart+1; 515constintfieldStart=jStart+3; 516// 517//KENETICINTERFACEPART 518// 519//Equation4 520//r2)]TJ /F20 7.97 Tf 11.48 0 Td[(r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r4a+nr6a=0 521solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,0,r2)]TJ /F10 7.97 Tf 11.47 0 Td[(r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r4a+nr6a); 522//Equation5 523//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b)]TJ /F20 7.97 Tf 10.94 0 Td[(nr6b=0 524solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,0,r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r3b)]TJ /F10 7.97 Tf 11.47 0 Td[(r4b+nr6b); 525//Equation6 526//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0 527solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,0,r4a+r4b+r5)]TJ /F10 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)); 528//Equation7 529//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 530solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,0,C d g+C d pos+C d e1+C d e3)]TJ /F10 7.97 Tf 11.73 0 Td[(C d t); 531//Gauss'sLawattheinterface 532//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 533solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.67 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 214

PAGE 215

534//J eBC 535//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 536solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart,0,GetJ e())]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 537//J redBC 538//J red=1.5rNet(@interface) 539solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+1,0,GetJ red()+b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 540//J oxBC 541//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 542solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+2,0,)]TJ /F10 7.97 Tf 6.65 0 Td[(GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 543//field[0]=fieldINT 544solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.83 0 Td[((phiD)]TJ /F10 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 545//fieldEl=fieldINT 546//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart+1,0,phiEl[1])]TJ /F20 7.97 Tf 11.89 0 Td[(phi applied/phiEl[2])]TJ /F20 7.97 Tf 11.8 0 Td[(phiEl[0])]TJ /F20 7.97 Tf -356.36 -15.66 Td[(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec(phiEl[1])]TJ /F20 7.97 Tf 7.75 0 Td[(phiD)/dell El/); 547g 548else 549f 550constintphiStart=0; 551constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 552constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 553constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 554constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 555constintphiElStart=phiDStart+1; 556constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2; 557constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 558constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 559constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 560constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 561// 562//SEMICONDUCTORPART 563// 564//PhiScBC's 565//phiSc[0]=0 566solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,0,phiSc[0])]TJ /F10 7.97 Tf 11.88 0 Td[(phi applied); 567//phiSc[2])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0]=0 568//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(1,0,phiSc[2])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[0]); 215

PAGE 216

569//field[0]=0 570solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.83 0 Td[((phiD)]TJ /F10 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 571//C eBC 572//C e[0]=N a 573solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,0,/C e[1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[0]/+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/D eJ e[0])]TJ /F10 7.97 Tf 12.05 0 Td[(fC e[0](phiSc[1])]TJ /F10 7.97 Tf 7.86 0 Td[(phiSc[0])); 574//J eBC 575//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 576solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,0,GetJ e())]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 577//LeftBoundary 578solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,0,PotentialFieldSc 0(0)); 579solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,0,PoissonFieldSc 0(0)); 580solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,0,ElectronFlux2 0(0)); 581solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,0,ElectronContinuity 0(0)); 582for(inti=1;isemiWidth;i++) 583f 584//Equation1 585//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 586solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,0,PotentialFieldSc(i)); 587//Equation2 588//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 589solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,0,PoissonFieldSc(i)); 590//Equation3 591//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi)]TJ /F20 7.97 Tf 12.05 0 Td[(fSq(C e[i])(phiSc[i+1])]TJ /F20 7.97 Tf 7.45 0 Td[(phiSc[i])/(hSemi))=0 592solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,0,ElectronFlux2(i)); 593//Equation4 594//J e[i+1])]TJ /F20 7.97 Tf 11.54 0 Td[(J e[i])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemiR net=0,R net=0fornow 595solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,0,ElectronContinuity(i)); 596g 597//Gauss'sLawattheinterface 598//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 599solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.66 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 600// 601//ELECTROLYTEPART 602// 216

PAGE 217

603//PhiElBC(1) 604//phiEl)]TJ /F20 7.97 Tf 11.17 0 Td[(v=0 605solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth]/)]TJ /F20 7.97 Tf 15.96 0 Td[(phi applied/); 606//PhiElBC(2) 607//phiEl p=0 608solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1])]TJ /F10 7.97 Tf 11.8 0 Td[(phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)]TJ /F10 7.97 Tf 6.86 0 Td[(1]/)]TJ /F20 7.97 Tf 19.91 0 Td[(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec(phiEl[1])]TJ /F20 7.97 Tf 7.75 0 Td[(phiD)/dell El/); 609//C redBC 610//C red=C I ref 611solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C red[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 12.07 0 Td[(C I ref); 612//C oxBC 613//C ox=C I3 ref 614solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0,C ox[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 11.96 0 Td[(C I3 ref); 615//C supBC 616//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 617solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C sup[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 10.94 0 Td[(5e)]TJ /F10 7.97 Tf 6.76 0 Td[(4); 618//J redBC 619//J red=1.5rNet(@interface) 620solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,0,GetJ red()+b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 621//J oxBC 622//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 623solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,0,)]TJ /F10 7.97 Tf 6.66 0 Td[(GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 624for(inti=0;ielecWidth;i++) 625f 626//Equation8 627//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.06 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.71 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])=0 628solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i+1,0,PoissonEl(i+1)); 629//Equation9 630//J red[i+1]+D red(C red[i+1])]TJ /F20 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC red[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf -316.56 -15.67 Td[(phiEl[i]))/h=0 631solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+i,0,RedFlux(i)); 632//Equation10 633//J ox[i+1]+D ox(C ox[i+1])]TJ /F20 7.97 Tf 7.21 0 Td[(C ox[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC ox[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i]))/h=0 634solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+i,0,OxFlux(i)); 635//Equation11 636//C sup[i+1])]TJ /F20 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i])=0 637solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+i,0,SupFlux(i)); 217

PAGE 218

638//Equation12 639//J red[i+1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec 640solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i+1,0,RedContinuity(i)); 641//Equation13 642//J ox[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J ox[i]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec 643solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i+1,0,OxContinuity(i)); 644g 645g 646//Calculatetheerrorofthefmatrix 647solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateError(); 648g 649// 650//NewtonStep 651// 652voidMainSystemNoField::NewtonStep() 653f 654constintsize=Size(); 655if(CurrentMode()==0) 656f 657//Concentrations 658C d g+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(0,size)); 659C d pos+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(1,size)); 660C d e1+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(2,size)); 661C d e3+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(3,size)); 662//PhiD 663phiD+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(4,size)); 664//Flux 665J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.86 0 Td[(1]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(5,size)); 666J red[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(6,size)); 667J ox[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(7,size)); 668fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(8,size)); 669//phiEl[1]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(9,size)); 670g 218

PAGE 219

671else 672f 673constintphiStart=0; 674constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 675constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 676constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 677constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 678constintphiElStart=phiDStart+1; 679constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2; 680constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 681constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 682constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 683constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 684//Semiconductor 685for(inti=0;isemiWidth+1;i++) 686f 687phiSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiStart+i,size)); 688fieldSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(fieldStart+i,size)); 689C e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(C eStart+i,size)); 690J e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J eStart+i,size)); 691g 692//PhiD 693phiD+=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(phiDStart,size)); 694//PhiEl 695for(inti=0;ielecWidth+2;i++) 696phiEl[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiElStart+i,size)); 697//TheRest 698for(inti=0;ielecWidth+1;i++) 699f 700C red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(redStart+i,size)); 701C ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(oxStart+i,size)); 702C sup[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(supStart+i,size)); 703J red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J redStart+i,size)); 704J ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J oxStart+i,size)); 705g 706g 707g 708constdoubleMainSystemNoField::GetPhiSc()constfreturnphiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 709constdoubleMainSystemNoField::GetC e()constfreturnC e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.33 0 Td[(1];g 710constdoubleMainSystemNoField::GetJ e()constfreturnJ e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.33 0 Td[(1];g 711constdoubleMainSystemNoField::GetPhiEl()constfreturnphiEl[1];g 219

PAGE 220

712constdoubleMainSystemNoField::GetC red()constfreturnC red[1];g 713constdoubleMainSystemNoField::GetC ox()constfreturnC ox[1];g 714constdoubleMainSystemNoField::GetC sup()constfreturnC sup[1];g 715constdoubleMainSystemNoField::GetJ red()constfreturnJ red[0];g 716constdoubleMainSystemNoField::GetJ ox()constfreturnJ ox[0];g 717constdoubleMainSystemNoField::GetJ e P()constfreturn(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.54 0 Td[(J e[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.23 0 Td[(2])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);g 718// 719//size 720// 721intMainSystemNoField::Size()const 722f 723if(CurrentMode()==0) 724return4+4+1/+1/; 725else 726return4(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)+1+(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2)+5(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 727g 728// 729//Var 730// 731double&MainSystemNoField::GetVar(inti) 732f 733if(CurrentMode()==0) 734f 735if(i==0) 736returnC d g; 737elseif(i==1) 738returnC d pos; 739elseif(i==2) 740returnC d e1; 741elseif(i==3) 742returnC d e3; 743else 744returnphiD; 745g 746else 747f 748constintw1=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth; 749constintw2=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth; 750if(i
PAGE 221

751returnphiSc[i]; 752elseif(i<2(w1+1)) 753returnC e[i)]TJ /F10 7.97 Tf 6.7 0 Td[((w1+1)]; 754elseif(i<3(w1+1)) 755returnJ e[i)]TJ /F10 7.97 Tf 6.83 0 Td[(2(w1+1)]; 756elseif(i
PAGE 222

23//Buildsmatricesforsystem 24voidBuildJ(constdoublez); 25voidBuildF(constdoublez); 26//Doesthenewtonstepforthesystem 27voidNewtonStep(); 28//Checkstoseeifthecurrentstateispossible(valid) 29boolIsValid()const; 30//Genericaccesforallvariables 31double&GetVar(inti); 32intSize()const; 33//Modes 34intModes()constfreturn2;g 35doubleModeConverganceError()const; 36voidUpdateMode(); 37//Printstheconvergancestufftotheconsole 38virtualvoidPrintConvergance(); 39//Functionsforgettingthecorrectinterfacevalues 40constdoubleGetPhiSc()const; 41constdoubleGetPhiEl()const; 42constdoubleGetC e()const; 43constdoubleGetC red()const; 44constdoubleGetC ox()const; 45constdoubleGetC sup()const; 46constdoubleGetJ e()const; 47constdoubleGetJ red()const; 48constdoubleGetJ ox()const; 49//Functionsforgettingthecorrectinterfacederivatives 50constdoubleGetJ e P()const; 51//Savedvaluesusedforerrorcalculations 52doubleoldC e; 53doubleoldRateTotal; 54doubleoldPhiSc; 55doubleoldphiD; 56doubleoldJ e,oldJ red,oldJ ox; 57g; 1#includeAraMath.h 2#includeConsole.h 3#includeElectroNeutrality.h 4#includeConstants.h 5#includeSolveState.h 6#includeThreadCheck.h 222

PAGE 223

7#include//for isnan 8// 9//Constructor 10// 11ElectroNeutrality::ElectroNeutrality(constElectroNeutralitystate) 12:System(state) 13f 14g 15ElectroNeutrality::ElectroNeutrality(StateController controller,SolveStates,constdouble a) 16:System( controller,s, a) 17f 18g 19ElectroNeutrality::ElectroNeutrality(StateController controller, 20doubleshellThickness,intshellIterations,intelecIterations, 21doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 22doubleporocity,doubledyeCoverage, 23doublemaxError,doublemaxTime) 24:System( controller,shellThickness,shellIterations,elecIterations,nanorodLength,nanorodDiameter,nanorodDensity, 25porocity,dyeCoverage,maxError,maxTime) 26f 27g 28// 29//CreateCopy 30// 31SystemElectroNeutrality::CreateCopy()const 32f 33returnhtnewElectroNeutrality(controller,solver,a); 34g 35// 36//CreateRef 37// 38SystemElectroNeutrality::CreateRef()const 39f 40returnhtnewElectroNeutrality(this); 41g 42// 43//InitializephiSc[n],C e[n]&J e[n] 44// 45voidElectroNeutrality::InitializeTotal(SubStatelast) 223

PAGE 224

46f 47if(last) 48f 49//Semiconductor 50//phiSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiScList; 51fieldSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>fieldScList; 52C e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C eList; 53J e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J eList; 54//Electrolyte 55phiEl=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiElList; 56C red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C redList; 57C ox=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C oxList; 58C sup=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C supList; 59J red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J redList; 60J ox=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>J oxList; 61g 62else 63f 64//Semiconductor 65//phiSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,phi applied); 66fieldSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,0); 67C e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1); 68fori(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1) 69C e[i]=(1e)]TJ /F10 7.97 Tf 6.76 0 Td[(8)exp(()]TJ /F10 7.97 Tf 7.2 0 Td[(0.6721Sq(phi applied)+0.8427phi applied+0.0065)i); 70J e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,1.77e)]TJ /F10 7.97 Tf 6.76 0 Td[(7); 71//Electrolyte 72phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 73C red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref); 74C ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I3 ref); 75C sup.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref+C I3 ref); 76J red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 77J ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 78g 79phiSc.clear(); 80phiSc.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1,phi applied); 81//phiEl.clear(); 82//phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phi applied); 83g 84// 85//InitializeConc 224

PAGE 225

86// 87voidElectroNeutrality::InitializeConc(SubStatelast) 88f 89if(last==0) 90f 91C d pos=1.26e)]TJ /F10 7.97 Tf 6.88 0 Td[(16; 92C d e3=2.54e)]TJ /F10 7.97 Tf 6.88 0 Td[(44; 93C d e1=1.9e)]TJ /F10 7.97 Tf 6.88 0 Td[(22; 94C d g=7.5e)]TJ /F10 7.97 Tf 6.86 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 95phiD=0.03; 96g 97else 98f 99C d pos=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos; 100C d e3=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e3; 101C d e1=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1; 102C d g=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 103phiD=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 104g 105//Same,nomatterwhat 106//C d pos=(2e)]TJ /F20 7.97 Tf 6.8 0 Td[(16)exp(18.31phi applied);//functionofphi applied 107g 108// 109//IsValid 110// 111boolElectroNeutrality::IsValid()const 112f 113//AssertthatC eispositive 114/for(inti=0;i1)returnfalse;/ 118if(CurrentMode()==0) 119returnIsPositive(C d pos)&& 120IsPositive(C d e1)&& 121IsPositive(C d e3)&& 122(C d g>0)&& 123(C d g<=7.5e)]TJ /F10 7.97 Tf 6.76 0 Td[(5)&& 124! isnan(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError); 125else 126returnIsPositive(GetC e())&& 225

PAGE 226

127IsPositive(GetC ox())&& 128IsPositive(GetC red())&& 129IsPositive(GetC sup())&& 130! isnan(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError); 131g 132// 133//ModeConverganceError 134// 135doubleElectroNeutrality::ModeConverganceError()const 136f 137//Calculatealltheerror 138doubleerror1=fabs((GetC e())]TJ /F10 7.97 Tf 11.48 0 Td[(oldC e)/GetC e()); 139doubleerror2=fabs((RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 11.7 0 Td[(oldRateTotal)/RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 140doubleerror3=fabs((GetPhiSc())]TJ /F10 7.97 Tf 11.53 0 Td[(oldPhiSc)/GetPhiSc()); 141doubleerror4=fabs((phiD)]TJ /F10 7.97 Tf 11.58 0 Td[(oldphiD)/phiD); 142doubleerror5=fabs((GetJ e())]TJ /F10 7.97 Tf 11.73 0 Td[(oldJ e)/GetJ e()); 143doubleerror6=fabs((GetJ red())]TJ /F10 7.97 Tf 11.8 0 Td[(oldJ red)/GetJ red()); 144doubleerror7=fabs((GetJ ox())]TJ /F10 7.97 Tf 11.72 0 Td[(oldJ ox)/GetJ ox()); 145//Returnthelargesterror 146returnmax(max(max(error1,error2),max(error3,error4)),max(max(error5,error6),error7)); 147g 148// 149//PrintConvergance 150// 151voidElectroNeutrality::PrintConvergance() 152f 153ThreadCheck(ElectroNeutrality::PrintConvergance); 154WriteLine(ntntR tot ,oldRateTotal, => ,RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 155WriteLine(ntntPhiSc ,oldPhiSc, => ,GetPhiSc()); 156WriteLine(ntntPhiD ,oldphiD, => ,phiD); 157WriteLine(ntntC e ,oldC e, => ,GetC e()); 158WriteLine(ntntJ e ,oldJ e, => ,GetJ e()); 159WriteLine(ntntJ red ,oldJ red, => ,GetJ red()); 160WriteLine(ntntJ ox ,oldJ ox, => ,GetJ ox()); 161g 162voidElectroNeutrality::UpdateMode() 163f 164//Savealltheoldvalues 165oldC e=GetC e(); 226

PAGE 227

166oldRateTotal=RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage); 167oldPhiSc=GetPhiSc(); 168oldphiD=phiD; 169oldJ e=GetJ e(); 170oldJ red=GetJ red(); 171oldJ ox=GetJ ox(); 172g 173// 174//BuildJ 175// 176voidElectroNeutrality::BuildJ(constdoublez) 177f 178//SetupthesizeoftheJacobian 179constintsize=Size(); 180solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(size,size); 181if(CurrentMode()==0) 182f 183//Indicesforderivatives 184constintconcStart=0; 185constintphiDStart=4; 186constintJ eStart=5; 187constintJ redStart=6; 188constintJ oxStart=7; 189constintfieldStart=8; 190// 191//Interface 192// 193//Equation4 194//r2)]TJ /F20 7.97 Tf 11.47 0 Td[(r3a)]TJ /F20 7.97 Tf 11.48 0 Td[(r4a+nr6a=0 195//d/dC d g 196solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart,dR2( C d g,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d g))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( C d g)+ndR6a( C d g)); 197//d/dC d pos=0 198//d/dC d e1 199solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart+2,dR2( C d e1,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4a( C d e1)+ndR6a( C d e1)); 200//Equation5 201//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b+nr6b=0//maybeshouldbe+r6b???1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 202//d/dC d e1 203solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+2,dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e1)+ndR6b( C d e1)); 227

PAGE 228

204//d/dC d e3 205solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+3,dR3a( C d e3))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e3)+ndR6b( C d e3)); 206//Equation6 207//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0//Addedr5b/citshouldhavebeenthere?1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 208//d/dC d pos 209solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+1,dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos))); 210//d/dC d e1 211solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+2,dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1))); 212//d/dC d e3 213solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+3,dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3))); 214//Equation7 215//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 216for(inti=0;i<4;i++) 217solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,concStart+i,1); 218//Gauss'sequationattheinterface 219//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 220//d/dphiD 221solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 222//d/dC d pos 223solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,concStart+1,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/a); 224//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 225//C d pos[n] 226solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos)))); 227//C d e1[n] 228solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+2,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1)))); 229//C d e3[n] 230solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+3,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3)))); 231//J e[n] 232solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 233//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 234//d/dC d pos 228

PAGE 229

235solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 236//d/dC d e1 237solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+2,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 238//d/dC d e3 239solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+3,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 240//d/dJ red 241solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 242//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 243//d/dC d pos 244solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 245//d/dC d e1 246solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+2,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 247//d/dC d e3 248solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+3,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 249//d/dJ red 250solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,1); 251//field[0]=fieldINT 252//fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F20 7.97 Tf 11.84 0 Td[((phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc 253solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart,1); 254solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/dell Sc);//outfornofield 255g 256else 257f 258//Indicesforderivatives 259constintphiStart=0; 260constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 261constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 262constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 263constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 264constintphiElStart=phiDStart+1; 265constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 266constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 267constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 268constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 229

PAGE 230

269constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 270// 271//Semiconductor 272// 273//Phiboundaryconditions: 274//phiSc[0]=0 275solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,phiStart,1);//ChangedcolumnfromphiStarttophiStart+1,jjh 276//fieldSc[0]=0 277//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,fieldStart,1); 278//fieldSc[tau]=(phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc 279solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth,1); 280solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1/dell Sc); 281solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/dell Sc); 282//C eboundaryconditions: 283//C e[0]=N a 284solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,C eStart,1);//infornofield 285//C e[0]isgivenbyfluxeqn//inifwantdiffusion(below) 286//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart,/)]TJ /F20 7.97 Tf 12.61 0 Td[(1/)]TJ /F20 7.97 Tf 12.05 0 Td[(f(phiSc[1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[0]));// 287//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart+1,1);//inifwantdiffusion 288//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/D e);// 289//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiStart,fC e[0]);// 290//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiStart+1,)]TJ /F20 7.97 Tf 7.27 0 Td[(fC e[0]);// 291//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F20 7.97 Tf 6.81 0 Td[(1,N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf -361.23 -15.67 Td[(GetPhiSc())/(RT))); 292//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiDStart,)]TJ /F20 7.97 Tf 6.3 0 Td[(N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf 6.19 0 Td[(GetPhiSc())/(RT))); 293//RightBoundaryCondition 294//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 295//JacobianEntries 296//phiSc[n] 297solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiSc)+dR4b( phiSc)+dR5( phiSc)))); 298//C e[n] 299solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C e)+dR4b( C e)+dR5( C e)))); 300//phiEl[n] 230

PAGE 231

301solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,phiElStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiEl)+dR4b( phiEl)+dR5( phiEl)))); 302//C ox[n] 303solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,oxStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C ox)+dR4b( C ox)+dR5( C ox)))); 304//C red[n] 305solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,redStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C red)+dR4b( C red)+dR5( C red)))); 306//J e[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 307//J e[n+1] 308solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 309//LeftBoundary 310//Equation1 311//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 312solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart+1,1); 313solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 314solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 315//Equation2 316//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 317solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart+1,1); 318solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 319solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,C eStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemiF/(E sc)); 320//Equation3 321//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/hSemi)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/hSemi=0 322solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,phiStart+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//outfornofield 323solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,phiStart,f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//outfornofield 324solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart+1,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi);//outfornofield(below) 325solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)]TJ /F10 7.97 Tf 12.05 0 Td[(f(phiSc[1])]TJ /F10 7.97 Tf 7.86 0 Td[(phiSc[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 326solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,J eStart,1/D e); 327//Equation4 328//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=0,R net=0fornow 329solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart+1,1); 330solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 331//Restofcentralarea 332for(inti=1;isemiWidth;i++) 333f 231

PAGE 232

334//Equation1 335//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemifieldSc[n]=0 336//d/dphi[n+1] 337solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i+1,1); 338//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 339solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 340//d/dfield[n] 341solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,fieldStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 342//Equation2 343//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+2hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 344//d/dfield[n+1] 345solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i+1,1); 346//d/dfield[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 347solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 348//d/dC e[n] 349solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)F/(E sc));//thisstartsatthe0'thtermsono+1,jjh 350//Equation3 351//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/(2hSemi))]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/(2hSemi)=0 352//d/dphi[n+1] 353solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi));//outfornofield 354//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 355solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi));//outfornofield 356//d/dC e[n+1] 357solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i+1,1/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 358//d/dC e[n] 359solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(phiSc[i+1])]TJ /F10 7.97 Tf 7.45 0 Td[(phiSc[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi));//outfornofield 360//d/dC e[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 361solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 7.1 0 Td[(1/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 362//d/dJ e[n] 363solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,J eStart+i,1/D e); 364//Equation4 365//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=0,R net=0fornow 366//d/dJ e[n+1] 367solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i+1,1); 368//d/dJ e[n] 369solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 232

PAGE 233

370//d/dC e[n] 371//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i,C eStart+i]=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi1e5;//Commentedout12)]TJ /F20 7.97 Tf 6.45 0 Td[(09)]TJ /F20 7.97 Tf 6.45 0 Td[(09 372g 373//Gauss'sequationattheinterface 374//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 375//d/dphiSc 376solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,E sc/dell Sc); 377//d/dphiD 378solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 379//d/dphiEl 380solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiElStart+1,E el/dell El); 381// 382//Electrolye 383// 384//PhiEl 385//phi=v 386//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart,phiElStart+1,1); 387solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 388//J red 389//C red=C I ref 390solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 391//J ox 392//C sup=C I3 ref 393solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 394//C 395//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 396solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 397//BC 398//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 399//d/dphiSc 400solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 401//d/dC e 402solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 403//d/dphiEl 233

PAGE 234

404solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiElStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 405//d/dC red 406solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,redStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 407//d/dC ox 408solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,oxStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 409//d/dJ red 410solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 411//BC 412//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 413//d/dphiSc 414solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 415//d/dC e 416solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 417//d/dphiEl 418solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiElStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 419//d/dC red 420solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,redStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 421//d/dC ox 422solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,oxStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 423//d/dJ red 424solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,1); 425for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth;i++) 426f 427//Equation8 428//(phiEl[i])]TJ /F20 7.97 Tf 11.79 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))()]TJ /F20 7.97 Tf 7.44 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+(D ox(C sup[i])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))]TJ /F20 7.97 Tf 11.18 0 Td[(D ox(C ox[i])]TJ /F20 7.97 Tf 11.19 0 Td[(C ox[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1]))]TJ /F20 7.97 Tf 11.4 0 Td[(D red(C red[i])]TJ /F20 7.97 Tf -304.23 -15.66 Td[(C red[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec) 429solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 430solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 234

PAGE 235

431solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,RTD red/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 432solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart+i,)]TJ /F10 7.97 Tf 6.67 0 Td[((RTD red()]TJ /F10 7.97 Tf 7.09 0 Td[((J red[i]+J ox[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+2D oxC sup[i])]TJ /F10 7.97 Tf 7.19 0 Td[(D oxC sup[i)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+D oxC ox[i)]TJ /F10 7.97 Tf 6.84 0 Td[(1]+D redC red[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(F Sq(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec))); 433solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,RTD ox/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 434solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart+i,)]TJ /F10 7.97 Tf 6.67 0 Td[((RTD ox()]TJ /F10 7.97 Tf 7.08 0 Td[((J red[i]+J ox[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+2D oxC sup[i])]TJ /F10 7.97 Tf 7.19 0 Td[(D oxC sup[i)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+D oxC ox[i)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+D redC red[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/(F Sq(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec))); 435solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 5.5 0 Td[(RTD ox/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 436solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart+i,(RTD ox((J red[i]+J ox[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+D oxC sup[i)]TJ /F10 7.97 Tf 6.89 0 Td[(1]+2D oxC ox[i])]TJ /F10 7.97 Tf 7.19 0 Td[(D oxC ox[i)]TJ /F10 7.97 Tf 6.9 0 Td[(1]+2D redC red[i])]TJ /F10 7.97 Tf 7.41 0 Td[(D redC red[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(F Sq(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec))); 437solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,J redStart+i,)]TJ /F10 7.97 Tf 5.5 0 Td[(RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))); 438solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,J oxStart+i,)]TJ /F10 7.97 Tf 5.5 0 Td[(RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))); 439//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart)]TJ /F20 7.97 Tf 6.26 0 Td[(1+i,F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec)); 440//Equation9 441//J red[i]+D red(C red[i])]TJ /F20 7.97 Tf 7.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 7.19 0 Td[(1]0.5f(phiEl[i])]TJ /F20 7.97 Tf -307.01 -15.66 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 442solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J redStart+i,1/D red); 443solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,redStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 444if(!useMigration) 445f 446solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 447g 448else 449f 450solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1(1+f(phiEl[i])]TJ /F10 7.97 Tf -273.53 -15.66 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 451solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.4 0 Td[(1C red[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 452solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C red[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 235

PAGE 236

453g 454//Equation10 455//J ox[i]+D ox(C ox[i])]TJ /F20 7.97 Tf 7.2 0 Td[(C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.18 0 Td[(C ox[i)]TJ /F20 7.97 Tf 7.22 0 Td[(1](phiEl[i])]TJ /F20 7.97 Tf 7.81 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 456solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J oxStart+i,1/D ox); 457solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,oxStart+i,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 458if(!useMigration) 459f 460solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 461g 462else 463f 464solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.82 0 Td[(1(1+f(phiEl[i])]TJ /F10 7.97 Tf -263.97 -15.66 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 465solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.4 0 Td[(1C ox[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 466solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C ox[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 467g 468//Equation11 469//C sup[i])]TJ /F20 7.97 Tf 7.18 0 Td[(C sup[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+C sup[i)]TJ /F20 7.97 Tf 7.22 0 Td[(1](phiEl[i])]TJ /F20 7.97 Tf 7.81 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 470solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,supStart+i,1); 471if(!useMigration) 472f 473solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 474g 475else 476f 477solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 478solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,()]TJ /F10 7.97 Tf 6.72 0 Td[(1+f(phiEl[i])]TJ /F10 7.97 Tf -263.97 -15.67 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))); 479solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.39 0 Td[(C sup[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f); 480solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C sup[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f); 481g 482//Equation12 483//J red[i])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 484solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i,1); 485solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 486//Equation13 487//J ox[i])]TJ /F20 7.97 Tf 11.54 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 488solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i,1); 236

PAGE 237

489solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 490g 491g 492g 493// 494//BuildF 495// 496voidElectroNeutrality::BuildF(constdoublez) 497f 498//GenerateRateconstants 499//Makesurethisiscalledorrestofthefunctionwillnotworkproperly!!! 500GenerateRates(z); 501//SetupthesizeoftheFvector 502constintsize=Size(); 503//InitializesizeofFmatrix 504solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(1,size); 505if(CurrentMode()==0) 506f 507constintconcStart=0; 508constintphiDStart=concStart+4; 509constintjStart=phiDStart+1; 510constintfieldStart=jStart+3; 511// 512//KENETICINTERFACEPART 513// 514//Equation4 515//r2)]TJ /F20 7.97 Tf 11.48 0 Td[(r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r4a+nr6a=0 516solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,0,r2)]TJ /F10 7.97 Tf 11.47 0 Td[(r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r4a+nr6a); 517//Equation5 518//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b)]TJ /F20 7.97 Tf 10.94 0 Td[(nr6b=0 519solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,0,r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r3b)]TJ /F10 7.97 Tf 11.47 0 Td[(r4b+nr6b); 520//Equation6 521//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0 522solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,0,r4a+r4b+r5)]TJ /F10 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)); 523//Equation7 524//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 525solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,0,C d g+C d pos+C d e1+C d e3)]TJ /F10 7.97 Tf 11.73 0 Td[(C d t); 526//Gauss'sLawattheinterface 527//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 237

PAGE 238

528solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.66 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 529//J eBC 530//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 531solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart,0,)]TJ /F10 7.97 Tf 6.63 0 Td[(GetJ e())]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 532//J redBC 533//J red=1.5rNet(@interface) 534solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+1,0,)]TJ /F10 7.97 Tf 6.77 0 Td[(GetJ red()+b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 535//J oxBC 536//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 537solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+2,0,GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 538//field[0]=fieldINT 539solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.83 0 Td[((phiD)]TJ /F10 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 540g 541else 542f 543constintphiStart=0; 544constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 545constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 546constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 547constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 548constintphiElStart=phiDStart+1; 549constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 550constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 551constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 552constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 553constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 554// 555//SEMICONDUCTORPART 556// 557//PhiScBC's 558//phiSc[0]=phi applied 559solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,0,phiSc[0])]TJ /F10 7.97 Tf 11.88 0 Td[(phi applied); 560//phiSc[2])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0]=0 561//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(1,0,phiSc[2])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[0]); 562//field[0]=fieldINT 238

PAGE 239

563//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,0,fieldSc[0]); 564//field[tau sc]=(phiD)]TJ /F20 7.97 Tf 6.2 0 Td[(GetPhiSc())/dell Sc 565solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.83 0 Td[((phiD)]TJ /F10 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 566//C eBC 567//C e[0]=N a 568solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,0,C e[0])]TJ /F10 7.97 Tf 11.09 0 Td[(N a); 569//C e[0]isgivenbyfluxeqn 570//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,0,/C e[1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[0]/+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi/D eJ e[0])]TJ /F20 7.97 Tf 12.05 0 Td[(fC e[0](phiSc[1])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0])); 571//J eBC 572//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 573solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,0,)]TJ /F10 7.97 Tf 6.64 0 Td[(GetJ e())]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 574//LeftBoundary 575solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,0,PotentialFieldSc 0(0)); 576solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,0,PoissonFieldSc 0(0)); 577solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,0,ElectronFlux2 0(0)); 578solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,0,ElectronContinuity 0(0)); 579for(inti=1;isemiWidth;i++) 580f 581//Equation1 582//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 583solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,0,PotentialFieldSc(i)); 584//Equation2 585//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 586solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,0,PoissonFieldSc(i)); 587//Equation3 588//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi)]TJ /F20 7.97 Tf 12.05 0 Td[(fSq(C e[i])(phiSc[i+1])]TJ /F20 7.97 Tf 7.45 0 Td[(phiSc[i])/(hSemi))=0 589solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,0,ElectronFlux2(i));//inforfield 590//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi 591//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,0,ElectronFlux3(i));//infornofield 592//Equation4 593//J e[i+1])]TJ /F20 7.97 Tf 11.54 0 Td[(J e[i])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemiR net=0,R net=0fornow 594solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,0,ElectronContinuity(i)); 595g 596//Gauss'sLawattheinterface 597//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 239

PAGE 240

598solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.66 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 599// 600//ELECTROLYTEPART 601// 602//PhiElBC 603//phiEl[interface])]TJ /F20 7.97 Tf 11.17 0 Td[(v=0 604//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart,0,phiEl[1])]TJ /F20 7.97 Tf 11.88 0 Td[(phi applied); 605solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth]); 606//C redBC 607//C red=C I ref 608solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C red[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 12.07 0 Td[(C I ref); 609//C oxBC 610//C ox=C I3 ref 611solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0,C ox[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 11.96 0 Td[(C I3 ref); 612//C supBC 613//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 614solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C sup[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 10.94 0 Td[(5e)]TJ /F10 7.97 Tf 6.76 0 Td[(4); 615//J redBC 616//J red=1.5rNet(@interface) 617//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,0,GetJ red()+3GetJ ox());tryingsamebcbutwrittenout1)]TJ /F20 7.97 Tf 6.4 0 Td[(27)]TJ /F20 7.97 Tf 6.4 0 Td[(10 618solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,0,)]TJ /F10 7.97 Tf 6.77 0 Td[(GetJ red()+b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 619//J oxBC 620//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 621solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,0,GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 622for(inti=0;ielecWidth;i++) 623f 624//Equation8 625//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.06 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.71 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])=0 626solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i+1,0,OhmEl(i+1)); 627//Equation9 628//J red[i+1]+D red(C red[i+1])]TJ /F20 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC red[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf -316.56 -15.66 Td[(phiEl[i]))/h=0 629solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+i,0,RedFlux2(i)); 630//Equation10 631//J ox[i+1]+D ox(C ox[i+1])]TJ /F20 7.97 Tf 7.21 0 Td[(C ox[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC ox[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i]))/h=0 240

PAGE 241

632solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+i,0,OxFlux2(i)); 633//Equation11 634//C sup[i+1])]TJ /F20 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i])=0 635solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+i,0,SupFlux2(i)); 636//Equation12 637//J red[i+1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec 638solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i+1,0,RedContinuity(i)); 639//Equation13 640//J ox[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J ox[i]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec 641solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i+1,0,OxContinuity(i)); 642g 643g 644//Calculatetheerrorofthefmatrix 645solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateError(); 646g 647// 648//NewtonStep 649// 650voidElectroNeutrality::NewtonStep() 651f 652constintsize=Size(); 653if(CurrentMode()==0) 654f 655//Concentrations 656C d g+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(0,size)); 657C d pos+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(1,size)); 658C d e1+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(2,size)); 659C d e3+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(3,size)); 660//PhiD 661phiD+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(4,size)); 662//Flux 663J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.86 0 Td[(1]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(5,size)); 664J red[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(6,size)); 665J ox[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(7,size)); 241

PAGE 242

666fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(8,size)); 667g 668else 669f 670constintphiStart=0; 671constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 672constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 673constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 674constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 675constintphiElStart=phiDStart+1; 676constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 677constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 678constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 679constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 680constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 681//Semiconductor 682for(inti=0;isemiWidth+1;i++) 683f 684phiSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiStart+i,size)); 685fieldSc[i]+=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(fieldStart+i,size)); 686C e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(C eStart+i,size)); 687J e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J eStart+i,size)); 688g 689//phiD 690phiD+=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(phiDStart,size)); 691//Electrolyte 692for(inti=0;ielecWidth+1;i++) 693f 694phiEl[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiElStart+i,size)); 695C red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(redStart+i,size)); 696C ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(oxStart+i,size)); 697C sup[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(supStart+i,size)); 698J red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J redStart+i,size)); 699J ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J oxStart+i,size)); 700g 701g 702g 703constdoubleElectroNeutrality::GetPhiSc()constfreturnphiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 704constdoubleElectroNeutrality::GetC e()constfreturnC e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.33 0 Td[(1];g 705constdoubleElectroNeutrality::GetJ e()constfreturnJ e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.33 0 Td[(1];g 706constdoubleElectroNeutrality::GetPhiEl()constfreturnphiEl[1];g 242

PAGE 243

707constdoubleElectroNeutrality::GetC red()constfreturnC red[1];g 708constdoubleElectroNeutrality::GetC ox()constfreturnC ox[1];g 709constdoubleElectroNeutrality::GetC sup()constfreturnC sup[1];g 710constdoubleElectroNeutrality::GetJ red()constfreturnJ red[0];g 711constdoubleElectroNeutrality::GetJ ox()constfreturnJ ox[0];g 712constdoubleElectroNeutrality::GetJ e P()constfreturn(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.54 0 Td[(J e[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.23 0 Td[(2])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);g 713// 714//size 715// 716intElectroNeutrality::Size()const 717f 718if(CurrentMode()==0) 719return4+4+1; 720else 721return4(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)+1+6(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 722g 723// 724//Var 725// 726double&ElectroNeutrality::GetVar(inti) 727f 728if(CurrentMode()==0) 729f 730if(i==0) 731returnC d g; 732elseif(i==1) 733returnC d pos; 734elseif(i==2) 735returnC d e1; 736elseif(i==3) 737returnC d e3; 738else 739returnphiD; 740g 741else 742f 743constintw1=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth; 744if(i
PAGE 244

747returnC e[i)]TJ /F10 7.97 Tf 6.7 0 Td[((w1+1)]; 748elseif(i<3(w1+1)) 749returnC e[i)]TJ /F10 7.97 Tf 6.7 0 Td[((w1+1)]; 750else 751returnJ e[i)]TJ /F10 7.97 Tf 6.7 0 Td[((w1+2+w1+1)]; 752g 753g 1#pragmaonce 2#includeSystem.h 3//TheElectroNeutralityNoFieldSystemiseverythingexcludingtheelectrolyte 4classElectroNeutralityNoField:publicSystem 5f 6public: 7//Constructor 8ElectroNeutralityNoField(StateController controller, 9doubleshellThickness,intshellIterations,intelecIterations, 10doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 11doubleporocity,doubledyeCoverage, 12doublemaxError,doublemaxTime); 13ElectroNeutralityNoField(StateController controller,SolveState solver,constdouble a); 14ElectroNeutralityNoField(constElectroNeutralityNoFieldstate); 15//Createsacompletecopy 16SystemCreateCopy()const; 17//Createsareference 18SystemCreateRef()const; 19//InitializedtheTotalArrayforphiSc,C e&J e 20voidInitializeTotal(SubStatelast); 21//InitializeConcentrations 22voidInitializeConc(SubStatelast); 23//Buildsmatricesforsystem 24voidBuildJ(constdoublez); 25voidBuildF(constdoublez); 26//Doesthenewtonstepforthesystem 27voidNewtonStep(); 28//Checkstoseeifthecurrentstateispossible(valid) 29boolIsValid()const; 30//Genericaccesforallvariables 31double&GetVar(inti); 32intSize()const; 33//Modes 244

PAGE 245

34intModes()constfreturn2;g 35doubleModeConverganceError()const; 36voidUpdateMode(); 37//Printstheconvergancestufftotheconsole 38virtualvoidPrintConvergance(); 39//Functionsforgettingthecorrectinterfacevalues 40constdoubleGetPhiSc()const; 41constdoubleGetPhiEl()const; 42constdoubleGetC e()const; 43constdoubleGetC red()const; 44constdoubleGetC ox()const; 45constdoubleGetC sup()const; 46constdoubleGetJ e()const; 47constdoubleGetJ red()const; 48constdoubleGetJ ox()const; 49//Functionsforgettingthecorrectinterfacederivatives 50constdoubleGetJ e P()const; 51//Savedvaluesusedforerrorcalculations 52doubleoldC e; 53doubleoldRateTotal; 54doubleoldPhiSc; 55doubleoldphiD; 56doubleoldJ e,oldJ red,oldJ ox; 57g; 1#includeAraMath.h 2#includeConsole.h 3#includeElectroNeutralityNoField.h 4#includeConstants.h 5#includeSolveState.h 6#includeThreadCheck.h 7#include//for isnan 8// 9//Constructor 10// 11ElectroNeutralityNoField::ElectroNeutralityNoField(constElectroNeutralityNoFieldstate) 12:System(state) 13f 14g 15ElectroNeutralityNoField::ElectroNeutralityNoField(StateController controller,SolveStates,constdouble a) 16:System( controller,s, a) 245

PAGE 246

17f 18g 19ElectroNeutralityNoField::ElectroNeutralityNoField(StateController controller, 20doubleshellThickness,intshellIterations,intelecIterations, 21doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 22doubleporocity,doubledyeCoverage, 23doublemaxError,doublemaxTime) 24:System( controller,shellThickness,shellIterations,elecIterations,nanorodLength,nanorodDiameter,nanorodDensity, 25porocity,dyeCoverage,maxError,maxTime) 26f 27g 28// 29//CreateCopy 30// 31SystemElectroNeutralityNoField::CreateCopy()const 32f 33returnhtnewElectroNeutralityNoField(controller,solver,a); 34g 35// 36//CreateRef 37// 38SystemElectroNeutralityNoField::CreateRef()const 39f 40returnhtnewElectroNeutralityNoField(this); 41g 42// 43//InitializephiSc[n],C e[n]&J e[n] 44// 45voidElectroNeutralityNoField::InitializeTotal(SubStatelast) 46f 47if(last) 48f 49//Semiconductor 50//phiSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiScList; 51fieldSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>fieldScList; 52C e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C eList; 53J e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J eList; 54//Electrolyte 55phiEl=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiElList; 56C red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C redList; 246

PAGE 247

57C ox=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C oxList; 58C sup=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C supList; 59J red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J redList; 60J ox=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>J oxList; 61g 62else 63f 64//Semiconductor 65//phiSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,phi applied); 66fieldSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,0); 67C e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1); 68fori(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1) 69C e[i]=(1e)]TJ /F10 7.97 Tf 6.76 0 Td[(8)exp(()]TJ /F10 7.97 Tf 7.2 0 Td[(0.6721Sq(phi applied)+0.8427phi applied+0.0065)i); 70J e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,1.77e)]TJ /F10 7.97 Tf 6.76 0 Td[(7); 71//Electrolyte 72phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 73C red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref); 74C ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I3 ref); 75C sup.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref+C I3 ref); 76J red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 77J ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,0); 78g 79phiSc.clear(); 80phiSc.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1,phi applied); 81//phiEl.clear(); 82//phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phi applied); 83g 84// 85//InitializeConc 86// 87voidElectroNeutralityNoField::InitializeConc(SubStatelast) 88f 89if(last==0) 90f 91C d pos=1.26e)]TJ /F10 7.97 Tf 6.88 0 Td[(16; 92C d e3=2.54e)]TJ /F10 7.97 Tf 6.88 0 Td[(44; 93C d e1=1.9e)]TJ /F10 7.97 Tf 6.88 0 Td[(22; 94C d g=7.5e)]TJ /F10 7.97 Tf 6.86 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 95phiD=0.03; 96g 247

PAGE 248

97else 98f 99C d pos=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos; 100C d e3=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e3; 101C d e1=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1; 102C d g=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 103phiD=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 104g 105//Same,nomatterwhat 106//C d pos=(2e)]TJ /F20 7.97 Tf 6.8 0 Td[(16)exp(18.31phi applied);//functionofphi applied 107g 108// 109//IsValid 110// 111boolElectroNeutralityNoField::IsValid()const 112f 113//AssertthatC eispositive 114/for(inti=0;i1)returnfalse;/ 118if(CurrentMode()==0) 119returnIsPositive(C d pos)&& 120IsPositive(C d e1)&& 121IsPositive(C d e3)&& 122(C d g>0)&& 123(C d g<=7.5e)]TJ /F10 7.97 Tf 6.76 0 Td[(5)&& 124! isnan(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError); 125else 126returnIsPositive(GetC e())&& 127IsPositive(GetC ox())&& 128IsPositive(GetC red())&& 129IsPositive(GetC sup())&& 130! isnan(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>standardError); 131g 132// 133//ModeConverganceError 134// 135doubleElectroNeutralityNoField::ModeConverganceError()const 136f 137//Calculatealltheerror 248

PAGE 249

138doubleerror1=fabs((GetC e())]TJ /F10 7.97 Tf 11.48 0 Td[(oldC e)/GetC e()); 139doubleerror2=fabs((RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 11.7 0 Td[(oldRateTotal)/RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 140doubleerror3=fabs((GetPhiSc())]TJ /F10 7.97 Tf 11.53 0 Td[(oldPhiSc)/GetPhiSc()); 141doubleerror4=fabs((phiD)]TJ /F10 7.97 Tf 11.58 0 Td[(oldphiD)/phiD); 142doubleerror5=fabs((GetJ e())]TJ /F10 7.97 Tf 11.73 0 Td[(oldJ e)/GetJ e()); 143doubleerror6=fabs((GetJ red())]TJ /F10 7.97 Tf 11.8 0 Td[(oldJ red)/GetJ red()); 144doubleerror7=fabs((GetJ ox())]TJ /F10 7.97 Tf 11.72 0 Td[(oldJ ox)/GetJ ox()); 145//Returnthelargesterror 146returnmax(max(max(error1,error2),max(error3,error4)),max(max(error5,error6),error7)); 147g 148// 149//PrintConvergance 150// 151voidElectroNeutralityNoField::PrintConvergance() 152f 153ThreadCheck(ElectroNeutralityNoField::PrintConvergance); 154WriteLine(ntntR tot ,oldRateTotal, => ,RateTotal(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)); 155WriteLine(ntntPhiSc ,oldPhiSc, => ,GetPhiSc()); 156WriteLine(ntntPhiD ,oldphiD, => ,phiD); 157WriteLine(ntntC e ,oldC e, => ,GetC e()); 158WriteLine(ntntJ e ,oldJ e, => ,GetJ e()); 159WriteLine(ntntJ red ,oldJ red, => ,GetJ red()); 160WriteLine(ntntJ ox ,oldJ ox, => ,GetJ ox()); 161g 162voidElectroNeutralityNoField::UpdateMode() 163f 164//Savealltheoldvalues 165oldC e=GetC e(); 166oldRateTotal=RateTotal(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage); 167oldPhiSc=GetPhiSc(); 168oldphiD=phiD; 169oldJ e=GetJ e(); 170oldJ red=GetJ red(); 171oldJ ox=GetJ ox(); 172g 173// 174//BuildJ 175// 176voidElectroNeutralityNoField::BuildJ(constdoublez) 249

PAGE 250

177f 178//SetupthesizeoftheJacobian 179constintsize=Size(); 180solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(size,size); 181if(CurrentMode()==0) 182f 183//Indicesforderivatives 184constintconcStart=0; 185constintphiDStart=4; 186constintJ eStart=5; 187constintJ redStart=6; 188constintJ oxStart=7; 189constintfieldStart=8; 190// 191//Interface 192// 193//Equation4 194//r2)]TJ /F20 7.97 Tf 11.47 0 Td[(r3a)]TJ /F20 7.97 Tf 11.48 0 Td[(r4a+nr6a=0 195//d/dC d g 196solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart,dR2( C d g,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d g))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( C d g)+ndR6a( C d g)); 197//d/dC d pos=0 198//d/dC d e1 199solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,concStart+2,dR2( C d e1,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4a( C d e1)+ndR6a( C d e1)); 200//Equation5 201//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b+nr6b=0//maybeshouldbe+r6b???1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 202//d/dC d e1 203solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+2,dR3a( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e1)+ndR6b( C d e1)); 204//d/dC d e3 205solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,concStart+3,dR3a( C d e3))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( C d e3)+ndR6b( C d e3)); 206//Equation6 207//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0//Addedr5b/citshouldhavebeenthere?1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 208//d/dC d pos 209solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+1,dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos))); 210//d/dC d e1 250

PAGE 251

211solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+2,dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1))); 212//d/dC d e3 213solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,concStart+3,dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3))); 214//Equation7 215//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 216for(inti=0;i<4;i++) 217solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,concStart+i,1); 218//Gauss'sequationattheinterface 219//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 220//d/dphiD 221solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 222//d/dC d pos 223solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,concStart+1,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/a); 224//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 225//C d pos[n] 226solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos)))); 227//C d e1[n] 228solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+2,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1)))); 229//C d e3[n] 230solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,concStart+3,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3)))); 231//J e[n] 232solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 233//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 234//d/dC d pos 235solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 236//d/dC d e1 237solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+2,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 238//d/dC d e3 239solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,concStart+3,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 240//d/dJ red 241solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 251

PAGE 252

242//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 243//d/dC d pos 244solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 245//d/dC d e1 246solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+2,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 247//d/dC d e3 248solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,concStart+3,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 249//d/dJ red 250solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,1); 251//field[0]=fieldINT 252//fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F20 7.97 Tf 11.84 0 Td[((phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc 253solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart,1); 254//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F20 7.97 Tf 6.81 0 Td[(1/dell Sc);//outfornofield 255g 256else 257f 258//Indicesforderivatives 259constintphiStart=0; 260constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 261constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 262constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 263constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 264constintphiElStart=phiDStart+1; 265constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 266constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 267constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 268constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 269constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 270// 271//Semiconductor 272// 273//Phiboundaryconditions: 274//phiSc[0]=0 275solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,phiStart,1);//ChangedcolumnfromphiStarttophiStart+1,jjh 276//fieldSc[0]=0 277solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,fieldStart,1); 252

PAGE 253

278//fieldSc[tau]=(phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc 279//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,1); 280//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,phiStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth)]TJ /F20 7.97 Tf 6.81 0 Td[(1,1/dell Sc); 281//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,phiDStart,)]TJ /F20 7.97 Tf 6.81 0 Td[(1/dell Sc); 282//C eboundaryconditions: 283//C e[0]=N a 284solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,C eStart,1); 285//C e[0]isgivenbyfluxeqn 286//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart,/)]TJ /F20 7.97 Tf 11.65 0 Td[(1/)]TJ /F20 7.97 Tf 12.91 0 Td[(f(phiSc[1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[0]));outforN a 287//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart+1,1); 288/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/D e); 289solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,phiStart,fC e[0]);//outforN a 290solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,phiStart+1,)]TJ /F20 7.97 Tf 7.27 0 Td[(fC e[0]);/ 291//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F20 7.97 Tf 6.81 0 Td[(1,N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf -361.23 -15.67 Td[(GetPhiSc())/(RT))); 292//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,phiDStart,)]TJ /F20 7.97 Tf 6.3 0 Td[(N aF/(RT)exp(F(phiD)]TJ /F20 7.97 Tf 6.19 0 Td[(GetPhiSc())/(RT))); 293//RightBoundaryCondition 294//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5)) 295//JacobianEntries 296//phiSc[n] 297solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiSc)+dR4b( phiSc)+dR5( phiSc)))); 298//C e[n] 299solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C e)+dR4b( C e)+dR5( C e)))); 300//phiEl[n] 301solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,phiElStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiEl)+dR4b( phiEl)+dR5( phiEl)))); 302//C ox[n] 303solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,oxStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C ox)+dR4b( C ox)+dR5( C ox)))); 304//C red[n] 305solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,redStart+1,0)]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C red)+dR4b( C red)+dR5( C red)))); 306//J e[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 307//J e[n+1] 308solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 253

PAGE 254

309//LeftBoundary 310//Equation1 311//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 312solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart+1,1); 313solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 314solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 315//Equation2 316//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 317solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart+1,1); 318solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,fieldStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 319solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,C eStart,)]TJ /F10 7.97 Tf 6.92 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemiF/(E sc)); 320//Equation3 321//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/hSemi)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/hSemi=0 322//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart+1,phiStart+1,)]TJ /F20 7.97 Tf 7.27 0 Td[(f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//outfornofield 323//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart+1,phiStart,f(C e[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);//outfornofield 324solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart+1,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi);//outfornofield(below) 325solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,C eStart,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi/)]TJ /F20 7.97 Tf 16.12 0 Td[(f(phiSc[1])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi/); 326solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,J eStart,1/D e); 327//Equation4 328//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=0,R net=0fornow 329solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart+1,1); 330solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,J eStart,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 331//Restofcentralarea 332for(inti=1;isemiWidth;i++) 333f 334//Equation1 335//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemifieldSc[n]=0 336//d/dphi[n+1] 337solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i+1,1); 338//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 339solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,phiStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 340//d/dfield[n] 341solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,fieldStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 342//Equation2 343//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+2hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 344//d/dfield[n+1] 254

PAGE 255

345solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i+1,1); 346//d/dfield[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 347solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,fieldStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 348//d/dC e[n] 349solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,C eStart+i,)]TJ /F10 7.97 Tf 6.79 0 Td[((2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)F/(E sc));//thisstartsatthe0'thtermsono+1,jjh 350//Equation3 351//(1/D e)J e[n]+(C e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/(2hSemi))]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n](phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/(2hSemi)=0 352//d/dphi[n+1] 353//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i+1,)]TJ /F20 7.97 Tf 7.27 0 Td[(f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi));//outfornofield 354//d/dphi[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 355//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,phiStart+i)]TJ /F20 7.97 Tf 6.81 0 Td[(1,f(C e[i])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi));//outfornofield 356//d/dC e[n+1] 357solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i+1,1/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 358//d/dC e[n] 359//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i,)]TJ /F20 7.97 Tf 7.27 0 Td[(f(phiSc[i+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi));//outfornofield 360//d/dC e[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1] 361solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,C eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 7.1 0 Td[(1/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 362//d/dJ e[n] 363solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,J eStart+i,1/D e); 364//Equation4 365//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=0,R net=0fornow 366//d/dJ e[n+1] 367solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i+1,1); 368//d/dJ e[n] 369solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,J eStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 370//d/dC e[n] 371//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i,C eStart+i]=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi1e5;//Commentedout12)]TJ /F20 7.97 Tf 6.45 0 Td[(09)]TJ /F20 7.97 Tf 6.45 0 Td[(09 372g 373//Gauss'sequationattheinterface 374//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 375//d/dphiSc 376solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,E sc/dell Sc); 377//d/dphiD 378solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.67 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 255

PAGE 256

379//d/dphiEl 380solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,phiElStart+1,E el/dell El); 381// 382//Electrolye 383// 384//PhiEl 385//phi=v 386//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart,phiElStart+1,1); 387solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 388//J red 389//C red=C I ref 390solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 391//J ox 392//C sup=C I3 ref 393solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 394//C 395//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 396solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 397//BC 398//J red)]TJ /F20 7.97 Tf 11.53 0 Td[(1.5rNet=0 399//d/dphiSc 400solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 401//d/dC e 402solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 403//d/dphiEl 404solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,phiElStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 405//d/dC red 406solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,redStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 407//d/dC ox 408solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,oxStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 409//d/dJ red 410solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 411//BC 256

PAGE 257

412//J ox+0.5((1)]TJ /F20 7.97 Tf 8.18 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 413//d/dphiSc 414solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc)))); 415//d/dC e 416solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C e)+dR6b( C e)+dR7( C e)))); 417//d/dphiEl 418solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,phiElStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 419//d/dC red 420solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,redStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 421//d/dC ox 422solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,oxStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 423//d/dJ red 424solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,J oxStart,1); 425for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth;i++) 426f 427//Equation8 428//(phiEl[i])]TJ /F20 7.97 Tf 11.79 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))()]TJ /F20 7.97 Tf 7.44 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+(D ox(C sup[i])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))]TJ /F20 7.97 Tf 11.18 0 Td[(D ox(C ox[i])]TJ /F20 7.97 Tf 11.19 0 Td[(C ox[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1]))]TJ /F20 7.97 Tf 11.4 0 Td[(D red(C red[i])]TJ /F20 7.97 Tf -304.23 -15.66 Td[(C red[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec) 429solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 430solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 431solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,RTD red/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 432solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart+i,)]TJ /F10 7.97 Tf 6.67 0 Td[((RTD red()]TJ /F10 7.97 Tf 7.09 0 Td[((J red[i]+J ox[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+2D oxC sup[i])]TJ /F10 7.97 Tf 7.19 0 Td[(D oxC sup[i)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+D oxC ox[i)]TJ /F10 7.97 Tf 6.84 0 Td[(1]+D redC red[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(F Sq(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec))); 433solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,RTD ox/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 434solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart+i,)]TJ /F10 7.97 Tf 6.67 0 Td[((RTD ox()]TJ /F10 7.97 Tf 7.08 0 Td[((J red[i]+J ox[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+2D oxC sup[i])]TJ /F10 7.97 Tf 7.19 0 Td[(D oxC sup[i)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+D oxC ox[i)]TJ /F10 7.97 Tf 6.83 0 Td[(1]+D redC red[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/(F Sq(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec))); 257

PAGE 258

435solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 5.5 0 Td[(RTD ox/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 436solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart+i,(RTD ox((J red[i]+J ox[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec+D oxC sup[i)]TJ /F10 7.97 Tf 6.89 0 Td[(1]+2D oxC ox[i])]TJ /F10 7.97 Tf 7.19 0 Td[(D oxC ox[i)]TJ /F10 7.97 Tf 6.9 0 Td[(1]+2D redC red[i])]TJ /F10 7.97 Tf 7.41 0 Td[(D redC red[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(F Sq(D oxC ox[i]+D redC red[i]+D oxC sup[i])solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec))); 437solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,J redStart+i,)]TJ /F10 7.97 Tf 5.5 0 Td[(RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))); 438solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,J oxStart+i,)]TJ /F10 7.97 Tf 5.5 0 Td[(RT/(F(D oxC ox[i]+D redC red[i]+D oxC sup[i]))); 439//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart)]TJ /F20 7.97 Tf 6.26 0 Td[(1+i,F/(E el)Sq(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec)); 440//Equation9 441//J red[i]+D red(C red[i])]TJ /F20 7.97 Tf 7.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.4 0 Td[(C red[i)]TJ /F20 7.97 Tf 7.19 0 Td[(1]0.5f(phiEl[i])]TJ /F20 7.97 Tf -307.01 -15.67 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 442solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J redStart+i,1/D red); 443solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,redStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 444if(!useMigration) 445f 446solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 447g 448else 449f 450solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1(1+f(phiEl[i])]TJ /F10 7.97 Tf -273.53 -15.67 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 451solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.4 0 Td[(1C red[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 452solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C red[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 453g 454//Equation10 455//J ox[i]+D ox(C ox[i])]TJ /F20 7.97 Tf 7.2 0 Td[(C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.18 0 Td[(C ox[i)]TJ /F20 7.97 Tf 7.22 0 Td[(1](phiEl[i])]TJ /F20 7.97 Tf 7.81 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 456solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J oxStart+i,1/D ox); 457solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,oxStart+i,1/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 458if(!useMigration) 459f 460solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.81 0 Td[(1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 461g 462else 463f 258

PAGE 259

464solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.82 0 Td[(1(1+f(phiEl[i])]TJ /F10 7.97 Tf -263.97 -15.66 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 465solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.4 0 Td[(1C ox[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 466solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C ox[i)]TJ /F10 7.97 Tf 7.2 0 Td[(1]0.5f/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 467g 468//Equation11 469//C sup[i])]TJ /F20 7.97 Tf 7.18 0 Td[(C sup[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+C sup[i)]TJ /F20 7.97 Tf 7.22 0 Td[(1](phiEl[i])]TJ /F20 7.97 Tf 7.81 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 470solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,supStart+i,1); 471if(!useMigration) 472f 473solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 474g 475else 476f 477solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 478solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,()]TJ /F10 7.97 Tf 6.72 0 Td[(1+f(phiEl[i])]TJ /F10 7.97 Tf -263.97 -15.66 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))); 479solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.39 0 Td[(C sup[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f); 480solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,C sup[i)]TJ /F10 7.97 Tf 6.92 0 Td[(1]f); 481g 482//Equation12 483//J red[i])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 484solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i,1); 485solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 486//Equation13 487//J ox[i])]TJ /F20 7.97 Tf 11.54 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 488solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i,1); 489solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 490g 491g 492g 493// 494//BuildF 495// 496voidElectroNeutralityNoField::BuildF(constdoublez) 497f 498//GenerateRateconstants 499//Makesurethisiscalledorrestofthefunctionwillnotworkproperly!!! 500GenerateRates(z); 259

PAGE 260

501//SetupthesizeoftheFvector 502constintsize=Size(); 503//InitializesizeofFmatrix 504solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(1,size); 505if(CurrentMode()==0) 506f 507constintconcStart=0; 508constintphiDStart=concStart+4; 509constintjStart=phiDStart+1; 510constintfieldStart=jStart+3; 511// 512//KENETICINTERFACEPART 513// 514//Equation4 515//r2)]TJ /F20 7.97 Tf 11.48 0 Td[(r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r4a+nr6a=0 516solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart,0,r2)]TJ /F10 7.97 Tf 11.47 0 Td[(r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r4a+nr6a); 517//Equation5 518//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.47 0 Td[(r4b)]TJ /F20 7.97 Tf 10.94 0 Td[(nr6b=0 519solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+1,0,r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r3b)]TJ /F10 7.97 Tf 11.47 0 Td[(r4b+nr6b); 520//Equation6 521//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0 522solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+2,0,r4a+r4b+r5)]TJ /F10 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)); 523//Equation7 524//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 525solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,0,C d g+C d pos+C d e1+C d e3)]TJ /F10 7.97 Tf 11.73 0 Td[(C d t); 526//Gauss'sLawattheinterface 527//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 528solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.66 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 529//J eBC 530//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 531solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart,0,)]TJ /F10 7.97 Tf 6.63 0 Td[(GetJ e())]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 532//J redBC 533//J red=1.5rNet(@interface) 534solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+1,0,)]TJ /F10 7.97 Tf 6.77 0 Td[(GetJ red()+b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 535//J oxBC 536//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 260

PAGE 261

537solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(jStart+2,0,GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 538//field[0]=fieldINT 539solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth]/)]TJ /F20 7.97 Tf 15.9 0 Td[((phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc/); 540g 541else 542f 543constintphiStart=0; 544constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 545constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 546constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 547constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 548constintphiElStart=phiDStart+1; 549constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 550constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 551constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 552constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 553constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 554// 555//SEMICONDUCTORPART 556// 557//PhiScBC's 558//phiSc[0]=0 559solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart,0,phiSc[0])]TJ /F10 7.97 Tf 11.88 0 Td[(phi applied); 560//phiSc[2])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0]=0 561//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(1,0,phiSc[2])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[0]); 562//field[0]=fieldINT 563solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart,0,fieldSc[0]); 564//field[tau sc]=(phiD)]TJ /F20 7.97 Tf 6.2 0 Td[(GetPhiSc())/dell Sc 565//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(fieldStart,0,fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F20 7.97 Tf 11.83 0 Td[((phiD)]TJ /F20 7.97 Tf 11.28 0 Td[(GetPhiSc())/dell Sc); 566//C eBC 567//C e[0]=N a 568solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart,0,C e[0])]TJ /F10 7.97 Tf 11.09 0 Td[(N a); 569//C e[0]isgivenbyfluxeqn 570//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,0,/C e[1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[0]/+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi/D eJ e[0])]TJ /F20 7.97 Tf 12.05 0 Td[(fC e[0](phiSc[1])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[0])); 571//J eBC 572//J e=((1)]TJ /F20 7.97 Tf 8.08 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 261

PAGE 262

573solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart,0,)]TJ /F10 7.97 Tf 6.64 0 Td[(GetJ e())]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 574//LeftBoundary 575solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,0,PotentialFieldSc 0(0)); 576solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+1,0,PoissonFieldSc 0(0)); 577solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+1,0,ElectronFlux3 0(0)); 578solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+1,0,ElectronContinuity 0(0)); 579for(inti=1;isemiWidth;i++) 580f 581//Equation1 582//phiSc[n+1])]TJ /F20 7.97 Tf 11.43 0 Td[(phiSc[n])]TJ /F20 7.97 Tf 10.99 0 Td[(hSemifieldSc[n]=0 583solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+i+1,0,PotentialFieldSc(i)); 584//Equation2 585//fieldSc[n+1])]TJ /F20 7.97 Tf 11.96 0 Td[(fieldSc[n]+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n]) 586solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(fieldStart+i+1,0,PoissonFieldSc(i)); 587//Equation3 588//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi)]TJ /F20 7.97 Tf 12.05 0 Td[(fSq(C e[i])(phiSc[i+1])]TJ /F20 7.97 Tf 7.45 0 Td[(phiSc[i])/(hSemi))=0 589//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,0,ElectronFlux2(i));//inforfield 590//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi 591solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i+1,0,ElectronFlux3(i));//infornofield 592//Equation4 593//J e[i+1])]TJ /F20 7.97 Tf 11.54 0 Td[(J e[i])]TJ /F20 7.97 Tf 11.07 0 Td[(2hSemiR net=0,R net=0fornow 594solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i+1,0,ElectronContinuity(i)); 595g 596//Gauss'sLawattheinterface 597//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 598solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.54 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf -351.42 -15.66 Td[(GetPhiEl())+F(/(GetC e()+GetC ox()+GetC red())/a/)]TJ /F10 7.97 Tf 11.83 0 Td[((C d pos)/a)); 599// 600//ELECTROLYTEPART 601// 602//PhiElBC 603//phiEl[interface])]TJ /F20 7.97 Tf 11.17 0 Td[(v=0 604//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart,0,phiEl[1])]TJ /F20 7.97 Tf 11.88 0 Td[(phi applied); 605solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth]); 606//C redBC 607//C red=C I ref 608solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C red[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 12.07 0 Td[(C I ref); 609//C oxBC 262

PAGE 263

610//C ox=C I3 ref 611solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0,C ox[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 11.96 0 Td[(C I3 ref); 612//C supBC 613//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 614solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C sup[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 10.94 0 Td[(5e)]TJ /F10 7.97 Tf 6.76 0 Td[(4); 615//J redBC 616//J red=1.5rNet(@interface) 617//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,0,GetJ red()+3GetJ ox());tryingsamebcbutwrittenout1)]TJ /F20 7.97 Tf 6.4 0 Td[(27)]TJ /F20 7.97 Tf 6.4 0 Td[(10 618solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,0,)]TJ /F10 7.97 Tf 6.77 0 Td[(GetJ red()+b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 619//J oxBC 620//J ox=)]TJ /F20 7.97 Tf 6.87 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7)) 621solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,0,GetJ ox()+d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 622for(inti=0;ielecWidth;i++) 623f 624//Equation8 625//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.06 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.71 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1])=0 626solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i+1,0,OhmEl(i+1)); 627//Equation9 628//J red[i+1]+D red(C red[i+1])]TJ /F20 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC red[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf -316.56 -15.66 Td[(phiEl[i]))/h=0 629solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+i,0,RedFlux2(i)); 630//Equation10 631//J ox[i+1]+D ox(C ox[i+1])]TJ /F20 7.97 Tf 7.21 0 Td[(C ox[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC ox[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i]))/h=0 632solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+i,0,OxFlux2(i)); 633//Equation11 634//C sup[i+1])]TJ /F20 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i])=0 635solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+i,0,SupFlux2(i)); 636//Equation12 637//J red[i+1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec 638solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i+1,0,RedContinuity(i)); 639//Equation13 640//J ox[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J ox[i]=)]TJ /F20 7.97 Tf 6.37 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec 641solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i+1,0,OxContinuity(i)); 642g 643g 644//Calculatetheerrorofthefmatrix 263

PAGE 264

645solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateError(); 646g 647// 648//NewtonStep 649// 650voidElectroNeutralityNoField::NewtonStep() 651f 652constintsize=Size(); 653if(CurrentMode()==0) 654f 655//Concentrations 656C d g+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(0,size)); 657C d pos+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(1,size)); 658C d e1+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(2,size)); 659C d e3+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(3,size)); 660//PhiD 661phiD+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(4,size)); 662//Flux 663J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.86 0 Td[(1]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(5,size)); 664J red[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(6,size)); 665J ox[0]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(7,size)); 666fieldSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(8,size)); 667g 668else 669f 670constintphiStart=0; 671constintfieldStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 672constintC eStart=fieldStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 673constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 674constintphiDStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 675constintphiElStart=phiDStart+1; 676constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 677constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 678constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 264

PAGE 265

679constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 680constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1; 681//Semiconductor 682for(inti=0;isemiWidth+1;i++) 683f 684phiSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiStart+i,size)); 685fieldSc[i]+=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(fieldStart+i,size)); 686C e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(C eStart+i,size)); 687J e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J eStart+i,size)); 688g 689//phiD 690phiD+=(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(phiDStart,size)); 691//Electrolyte 692for(inti=0;ielecWidth+1;i++) 693f 694phiEl[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiElStart+i,size)); 695C red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(redStart+i,size)); 696C ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(oxStart+i,size)); 697C sup[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(supStart+i,size)); 698J red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J redStart+i,size)); 699J ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J oxStart+i,size)); 700g 701g 702g 703constdoubleElectroNeutralityNoField::GetPhiSc()constfreturnphiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 704constdoubleElectroNeutralityNoField::GetC e()constfreturnC e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 705constdoubleElectroNeutralityNoField::GetJ e()constfreturnJ e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.32 0 Td[(1];g 706constdoubleElectroNeutralityNoField::GetPhiEl()constfreturnphiEl[1];g 707constdoubleElectroNeutralityNoField::GetC red()constfreturnC red[1];g 708constdoubleElectroNeutralityNoField::GetC ox()constfreturnC ox[1];g 709constdoubleElectroNeutralityNoField::GetC sup()constfreturnC sup[1];g 710constdoubleElectroNeutralityNoField::GetJ red()constfreturnJ red[0];g 711constdoubleElectroNeutralityNoField::GetJ ox()constfreturnJ ox[0];g 712constdoubleElectroNeutralityNoField::GetJ e P()constfreturn(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 11.53 0 Td[(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.23 0 Td[(2])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi);g 713// 714//size 715// 716intElectroNeutralityNoField::Size()const 717f 718if(CurrentMode()==0) 265

PAGE 266

719return4+4+1; 720else 721return4(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)+1+6(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 722g 723// 724//Var 725// 726double&ElectroNeutralityNoField::GetVar(inti) 727f 728if(CurrentMode()==0) 729f 730if(i==0) 731returnC d g; 732elseif(i==1) 733returnC d pos; 734elseif(i==2) 735returnC d e1; 736elseif(i==3) 737returnC d e3; 738else 739returnphiD; 740g 741else 742f 743constintw1=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth; 744if(i//for isnan 266

PAGE 267

7// 8//Constructor 9// 10ElectrolyteInterface::ElectrolyteInterface(constElectrolyteInterfacestate) 11:System(state) 12f 13g 14ElectrolyteInterface::ElectrolyteInterface(StateController controller,SolveStates,constdouble a) 15:System( controller,s, a) 16f 17g 18ElectrolyteInterface::ElectrolyteInterface(StateController controller, 19doubleshellThickness,intshellIterations,intelecIterations, 20doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 21doubleporocity,doubledyeCoverage, 22doublemaxError,doublemaxTime) 23:System( controller,shellThickness,shellIterations,elecIterations,nanorodLength,nanorodDiameter,nanorodDensity, 24porocity,dyeCoverage,maxError,maxTime) 25f 26g 27// 28//CreateCopy 29// 30SystemElectrolyteInterface::CreateCopy()const 31f 32returnhtnewElectrolyteInterface(controller,solver,a); 33g 34// 35//CreateRef 36// 37SystemElectrolyteInterface::CreateRef()const 38f 39returnhtnewElectrolyteInterface(this); 40g 41// 42//InitializeConc 43// 44voidElectrolyteInterface::InitializeConc(SubStatelast) 45f 267

PAGE 268

46if(last==0) 47f 48//C d pos=1e)]TJ /F20 7.97 Tf 6.88 0 Td[(23; 49//C d e3=7.28e)]TJ /F20 7.97 Tf 6.88 0 Td[(29; 50//C d e1=4.77e)]TJ /F20 7.97 Tf 6.88 0 Td[(23; 51//C d g=7.5e)]TJ /F20 7.97 Tf 7.62 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 52g 53else 54f 55//C d pos=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d pos; 56//C d e3=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e3; 57//C d e1=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d e1; 58//C d g=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>C d g; 59g 60//Same,nomatterwhat 61C d pos=2.15e)]TJ /F10 7.97 Tf 6.88 0 Td[(16;//(1e)]TJ /F20 7.97 Tf 6.79 0 Td[(16)exp(19.485phi applied);//functionofphi applied 62C d g=7.5e)]TJ /F10 7.97 Tf 6.87 0 Td[(5; 63C d e1=4.85e)]TJ /F10 7.97 Tf 6.88 0 Td[(30; 64C d e3=6.47e)]TJ /F10 7.97 Tf 6.88 0 Td[(52; 65g 66// 67//InitializephiSc[n],C e[n]&J e[n] 68// 69voidElectrolyteInterface::InitializeTotal(SubStatelast) 70f 71if(last) 72f 73//Electrolyte 74//C red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C redList; 75//C ox=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C oxList; 76C sup=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C supList; 77J red=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J redList; 78J ox=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>J oxList; 79g 80else 81f 82//Electrolyte 83//C red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I); 84//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)C red[i]=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4)]TJ /F20 7.97 Tf 11.45 0 Td[(double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)(5e)]TJ /F20 7.97 Tf 5.94 0 Td[(4)]TJ /F20 7.97 Tf 6.81 0 Td[(C I); 85//C ox.resize(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1,C I3); 268

PAGE 269

86//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)C ox[i]=double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)C I3+1e)]TJ /F20 7.97 Tf 6.87 0 Td[(7; 87C sup.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I+C I3); 88J red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,)]TJ /F10 7.97 Tf 7.03 0 Td[(31.27e)]TJ /F10 7.97 Tf 6.75 0 Td[(7); 89J ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,1.27e)]TJ /F10 7.97 Tf 6.75 0 Td[(7); 90g 91constdoublex1=double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1)/41.0; 92constdoublex2=double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2)/42.0; 93//C red.clear(); 94C red.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I ref); 95fori(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1)C red[i]=1e)]TJ /F10 7.97 Tf 6.47 0 Td[(11Sq(double(i+1)x1))]TJ /F10 7.97 Tf 10.94 0 Td[(1e)]TJ /F10 7.97 Tf 6.36 0 Td[(9double(i+1)x1+0.0005; 96//C ox.clear(); 97C ox.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,C I3 ref); 98fori(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1)C ox[i]=)]TJ /F10 7.97 Tf 6.23 0 Td[(2e)]TJ /F10 7.97 Tf 6.47 0 Td[(11Sq(double(i+1)x1)+2e)]TJ /F10 7.97 Tf 6.36 0 Td[(9double(i+1)x1+5e)]TJ /F10 7.97 Tf 6.87 0 Td[(5; 99//phiEl.clear(); 100phiEl.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+2,phi applied); 101fori(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2)phiEl[i]=5e)]TJ /F10 7.97 Tf 6.36 0 Td[(8Sq(double(i+1)x2))]TJ /F10 7.97 Tf 10.94 0 Td[(1e)]TJ /F10 7.97 Tf 6.37 0 Td[(5double(i+1)x2+phi applied; 102g 103// 104//IsValid 105// 106boolElectrolyteInterface::IsValid()const 107f 108//AssertthatC eispositive 109/for(inti=0;i5e)]TJ /F20 7.97 Tf 6.76 0 Td[(4)returnfalse; 111for(inti=0;i5e)]TJ /F20 7.97 Tf 6.75 0 Td[(4)returnfalse; 113for(inti=0;i5e)]TJ /F20 7.97 Tf 6.76 0 Td[(4)returnfalse;/ 115/for(inti=0;i1)returnfalse;/ 117return/IsPositive(C d pos)&& 118IsPositive(C d e1)&& 119IsPositive(C d e3)&& 120(C d g<=7.5e)]TJ /F20 7.97 Tf 6.75 0 Td[(5)&&/ 121! isnan(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>maxError); 122g 269

PAGE 270

123// 124//BuildJ 125// 126voidElectrolyteInterface::BuildJ(constdoublez) 127f 128//SetupthesizeoftheJacobian 129constintsize=4+(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2)+5(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 130solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(size,size); 131//Indicesforderivatives 132constintconcStart=0; 133constintphiElStart=concStart+4; 134constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2; 135constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 136constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 137constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 138constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 139// 140//Interface 141// 142//Equation4 143//r2)]TJ /F20 7.97 Tf 11.48 0 Td[(r3a)]TJ /F20 7.97 Tf 11.48 0 Td[(r4a+nr6a=0 144//d/dC d g 145solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,concStart,dR2( C d g,z))]TJ /F10 7.97 Tf 10.79 0 Td[(dR3a( C d g))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4a( C d g)+ndR6a( C d g)); 146//d/dC d pos=0 147//d/dC d e1 148solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,concStart+2,dR2( C d e1,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( C d e1)+ndR6a( C d e1)); 149//d/dPhiEl 150solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,phiElStart+1,dR2( phiEl,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( phiEl))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( phiEl)+ndR6a( phiEl)); 151//Equation5 152//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.48 0 Td[(r4b+nr6b=0//maybeshouldbe+r6b???1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 153//d/dC d e1 154solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,concStart+2,dR3a( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR3b( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4b( C d e1)+ndR6b( C d e1)); 155//d/dC d e3 156solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,concStart+3,dR3a( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR3b( C d e3))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4b( C d e3)+ndR6b( C d e3)); 157//d/dphiEl 270

PAGE 271

158solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,phiElStart+1,dR3a( phiEl))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( phiEl))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( phiEl)+ndR6b( phiEl)); 159//Equation6 160//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0//Addedr5b/citshouldhavebeenthere?1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.41 0 Td[(10 161//d/dC d pos 162solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,concStart+1,dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos))); 163//d/dC d e1 164solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,concStart+2,dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1))); 165//d/dC d e3 166solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,concStart+3,dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3))); 167//d/dphiEl 168solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,phiElStart+1,dR4a( phiEl)+dR4b( phiEl)+dR5( phiEl))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl))); 169//C red 170solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,redStart,dR4a( C red)+dR4b( C red)+dR5( C red))]TJ /F10 7.97 Tf 10.95 0 Td[(n(dR6a( C red)+dR6b( C red)+dR7( C red))); 171//Equation7 172//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 173for(inti=0;i<4;i++) 174solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,concStart+i,1); 175// 176//Electrolye 177// 178//PhiEl 179//phi=v 180solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart,phiElStart+1,1); 181//dPhi=0 182solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,1); 183solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 184//J red=)]TJ /F20 7.97 Tf 6.75 0 Td[(J ox 185//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,J redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 186//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,J oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 187//phiEl@right=0.1 188//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 189//C red=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 190//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1,redStart,1); 191//J red 271

PAGE 272

192//C red=C I ref 193solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,redStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 194//J ox 195//C sup=C I3 ref 196solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth,1); 197//C 198//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 199solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,supStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth,1); 200//BC 201//J red=)]TJ /F20 7.97 Tf 6.4 0 Td[(3J ox 202//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J redStart+1,1); 203//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,J oxStart+1,3); 204//BC 205//J red)]TJ /F20 7.97 Tf 11.07 0 Td[(3rNet=0 206//d/dC d pos 207solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,concStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 9.81 0 Td[(dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 6.77 0 Td[(dR6a( C d pos))]TJ /F10 7.97 Tf 10.78 0 Td[(dR6b( C d pos))]TJ /F10 7.97 Tf 10.7 0 Td[(dR7( C d pos)))); 208//d/dC d e1 209solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,concStart+2,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 9.81 0 Td[(dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 6.77 0 Td[(dR6a( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR6b( C d e1))]TJ /F10 7.97 Tf 10.7 0 Td[(dR7( C d e1)))); 210//d/dC d e3 211solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,concStart+3,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 9.81 0 Td[(dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 6.77 0 Td[(dR6a( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR6b( C d e3))]TJ /F10 7.97 Tf 10.7 0 Td[(dR7( C d e3)))); 212//d/dphiEl 213solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,phiElStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 9.82 0 Td[(dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 6.77 0 Td[(dR6a( phiEl))]TJ /F10 7.97 Tf 10.78 0 Td[(dR6b( phiEl))]TJ /F10 7.97 Tf 10.7 0 Td[(dR7( phiEl)))); 214//d/dC red 215solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,redStart+1,b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 9.81 0 Td[(dR1( C red)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 6.78 0 Td[(dR6a( C red))]TJ /F10 7.97 Tf 10.78 0 Td[(dR6b( C red))]TJ /F10 7.97 Tf 10.7 0 Td[(dR7( C red)))); 216//d/dC ox 217solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,oxStart+1,b((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 9.81 0 Td[(dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 6.78 0 Td[(dR6a( C ox))]TJ /F10 7.97 Tf 10.79 0 Td[(dR6b( C ox))]TJ /F10 7.97 Tf 10.7 0 Td[(dR7( C ox)))); 218//d/dJ red 219solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,J redStart,1); 220//BC 221//J ox+0.5((1)]TJ /F20 7.97 Tf 8.17 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 7.32 0 Td[(r6a)]TJ /F20 7.97 Tf 6.39 0 Td[(r6b+r7))=0 222//d/dC d pos 223solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,concStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos)))); 224//d/dC d e1 272

PAGE 273

225solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,concStart+2,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1)))); 226//d/dC d e3 227solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,concStart+3,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3)))); 228//d/dphiEl 229solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,phiElStart+1,d((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( phiEl)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( phiEl)+dR6b( phiEl)+dR7( phiEl)))); 230//d/dC red 231solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,redStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C red)+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage(dR6a( C red)+dR6b( C red)+dR7( C red)))); 232//d/dC ox 233solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,oxStart+1,d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C ox)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR6a( C ox)+dR6b( C ox)+dR7( C ox)))); 234//d/dJ red 235solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,J oxStart,1); 236//C ox=1e)]TJ /F20 7.97 Tf 6.1 0 Td[(7 237//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,oxStart,1); 238for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth;i++) 239f 240//Equation8 241//phiEl[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.7 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf -356.25 -15.67 Td[(C sup[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 242solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1); 243solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i,)]TJ /F10 7.97 Tf 6.72 0 Td[(2); 244solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,phiElStart+i+1,1); 245solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/E elSq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 246solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,oxStart)]TJ /F10 7.97 Tf 6.32 0 Td[(1+i,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/E elSq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 247solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,F/E elSq(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec)); 248//Equation9 249//J red[i]+D red(C red[i])]TJ /F20 7.97 Tf 7.41 0 Td[(C red[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 12.05 0 Td[(fC red[i)]TJ /F20 7.97 Tf 7.35 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.83 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 250solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,J redStart+i,1); 251solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.62 0 Td[(D red(1+f0.5(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 252solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,redStart+i,D red/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 253if(useMigration) 254f 255solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,phiElStart+i+1,D redfC red[i)]TJ /F10 7.97 Tf 7.42 0 Td[(1]0.5/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 273

PAGE 274

256solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.62 0 Td[(D redfC red[i)]TJ /F10 7.97 Tf 7.42 0 Td[(1]0.5/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 257g 258//Equation10 259//J ox[i]+D ox(C ox[i])]TJ /F20 7.97 Tf 7.2 0 Td[(C ox[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 12.05 0 Td[(fC ox[i)]TJ /F20 7.97 Tf 7.35 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.83 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.23 0 Td[(1]))/h=0 260solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,J oxStart+i,1); 261solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.4 0 Td[(D ox(1+f0.5(phiEl[i+1])]TJ /F10 7.97 Tf 7.82 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1]))/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 262solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,oxStart+i,D ox/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 263if(useMigration) 264f 265solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,phiElStart+i+1,D oxfC ox[i)]TJ /F10 7.97 Tf 7.42 0 Td[(1]0.5/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 266solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.25 0 Td[(1+i,phiElStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.4 0 Td[(D oxfC ox[i)]TJ /F10 7.97 Tf 7.42 0 Td[(1]0.5/solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hElec); 267g 268//Equation11 269//C sup[i])]TJ /F20 7.97 Tf 7.19 0 Td[(C sup[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]+fC sup[i)]TJ /F20 7.97 Tf 7.34 0 Td[(1]0.5(phiEl[i+1])]TJ /F20 7.97 Tf 7.83 0 Td[(phiEl[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 270solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,()]TJ /F10 7.97 Tf 6.72 0 Td[(1+f0.5(phiEl[i+1])]TJ /F10 7.97 Tf 7.83 0 Td[(phiEl[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1]))); 271solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,supStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec); 272if(useMigration) 273f 274//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F20 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i+1,fC sup[i)]TJ /F20 7.97 Tf 7.37 0 Td[(1]0.5); 275//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart)]TJ /F20 7.97 Tf 6.26 0 Td[(1+i,phiElStart+i)]TJ /F20 7.97 Tf 6.81 0 Td[(1,)]TJ /F20 7.97 Tf 7.27 0 Td[(fC sup[i)]TJ /F20 7.97 Tf 7.37 0 Td[(1]0.5); 276g 277//Equation12 278//J red[i])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 279solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i,1); 280solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i,J redStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 281//Equation13 282//J ox[i])]TJ /F20 7.97 Tf 11.54 0 Td[(J ox[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1]=)]TJ /F20 7.97 Tf 6.36 0 Td[(10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7hElec 283solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i,1); 284solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i,J oxStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 6.73 0 Td[(1); 285g 286g 287// 288//BuildF 289// 290voidElectrolyteInterface::BuildF(constdoublez) 291f 274

PAGE 275

292//GenerateRateconstants 293//Makesurethisiscalledorrestofthefunctionwillnotworkproperly!!! 294GenerateRates(z); 295//SetupthesizeoftheFvector 296constintsize=4+(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2)+5(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 297constintconcStart=0; 298constintphiElStart=concStart+4; 299constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2; 300constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 301constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 302constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 303constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 304solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(1,size); 305// 306//KENETICINTERFACEPART 307// 308//Equation4 309//r2)]TJ /F20 7.97 Tf 11.47 0 Td[(r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r4a+nr6a=0 310solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,0,r2)]TJ /F10 7.97 Tf 11.48 0 Td[(r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r4a+nr6a); 311//Equation5 312//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.48 0 Td[(r4b)]TJ /F20 7.97 Tf 10.95 0 Td[(nr6b=0 313solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,0,r3a)]TJ /F10 7.97 Tf 11.47 0 Td[(r3b)]TJ /F10 7.97 Tf 11.48 0 Td[(r4b+nr6b); 314//Equation6 315//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0 316solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,0,r4a+r4b+r5)]TJ /F10 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)); 317//Equation7 318//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 319solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+3,0,C d g+C d pos+C d e1+C d e3)]TJ /F10 7.97 Tf 11.73 0 Td[(C d t); 320// 321//ELECTROLYTEPART 322// 323//PhiElBC(1) 324//phiEl)]TJ /F20 7.97 Tf 11.17 0 Td[(v=0 325solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiElStart,0,GetPhiEl())]TJ /F10 7.97 Tf 11.89 0 Td[(phi applied); 326//Equation8 327//phiEl[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2phiEl[i]+phiEl[i+1])]TJ /F20 7.97 Tf 10.7 0 Td[(Sq(h)F/E el(C red[i)]TJ /F20 7.97 Tf 6.86 0 Td[(1]+C ox[i)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.17 0 Td[(C sup[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])=0 328for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth;i++) 329solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiElStart+i,0,PoissonEl(i)); 330//PhiElBC(2) 331//phiEl p=0 275

PAGE 276

332solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(redStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1])]TJ /F10 7.97 Tf 11.8 0 Td[(phiEl[solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth)]TJ /F10 7.97 Tf 7.23 0 Td[(1]); 333//phiEl=0.1 334//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F20 7.97 Tf 6.81 0 Td[(1,0,phiEl[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F20 7.97 Tf 11.85 0 Td[(0.1); 335//C red=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 336//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F20 7.97 Tf 6.81 0 Td[(1,0,GetC red())]TJ /F20 7.97 Tf 10.95 0 Td[(5e)]TJ /F20 7.97 Tf 6.75 0 Td[(4); 337//BC 338//J red=)]TJ /F20 7.97 Tf 6.75 0 Td[(J ox(@rightside) 339//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart)]TJ /F20 7.97 Tf 6.81 0 Td[(1,0,J red[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth]+J ox[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth]); 340//Equation9 341//J red[i+1]+D red(C red[i+1])]TJ /F20 7.97 Tf 7.42 0 Td[(C red[i])]TJ /F20 7.97 Tf 12.06 0 Td[(fC red[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i]))/h=0 342for(inti=0;ielecWidth;i++) 343solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(redStart+i,0,RedFlux(i)); 344//J redBC 345//C red=C I ref 346solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(oxStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C red[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 12.07 0 Td[(C I ref); 347//Equation10 348//J ox[i+1]+D ox(C ox[i+1])]TJ /F20 7.97 Tf 7.21 0 Td[(C ox[i])]TJ /F20 7.97 Tf 12.05 0 Td[(fC ox[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.82 0 Td[(phiEl[i]))/h=0 349for(inti=0;ielecWidth;i++) 350solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(oxStart+i,0,OxFlux(i)); 351//J oxBC 352//C ox=C I3 ref 353solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(supStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C ox[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 11.97 0 Td[(C I3 ref); 354//Equation11 355//C sup[i+1])]TJ /F20 7.97 Tf 7.2 0 Td[(C sup[i]+fC sup[i]0.5(phiEl[i+2])]TJ /F20 7.97 Tf 7.83 0 Td[(phiEl[i])=0 356/for(inti=0;ielecWidth;i++) 357solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(supStart+i,0,SupFlux(i));/ 358//C'sBC 359//C sup=5e)]TJ /F20 7.97 Tf 6.1 0 Td[(4 360solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart)]TJ /F10 7.97 Tf 6.81 0 Td[(1,0,C sup[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth])]TJ /F10 7.97 Tf 10.95 0 Td[(5e)]TJ /F10 7.97 Tf 6.76 0 Td[(4); 361//BC)]TJ /F20 7.97 Tf 10.03 0 Td[(MAYUSELATEROFIHP 362//rNet=0 363//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,0,(1)]TJ /F20 7.97 Tf 7.65 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F20 7.97 Tf 6.84 0 Td[(3r6a)]TJ /F20 7.97 Tf 6.36 0 Td[(3r6b+r7)); 364//BC 365//J red=1.5rNet(@interface) 366//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart,0,GetJ red()+3GetJ ox());tryingsamebcbutwrittenout1)]TJ /F20 7.97 Tf 6.4 0 Td[(27)]TJ /F20 7.97 Tf 6.4 0 Td[(10 367solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J redStart,0,GetJ red()+b((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage))]TJ /F10 7.97 Tf 10.7 0 Td[(r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage()]TJ /F10 7.97 Tf 7.33 0 Td[(r6a)]TJ /F10 7.97 Tf 6.25 0 Td[(r6b)]TJ /F10 7.97 Tf 6.52 0 Td[(r7))); 368//Equation12 369//J red[i+1])]TJ /F20 7.97 Tf 11.69 0 Td[(J red[i]=10e)]TJ /F20 7.97 Tf 6.1 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec 276

PAGE 277

370for(inti=0;ielecWidth;i++) 371solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J redStart+i+1,0,RedContinuity(i)); 372//J ox PBC 373//J ox=)]TJ /F20 7.97 Tf 6.88 0 Td[(0.5rNet((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta)r1+theta()]TJ /F20 7.97 Tf 7.33 0 Td[(r6a)]TJ /F20 7.97 Tf 6.4 0 Td[(r6b+r7)) 374solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J oxStart,0,GetJ ox()+d((1)]TJ /F10 7.97 Tf 8 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r6a+r6b+r7))); 375//C ox=1e)]TJ /F20 7.97 Tf 6.1 0 Td[(7 376//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart,0,GetC ox())]TJ /F20 7.97 Tf 10.94 0 Td[(1e)]TJ /F20 7.97 Tf 6.76 0 Td[(7); 377//Equation13 378//J ox[i+1])]TJ /F20 7.97 Tf 11.54 0 Td[(J ox[i]=)]TJ /F20 7.97 Tf 6.36 0 Td[(10e)]TJ /F20 7.97 Tf 6.11 0 Td[(7solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec 379for(inti=0;ielecWidth;i++) 380solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J oxStart+i+1,0,OxContinuity(i)); 381//Calculatetheerrorofthefmatrix 382solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateError(); 383g 384// 385//NewtonStep 386// 387voidElectrolyteInterface::NewtonStep() 388f 389constintsize=4+(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2)+5(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>elecWidth+1); 390constintconcStart=0; 391constintphiElStart=concStart+4; 392constintredStart=phiElStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+2; 393constintoxStart=redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 394constintsupStart=oxStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 395constintJ redStart=supStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 396constintJ oxStart=J redStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>elecWidth+1; 397//Concentrations 398C d g+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(concStart,size)); 399C d pos+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(concStart+1,size)); 400C d e1+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(concStart+2,size)); 401C d e3+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(concStart+3,size)); 402//PhiEl 403for(inti=0;ielecWidth+2;i++) 404phiEl[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiElStart+i,size)); 405//TheRest 406for(inti=0;ielecWidth+1;i++) 407f 408C red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(redStart+i,size)); 409C ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(oxStart+i,size)); 277

PAGE 278

410C sup[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(supStart+i,size)); 411J red[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J redStart+i,size)); 412J ox[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J oxStart+i,size)); 413g 414g 415constdoubleElectrolyteInterface::GetPhiEl()constfreturnphiEl[1];g 416constdoubleElectrolyteInterface::GetC red()constfreturnC red[1];g 417constdoubleElectrolyteInterface::GetC ox()constfreturnC ox[1];g 418constdoubleElectrolyteInterface::GetC sup()constfreturnC sup[1];g 419constdoubleElectrolyteInterface::GetJ red()constfreturnJ red[0];g 420constdoubleElectrolyteInterface::GetJ ox()constfreturnJ ox[0];g 421constdoubleElectrolyteInterface::GetJ red P()constfreturn(J red[2])]TJ /F10 7.97 Tf 8.13 0 Td[(J red[0])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec);g 422constdoubleElectrolyteInterface::GetJ ox P()constfreturn(J ox[2])]TJ /F10 7.97 Tf 7.97 0 Td[(J ox[0])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hElec);g 1#includeAraMath.h 2#includeConsole.h 3#includeSemiconductorInterface.h 4#includeConstants.h 5#includeSolveState.h 6#include//for isnan 7// 8//Constructor 9// 10SemiconductorInterface::SemiconductorInterface(constSemiconductorInterfacestate) 11:System(state) 12f 13g 14SemiconductorInterface::SemiconductorInterface(StateController controller,SolveStates,constdouble a) 15:System( controller,s, a) 16f 17g 18SemiconductorInterface::SemiconductorInterface(StateController controller, 19doubleshellThickness,intshellIterations,intelecIterations, 20doublenanorodLength,doublenanorodDiameter,doublenanorodDensity, 21doubleporocity,doubledyeCoverage, 22doublemaxError,doublemaxTime) 23:System( controller,shellThickness,shellIterations,elecIterations,nanorodLength,nanorodDiameter,nanorodDensity, 24porocity,dyeCoverage,maxError,maxTime) 278

PAGE 279

25f 26g 27// 28//CreateCopy 29// 30SystemSemiconductorInterface::CreateCopy()const 31f 32returnhtnewSemiconductorInterface(controller,solver,a); 33g 34// 35//CreateRef 36// 37SystemSemiconductorInterface::CreateRef()const 38f 39returnhtnewSemiconductorInterface(this); 40g 41// 42//InitializephiSc[n],C e[n]&J e[n] 43// 44voidSemiconductorInterface::InitializeTotal(SubStatelast) 45f 46if(last) 47f 48//Semiconductor 49phiSc=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>phiScList; 50C e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C eList; 51J e=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>J eList; 52g 53else 54f 55//Semiconductor 56phiSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+2,0); 57C e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,1.39e)]TJ /F10 7.97 Tf 6.76 0 Td[(8); 58J e.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1,1.77e)]TJ /F10 7.97 Tf 6.76 0 Td[(7); 59//phiSc[0]=0; 60//phiSc[1]=0; 61//phiSc[2]=0; 62g 63//phiSc.clear(); 64//phiSc.resize(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+2); 65//fori(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+2) 279

PAGE 280

66//phiSc[i]=double(i)/double(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)(phi applied); 67g 68// 69//InitializeConc 70// 71voidSemiconductorInterface::InitializeConc(SubStatelast) 72f 73if(last==0) 74f 75C d pos=1.26e)]TJ /F10 7.97 Tf 6.88 0 Td[(16; 76C d e3=2.54e)]TJ /F10 7.97 Tf 6.88 0 Td[(44; 77C d e1=1.9e)]TJ /F10 7.97 Tf 6.88 0 Td[(22; 78C d g=7.5e)]TJ /F10 7.97 Tf 6.86 0 Td[(5;//C d t)]TJ /F20 7.97 Tf 11.83 0 Td[((C d e3+C d pos+C d e1); 79phiD=0.06phi applied; 80g 81else 82f 83C d pos=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d pos; 84C d e3=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e3; 85C d e1=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d e1; 86C d g=last)]TJ /F16 7.97 Tf 4.78 0 Td[(>C d g; 87phiD=last)]TJ /F16 7.97 Tf 4.79 0 Td[(>phiD; 88g 89//C d pos=0; 90//C d e3=0; 91//C d e1=0; 92//C d g=7.5e)]TJ /F20 7.97 Tf 6.87 0 Td[(5; 93//Same,nomatterwhat 94//C d pos=(2e)]TJ /F20 7.97 Tf 6.8 0 Td[(16)exp(18.31phi applied);//functionofphi applied 95g 96// 97//IsValid 98// 99boolSemiconductorInterface::IsValid()const 100f 101//AssertthatC eispositive 102/for(inti=0;i1)returnfalse;/ 106returnIsPositive(C d pos)&& 280

PAGE 281

107IsPositive(C d e1)&& 108IsPositive(C d e3)&& 109IsPositive(GetC e())&& 110(C d g>0)&& 111(C d g<=7.5e)]TJ /F10 7.97 Tf 6.75 0 Td[(5)&& 112! isnan(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>standardError); 113g 114// 115//BuildJ 116// 117voidSemiconductorInterface::BuildJ(constdoublez) 118f 119//SetupthesizeoftheJacobian 120constintsize=Size(); 121solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(size,size); 122//Indicesforderivatives 123constintphiStart=0; 124constintC eStart=phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+2; 125constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 126constintconcStart=J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1; 127constintphiDStart=concStart+4; 128// 129//Semiconductor 130// 131//Phiboundaryconditions: 132//phiSc[0]=0 133solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiStart,phiStart+1,1);//ChangedcolumnfromphiStarttophiStart+1,jjh 134//phiSc[1])]TJ /F20 7.97 Tf 7.86 0 Td[(phiSc[)]TJ /F20 7.97 Tf 7.2 0 Td[(1]=0//Shouldbeover1,)]TJ /F20 7.97 Tf 7.09 0 Td[(1'thentrynot1,0'th,jjh 135solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiStart+1,phiStart,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 136solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiStart+1,phiStart+2,1);//ColumnshouldbephiStart+2,not1,jjh 137//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,1); 138//C eboundaryconditions: 139//C e[0]=N a 140solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,C eStart,1); 141//RightBoundaryCondition 142//J e=)]TJ /F20 7.97 Tf 6.71 0 Td[(((1)]TJ /F20 7.97 Tf 7.74 0 Td[(theta))]TJ /F20 7.97 Tf 10.7 0 Td[(r1+theta(r4a+r4b+r5)) 143//JacobianEntries 144//phiSc[n] 281

PAGE 282

145solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( phiSc)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( phiSc)+dR4b( phiSc)+dR5( phiSc)))); 146//C e[n] 147solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,0+((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)dR1( C e)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C e)+dR4b( C e)+dR5( C e)))); 148//J e[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 149//J e[n+1] 150//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F20 7.97 Tf 6.81 0 Td[(2,)]TJ /F20 7.97 Tf 6.72 0 Td[(1); 151solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.8 0 Td[(1,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 152//C d g=0 153//C d pos 154solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,concStart+1,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( C d pos)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos)))); 155//C d e1 156solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,concStart+2,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( C d e1)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1)))); 157//C d e3 158solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,concStart+3,0)]TJ /F10 7.97 Tf 11.23 0 Td[(((1)]TJ /F10 7.97 Tf 7.98 0 Td[(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>dyeCoverage)dR1( C d e3)+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3)))); 159for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth;i++) 160f 161//Equation1 162//phiSc[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2phiSc[n]+phiSc[n+1]+Sq(hSemi)(F/(E sc))(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n])=0 163//d/dphi[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 164solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1+i,phiStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1); 165//d/dphi[n] 166solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1+i,phiStart+i,)]TJ /F10 7.97 Tf 6.72 0 Td[(2); 167//d/dphi[n+1] 168solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1+i,phiStart+i+1,1); 169//d/dC e[n] 170solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1+i,C eStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 5.93 0 Td[(Sq(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)F/(E sc));//thisstartsatthe0'thtermsono+1,jjh 171//Equation2 172//(1/D e)J e[n]+fC e[n+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n])/hSemi)]TJ /F20 7.97 Tf 11.83 0 Td[((C e[n])(phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 7.23 0 Td[(1])/(2hSemi)=0 173//d/dphi[n)]TJ /F20 7.97 Tf 6.86 0 Td[(1] 174solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i,phiStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,f(C e[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>hSemi)); 175//d/dphi[n] 176//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart+i,phiStart+i,0); 177//d/dphi[n+1] 282

PAGE 283

178solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i,phiStart+i+1,)]TJ /F10 7.97 Tf 7.27 0 Td[(f(C e[i)]TJ /F10 7.97 Tf 7.23 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 179//d/dC e[n] 180solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i,C eStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,()]TJ /F10 7.97 Tf 7.05 0 Td[(1)/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)]TJ /F10 7.97 Tf 12.05 0 Td[(f(phiSc[i+1])]TJ /F10 7.97 Tf 7.46 0 Td[(phiSc[i)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/(2solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi)); 181//d/dC e[n+1] 182solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i,C eStart+i,1/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi); 183//d/dJ e[n] 184solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i,J eStart+i)]TJ /F10 7.97 Tf 6.81 0 Td[(1,1/D e); 185g 186//Equation3 187//J e[i+1])]TJ /F20 7.97 Tf 11.54 0 Td[(J e[i]=0,R net=0fornow 188for(inti=0;isemiWidth;i++) 189f 190//d/dJ e[n] 191//d/dJ e[n+1] 192solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i,J eStart+i,)]TJ /F10 7.97 Tf 6.72 0 Td[(1); 193solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart+i,J eStart+i+1,1); 194//d/dC e[n] 195//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+i,C eStart+i]=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi1e5;//Commentedout12)]TJ /F20 7.97 Tf 6.45 0 Td[(09)]TJ /F20 7.97 Tf 6.45 0 Td[(09 196g 197// 198//Interface 199// 200//Equation4 201//r2)]TJ /F20 7.97 Tf 11.48 0 Td[(r3a)]TJ /F20 7.97 Tf 11.48 0 Td[(r4a+nr6a=0 202//d/dPhiSc 203solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,dR2( phiSc,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( phiSc))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( phiSc)+ndR6a( phiSc)); 204//d/dC d g 205solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,concStart,dR2( C d g,z))]TJ /F10 7.97 Tf 10.79 0 Td[(dR3a( C d g))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4a( C d g)+ndR6a( C d g)); 206//d/dC d pos=0 207//d/dC d e1 208solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,concStart+2,dR2( C d e1,z))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3a( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4a( C d e1)+ndR6a( C d e1)); 209//Equation5 210//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.48 0 Td[(r4b+nr6b=0//maybeshouldbe+r6b???1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.4 0 Td[(10 211//d/dphiSc 212solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,dR3a( phiSc))]TJ /F10 7.97 Tf 10.78 0 Td[(dR3b( phiSc))]TJ /F10 7.97 Tf 10.79 0 Td[(dR4b( phiSc)+ndR6b( phiSc)); 283

PAGE 284

213//d/dC d e1 214solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,concStart+2,dR3a( C d e1))]TJ /F10 7.97 Tf 10.79 0 Td[(dR3b( C d e1))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4b( C d e1)+ndR6b( C d e1)); 215//d/dC d e3 216solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,concStart+3,dR3a( C d e3))]TJ /F10 7.97 Tf 10.79 0 Td[(dR3b( C d e3))]TJ /F10 7.97 Tf 10.78 0 Td[(dR4b( C d e3)+ndR6b( C d e3)); 217//Equation6 218//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0//Addedr5b/citshouldhavebeenthere?1)]TJ /F20 7.97 Tf 6.4 0 Td[(12)]TJ /F20 7.97 Tf 6.41 0 Td[(10 219//d/dphiSc 220solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,dR4a( phiSc)+dR4b( phiSc)+dR5( phiSc))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( phiSc)+dR6b( phiSc)+dR7( phiSc))); 221//d/dC e 222solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,dR4a( C e)+dR4b( C e)+dR5( C e))]TJ /F10 7.97 Tf 10.95 0 Td[(n(dR6a( C e)+dR6b( C e)+dR7( C e))); 223//d/dC d pos 224solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,concStart+1,dR4a( C d pos)+dR4b( C d pos)+dR5( C d pos))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d pos)+dR6b( C d pos)+dR7( C d pos))); 225//d/dC d e1 226solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,concStart+2,dR4a( C d e1)+dR4b( C d e1)+dR5( C d e1))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e1)+dR6b( C d e1)+dR7( C d e1))); 227//d/dC d e3 228solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,concStart+3,dR4a( C d e3)+dR4b( C d e3)+dR5( C d e3))]TJ /F10 7.97 Tf 10.94 0 Td[(n(dR6a( C d e3)+dR6b( C d e3)+dR7( C d e3))); 229//Equation7 230//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 231for(inti=0;i<4;i++) 232solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(concStart+3,concStart+i,1); 233//Gauss'sequationattheinterface 234//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.94 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.45 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 235//d/dphiD 236solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiDStart,phiDStart,)]TJ /F10 7.97 Tf 6.66 0 Td[((E sc/dell Sc))]TJ /F10 7.97 Tf 11.83 0 Td[((E el/dell El)); 237//d/dphiSc 238solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiDStart,phiStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,E sc/dell Sc); 239//d/dC e 240solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiDStart,C eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 6.81 0 Td[(1,)]TJ /F10 7.97 Tf 5.94 0 Td[(F/a); 241//d/dC d pos 242solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiDStart,concStart+1,+F/a); 243g 244// 284

PAGE 285

245//BuildF 246// 247voidSemiconductorInterface::BuildF(constdoublez) 248f 249//GenerateRateconstants 250//Makesurethisiscalledorrestofthefunctionwillnotworkproperly!!! 251GenerateRates(z); 252//SetupthesizeoftheFvector 253constintsize=Size(); 254constintphiStart=0; 255constintC eStart=phiStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+2; 256constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1; 257constintconcStart=J eStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1; 258constintphiDStart=concStart+4; 259solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Initialize(1,size); 260//Addinzcontribution 261//C e=C e neg refexp()]TJ /F20 7.97 Tf 7.95 0 Td[(f(phiSc)]TJ /F20 7.97 Tf 6.67 0 Td[(E f)) 262// 263//SEMICONDUCTORPART 264// 265//PhiScBC's 266//phiSc[n]=0 267solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(0,0,phiSc[1]); 268//phiSc[n+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[n)]TJ /F20 7.97 Tf 6.85 0 Td[(1]=0 269solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(1,0,phiSc[2])]TJ /F10 7.97 Tf 11.43 0 Td[(phiSc[0]); 270//solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(1,0,GetPhiSc())]TJ /F20 7.97 Tf 11.88 0 Td[(phi applied/10); 271for(inti=1;i<=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth;i++) 272f 273//Equation1 274//phiSc[n)]TJ /F20 7.97 Tf 6.87 0 Td[(1])]TJ /F20 7.97 Tf 11.07 0 Td[(2phiSc[n]+phiSc[n+1]+Sq(hSemi)(F/E sc)(N a)]TJ /F20 7.97 Tf 11.09 0 Td[(C e[n])=0 275solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(phiStart+1+i,0,PoissonSc(i)); 276//Equation2 277//(N a/D e)J e[i]+C e[i](C e[i+1])]TJ /F20 7.97 Tf 11.09 0 Td[(C e[i])/hSemi)]TJ /F20 7.97 Tf 12.05 0 Td[(fSq(C e[i])(phiSc[i+1])]TJ /F20 7.97 Tf 7.46 0 Td[(phiSc[i)]TJ /F20 7.97 Tf 7.24 0 Td[(1])/(2hSemi))=0 278solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(C eStart+i,0,ElectronFlux(i)); 279//Equation3 280//J e[i+1])]TJ /F20 7.97 Tf 11.53 0 Td[(J e[i])]TJ /F20 7.97 Tf 11.06 0 Td[(2hSemiR net=0,R net=0fornow 281solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>f)]TJ /F16 7.97 Tf 4.78 0 Td[(>Set(J eStart)]TJ /F10 7.97 Tf 6.26 0 Td[(1+i,0,ElectronContinuity(i)); 282g 283//C eBC 284//C e[0]=N a 285

PAGE 286

285solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(C eStart,0,C e[0])]TJ /F10 7.97 Tf 11.09 0 Td[(N a); 286//J eBC 287//J e=((1)]TJ /F20 7.97 Tf 8.09 0 Td[(theta))]TJ /F20 7.97 Tf 10.71 0 Td[(r1+theta(r4a+r4b+r5))//ChangedtoJ e=rTot(not)]TJ /F20 7.97 Tf 6.98 0 Td[(rTot)@1/12/2010 288solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(J eStart+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth,0,)]TJ /F10 7.97 Tf 6.64 0 Td[(GetJ e())]TJ /F10 7.97 Tf 11.24 0 Td[(((1)]TJ /F10 7.97 Tf 7.99 0 Td[(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage)r1+solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>dyeCoverage(r4a+r4b+r5))); 289// 290//KENETICINTERFACEPART 291// 292//Equation4 293//r2)]TJ /F20 7.97 Tf 11.47 0 Td[(r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r4a+nr6a=0 294solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart,0,r2)]TJ /F10 7.97 Tf 11.48 0 Td[(r3a)]TJ /F10 7.97 Tf 11.48 0 Td[(r4a+nr6a); 295//Equation5 296//r3a)]TJ /F20 7.97 Tf 11.47 0 Td[(r3b)]TJ /F20 7.97 Tf 11.48 0 Td[(r4b)]TJ /F20 7.97 Tf 10.95 0 Td[(nr6b=0 297solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+1,0,r3a)]TJ /F10 7.97 Tf 11.47 0 Td[(r3b)]TJ /F10 7.97 Tf 11.48 0 Td[(r4b+nr6b); 298//Equation6 299//r4a+r4b+r5)]TJ /F20 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)=0 300solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+2,0,r4a+r4b+r5)]TJ /F10 7.97 Tf 10.94 0 Td[(n(r6a+r6b+r7)); 301//Equation7 302//C d g+C d pos+C d e1+C d e3)]TJ /F20 7.97 Tf 11.73 0 Td[(C d t=0 303solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(concStart+3,0,C d g+C d pos+C d e1+C d e3)]TJ /F10 7.97 Tf 11.73 0 Td[(C d t); 304//Gauss'sLawattheinterface 305//E sc/dell Sc(GetPhiSc())]TJ /F20 7.97 Tf 6.53 0 Td[(phiD))]TJ /F20 7.97 Tf 6.94 0 Td[(E el/dell El(phiD)]TJ /F20 7.97 Tf 6.45 0 Td[(GetPhiEl()))]TJ /F20 7.97 Tf 10.72 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F20 7.97 Tf 11.83 0 Td[((C d pos+GetC sup())/a) 306solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>f)]TJ /F16 7.97 Tf 4.79 0 Td[(>Set(phiDStart,0,E sc/dell Sc(GetPhiSc())]TJ /F10 7.97 Tf 6.53 0 Td[(phiD))]TJ /F10 7.97 Tf 6.93 0 Td[(E el/dell El(phiD)]TJ /F10 7.97 Tf 6.44 0 Td[(GetPhiEl()))]TJ /F10 7.97 Tf 10.73 0 Td[(F((GetC e()+GetC ox()+GetC red())/a)]TJ /F10 7.97 Tf 11.84 0 Td[((C d pos+GetC sup())/a)); 307//Calculatetheerrorofthefmatrix 308solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>CalculateError(); 309g 310// 311//NewtonStep 312// 313voidSemiconductorInterface::NewtonStep() 314f 315constintsize=Size(); 316constintphiStart=0; 317constintC eStart=phiStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+2; 318constintJ eStart=C eStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1; 319constintconcStart=J eStart+solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+1; 320constintphiDStart=concStart+4; 321//PhiSc 286

PAGE 287

322for(inti=0;isemiWidth+2;i++) 323phiSc[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiStart+i,size)); 324for(inti=0;isemiWidth+1;i++) 325f 326//C e 327C e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(C eStart+i,size)); 328//J e 329J e[i]+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(J eStart+i,size)); 330g 331//Concentrations 332C d g+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(concStart,size)); 333C d pos+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(concStart+1,size)); 334C d e1+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(concStart+2,size)); 335C d e3+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.78 0 Td[(>j)]TJ /F16 7.97 Tf 4.79 0 Td[(>Get(concStart+3,size)); 336phiD+=(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>sigmasolver)]TJ /F16 7.97 Tf 4.79 0 Td[(>j)]TJ /F16 7.97 Tf 4.78 0 Td[(>Get(phiDStart,size)); 337g 338constdoubleSemiconductorInterface::GetPhiSc()constfreturnphiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth];g 339constdoubleSemiconductorInterface::GetC e()constfreturnC e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.33 0 Td[(1];g 340constdoubleSemiconductorInterface::GetJ e()constfreturnJ e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.33 0 Td[(1];g 341constdoubleSemiconductorInterface::GetPhiSc P()constfreturn(phiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1])]TJ /F10 7.97 Tf -417.35 -15.66 Td[(phiSc[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.24 0 Td[(1])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi;g 342constdoubleSemiconductorInterface::GetC e P()constfreturn(C e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 7.1 0 Td[(C e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.23 0 Td[(2])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi;g 343constdoubleSemiconductorInterface::GetJ e P()constfreturn(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth])]TJ /F10 7.97 Tf 7.54 0 Td[(J e[solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth)]TJ /F10 7.97 Tf 7.23 0 Td[(2])/solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>hSemi;g 344// 345//size 346// 347intSemiconductorInterface::Size()const 348f 349return(solver)]TJ /F16 7.97 Tf 4.79 0 Td[(>semiWidth+2)+2(solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth+1)+4+1; 350g 351// 352//Var 353// 354double&SemiconductorInterface::GetVar(inti) 355f 356constintw1=solver)]TJ /F16 7.97 Tf 4.78 0 Td[(>semiWidth; 357if(i
PAGE 288

360returnC e[i)]TJ /F10 7.97 Tf 6.69 0 Td[((w1+2)]; 361elseif(i 6//shouldbethesamelength. 7classArrayMatrix:publicMatrix 8f 9public: 10ArrayMatrix()fg 11ArrayMatrix(constint width,constint height) 12fInitialize( width, height);g 13ArrayMatrix(constvector>& mat) 14:mat( mat) 15fg 16//Clearsandrecreates 17voidInitialize(constint width,constint height) 18f 19mat.clear(); 20vectorrow( width); 21fori( height)addRow(row); 22g 23voidInitialize(constint width,constint height,constdoublevalue) 24f 25mat.clear(); 26vectorrow( width,value); 27fori( height)addRow(row); 28g 29voidClear()fmat.clear();g 288

PAGE 289

30//Operator 31doubleGet(introw,intcol)constfreturnmat[row][col];g 32doubleGetFirst(introw)constfreturnmat[row][0];g 33doubleGetLast(introw)constfreturnmat[row][mat[row].size())]TJ /F10 7.97 Tf 7.2 0 Td[(1];g 34voidSet(introw,intcol,constdoublevalue)fmat[row][col]=value;g 35//Size 36intwidth()constfreturnmat[0].size();g 37intheight()constfreturnmat.size();g 38//Regularization 39voidRegularize(constdoublemu); 40voidRegularize(constdoublemu,constvector&diag); 41//Returnsthesumofthefirstcolumnsquared 42constdoubleStandardError()const; 43//Returnsthemaxofthefirstcolumn 44constdoubleMaxError()const; 45//Addingvalues 46voidaddNegColumn(constMatrixcol) 47ffori(size())mat[i].push back()]TJ /F10 7.97 Tf 7.5 0 Td[(col)]TJ /F16 7.97 Tf 4.78 0 Td[(>GetFirst(i));g 48//Reducedrowechelonform 49voidrref(); 50//Checkstoseeifthematrixisinrrefform 51boolisrref()const; 52//Printsoutthematrix 53voidprint()const; 54voidprintE()const; 55//Writesabitmapblendingfromonecolortotheother 56//Coloraisthelowestcolor,andbisthehighestvaluecolor 57voidWriteImage(charfile,constColor&a,constColor&b)const; 58//Writesoutthedatainatextformat 59voidWriteData(constcharfile)const; 60voidWriteDataAppend(constcharfile)const; 61private: 62//Addingvalues 63voidpush back(constvector&vec) 64fmat.push back(vec);g 65voidaddRow(constvector&row) 66fmat.push back(row);g 67/voidaddColumn(constvector&col) 68ffori(size())mat[i].push back(col[i]);g 69voidaddColumn(constMatrix&col) 70ffori(size())mat[i].push back(col[i][0]);g 289

PAGE 290

71voidaddNegColumn(constvector&col) 72ffori(size())mat[i].push back()]TJ /F20 7.97 Tf 7.71 0 Td[(col[i]);g/ 73//Swapsrows&columns 74voidSwapRows(inta,intb); 75//Data 76vector>mat; 77g; 1#includeConsole.h 2#includeAraImage.h 3#includeArrayMatrix.h 4#include 5#include 6voidArrayMatrix::rref() 7f 8intlead=0; 9introwCount=height(); 10intcolCount=width(); 11for(intr=0;r
PAGE 291

35f 36if(i>=height())break; 37forj(height()) 38f 39if(i==j) 40f 41if(mat[i][i]!=1) 42returnfalse; 43g 44else 45if(mat[j][i]>1e)]TJ /F10 7.97 Tf 6.79 0 Td[(50) 46returnfalse; 47g 48g 49returntrue; 50g 51voidArrayMatrix::Regularize(constdoublemu) 52f 53fori(width()) 54mat[i][i]+=mu; 55g 56voidArrayMatrix::Regularize(constdoublemu,constvector&diag) 57f 58fori(width()) 59mat[i][i]+=mudiag[i]; 60g 61/MatrixArrayMatrix::Transpose()const 62f 63ArrayMatrixnewMatrix; 64intsize=width(); 65fori(size) 66f 67vectorrow; 68forj(size) 69row.push back(mat[j][i]); 70newMatrix.addRow(row); 71g 72returnnewMatrix; 73g 74Matrixoperator(constMatrix&a,constMatrix&b) 75f 291

PAGE 292

76ArrayMatrixnewMatrix(b.width(),a.height()); 77fori(a.height()) 78f 79forj(b.width()) 80f 81doubletotal=0; 82for(inti2=0;i2max)?fabs(mat[i][0]):max; 102returnmax; 103g 104voidArrayMatrix::SwapRows(inta,intb) 105f 106if(a==bjja>=height()jjb>=height())return; 107fori(width()) 108f 109constdoubletemp=mat[a][i]; 110mat[a][i]=mat[b][i]; 111mat[b][i]=temp; 112g 113g 114voidArrayMatrix::print()const 115f 116fori(height()) 292

PAGE 293

117f 118forj(mat[i].size()) 119printf(%.3fnt,mat[i][j]); 120printf(nn); 121g 122g 123voidArrayMatrix::printE()const 124f 125fori(height()) 126f 127forj(mat[i].size()) 128printf(%.3Ent,mat[i][j]); 129printf(nn); 130g 131g 132voidArrayMatrix::WriteImage(charfile,constColor&a,constColor&b)const 133f 134double min=1E100; 135double max=)]TJ /F10 7.97 Tf 6.22 0 Td[(1E100; 136forij(mat.size(),mat[i].size()) 137f 138 min=min( min,mat[i][j]); 139 max=max( max,mat[i][j]); 140g 141AraImageimage; 142image.Resize(width(),height()); 143constdoubleiDiff=1.0/( max)]TJ ET q .398 w 206.79 -419.01 m 209.18 -419.01 l S Q BT /F10 7.97 Tf 209.87 -419.21 Td[(min); 144fori(width()) 145forj(height()) 146f 147constdoublepercent=(mat[i][j])]TJ ET q .398 w 249.83 -481.67 m 252.22 -481.67 l S Q BT /F10 7.97 Tf 252.91 -481.87 Td[(min)iDiff; 148image.Cell(i,j)=Blend(a,b,percent); 149g 150AraImage::writeImageDelegate(image,file); 151g 152voidArrayMatrix::WriteData(constcharfileName)const 153f 154fstreamfile; 155file.open(fileName,ios base::out); 156if(!file.is open())return; 157fori(mat.size()) 293

PAGE 294

158f 159forj(mat[i].size()) 160file<
PAGE 295

24voidDivide(constdoublevalue); 25//Subtractsarowfromthisone 26voidSubtract(constEntryList&list,doublevalue); 27//Writesalineofdata 28voidWrite(intsize,fstream&file)const; 29private: 30intFind(intcol)const; 31vectorrow; 32g; 33//Thisclassonlykeepsthenonzeroelementsinmemoryinhopesof 34//makingbothmemoryandprocessingtimemoreefficient 35classSparseMatrix:publicMatrix 36f 37public: 38//Constructor 39SparseMatrix(); 40//Clearsandrecreates 41voidInitialize(constint width,constint height); 42voidClear(); 43//Operator 44doubleGet(introw,intcol)constfreturnmat[row].Get(col);g 45doubleGetFirst(introw)constfreturnmat[row].First();g 46doubleGetLast(introw)constfreturnmat[row].Last();g 47voidSet(introw,intcol,constdoublevalue)fmat[row].Set(col,value);g 48//Size 49intwidth()constfreturnsetWidth;g 50intheight()constfreturnsetHeight;g 51//Returnsthesumofthefirstcolumnsquared 52constdoubleStandardError()const; 53//Returnsthemaxofthefirstcolumn 54constdoubleMaxError()const; 55//Addingvalues 56voidaddNegColumn(constMatrixcol); 57//Reducedrowechelonform 58voidrref(); 59//Checkstoseeifthematrixisinrrefform 60boolisrref()const; 61//Printsoutthematrix 62voidprint()constfg 63voidprintE()constfg 64//Writesabitmapblendingfromonecolortotheother 295

PAGE 296

65//Coloraisthelowestcolor,andbisthehighestvaluecolor 66voidWriteImage(charfile,constColor&a,constColor&b)constfg 67//Writesoutthedatainatextformat 68voidWriteData(constcharfile)const; 69voidWriteDataAppend(constcharfile)constfg 70private: 71//Data 72intsetWidth,setHeight; 73//Matrixofentries 74vectormat; 75//Swapsrows&columns 76voidSwapRows(inta,intb); 77g; 78#endif 1#includeSparseMatrix.h 2#include 3#include 4// 5//EntryList 6// 7#defineEpsilon1e)]TJ /F10 7.97 Tf 6.31 0 Td[(30 8// 9//Set 10// 11voidEntryList::Set(intcol,doublevalue) 12f 13intlow=0,high=row.size(); 14while(low
PAGE 297

28g 29elserow[low].value=value; 30g 31elseif(abs(value)>Epsilon) 32f 33Entryentry(col,value); 34row.insert(row.begin()+low,entry); 35g 36g 37// 38//Get 39// 40doubleEntryList::Get(intcol)const 41f 42intindex=Find(col); 43if(index==)]TJ /F10 7.97 Tf 6.72 0 Td[(1)return0; 44returnrow[index].value; 45g 46// 47//Find 48// 49intEntryList::Find(intcol)const 50f 51intlow=0,high=row.size(); 52while(low
PAGE 298

69g 70// 71//Subtract 72// 73voidEntryList::Subtract(constEntryList&list,doublevalue) 74f 75intj=0; 76fori(list.row.size()) 77f 78while(j=row.size()jjrow[j].index>i) 94file<<0, ; 95elsefile<
PAGE 299

109voidSparseMatrix::Initialize(constint width,constint height) 110f 111setWidth= width; 112setHeight= height; 113mat.clear(); 114mat.resize(setHeight); 115g 116// 117//Clear 118// 119voidSparseMatrix::Clear() 120f 121setWidth=0; 122setHeight=0; 123mat.clear(); 124g 125// 126//Error 127// 128constdoubleSparseMatrix::StandardError()const 129f 130doubleerror=0; 131fori(height()) 132error+=Sq(mat[i].First()); 133returnerror; 134g 135constdoubleSparseMatrix::MaxError()const 136f 137doublemax=fabs(mat[0].First()); 138for(inti=1;imax)?fabs(mat[i].First()):max; 140returnmax; 141g 142// 143//addNegColumn 144// 145voidSparseMatrix::addNegColumn(constMatrixm) 146f 147for(inti=0;iGetFirst(i))); 149g 299

PAGE 300

150// 151//rref 152// 153voidSparseMatrix::rref() 154f 155intlead=0; 156introwCount=height(); 157intcolCount=width(); 158for(intr=0;r=height()jjj>=height())return; 183EntryListtemp=mat[i]; 184mat[i]=mat[j]; 185mat[j]=temp; 186g 187// 188//WriteData 189// 190voidSparseMatrix::WriteData(constcharfileName)const 300

PAGE 301

191f 192fstreamfile; 193file.open(fileName,ios base::out); 194if(!file.is open())return; 195fori(mat.size()) 196f 197mat[i].Write(setWidth,file); 198file<& coeff) 11fcoeff= coeff;g 12//Usedtoevaluateapointontheline,f(x) 13virtualdoubleEvaluate(doublex)const=0; 14//Evaluatesthefunction 15doubleoperator()(doublex)constfreturnEvaluate(x);g 16//Usedtointegratethefunction 17virtualdoubleIntegrate(doublex1,doublex2)const=0; 18//Fittingfunction,returnstheresidual 19virtualdoubleBestFit(constvector&x,constvector&y)=0; 20//Writesthelinetothescreen 21virtualvoidPrint()const=0; 22//Writesthedatatoafile 23voidWriteData(constcharfileName,intpoints,doublex1,doublex2); 24//Coefficeintsoftheline 25vectorcoeff; 26g; 27//PolynomiallineclassSum(c ixi) 28classPolynomial:publicLine 29f 30public: 301

PAGE 302

31//Constructor 32Polynomial():Line()fg 33Polynomial(doublec0)fcoeff.push back(c0);g 34Polynomial(doublec0,doublec1)fcoeff.push back(c0);coeff.push back(c1);g 35Polynomial(doublec0,doublec1,doublec2)fcoeff.push back(c0);coeff.push back(c1);coeff.push back(c2);g 36Polynomial(doublec0,doublec1,doublec2,doublec3)fcoeff.push back(c0);coeff.push back(c1);coeff.push back(c2);coeff.push back(c3);g 37Polynomial(constvector& coeff):Line( coeff)fg 38Polynomial(constdouble coeff,intsize):Line() 39ffori(size)coeff.push back( coeff[i]);g 40//Evaluatesthefunctionatx,f(x) 41doubleEvaluate(doublex)const; 42//Integratethefunctionfromx1tox2 43doubleIntegrate(doublex1,doublex2)const; 44//Fittingfunction 45doubleBestFit(constvector&x,constvector&y); 46//Print 47voidPrint()const; 48g; 49//ExponentialFunctions,ae(bx+c)+d 50classExponential:publicLine 51f 52public: 53//Constructor 54Exponential():Line()fg 55Exponential(constvector& coeff):Line( coeff)fg 56Exponential(doublea,doubleb=1,doublec=0,doubled=0); 57//Evaluatesthefunctionsatx,f(x) 58doubleEvaluate(doublex)const; 59//Integratethefunctionfromx1tox2 60doubleIntegrate(doublex1,doublex2)const; 61//Fittingfunction 62doubleBestFit(constvector&x,constvector&y); 63//ConvertstoPolynomialfunction,usingtheBestFitfunction 64PolynomialToPolynomial(intpoints,doublex1,doublex2)const; 65//Print 66voidPrint()const; 67g; 68#endif// LINE H 1#includeConsole.h 302

PAGE 303

2#includeLine.h 3#includeArrayMatrix.h 4// 5//LineClass 6// 7voidLine::WriteData(constcharfileName,intpoints,doublex1,doublex2) 8f 9constdoubledx=(x2)]TJ /F10 7.97 Tf 6.07 0 Td[(x1)/double(points)]TJ /F10 7.97 Tf 6.75 0 Td[(1); 10vectorx,y; 11double x=x1; 12fori(points) 13f 14x.push back( x); 15y.push back(Evaluate( x)); 16 x+=dx; 17g 18WriteValues(fileName,x,y,X,Y); 19g 20// 21//PolynomialClass 22// 23doublePolynomial::Evaluate(doublex)const 24f 25doubletotal=0; 26for(inti=int(coeff.size()))]TJ /F10 7.97 Tf 6.81 0 Td[(1;i!=)]TJ /F10 7.97 Tf 6.81 0 Td[(1;i)74()]TJ /F10 7.97 Tf 12.29 0 Td[() 27total=totalx+coeff[i]; 28returntotal; 29g 30doublePolynomial::Integrate(doublex1,doublex2)const 31f 32doubletotal1=0,total2=0; 33for(inti=int(coeff.size()))]TJ /F10 7.97 Tf 6.81 0 Td[(1;i!=(int))]TJ /F10 7.97 Tf 6.81 0 Td[(1;i)74()]TJ /F10 7.97 Tf 12.29 0 Td[() 34f 35constdoubletemp=coeff[i]/double(i+1); 36total1=total1x1+temp; 37total2=total2x2+temp; 38g 39returnx2total2)]TJ /F10 7.97 Tf 11.15 0 Td[(x1total1; 40g 41doublePolynomial::BestFit(constvector&x,constvector&y) 42f 303

PAGE 304

43intsize=x.size(); 44ArrayMatrixm(size+1,size); 45//Buildthematrix 46forij(size,size) 47m.Set(i,j,pow(x[i],double(j))); 48fori(size) 49m.Set(i,size,y[i]); 50//Solvematrix 51m.rref(); 52//Setcoefficients 53coeff.resize(size); 54fori(size) 55coeff[i]=m.Get(i,size); 56doubleresidual=0; 57fori(size) 58residual+= Sq(y[i])]TJ /F10 7.97 Tf 11.57 0 Td[(Evaluate(x[i])); 59returnresidual; 60g 61voidPolynomial::Print()const 62f 63fori(coeff.size()) 64f 65if(i==0) 66Write(coeff[i]); 67elseif(i==1) 68Write( + ,coeff[i]); 69else 70Write( + ,coeff[i],x,i); 71g 72Write(nn); 73g 74// 75//ExponentialClass,ae(bx+c)+d 76// 77Exponential::Exponential(doublea,doubleb,doublec,doubled) 78f 79coeff.push back(a); 80coeff.push back(b); 81coeff.push back(c); 82coeff.push back(d); 83g 304

PAGE 305

84doubleExponential::Evaluate(doublex)const 85f 86returncoeff[0]exp(coeff[1]x+coeff[2])+coeff[3]; 87g 88doubleExponential::Integrate(doublex1,doublex2)const 89f 90return(coeff[0]/coeff[1])(exp(coeff[1]x2+coeff[2]))]TJ /F10 7.97 Tf 11.14 0 Td[(exp(coeff[1]x1+coeff[2]))+coeff[3](x2)]TJ /F10 7.97 Tf 11.15 0 Td[(x1); 91g 92doubleExponential::BestFit(constvector&x,constvector&y) 93f 94return1e300; 95g 96voidExponential::Print()const 97f 98WriteLine(coeff[0], e(,coeff[1],x + ,coeff[2],) + ,coeff[3]); 99g 100PolynomialExponential::ToPolynomial(intpoints,doublex1,doublex2)const 101f 102constdoubledx=(x2)]TJ /F10 7.97 Tf 6.07 0 Td[(x1)/double(points)]TJ /F10 7.97 Tf 6.75 0 Td[(1); 103vectorx,y; 104double x=x1; 105//Createdata 106fori(points) 107f 108x.push back( x); 109y.push back(Evaluate( x)); 110 x+=dx; 111g 112//Passdata&calculatebestfit 113Polynomialpoly; 114doubleresidual=poly.BestFit(x,y); 115WriteLine(Residual = ,residual); 116//Returnlinefound 117returnpoly; 118g 1#ifndef MATRIX H 2#define MATRIX H 3#includeGlobals.h 4namespaceArafclassColor;g 5//ThebaseclassofboththeArrayMatrixandtheSparseMatrixclasses 305

PAGE 306

6classMatrix 7f 8public: 9//Clearsandrecreates 10virtualvoidInitialize(constint width,constint height)=0; 11virtualvoidClear()=0; 12//Operatorstogetandsetthevaluesofthematrix 13virtualdoubleGet(introw,intcol)const=0; 14virtualdoubleGetFirst(introw)const=0; 15virtualdoubleGetLast(introw)const=0; 16virtualvoidSet(introw,intcol,constdoublevalue)=0; 17//Size 18virtualintwidth()const=0; 19virtualintheight()const=0; 20intsize()constfreturnheight();g 21//Regularization 22virtualvoidRegularize(constdoublemu)fg 23virtualvoidRegularize(constdoublemu,constvector&diag)fg 24//Returnsthesumofthefirstcolumnsquared 25virtualconstdoubleStandardError()const=0; 26//Returnsthemaxofthefirstcolumn 27virtualconstdoubleMaxError()const=0; 28//Addingvalues 29virtualvoidaddNegColumn(constMatrixcol)=0; 30//Reducedrowechelonform 31virtualvoidrref()=0; 32//Checkstoseeifthematrixisinrrefform 33//virtualboolisrref()const=0; 34//Printsoutthematrix 35virtualvoidprint()const=0; 36virtualvoidprintE()const=0; 37//Writesabitmapblendingfromonecolortotheother 38//Coloraisthelowestcolor,andbisthehighestvaluecolor 39virtualvoidWriteImage(charfile,constColor&a,constColor&b)const=0; 40//Writesoutthedatainatextformat 41virtualvoidWriteData(constcharfile)const=0; 42virtualvoidWriteDataAppend(constcharfile)const=0; 43g; 44//Writesoutvectorvalues 45voidWriteValues(constcharfile,constvector&values); 306

PAGE 307

46voidWriteValues(constcharfile,constvector>&values,vector&titles); 47voidWriteValues(constcharfile,constvector&x,constvector&y,constcharxTitle,constcharyTitle); 48//Printsoutvectorvalues 49voidPrintValues(constvector&values); 50//Dividematrixlinebyavalue 51inlinevoiddivMat(vector&matrix,constdoubleval) 52ffori(matrix.size())matrix[i]/=val;g 53//Subtractmatrixlinesbyamultipleofanother 54inlinevoidsubMat(vector&a,vector&b,constdoublemult) 55ffori(a.size())a[i])]TJ /F10 7.97 Tf 6.17 0 Td[(=(b[i]mult);g 56//Returnsthesumofthefirstcolumnsquared 57inlinedoubleStandardError(constvector&v) 58fdoublet=0;fori(v.size())t+=Sq(v[i]);returnt;g 59//Calculatesthemaxvalue(absolute)ofavector/matrix 60//Usedforcalculatingmaxerror 61inlinedoublemaxMatError(constvector&matrix) 62f 63doublemaxError=0; 64fori(matrix.size()) 65if(fabs(matrix[i])>maxError) 66maxError=fabs(matrix[i]); 67returnmaxError; 68g 69#endif 1#includeConsole.h 2#includeMatrix.h 3#include 4#include 5voidWriteValues(constcharfileName,constvector&values) 6f 7fstreamfile; 8file.open(fileName,ios base::out); 9if(!file.is open())return; 10fori(values.size()) 11file<>&values,vector&titles) 307

PAGE 308

15f 16if(values.size()<1)return; 17fstreamfile; 18file.open(fileName,ios base::out); 19if(!file.is open())return; 20fori(titles.size()) 21file<&x,constvector&y,constcharxTitle,constcharyTitle) 32f 33fstreamfile; 34file.open(fileName,ios base::out); 35if(!file.is open())return; 36if(x.size()!=y.size())return; 37file<&values) 43f 44fori(values.size()) 45Write(values[i],, ); 46Write(nn); 47g 308

PAGE 309

REFERENCES [1] Hagfeldt,A.&Gratzel,M.Light-inducedredoxreactionsinnanocrystallinesystems.ChemicalReviews95,49(1995). [2] Gratzel,M.Photoelectrochemicalcells.Nature414,338(2001). [3] Peter,L.Transport,trappingandinterfacialtransferofelectronsindye-sensitizednanocrystallinesolarcells.JournalofElectroanalyticalChemistry599,233(2007). [4] Law,M.,Greene,L.E.,Johnson,J.C.,Saykally,R.&Yang,P.D.Nanowiredye-sensitizedsolarcells.NatureMaterials4,455(2005). [5] Martinson,A.B.F.,Elam,J.W.,Hupp,J.T.&Pellin,M.J.Znonanotubebaseddye-sensitizedsolarcells.NanoLett.7,2183(2007).Doi:10.1021/nl070160+1530-6984doi:10.1021/nl070160+. [6] Martinson,A.B.F.etal.Electrontransportindye-sensitizedsolarcellsbasedonznonanotubes:Evidenceforhighlyefcientchargecollectionandexceptionallyrapiddynamics.JPhysChemA113,4015(2009). [7] Dev,A.&Chaudhuri,S.Uniformlarge-scalegrowthofmicropatternedarraysofznonanowiressynthesizedbyasurfactantassistedapproach.Nat.Nanotechnol.18,175607(2007). [8] Law,M.etal.Zno-al2o3andzno-tio2core-shellnanowiredye-sensitizedsolarcells.J.Phys.Chem.B110,22652(2006). [9] Chen,X.&Mao,S.S.Titaniumdioxidenanomaterials:Synthesis,properties,modications,andapplications.ChemRev107(7),2891(2007). [10] Anderson,J.L.,Bowden,E.F.&Pickup,P.G.Dynamicelectrochemistry:Methodologyandapplication.AnalChem68(12),379(1996). [11] Chu,S.Z.,Wada,K.,Inoue,S.&Todoroki,S.Formationandmicrostructuresofanodicaluminalmsfromaluminumsputteredonglasssubstrate.J.Electrochem.Soc.149,B321B327(2002). [12] Foong,T.R.B.,Sellinger,A.&Hu,X.Originofthebottlenecksinpreparinganodizedaluminumoxide(aao)templatesonitoglass.ACSNano2,2250(2008).Doi:10.1021/nn800435n1936-0851doi:10.1021/nn800435n. [13] Cott,D.J.etal.Preparationoforientedmesoporouscarbonnano-lamentswithintheporesofanodicaluminamembranes.J.Am.Chem.Soc.128,3920(2006).Doi:10.1021/ja058441b0002-7863doi:10.1021/ja058441b. [14] Jessensky,O.,Muller,F.&Gosele,U.Self-organizedformationofhexagonalporearraysinanodicalumina.Appl.Phys.Lett.72,1173(1998). 309

PAGE 310

[15] Li,A.P.,Muller,F.,Birner,A.,Nielsch,K.&Gosele,U.Hexagonalporearrayswitha50-420nminterporedistanceformedbyself-organizationinanodicalumina.J.Appl.Phys.84,6023(1998). [16] Masuda,H.etal.Squareandtriangularnanoholearrayarchitecturesinanodicalumina.Adv.Mater.13,189(2001). [17] Masuda,H.etal.Highlyorderednanochannel-arrayarchitectureinanodicalumina.App.Phys.Lett.71,2770(1997). [18] Osulliva.Jp&Wood,G.C.Morphologyandmechanismofformationofporousanodiclmsonaluminium.ProceedingsoftheRoyalSocietyofLondonSeriesa-MathematicalandPhysicalSciences317,511&(1970). [19] Parkhutik,V.P.&Shershulsky,V.I.Theoreticalmodelingofporousoxide-growthonaluminum.J.Phys.D25,1258(1992). [20] Xu,H.B.,Chen,H.Z.,Xu,W.J.&Wang,M.Fabricationoforganiccopperphthalocyaninenanowirearraysviaasimpleaaotemplate-basedelectrophoreticdeposition.Chem.Phys.Lett.412,294(2005).0009-2614doi:DOI:10.1016/j.cplett.2005.07.006. [21] Stair,P.etal.Novel,uniformnanostructuredcatalyticmembranes.Top.Catal.39,181(2006).[1]doi:10.1007/s11244-006-0055-0. [22] Bagshaw,S.A.,Prouzet,E.&Pinnavaia,T.J.Templatingofmesoporousmolecularsievesbynonionicpolyethyleneoxidesurfactants.Science269,1242(1995). [23] Teh,L.K.etal.Electrodepositionofcdseonnanopatternedpillararraysforphotonicandphotovoltaicapplications.ThinSolidFilms515,5787(2007).0040-6090doi:DOI:10.1016/j.tsf.2006.12.166. [24] Moore,G.E.Crammingmorecomponentsontointegratedcircuits.Electronics38,114(1965). [25] Hill,J.J.,Cotton,S.P.&Ziegler,K.J.Alignmentandmorphologycontroloforderedmesoporoussilicasinanodicaluminumoxidechannelsbyelectrophoreticdeposition.Chem.Mater.21,1841(2009).Doi:10.1021/cm803083s0897-4756doi:10.1021/cm803083s. [26] Chu,S.Z.etal.Highlyporous(tio2-sio2-teo2)/al2o3/tio2compositenanostructuresonglasswithenhancedphotocatalysisfabricatedbyanodizationandsol-gelprocess.J.Phys.Chem.B107,6586(2003). [27] Cao,G.Z.Growthofoxidenanorodarraysthroughsolelectrophoreticdeposition.J.Phys.Chem.B108,19921(2004). 310

PAGE 311

[28] Ishikawa,Y.&Matsumoto,Y.Electrodepositionoftio2photocatalystintoporousalumitepreparedinphosphoricacid.Sol.Stat.Ion.151,213(2002). [29] Liang,Y.,Zhen,C.,Zou,D.&Xu,D.Preparationoffree-standingnanowirearraysonconductivesubstrates.J.Amer.Chem.Soc.126,16338(2004).Scfnanowireaggregationinhibition. [30] Limmer,S.J.etal.Template-basedgrowthofvariousoxidenanorodsbysol-gelelectrophoresis.Adv.Fun.Mater.12,59(2002). [31] Limmer,S.J.,Chou,T.P.&Cao,G.Z.Astudyonthegrowthoftio2nanorodsusingsolelectrophoresis.J.Mater.Sci.39,895(2004). [32] Zhang,Q.,Li,Y.,Xu,D.&Gu,Z.Preparationofsilvernanowirearraysinanodicaluminumoxidetemplates.J.Mater.Sci.Lett.20,925(2001).SmallestAAOpores. [33] Xomeritakis,G.etal.Anodicaluminasupporteddual-layermicroporoussilicamembranes.J.Mem.Sci.287,157(2007). [34] Ziegler,K.J.,Lyons,D.M.&Holmes,J.D.Bistablenanoelectromechanicaldevices.Appl.Phys.Lett.84,4074(2004). [35] Wu,Y.etal.Compositemesostructuresbynano-connement.Nat.Mater.3,816(2004).1476-112210.1038/nmat123010.1038/nmat1230. [36] Kline,T.R.etal.Template-grownmetalnanowires.Inorg.Chem.45,7555(2006).Doi:10.1021/ic06013840020-1669doi:10.1021/ic0601384. [37] Lahav,M.,Weiss,E.A.,Xu,Q.&Whitesides,G.M.Coreshellandsegmentedpolymermetalcompositenanostructures.NanoLett.6,2166(2006).Doi:10.1021/nl061786n1530-6984doi:10.1021/nl061786n. [38] Miao,Z.etal.Electrochemicallyinducedsol-gelpreparationofsingle-crystallinetio2nanowires.NanoLett.2,717(2002). [39] Yang,Y.etal.Anodicaluminatemplateonau/sisubstrateandpreparationofcdsnanowires.SolidStateCommun.123,279(2002).0038-1098doi:DOI:10.1016/S0038-1098(02)00304-6. [40] Zheng,M.J.,Zhang,L.D.,Li,G.H.,Zhang,X.Y.&Wang,X.F.Orderedindium-oxidenanowirearraysandtheirphotoluminescenceproperties.Appl.Phys.Lett.79,839(2001). [41] Evans,U.,Colavita,P.E.,Doescher,M.S.,Schiza,M.&Myrick,M.L.Constructionandcharacterizationofananowellelectrodearray.NanoLett.2,641(2002).Doi:10.1021/nl025552p1530-6984doi:10.1021/nl025552p. 311

PAGE 312

[42] Cho,S.I.,Xiao,R.&Lee,S.B.Electrochemicalsynthesisofpoly(3,4-ethylenedioxythiophene)nanotubestowardsfastwindow-typeelectrochromicdevices.Nanotechnology18,405705(2007).0957-4484. [43] Nasirpouri,F.,Southern,P.,Ghorbani,M.,Irajizad,A.&Schwarzacher,W.Gmrinmultilayerednanowireselectrodepositedintrack-etchedpolyesterandpolycarbonatemembranes.J.Magn.Magn.Mater.308,35(2007).0304-8853doi:DOI:10.1016/j.jmmm.2006.04.035. [44] Hill,J.J.,Haller,K.,Gelfand,B.&Ziegler,K.J.Eliminatingcapillarycoalescenceofnanowirearrayswithappliedelectriceldssubmitted(2010). [45] Pan,S.,Zeng,D.,Zhang,H.&Li,H.Preparationoforderedarrayofnanoscopicgoldrodsbytemplatemethodanditsopticalproperties.Appl.Phys.A-Mater.70,637(2000). [46] Li,A.,Mller,F.,Birner,A.,Nielsch,K.&Gsele,U.Fabricationandmicrostructuringofhexagonallyorderedtwo-dimensionalnanoporearraysinanodicalumina.Adv.Mater.11,483(1999).10.1002/(SICI)1521-4095(199904)11:6::AID-ADMA483.0.CO;2-I. [47] Chu,S.Z.,Wada,K.,Inoue,S.&Todoroki,S.Fabricationandcharacteristicsofnanostructuresonglassbya1anodizationandelectrodeposition.Electrochim.Acta48,3147(2003). [48] Boudaoud,A.,Bico,J.&Roman,B.Elastocapillarycoalescence:Aggregationandfragmentationwithamaximalsize.Phys.Rev.E76,1(2007). [49] Bico,J.,Roman,B.,Moulin,L.&Boudaoud,A.Adhesion:Elastocapillarycoalescenceinwethair.Nature432,690(2004).0028-083610.1038/432690a10.1038/432690a. [50] Pokroy,B.,Kang,S.H.,Mahadevan,L.&Aizenberg,J.Self-organizationofamesoscalebristleintoordered,hierarchicalhelicalassemblies.Science323,237(2009). [51] Petkov,N.,Platschek,B.,Morris,M.A.,Holmes,J.D.&Bein,T.Orientedgrowthofmetalandsemiconductornanostructureswithinalignedmesoporouschannels.Chem.Mater.19,1376(2007). [52] Kim,H.C.etal.Aroutetonanoscopicsio2postsviablockcopolymertemplates.Adv.Mater.13,795(2001).10.1002/1521-4095(200106)13:11::AID-ADMA795.0.CO;2-1. [53] Lee,J.I.etal.Highlyalignedultrahighdensityarraysofconductingpolymernanorodsusingblockcopolymertemplates.NanoLett.8,2315(2008).Doi:10.1021/nl801105s1530-6984doi:10.1021/nl801105s. 312

PAGE 313

[54] Park,S.,Kim,B.,Wang,J.Y.&Russell,T..Fabricationofhighlyorderedsiliconoxidedotsandstripesfromblockcopolymerthinlms.Adv.Mater.20,681(2008).10.1002/adma.200701997. [55] Kim,J.U.,Cha,S.H.,Shin,K.,Jho,J..&Lee,J.C.Preparationofgoldnanowiresandnanosheetsinbulkblockcopolymerphasesundermildconditions.Adv.Mater.16,459(2004).10.1002/adma.200305613. [56] Chung,Y.,Lee,C.,Peng,C.&Chiu,H.Reactivetemplateassistedgrowthofone-dimensionalnanostructuresoftitaniumdioxide.Mater.Chem.Phys.100,380(2006). [57] Diao,J.,Gall,K.&Dunn,M.L.Surfacestressdrivenreorientationofgoldnanowires.Phys.Rev.B70,075413,075413(2004). [58] Lippmann,G.Relationsentrelesphenomeneselectriquesetcapillaires.Ann.Chim.Phys.5,494(1875). [59] Newman,J.&Thomas-Alyea,K.E.ElectrochemicalSystems(Wiley-Interscience,Hoboken,2004),3rdedn. [60] Hill,J.J.,Haller,K.&Ziegler,K.J.submitted(2010). [61] Kralchevsky,P.A.,Paunov,V.N.,Ivanov,I.B.&Nagayama,K.JColloidInterfacSci151,79(1992). [62] Chandra,D.,Yang,S.,Soshinsky,A.&Gambogi,R.Biomimeticultrathinwhiteningbycapillary-force-inducedrandomclusteringofhydrogelmicropillararrays.ACSAppl.Mater.Interfaces1,1698(2009). [63] Zhao,Y.P.,Wang,G.C.,Lu,T.M.,Palasantzas,G.&DeHosson,J.T.M.PhysRevB60(12),9157(1999). [64] Nanayakkara,Y.S.etal.AnalChem80(20),7690(2008). [65] Gratzel,M.Conversionofsunlighttoelectricpowerbynanocrystallinedye-sensitizedsolarcells.JPhotochPhotobioA164,3(2004).Sp.Iss.SI. [66] Haque,S.A.etal.Chargeseparationversusrecombinationindye-sensitizednanocrystallinesolarcells:theminimizationofkineticredundancy.JournaloftheAmericanChemicalSociety127,3456(2005). [67] Gratzel,M.&Frank,A.J.Phys.Chem.86,2964(1982).BandBendRef. [68] Peter,L.M.&Wijayantha,K.G.U.Electrontransportandbackreactionindyesensitisednanocrystallinephotovoltaiccells.ElectrochimicaActa45,4543(2000).0013-4686doi:DOI:10.1016/S0013-4686(00)00605-8. 313

PAGE 314

[69] Frank,A.J.,Kopidakis,N.&Lagemaat,J.dssctraplimiteddiffusionmodel.CoordChemRev248,1165(2004). [70] Nelson,J.Continuous-timerandom-walkmodelofelectrontransportinnanocrystallinetio2electrodes.PhysicalReviewB59,15374(1999). [71] Nelson,J.&Chandler,R.E.Randomwalkmodelsofchargetransferandtransportindyesensitizedsystems.CoordChemRev248,1181(2004). [72] Bisquert,J.Fractionaldiffusioninthemultiple-trappingregimeandrevisionoftheequivalencewiththecontinuous-timerandomwalk.PhysicalReviewLetters91(2003).010602. [73] Cameron,P.J.&Peter,L.M.Characterizationoftitaniumdioxideblockinglayersindye-sensitizednanocrystallinesolarcells.JournalofPhysicalChemistryB107,14394(2003). [74] Palomares,E.,Clifford,J.N.,Haque,S.A.,Lutz,T.&Durrant,J.R.Slowchargerecombinationindye-sensitisedsolarcells(dssc)usingal2o3coatednanoporoustio2lms.ChemicalCommunications1464(2002). [75] Palomares,E.,Clifford,J.N.,Haque,S.A.,Lutz,T.&Durrant,J.R.Controlofchargerecombinationdynamicsindyesensitizedsolarcellsbytheuseofconformallydepositedmetaloxideblockinglayers.JournaloftheAmericanChemicalSociety125,475(2003). [76] Martinson,A.B.F.etal.Radialelectroncollectionindye-sensitizedsolarcells.NanoLett8,2862(2008). [77] Wang,H.etal.Itocoreshelldsscs.Nanotechnology20,055601(2009). [78] Paulose,M.,Shankar,K.,Varghese,O.K.,Mor,G.K.&Grimes,C.A.believenw-dsscimprovement.JPhysDApplPhy39,2498(2006). [79] Mor,G.K.,Varghese,O.K.,Paulose,M.,Shankar,K.&Grimes,C.A.Areviewonhighlyordered,verticallyorientedtio2nanotubearrays:Fabrication,materialproperties,andsolarenergyapplications.SolarEnergyMaterialsandSolarCells90,2011(2006). [80] Pan,K.etal.Thephotoelectrochemicalpropertiesofdye-sensitizedsolarcellsmadewithtio2nanoribbonsandnanorods.ThinSolidFilms515,4085(2007). [81] Claude,L.,Jamil,E.&Ramon,T.nw-dsscnotgoodlightharvesting.PhysicaStatSol6,1596(2009). [82] Chen,G.,Lee,M.&Wang,G.Fabricationofdye-sensitizedsolarcellswitha3dnanostructuredelectrode.InternationalJournalofPhotoenergy2010,7(2010). 314

PAGE 315

[83] Joanni,E.etal.Dye-sensitizedsolarcellarchitecturebasedonindium-tinoxidenanowirescoatedwithtitaniumdioxide.ScriptaMat57,277(2007). [84] Tan,B.&Wu,Y.Dye-sensitizedsolarcellsbasedonanatasetio2nanoparticle/nanowirecomposites.JPhysChemB110(32),15932(2006). [85] Usami,A.np-dsscenhancedlighttrapping.ChemPhysLett277,105(1997). [86] Hore,S.,Vetter,C.,Kern,R.,Smit,H.&Hinsch,A.np-dsscenhancedlightscattering.SolEnergMatSolC90,1176(2006). [87] Kelzenberg,M.D.etal.enhancedlightpvw/sinws.NatMater9,239(2009). [88] Roy,P.,Albu,S.P.&Schmuki,P.Tio2nanotubesindye-sensitizedsolarcells:Higherefcienciesbywell-denedtubetops.ElectrochemCommun12,949(2010). [89] Pasquier,A.D.,Chen,H.&Lu,Y.Dyesensitizedsolarcellsusingwell-alignedzincoxidenanotiparrays.AppliedPhysicsLetters89,253513(2006). [90] MaggiePaulose,O.K.V.G.K.M.,KarthikShankar&Grimes,C.A.Applicationofhighly-orderedtio2nanotube-arraysinheterojunctiondye-sensitizedsolarcells.JournalofPhysicsD-AppliedPhysics39,2498(2006). [91] Mor,G.K.,Shankar,K.,Paulose,M.,Varghese,O.K.&Grimes,C.A.Useofhighly-orderednanotubearraysindye-sensitizedsolarcells.NanoLetters6,215(2006). [92] Bisquert,J.,Garcia-Belmonte,G.&Fabregat-Santiago,F.Modellingtheelectricpotentialdistributioninthedarkinnanoporoussemiconductorelectrodes.JSolStElectrochem3,337(1999). [93] Albery,W.&Bartlett,P.Modelingofbandbendinginsemiconductorcolloidalparticles.J.Electrochem.Soc.131,315(1984). [94] Zaban,A.,Greenshtein,M.&Bisquert,J.Determinationoftheelectronlifetimeinnanocrystallinedyesolarcellsbyopen-circuitvoltagedecaymeasurements.ChemPhysChemComm4,859(2003). [95] Bisquert,J.,Zaban,A.,Greenshtein,M.&Mora-Sero,I.Determinationofrateconstantsforchargetransferandthedistributionofsemiconductorandelectrolyteelectronicenergylevelsindye-sensitizedsolarcellsbyopen-circuitphotovoltagedecaymethod.JAmChemSoc126(41),13550(2004). [96] Toyoda,T.etal.Outdoorperformanceoflargescaledscmodules.JPhotochPhotobioA164,203(2004). 315

PAGE 316

[97] Ferber,J.&Luther,J.Modelingofphotovoltageandphotocurrentindye-sensitizedtitaniumdioxidesolarcells.J.Phys.Chem.B105,4895(2001). [98] Ferber,J.,Stangl,R.&Luther,J.Anelectricalmodelofthedye-sensitizedsolarcell.SolarEnergyMaterialsandSolarCells53,29(1998). [99] Penny,M.,Farrell,T.&Please,C.Amathematicalmodelforinterfacialchargetransferatthesemiconductor-dye-electrolyteinterfaceofadye-sensitisedsolarcell.SolEnergMatSolC92,11(2008). [100] Penny,M.,Farrell,T.&Will,G.Amathematicalmodelfortheanodichalfcellofadye-sensitisedsolarcell.SolEnergMatSolC92,24(2008). [101] Villanueva-Cab,J.,Wang,H.,Oskam,G.&Peter,L.Electrondiffusionandbackreactionindye-sensitizedsolarcells:Theeffectofnonlinearrecombinationkinetics.JPhysChemLett1(4),748(2010). [102] Duffy,N.W.,Peter,L.M.&Wijayantha,K.G.U.Characterisationofelectrontransportandbackreactionindye-sensitisednanocrystallinesolarcellsbysmallamplitudelaserpulseexcitation.ElectrochemCommun2,262(2000). [103] Oregan,B.&Gratzel,M.Alow-cost,high-efciencysolar-cellbasedondye-sensitizedcolloidaltio2lms.Nature353,737(1991). [104] Schlichthorl,G.,Huang,S.Y.,Sprague,J.&Frank,A.J.Bandedgemovementandrecombinationkineticsindye-sensitizednanocrystallinetio2solarcells:astudybyintensitymodulatedphotovoltagespectroscopy.JPhysChemB101(41),8141(1997). [105] Adachi,M.etal.Highlyefcientdye-sensitizedsolarcellswithatitaniathin-lmelectrodecomposedofanetworkstructureofsingle-crystal-liketio2nanowiresmadebytheorientedattachmentmechanism.JAmChemSoc126(45),14943(2004). [106] Orazem,P.M.E.Conversationswithprof.orazem. [107] Orazem,M.&Newman,J.Mathematicalmodelingofliquid-junctionphotovoltaiccells.JElectrochemSoc131(11),2569(1984). [108] Gratzel,M.Solarenergyconversionbydye-sensitizedphotovoltaiccells.Inorg.Chem.44(20),68416851(2005). [109] Asano,T.,Kubo,T.&Nishikitani,Y.JpnJApplPhys44,6776(2005). [110] Zaban,A.,Meier,A.&Gregg,B.A.JPhysChemB101,7985(1997). [111] Asbury,J.,Anderson,N.,Hao,E.,Ai,X.&Lian,T.JPhysChemB107,7376(2003). 316

PAGE 317

[112] Smestad,G.,Bignozzi,C.&Argazzi,R.SolEnergMatSolC32,259(1994). [113] Hagfeldt,A.&Gratzel,M.AccChemRes33,269(2000). [114] Kambili,A.etal.PhysicaE14,203(2002). [115] Angelis,F.,Fantacci,S.&Selloni,A.Alignmentofthedyesmolecularlevelswiththetio2bandedgesindye-sensitizedsolarcells:adfttddftstudy.Nanotechnology19,424002(7pp)(2008). [116] Gratzel,M.ProgPhotov8,171(2000). [117] Gratzel,M.NANOSTRUCTUREDANDPHOTOELECTROCHEMICALSYSTEMSFORSOLARPHOTONCONVERSION,vol.3(ImperialCollegePress,2008). [118] Kim,D.etal.Highlyconductivecoaxialsno2in2o3heterostructurednanowiresforliionbatteryelectrodes.NanoLett7(10),3041(2007). [119] Tseng,Y.etal.Characterizationandeld-emissionpropertiesofneedle-likezincoxidenanowiresgrownverticallyonconductivezincoxidelms.AdvFunMater13(10),811(2003). [120] Ziegler,K.etal.Conductivelmsoforderednanowirearrays.JMaterChem14,585(2004). [121] Xue,X.Y.etal.Synthesisandethanolsensingpropertiesofindium-dopedtinoxidenanowires.Appl.Phys.Lett.88,201907(2006). 317

PAGE 318

BIOGRAPHICALSKETCH JustinJ.HillwasborninCasper,Wyoming.AttendingPragueSeniorHighSchoolinOklahoma,hewasavarsitytrackathletecompetinginmanyeventssuchaspolevault,the4x400meterandthe4x800meterrelays,wherein1998,hewaspartofwinningtherstandonlystatechampionshiptitleformen'sathleticsatPragueSeniorHighSchool.Alsoduringhissecondaryeducation,heexcelledintherstacademichonorsprogramandpublishedseveralpoemsinnationalanthologies,mostnotablyTheLightofDay:apoemwritteninmemoryoftheOklahomaCityBombingof1995.JustinbegancollegeonaminorpolevaultingscholarshipforthetrackandeldteamatTheUniversityofNorthCarolinaatWilmingtonwherehecompetedandhelpedwintheColonialAthleticAssociationTrack&FieldChampionshipin1998.DuringhistimeatUNCWhepursuedstudiesinappliedmathematicsandchemistry.UpontransferringtoNorthCarolinaStateUniversityinRaleigh,hegraduatedwithhonorsdegreesinbothappliedmathematicsandchemicalengineering.HealsoworkedunderProfessorGregoryParsonsinvestigatingporphyrinself-assemblythroughliquidandsublimationmethodsfororganicsolarcells.In2005JustinacceptedanoffertothechemicalengineeringdoctoralprogramattheUniversityofFlorida.Inadditiontothestudiespresentedinthisthesis,hestudiedinterfacialprocessesinheterogeneous,nanoscalesystems,vaporliquidsolidnanowiregrowthaswellasinterfacialelectrochemistry.JustinhasacceptedapositionasleadscientistatMainstreamEngineeringinRockledge,FlandwillbemovingtoMerrittIslandwithhiswife,ElizabethHill,tobeginworkthereinlateJuly. 318