47 #include <Xyce_config.h>
51 #include <N_UTL_Math.h>
62 #include <N_LAS_Vector.h>
63 #include <N_LAS_System.h>
81 bool skipOutput =
false;
89 !(force_final_output) &&
90 given(
"OUTPUTINTERVAL") )
106 if (skipOutput)
return bsuccess;
118 bsuccess = bsuccess && bs1;
124 bsuccess = bsuccess && bs1;
130 bsuccess = bsuccess && bs1;
136 bsuccess = bsuccess && bs1;
142 bsuccess = bsuccess && bs1;
169 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=BLACK, X= .00, Y= .00,");
170 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.8\n");
172 if(iGnum == iNumG) fprintf(fp1,
"\t%d\n",iNumF);
173 else fprintf(fp1,
"\t%d\n",50);
201 fprintf(fp1,
"%4d\n%11.3e %11.3e\n%11.3e %11.3e\n",
213 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=BLACK, X= .00,");
214 fprintf(fp1,
"%s",
" Y= .00,");
215 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.8\n");
216 fprintf(fp1,
"\t%d\n",iNumF);}
220 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=BLACK, X= .00,");
221 fprintf(fp1,
"%s",
" Y= .00,");
222 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.8\n");
223 fprintf(fp1,
"\t%d\n",50);
228 fprintf(fp1,
"%s",
"\n");
235 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=RED, X= .00, Y= .00,");
236 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.2\n");
238 if(iGnum == iNumG) fprintf(fp1,
"\t%d\n",iNumF);
239 else fprintf(fp1,
"\t%d\n",50);
266 fprintf(fp1,
"%4d\n%11.3e %11.3e\n%11.3e %11.3e\n",
278 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=RED, X= .00,");
279 fprintf(fp1,
"%s",
" Y= .00,");
280 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.2\n");
281 fprintf(fp1,
"\t%d\n",iNumF);}
285 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=RED, X= .00,");
286 fprintf(fp1,
"%s",
" Y= .00,");
287 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.2\n");
288 fprintf(fp1,
"\t%d\n",50);
293 fprintf(fp1,
"%s",
"\n");
309 bool bsuccess =
true;
313 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
321 sprintf(filename,
"%s.dat",
outputName.c_str());
326 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) &&
getSolverState().debugTimeFlag)
328 Xyce::dout() << std::endl;
329 Xyce::dout() << section_divider << std::endl;
330 Xyce::dout() <<
"In Instance::outputTecplot. filename = ";
331 Xyce::dout() << std::string(filename);
332 Xyce::dout() << std::endl;
339 fp1 = fopen(filename,
"w");
345 fp1 = fopen(filename,
"w");
349 fp1 = fopen(filename,
"a");
358 double dDx_dt, dDy_dt;
371 " TITLE = \"Spatially Dependent data for 2D PDE: %s time = %12.4e seconds. equation set = nonlinear Poisson\",\n",
377 " TITLE = \"Spatially Dependent data for 2D PDE: %s time = %12.4e seconds. equation set = drift diffusion\",\n",
386 " TITLE = \"Spatially Dependent data for 2D PDE: %s time = %12.4e seconds.\",\n",
394 fprintf(fp1,
"%s",
"\tVARIABLES = \"R (cm) \",\"Z (cm)\",\n");
396 fprintf(fp1,
"%s",
"\tVARIABLES = \"X (cm) \",\"Y (cm)\",\n");
398 fprintf(fp1,
"%s",
"\t \"V \",\n");
399 fprintf(fp1,
"%s",
"\t \"nn (electron dens.) \",\n");
400 fprintf(fp1,
"%s",
"\t \"np (hole dens.) \",\n");
401 fprintf(fp1,
"%s",
"\t \"Dopant dens. \",\n");
402 fprintf(fp1,
"%s",
"\t \"abs(Dopant dens.)\",\n");
403 fprintf(fp1,
"%s",
"\t \"total density\",\n");
404 fprintf(fp1,
"%s",
"\t \"electron lifetime \",\n");
405 fprintf(fp1,
"%s",
"\t \"hole lifetime \",\n");
406 fprintf(fp1,
"%s",
"\t \"electron mobility \",\n");
407 fprintf(fp1,
"%s",
"\t \"hole mobility \",\n");
411 fprintf(fp1,
"%s",
"\t \"Ex \",\n");
412 fprintf(fp1,
"%s",
"\t \"Ey \",\n");
413 fprintf(fp1,
"%s",
"\t \"Emag \",\n");
414 fprintf(fp1,
"%s",
"\t \"dDx_dt \",\n");
415 fprintf(fp1,
"%s",
"\t \"dDy_dt \",\n");
416 fprintf(fp1,
"%s",
"\t \"dDmag_dt \",\n");
419 fprintf(fp1,
"%s",
"\t \"Recombination \",\n");
420 fprintf(fp1,
"%s",
"\t \"photogen \",\n");
421 fprintf(fp1,
"%s",
"\t \"total src \",\n");
424 fprintf(fp1,
"\tZONE F=FEPOINT,ET=QUADRILATERAL,N=%d,E=%d",
429 fprintf(fp1,
" T = \"DCOP step = %d\" \n",
callsOTEC);
433 fprintf(fp1,
" T = \"time step = %d\" time = %12.4e seconds\" \n",
callsOTEC , time);
446 fprintf(fp1,
" %12.4e",xLocS);
447 fprintf(fp1,
" %12.4e",yLocS);
452 fprintf(fp1,
" %12.4e",C);
453 fprintf(fp1,
" %12.4e",fabs(C));
455 fprintf(fp1,
" %12.4e",totCharge);
472 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
477 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
485 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
492 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
504 fprintf(fp1,
" %12.4e",Ex);
505 fprintf(fp1,
" %12.4e",Ey);
506 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
508 fprintf(fp1,
" %12.4e",dDx_dt);
509 fprintf(fp1,
" %12.4e",dDy_dt);
510 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
516 fprintf(fp1,
"%s",
"\n");
526 fprintf(fp1,
" %12.4e",xLoc);
527 fprintf(fp1,
" %12.4e",yLoc);
528 fprintf(fp1,
" %12.4e",
VVec[i]);
529 fprintf(fp1,
" %12.4e",
nnVec[i]);
530 fprintf(fp1,
" %12.4e",
npVec[i]);
532 fprintf(fp1,
" %12.4e",C);
533 fprintf(fp1,
" %12.4e",fabs(C));
535 fprintf(fp1,
" %12.4e",totCharge);
536 fprintf(fp1,
" %12.4e",
tnVec[i]);
537 fprintf(fp1,
" %12.4e",
tpVec[i]);
538 fprintf(fp1,
" %12.4e",
unVec[i]);
539 fprintf(fp1,
" %12.4e",
upVec[i]);
552 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
557 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
564 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
571 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
582 fprintf(fp1,
" %12.4e",Ex);
583 fprintf(fp1,
" %12.4e",Ey);
584 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
586 fprintf(fp1,
" %12.4e",dDx_dt);
587 fprintf(fp1,
" %12.4e",dDy_dt);
588 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
591 fprintf(fp1,
" %12.4e",
RVec[i]);
592 fprintf(fp1,
" %12.4e",
SVec[i]);
594 fprintf(fp1,
"%s",
"\n");
598 fprintf(fp1,
"%s",
"\n");
602 UINT inodeA,inodeB,inodeC,inodeD;
611 if(inodeD == -1u) inodeD = inodeC;
613 if((inodeA == -1u || inodeB == -1u ||
614 inodeC == -1u || inodeD == -1u) ||
615 (inodeA == inodeB) || (inodeA == inodeC) ||
618 fprintf(stdout,
"%s",
"Error in ::outputTecplot\n");
619 fprintf(stdout,
"inodeA = %d\n",inodeA);
620 fprintf(stdout,
"inodeB = %d\n",inodeB);
621 fprintf(stdout,
"inodeC = %d\n",inodeC);
622 fprintf(stdout,
"inodeD = %d\n",inodeD);
626 fprintf(fp1,
"%d %d %d %d\n",
638 bsuccess = bsuccess && bs1;
661 bool bsuccess =
true;
664 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
671 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS) &&
getSolverState().debugTimeFlag)
673 Xyce::dout() << std::endl;
674 Xyce::dout() << section_divider << std::endl;
675 Xyce::dout() <<
"In Instance::outputTecplotVectors. filename = ";
676 Xyce::dout() << std::string(filename);
677 Xyce::dout() << std::endl;
680 FILE *fp1 = fopen(filename,
"w");
702 double DeltaX = xMax - xMin;
703 double DeltaY = yMax - yMin;
712 { inx = iNumMeshPoints; iny =
static_cast<int> (iNumMeshPoints * fabs(DeltaY/DeltaX)); }
714 { iny = iNumMeshPoints; inx =
static_cast<int> (iNumMeshPoints * fabs(DeltaX/DeltaY)); }
716 double dx = fabs(DeltaX/static_cast<double>(inx));
718 double dy = fabs(DeltaY/static_cast<double>(iny));
726 double dDx_dt, dDy_dt;
733 Xyce::dout() <<
"outputTecplotVectors:\n";
734 Xyce::dout() <<
"DeltaX = " << DeltaX << std::endl;
735 Xyce::dout() <<
"DeltaY = " << DeltaY << std::endl;
737 Xyce::dout() <<
"xMax = " << xMax << std::endl;
738 Xyce::dout() <<
"xMin = " << xMin << std::endl;
739 Xyce::dout() <<
"yMax = " << yMax << std::endl;
740 Xyce::dout() <<
"yMin = " << yMin << std::endl;
742 Xyce::dout() <<
"dx = " << dx << std::endl;
743 Xyce::dout() <<
"dy = " << dy << std::endl;
745 Xyce::dout() <<
"inx = " << inx << std::endl;
746 Xyce::dout() <<
"iny = " << iny << std::endl;
752 " TITLE = \"Spatially Dependent vector data for 2D PDE: %s time = %12.4e seconds. equation set = nonlinear Poisson\",\n",
758 " TITLE = \"Spatially Dependent vector data for 2D PDE: %s time = %12.4e seconds. equation set = drift diffusion\",\n",
763 fprintf(fp1,
"%s",
"\tVARIABLES = \"R (cm) \",\"Z (cm)\",\n");
765 fprintf(fp1,
"%s",
"\tVARIABLES = \"X (cm) \",\"Y (cm)\",\n");
767 fprintf(fp1,
"%s",
"\t \"V \", \n");
768 fprintf(fp1,
"%s",
"\t \"Ex \", \n");
769 fprintf(fp1,
"%s",
"\t \"Ey \", \n");
770 fprintf(fp1,
"%s",
"\t \"Emag \",\n");
771 fprintf(fp1,
"%s",
"\t \"dDx_dt \", \n");
772 fprintf(fp1,
"%s",
"\t \"dDy_dt \", \n");
773 fprintf(fp1,
"%s",
"\t \"Dmag \",\n");
775 fprintf(fp1,
"\tZONE I=%d, J=%d, F=POINT\n", iny+1, inx+1);
781 for (i=0;i<inx+1;++i)
783 xLoc = xMin +
static_cast<double>(i) * dx;
785 for (j=0;j<iny+1;++j)
787 yLoc = yMin +
static_cast<double>(j) * dy;
789 fprintf(fp1,
" %12.4e",xLoc);
790 fprintf(fp1,
" %12.4e",yLoc);
801 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
808 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
823 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
830 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
839 fprintf(fp1,
" %12.4e",Ex);
840 fprintf(fp1,
" %12.4e",Ey);
841 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
843 fprintf(fp1,
" %12.4e",dDx_dt);
844 fprintf(fp1,
" %12.4e",dDy_dt);
845 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
846 fprintf(fp1,
"%s",
"\n");
852 for (i=0;i<inx+1;++i)
854 xLoc = xMin +
static_cast<double>(i) * dx;
855 for (j=0;j<iny+1;++j)
857 yLoc = yMin +
static_cast<double>(j) * dy;
859 fprintf(fp1,
" %12.4e",xLoc);
860 fprintf(fp1,
" %12.4e",yLoc);
863 fprintf(fp1,
" %12.4e",Vtmp);
871 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
878 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
893 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
900 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
909 fprintf(fp1,
" %12.4e",Ex);
910 fprintf(fp1,
" %12.4e",Ey);
911 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
913 fprintf(fp1,
" %12.4e",dDx_dt);
914 fprintf(fp1,
" %12.4e",dDy_dt);
915 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
916 fprintf(fp1,
"%s",
"\n");
947 bool bsuccess =
true;
950 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
958 UserWarning(*
this) <<
"Gnuplot only works if using the internal mesh.";
968 FILE *fp1 = fopen(filename,
"w");
970 for (j=0;j<iyMax;++j)
972 for (i=0;i<ixMax;++i)
974 int index = nodeIndex[i][j];
982 fprintf(fp1,
"%s",
"\n");
984 fprintf(fp1,
"%s",
"\n");
1005 bool bsuccess =
true;
1008 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
1010 sprintf(filename,
"%s_data.txt",
outputName.c_str());
1016 fp1 = fopen(filename,
"w");
1018 fp1 = fopen(filename,
"a");
1022 double VminOut = 1.0e+99;
1023 double VmaxOut =-1.0e+99;
1024 double NnMinOut = 1.0e+99;
1025 double NnMaxOut =-1.0e+99;
1026 double NpMinOut = 1.0e+99;
1027 double NpMaxOut =-1.0e+99;
1039 fprintf(fp1,
"%s",
"\n");
1040 fprintf(fp1,
"%s",
"---------------------------------------------------------\n");
1043 fprintf(fp1,
"Global data for DC step %4d:\n",
callsOTXT);
1047 fprintf(fp1,
"Global data for time step %4d:\n",
callsOTXT);
1049 fprintf(fp1,
"Current Time = %12.4e\n" , time);
1050 fprintf(fp1,
" Vmin = %12.4e\n", VminOut);
1051 fprintf(fp1,
" Vmax = %12.4e\n", VmaxOut);
1052 fprintf(fp1,
" NnMin = %12.4e\n", NnMinOut);
1053 fprintf(fp1,
" NnMax = %12.4e\n", NnMaxOut);
1054 fprintf(fp1,
" NpMin = %12.4e\n", NpMinOut);
1055 fprintf(fp1,
" NpMax = %12.4e\n", NpMaxOut);
1057 fprintf(fp1,
"%s",
"\n");
1060 std::vector<DeviceInterfaceNode>::iterator firstDI =
dIVec.begin ();
1061 std::vector<DeviceInterfaceNode>::iterator lastDI =
dIVec.end ();
1062 std::vector<DeviceInterfaceNode>::iterator iterDI;
1064 for (iterDI=firstDI; iterDI!=lastDI; ++iterDI)
1072 fprintf(fp1,
"Information for electrode: %s\n", iterDI->eName.c_str());
1073 fprintf(fp1,
"potential: %12.4e\n",
scalingVars.
V0*
VVec[iterDI->firstMeshNodeIndex] );
1074 fprintf(fp1,
" current: %12.4e\n", iterDI->currentSum);
1075 fprintf(fp1,
" charge: %12.4e\n", iterDI->chargeSum);
1076 fprintf(fp1,
" dIdVckt: %12.4e\n", iterDI->dIdVckt);
1077 fprintf(fp1,
" dQdVckt: %12.4e\n", iterDI->dQdVckt);
1078 fprintf(fp1,
"%s",
"\n");
1083 fprintf(fp1,
"%s",
"NOTE: The two-level Newton algorithm was not used.\n");
1084 fprintf(fp1,
"%s",
" This means that the conductances and capacitances\n");
1085 fprintf(fp1,
"%s",
" were not calculated.\n\n");
1090 fprintf(fp1,
"%s",
"Conductance array: \n");
1091 fprintf(fp1,
"%s",
" ");
1094 fprintf(fp1,
"\t%14s",
dIVec[iE2].eName.c_str());
1096 fprintf(fp1,
"%s",
"\n");
1100 fprintf(fp1,
"%14s",
dIVec[iE1].eName.c_str());
1103 fprintf(fp1,
"\t%14.4e",
condVec[iE1][iE2]);
1105 fprintf(fp1,
"%s",
"\n");
1107 fprintf(fp1,
"%s",
"\n");
1109 fprintf(fp1,
"%s",
"Capacitance array: \n");
1110 fprintf(fp1,
"%s",
" ");
1113 fprintf(fp1,
"\t%14s",
dIVec[iE2].eName.c_str());
1115 fprintf(fp1,
"%s",
"\n");
1119 fprintf(fp1,
"%14s",
dIVec[iE1].eName.c_str());
1122 fprintf(fp1,
"\t%14.4e",
capVec[iE1][iE2]);
1124 fprintf(fp1,
"%s",
"\n");
1126 fprintf(fp1,
"%s",
"\n");
1157 {
"SGFramework Result File Version 1.0\n\x1a",
1158 "@~!_RES" "ULT_!~@",
1169 RESHEAD *presheadxyce = &resheadxyce;
1187 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
1191 FILE *nHandle = fopen(filename,
"w");
1193 UINT cConst = Nconst;
1198 fwrite(presheadxyce,
sizeof(
RESHEAD),1,nHandle);
1199 if (cConst) fwrite(axlatconstxyce,
sizeof(
XLATCONST), cConst, nHandle);
1200 if (Narray ) fwrite( paxlat,
sizeof(
XLATARRAY), Narray, nHandle);
1215 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1218 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1221 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1224 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1227 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1230 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1250 void DAXLATARRAY::set (
const char *name, UINT uOffset, UINT cDim, UINT ac0, UINT ac1, UINT ac2)
1254 int istrl = strlen(name);
1261 for(i=0;i<
LEN_IDENT+1;++i) tmpname[i] = 0;
1264 tmpname[i] = name[i];
1266 sprintf(xlattmp.
szName,
"%s",tmpname);
1269 xlattmp.
cDim = cDim;
1293 char tmpArg[16];
for(
int i=0;i<16;++i) tmpArg[i] = 0;
1296 set(
"x" , 0*numMeshPoints,1,numMeshPoints,0,0);
1297 set(
"y" , 1*numMeshPoints,1,numMeshPoints,0,0);
1298 set(
"V" , 2*numMeshPoints,1,numMeshPoints,0,0);
1299 set(
"Ne", 3*numMeshPoints,1,numMeshPoints,0,0);
1300 set(
"Np" , 4*numMeshPoints,1,numMeshPoints,0,0);
1301 set(
"C" , 5*numMeshPoints,1,numMeshPoints,0,0);
std::vector< double > RVec
std::vector< double > displPotential
bool outputPlotFiles(bool force_final_output)
std::vector< double > CVec
int ** getNodeIndexVector()
bool given(const std::string ¶meter_name) const
std::vector< double > outputVec
Pure virtual class to augment a linear system.
std::vector< double > totSrcVec
bool labelEdgeType(std::string &labelName)
std::vector< double > minDXVec
std::vector< UINT > aiEdge
std::vector< double > xVec
std::vector< double > nnVec
std::vector< std::vector< double > > condVec
std::vector< double > tnVec
std::vector< double > VVec
std::vector< double > unVec
double interp(double *F, double r, double z)
std::vector< int > labelIndex
std::vector< DeviceInterfaceNode > dIVec
DAXLATARRAY(int numMeshPoints)
const SolverState & getSolverState() const
std::vector< double > yVec
std::vector< UINT > aiEdge_nf
XLATARRAY * GetPointer(UINT i)
std::vector< double > npVec
PDE_2DMesh * meshContainerPtr
std::vector< double > upVec
bool tecplotGeomOutput(FILE *fp1)
bool outputTecplotVectors()
void set(const char *, UINT, UINT, UINT, UINT, UINT)
double currTime_
DeviceEntity for expression time, breakpoints DeviceMgr for dependent parameters, breakpoints...
std::vector< std::vector< double > > capVec
std::vector< double > SVec
std::vector< double > tpVec