47 #include <Xyce_config.h>
51 #include <N_UTL_Misc.h>
52 #ifdef Xyce_DEBUG_DEVICE
71 #include <N_LAS_Vector.h>
72 #include <N_LAS_System.h>
90 bool skipOutput =
false;
99 given(
"OUTPUTINTERVAL") )
101 double outMult =
static_cast<double> (
outputIndex);
115 if (skipOutput)
return bsuccess;
119 #ifdef Xyce_DEBUG_DEVICE
126 bsuccess = bsuccess && bs1;
132 bsuccess = bsuccess && bs1;
138 bsuccess = bsuccess && bs1;
144 bsuccess = bsuccess && bs1;
150 bsuccess = bsuccess && bs1;
177 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=BLACK, X= .00, Y= .00,");
178 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.8\n");
180 if(iGnum == iNumG) fprintf(fp1,
"\t%d\n",iNumF);
181 else fprintf(fp1,
"\t%d\n",50);
209 fprintf(fp1,
"%4d\n%11.3e %11.3e\n%11.3e %11.3e\n",
221 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=BLACK, X= .00,");
222 fprintf(fp1,
"%s",
" Y= .00,");
223 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.8\n");
224 fprintf(fp1,
"\t%d\n",iNumF);}
228 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=BLACK, X= .00,");
229 fprintf(fp1,
"%s",
" Y= .00,");
230 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.8\n");
231 fprintf(fp1,
"\t%d\n",50);
236 fprintf(fp1,
"%s",
"\n");
243 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=RED, X= .00, Y= .00,");
244 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.2\n");
246 if(iGnum == iNumG) fprintf(fp1,
"\t%d\n",iNumF);
247 else fprintf(fp1,
"\t%d\n",50);
274 fprintf(fp1,
"%4d\n%11.3e %11.3e\n%11.3e %11.3e\n",
286 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=RED, X= .00,");
287 fprintf(fp1,
"%s",
" Y= .00,");
288 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.2\n");
289 fprintf(fp1,
"\t%d\n",iNumF);}
293 fprintf(fp1,
"%s",
"\n GEOMETRY M=GRID, C=RED, X= .00,");
294 fprintf(fp1,
"%s",
" Y= .00,");
295 fprintf(fp1,
"%s",
" T=LINE, F=POINT, LT=0.2\n");
296 fprintf(fp1,
"\t%d\n",50);
301 fprintf(fp1,
"%s",
"\n");
317 bool bsuccess =
true;
321 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
329 sprintf(filename,
"%s.dat",
outputName.c_str());
334 #ifdef Xyce_DEBUG_DEVICE
337 Xyce::dout() << std::endl;
338 Xyce::dout() << section_divider << std::endl;
339 Xyce::dout() <<
"In Instance::outputTecplot. filename = ";
340 Xyce::dout() << std::string(filename);
341 Xyce::dout() << std::endl;
349 fp1 = fopen(filename,
"w");
355 fp1 = fopen(filename,
"w");
359 fp1 = fopen(filename,
"a");
368 double dDx_dt, dDy_dt;
381 " TITLE = \"Spatially Dependent data for 2D PDE: %s time = %12.4e seconds. equation set = nonlinear Poisson\",\n",
387 " TITLE = \"Spatially Dependent data for 2D PDE: %s time = %12.4e seconds. equation set = drift diffusion\",\n",
396 " TITLE = \"Spatially Dependent data for 2D PDE: %s time = %12.4e seconds.\",\n",
404 fprintf(fp1,
"%s",
"\tVARIABLES = \"R (cm) \",\"Z (cm)\",\n");
406 fprintf(fp1,
"%s",
"\tVARIABLES = \"X (cm) \",\"Y (cm)\",\n");
408 fprintf(fp1,
"%s",
"\t \"V \",\n");
409 fprintf(fp1,
"%s",
"\t \"nn (electron dens.) \",\n");
410 fprintf(fp1,
"%s",
"\t \"np (hole dens.) \",\n");
411 fprintf(fp1,
"%s",
"\t \"Dopant dens. \",\n");
412 fprintf(fp1,
"%s",
"\t \"abs(Dopant dens.)\",\n");
413 fprintf(fp1,
"%s",
"\t \"total density\",\n");
414 fprintf(fp1,
"%s",
"\t \"electron lifetime \",\n");
415 fprintf(fp1,
"%s",
"\t \"hole lifetime \",\n");
416 fprintf(fp1,
"%s",
"\t \"electron mobility \",\n");
417 fprintf(fp1,
"%s",
"\t \"hole mobility \",\n");
421 fprintf(fp1,
"%s",
"\t \"Ex \",\n");
422 fprintf(fp1,
"%s",
"\t \"Ey \",\n");
423 fprintf(fp1,
"%s",
"\t \"Emag \",\n");
424 fprintf(fp1,
"%s",
"\t \"dDx_dt \",\n");
425 fprintf(fp1,
"%s",
"\t \"dDy_dt \",\n");
426 fprintf(fp1,
"%s",
"\t \"dDmag_dt \",\n");
429 fprintf(fp1,
"%s",
"\t \"Recombination \",\n");
430 fprintf(fp1,
"%s",
"\t \"photogen \",\n");
431 fprintf(fp1,
"%s",
"\t \"total src \",\n");
434 fprintf(fp1,
"\tZONE F=FEPOINT,ET=QUADRILATERAL,N=%d,E=%d",
439 fprintf(fp1,
" T = \"DCOP step = %d\" \n",
callsOTEC);
443 fprintf(fp1,
" T = \"time step = %d\" time = %12.4e seconds\" \n",
callsOTEC , time);
456 fprintf(fp1,
" %12.4e",xLocS);
457 fprintf(fp1,
" %12.4e",yLocS);
462 fprintf(fp1,
" %12.4e",C);
463 fprintf(fp1,
" %12.4e",fabs(C));
465 fprintf(fp1,
" %12.4e",totCharge);
482 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
487 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
495 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
502 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
514 fprintf(fp1,
" %12.4e",Ex);
515 fprintf(fp1,
" %12.4e",Ey);
516 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
518 fprintf(fp1,
" %12.4e",dDx_dt);
519 fprintf(fp1,
" %12.4e",dDy_dt);
520 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
526 fprintf(fp1,
"%s",
"\n");
536 fprintf(fp1,
" %12.4e",xLoc);
537 fprintf(fp1,
" %12.4e",yLoc);
538 fprintf(fp1,
" %12.4e",
VVec[i]);
539 fprintf(fp1,
" %12.4e",
nnVec[i]);
540 fprintf(fp1,
" %12.4e",
npVec[i]);
542 fprintf(fp1,
" %12.4e",C);
543 fprintf(fp1,
" %12.4e",fabs(C));
545 fprintf(fp1,
" %12.4e",totCharge);
546 fprintf(fp1,
" %12.4e",
tnVec[i]);
547 fprintf(fp1,
" %12.4e",
tpVec[i]);
548 fprintf(fp1,
" %12.4e",
unVec[i]);
549 fprintf(fp1,
" %12.4e",
upVec[i]);
562 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
567 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
574 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
581 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
592 fprintf(fp1,
" %12.4e",Ex);
593 fprintf(fp1,
" %12.4e",Ey);
594 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
596 fprintf(fp1,
" %12.4e",dDx_dt);
597 fprintf(fp1,
" %12.4e",dDy_dt);
598 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
601 fprintf(fp1,
" %12.4e",
RVec[i]);
602 fprintf(fp1,
" %12.4e",
SVec[i]);
604 fprintf(fp1,
"%s",
"\n");
608 fprintf(fp1,
"%s",
"\n");
612 UINT inodeA,inodeB,inodeC,inodeD;
621 if(inodeD == -1u) inodeD = inodeC;
623 if((inodeA == -1u || inodeB == -1u ||
624 inodeC == -1u || inodeD == -1u) ||
625 (inodeA == inodeB) || (inodeA == inodeC) ||
628 fprintf(stdout,
"%s",
"Error in ::outputTecplot\n");
629 fprintf(stdout,
"inodeA = %d\n",inodeA);
630 fprintf(stdout,
"inodeB = %d\n",inodeB);
631 fprintf(stdout,
"inodeC = %d\n",inodeC);
632 fprintf(stdout,
"inodeD = %d\n",inodeD);
636 fprintf(fp1,
"%d %d %d %d\n",
648 bsuccess = bsuccess && bs1;
671 bool bsuccess =
true;
674 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
681 #ifdef Xyce_DEBUG_DEVICE
684 Xyce::dout() << std::endl;
685 Xyce::dout() << section_divider << std::endl;
686 Xyce::dout() <<
"In Instance::outputTecplotVectors. filename = ";
687 Xyce::dout() << std::string(filename);
688 Xyce::dout() << std::endl;
692 FILE *fp1 = fopen(filename,
"w");
714 double DeltaX = xMax - xMin;
715 double DeltaY = yMax - yMin;
724 { inx = iNumMeshPoints; iny =
static_cast<int> (iNumMeshPoints * fabs(DeltaY/DeltaX)); }
726 { iny = iNumMeshPoints; inx =
static_cast<int> (iNumMeshPoints * fabs(DeltaX/DeltaY)); }
728 double dx = fabs(DeltaX/static_cast<double>(inx));
730 double dy = fabs(DeltaY/static_cast<double>(iny));
738 double dDx_dt, dDy_dt;
743 #ifdef Xyce_DEBUG_DEVICE
744 Xyce::dout() <<
"outputTecplotVectors:\n";
745 Xyce::dout() <<
"DeltaX = " << DeltaX << std::endl;
746 Xyce::dout() <<
"DeltaY = " << DeltaY << std::endl;
748 Xyce::dout() <<
"xMax = " << xMax << std::endl;
749 Xyce::dout() <<
"xMin = " << xMin << std::endl;
750 Xyce::dout() <<
"yMax = " << yMax << std::endl;
751 Xyce::dout() <<
"yMin = " << yMin << std::endl;
753 Xyce::dout() <<
"dx = " << dx << std::endl;
754 Xyce::dout() <<
"dy = " << dy << std::endl;
756 Xyce::dout() <<
"inx = " << inx << std::endl;
757 Xyce::dout() <<
"iny = " << iny << std::endl;
763 " TITLE = \"Spatially Dependent vector data for 2D PDE: %s time = %12.4e seconds. equation set = nonlinear Poisson\",\n",
769 " TITLE = \"Spatially Dependent vector data for 2D PDE: %s time = %12.4e seconds. equation set = drift diffusion\",\n",
774 fprintf(fp1,
"%s",
"\tVARIABLES = \"R (cm) \",\"Z (cm)\",\n");
776 fprintf(fp1,
"%s",
"\tVARIABLES = \"X (cm) \",\"Y (cm)\",\n");
778 fprintf(fp1,
"%s",
"\t \"V \", \n");
779 fprintf(fp1,
"%s",
"\t \"Ex \", \n");
780 fprintf(fp1,
"%s",
"\t \"Ey \", \n");
781 fprintf(fp1,
"%s",
"\t \"Emag \",\n");
782 fprintf(fp1,
"%s",
"\t \"dDx_dt \", \n");
783 fprintf(fp1,
"%s",
"\t \"dDy_dt \", \n");
784 fprintf(fp1,
"%s",
"\t \"Dmag \",\n");
786 fprintf(fp1,
"\tZONE I=%d, J=%d, F=POINT\n", iny+1, inx+1);
792 for (i=0;i<inx+1;++i)
794 xLoc = xMin +
static_cast<double>(i) * dx;
796 for (j=0;j<iny+1;++j)
798 yLoc = yMin +
static_cast<double>(j) * dy;
800 fprintf(fp1,
" %12.4e",xLoc);
801 fprintf(fp1,
" %12.4e",yLoc);
812 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
819 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
834 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
841 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
850 fprintf(fp1,
" %12.4e",Ex);
851 fprintf(fp1,
" %12.4e",Ey);
852 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
854 fprintf(fp1,
" %12.4e",dDx_dt);
855 fprintf(fp1,
" %12.4e",dDy_dt);
856 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
857 fprintf(fp1,
"%s",
"\n");
863 for (i=0;i<inx+1;++i)
865 xLoc = xMin +
static_cast<double>(i) * dx;
866 for (j=0;j<iny+1;++j)
868 yLoc = yMin +
static_cast<double>(j) * dy;
870 fprintf(fp1,
" %12.4e",xLoc);
871 fprintf(fp1,
" %12.4e",yLoc);
874 fprintf(fp1,
" %12.4e",Vtmp);
882 Ex = -0.5 * ( (V2x-V1x)+(V1x-V0x) )/dx1;
889 dDx_dt = -0.5 * ( (D2x-D1x)+(D1x-D0x) )/dx1;
904 Ey = -0.5 * ( (V2y-V1y)+(V1y-V0y) )/dy1;
911 dDy_dt = -0.5 * ( (D2y-D1y)+(D1y-D0y) )/dy1;
920 fprintf(fp1,
" %12.4e",Ex);
921 fprintf(fp1,
" %12.4e",Ey);
922 fprintf(fp1,
" %12.4e",sqrt(Ex*Ex + Ey*Ey) );
924 fprintf(fp1,
" %12.4e",dDx_dt);
925 fprintf(fp1,
" %12.4e",dDy_dt);
926 fprintf(fp1,
" %12.4e",sqrt(dDx_dt*dDx_dt + dDy_dt*dDy_dt) );
927 fprintf(fp1,
"%s",
"\n");
958 bool bsuccess =
true;
961 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
969 UserWarning(*
this) <<
"Gnuplot only works if using the internal mesh.";
979 FILE *fp1 = fopen(filename,
"w");
981 for (j=0;j<iyMax;++j)
983 for (i=0;i<ixMax;++i)
985 int index = nodeIndex[i][j];
993 fprintf(fp1,
"%s",
"\n");
995 fprintf(fp1,
"%s",
"\n");
1016 bool bsuccess =
true;
1019 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
1021 sprintf(filename,
"%s_data.txt",
outputName.c_str());
1027 fp1 = fopen(filename,
"w");
1029 fp1 = fopen(filename,
"a");
1033 double VminOut = 1.0e+99;
1034 double VmaxOut =-1.0e+99;
1035 double NnMinOut = 1.0e+99;
1036 double NnMaxOut =-1.0e+99;
1037 double NpMinOut = 1.0e+99;
1038 double NpMaxOut =-1.0e+99;
1050 fprintf(fp1,
"%s",
"\n");
1051 fprintf(fp1,
"%s",
"---------------------------------------------------------\n");
1054 fprintf(fp1,
"Global data for DC step %4d:\n",
callsOTXT);
1058 fprintf(fp1,
"Global data for time step %4d:\n",
callsOTXT);
1060 fprintf(fp1,
"Current Time = %12.4e\n" , time);
1061 fprintf(fp1,
" Vmin = %12.4e\n", VminOut);
1062 fprintf(fp1,
" Vmax = %12.4e\n", VmaxOut);
1063 fprintf(fp1,
" NnMin = %12.4e\n", NnMinOut);
1064 fprintf(fp1,
" NnMax = %12.4e\n", NnMaxOut);
1065 fprintf(fp1,
" NpMin = %12.4e\n", NpMinOut);
1066 fprintf(fp1,
" NpMax = %12.4e\n", NpMaxOut);
1068 fprintf(fp1,
"%s",
"\n");
1071 std::vector<DeviceInterfaceNode>::iterator firstDI =
dIVec.begin ();
1072 std::vector<DeviceInterfaceNode>::iterator lastDI =
dIVec.end ();
1073 std::vector<DeviceInterfaceNode>::iterator iterDI;
1075 for (iterDI=firstDI; iterDI!=lastDI; ++iterDI)
1083 fprintf(fp1,
"Information for electrode: %s\n", iterDI->eName.c_str());
1084 fprintf(fp1,
"potential: %12.4e\n",
scalingVars.
V0*
VVec[iterDI->firstMeshNodeIndex] );
1085 fprintf(fp1,
" current: %12.4e\n", iterDI->currentSum);
1086 fprintf(fp1,
" charge: %12.4e\n", iterDI->chargeSum);
1087 fprintf(fp1,
" dIdVckt: %12.4e\n", iterDI->dIdVckt);
1088 fprintf(fp1,
" dQdVckt: %12.4e\n", iterDI->dQdVckt);
1089 fprintf(fp1,
"%s",
"\n");
1094 fprintf(fp1,
"%s",
"NOTE: The two-level Newton algorithm was not used.\n");
1095 fprintf(fp1,
"%s",
" This means that the condutances and capacitances\n");
1096 fprintf(fp1,
"%s",
" were not calculated.\n\n");
1101 fprintf(fp1,
"%s",
"Conductance array: \n");
1102 fprintf(fp1,
"%s",
" ");
1105 fprintf(fp1,
"\t%14s",
dIVec[iE2].eName.c_str());
1107 fprintf(fp1,
"%s",
"\n");
1111 fprintf(fp1,
"%14s",
dIVec[iE1].eName.c_str());
1114 fprintf(fp1,
"\t%14.4e",
condVec[iE1][iE2]);
1116 fprintf(fp1,
"%s",
"\n");
1118 fprintf(fp1,
"%s",
"\n");
1120 fprintf(fp1,
"%s",
"Capacitance array: \n");
1121 fprintf(fp1,
"%s",
" ");
1124 fprintf(fp1,
"\t%14s",
dIVec[iE2].eName.c_str());
1126 fprintf(fp1,
"%s",
"\n");
1130 fprintf(fp1,
"%14s",
dIVec[iE1].eName.c_str());
1133 fprintf(fp1,
"\t%14.4e",
capVec[iE1][iE2]);
1135 fprintf(fp1,
"%s",
"\n");
1137 fprintf(fp1,
"%s",
"\n");
1168 {
"SGFramework Result File Version 1.0\n\x1a",
1169 "@~!_RES" "ULT_!~@",
1180 RESHEAD *presheadxyce = &resheadxyce;
1198 char filename[32];
for(i=0;i<32;++i) filename[i] = static_cast<char>(0);
1202 FILE *nHandle = fopen(filename,
"w");
1204 UINT cConst = Nconst;
1205 for(i = 0; i < Nconst; ++i)
1206 axlatconstxyce[i].data.n = static_cast<int> (axlatconstxyce[i].data.r);
1208 fwrite(presheadxyce,
sizeof(
RESHEAD),1,nHandle);
1209 if (cConst) fwrite(axlatconstxyce,
sizeof(
XLATCONST), cConst, nHandle);
1210 if (Narray ) fwrite( paxlat,
sizeof(
XLATARRAY), Narray, nHandle);
1225 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1228 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1231 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1234 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1237 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1240 fwrite( &(
outputVec[0]),
sizeof(
double), numMeshPoints, nHandle);
1260 void DAXLATARRAY::set (
const char *name, UINT uOffset, UINT cDim, UINT ac0, UINT ac1, UINT ac2)
1264 int istrl = strlen(name);
1271 for(i=0;i<
LEN_IDENT+1;++i) tmpname[i] = 0;
1274 tmpname[i] = name[i];
1276 sprintf(xlattmp.
szName,
"%s",tmpname);
1279 xlattmp.
cDim = cDim;
1303 char tmpArg[16];
for(
int i=0;i<16;++i) tmpArg[i] = 0;
1306 set(
"x" , 0*numMeshPoints,1,numMeshPoints,0,0);
1307 set(
"y" , 1*numMeshPoints,1,numMeshPoints,0,0);
1308 set(
"V" , 2*numMeshPoints,1,numMeshPoints,0,0);
1309 set(
"Ne", 3*numMeshPoints,1,numMeshPoints,0,0);
1310 set(
"Np" , 4*numMeshPoints,1,numMeshPoints,0,0);
1311 set(
"C" , 5*numMeshPoints,1,numMeshPoints,0,0);