19#include <gsl/gsl_cblas.h>
20#include <gsl/gsl_linalg.h>
21#include <gsl/gsl_matrix.h>
41 double time_begin = 0., time_end = 0.;
44 "----------------------------------------------------------------\n\n");
45 printf(
"ComputeSolution: neBEM solution begins ...\n");
47 printf(
" NewModel: %d, NewMesh: %d, NewBC: %d, NewPP: %d\n",
50 " ModelCntr: %d, MeshCntr: %d, BCCntr: %d, PPCntr: %d\n",
79 printf(
"Cannot proceed with OptSVD, OptLU and OptGSL zero.\n");
80 printf(
"Assuming the safer option OptSVD = 1.\n");
86 printf(
"Cannot proceed with all OptSVD, OptLU and OptGSL one.\n");
87 printf(
"Assuming the safer option OptSVD = 1.\n");
96 "ComputeSolution: Simultaneous presence of OptSystemChargeZero && "
97 "NbFloatingConductors!\n");
98 printf(
" Returning ...\n");
114 printf(
"Number of floating conductors > 1! ... not yet implemented.\n");
115 printf(
"Returning\n");
140 printf(
"ComputeSolution: LHMatrix ... ");
143 time_begin = omp_get_wtime();
147 time_end = omp_get_wtime();
148 printf(
"Elapsed time: %lg\n", time_end - time_begin);
154 printf(
"ComputeSolution: LHMatrix done!\n");
158 printf(
"to setup influence matrix.\n");
161 printf(
"ComputeSolution: Inverting influence matrix ...\n");
168 printf(
"ComputeSolution: Matrix inversion over.\n");
171 printf(
"to invert influence matrix.\n");
178 "ComputeSolution: Reading inverted matrix ... will take time ...");
187 printf(
"to read inverted influence matrix.\n");
189 neBEMMessage(
"ComputeSolution - NewBC but no InvMat ... ");
202 printf(
"ComputeSolution: neBEMKnownCharges ... ");
209 printf(
"ComputeSolution: neBEMKnownCharges done!\n");
213 printf(
"to set up neBEMKnownCharges.\n");
217 printf(
"ComputeSolution: neBEMChargingUp ... ");
224 printf(
"ComputeSolution: neBEMChargingUp done!\n");
228 printf(
"to set up neBEMChargingUp.\n");
232 printf(
"ComputeSolution: RHVector ... ");
239 printf(
"ComputeSolution: RHVector done!\n");
243 printf(
"to set up RH vector.\n");
249 printf(
"ComputeSolution: Solve ... ");
252 time_begin = omp_get_wtime();
256 time_end = omp_get_wtime();
257 printf(
"Elapsed time: %lg\n", time_end - time_begin);
263 printf(
"ComputeSolution: Solve done!\n");
267 printf(
"to compute solution.\n");
279 printf(
"ComputeSolution: neBEM solution ends ...\a\n");
309 "\nLHMatrix: The size of the Influence coefficient matrix is %d X %d\n",
328 printf(
"Computing influence coefficient matrix ... will take time ...\n");
331 int nthreads = 1, tid = 0;
332 #pragma omp parallel private(nthreads, tid)
337 tid = omp_get_thread_num();
339 nthreads = omp_get_num_threads();
340 printf(
"Starting influence matrix computation with %d threads\n",
348 for (
int elefld = 1; elefld <=
NbElements; ++elefld) {
354 const double xfld = (
EleArr + elefld - 1)->BC.CollPt.X;
355 const double yfld = (
EleArr + elefld - 1)->BC.CollPt.Y;
356 const double zfld = (
EleArr + elefld - 1)->BC.CollPt.Z;
361 for (
int elesrc = 1; elesrc <=
NbElements; ++elesrc) {
363 printf(
"\n\nelefld: %d, elesrc: %d\n", elefld, elesrc);
367 const int primsrc = (
EleArr + elesrc - 1)->PrimitiveNb;
368 const double xsrc = (
EleArr + elesrc - 1)->G.Origin.X;
369 const double ysrc = (
EleArr + elesrc - 1)->G.Origin.Y;
370 const double zsrc = (
EleArr + elesrc - 1)->G.Origin.Z;
372 if ((
EleArr + elesrc - 1)->E.Type == 0) {
374 "LHMatrix: Wrong EType for elesrc %d element %d on %dth "
376 elesrc, (
EleArr + elesrc - 1)->Id, primsrc);
391 double TransformationMatrix[3][3] = {{0.0, 0.0, 0.0},
396 TransformationMatrix[0][0] = DirCos->
XUnit.
X;
397 TransformationMatrix[0][1] = DirCos->
XUnit.
Y;
398 TransformationMatrix[0][2] = DirCos->
XUnit.
Z;
399 TransformationMatrix[1][0] = DirCos->
YUnit.
X;
400 TransformationMatrix[1][1] = DirCos->
YUnit.
Y;
401 TransformationMatrix[1][2] = DirCos->
YUnit.
Z;
402 TransformationMatrix[2][0] = DirCos->
ZUnit.
X;
403 TransformationMatrix[2][1] = DirCos->
ZUnit.
Y;
404 TransformationMatrix[2][2] = DirCos->
ZUnit.
Z;
406 double InitialVector[3] = {xfld - xsrc, yfld - ysrc, zfld - zsrc};
407 double FinalVector[3] = {0., 0., 0.};
408 for (
int i = 0; i < 3; ++i) {
409 for (
int j = 0; j < 3; ++j) {
410 FinalVector[i] += TransformationMatrix[i][j] * InitialVector[j];
414 localP.
X = FinalVector[0];
415 localP.
Y = FinalVector[1];
416 localP.
Z = FinalVector[2];
420 if ((elefld == 0) && (elesrc == 0))
426 &(
EleArr + elesrc - 1)->G.DC);
428 printf(
"elefld: %d, elesrc: %d, Influence: %.16lg\n", elefld,
429 elesrc,
Inf[elefld][elesrc]);
438 "Mirror not correctly implemented in this version of neBEM "
470 double XOfRpt = xsrc +
XPeriod[primsrc] * (double)xrpt;
474 double YOfRpt = ysrc +
YPeriod[primsrc] * (double)yrpt;
478 double ZOfRpt = zsrc +
ZPeriod[primsrc] * (double)zrpt;
480 if ((xrpt == 0) && (yrpt == 0) && (zrpt == 0))
486 double TransformationMatrix[3][3] = {
492 TransformationMatrix[0][0] = DirCos->
XUnit.
X;
493 TransformationMatrix[0][1] = DirCos->
XUnit.
Y;
494 TransformationMatrix[0][2] = DirCos->
XUnit.
Z;
495 TransformationMatrix[1][0] = DirCos->
YUnit.
X;
496 TransformationMatrix[1][1] = DirCos->
YUnit.
Y;
497 TransformationMatrix[1][2] = DirCos->
YUnit.
Z;
498 TransformationMatrix[2][0] = DirCos->
ZUnit.
X;
499 TransformationMatrix[2][1] = DirCos->
ZUnit.
Y;
500 TransformationMatrix[2][2] = DirCos->
ZUnit.
Z;
503 double InitialVector[3] = {xfld - XOfRpt, yfld - YOfRpt, zfld - ZOfRpt};
504 double FinalVector[3] = {0., 0., 0.};
505 for (
int i = 0; i < 3; ++i) {
506 for (
int j = 0; j < 3; ++j) {
508 TransformationMatrix[i][j] * InitialVector[j];
512 localP.
X = FinalVector[0];
513 localP.
Y = FinalVector[1];
514 localP.
Z = FinalVector[2];
520 &(
EleArr + elesrc - 1)->G.DC);
521 Inf[elefld][elesrc] += AddnalInfl;
524 printf(
"REPEATED\n");
525 printf(
"elefld: %d, elesrc: %d\n", elefld, elesrc);
526 printf(
"xsrc: %lg, ysrc: %lg, zsrc: %lg\n", xsrc, ysrc,
528 printf(
"xrpt: %d, yrpt: %d, zrpt: %d\n", xrpt, yrpt,
530 printf(
"XOfRpt: %lg, YOfRpt: %lg, ZOfRpt: %lg\n", XOfRpt,
532 printf(
"AddnalInfl: %lg\n", AddnalInfl);
533 printf(
"Inf: %lg\n",
Inf[elefld][elesrc]);
541 "Mirror not correctly implemented in this version of "
570 Inf[elefld][elesrc] -=
573 Inf[elefld][elesrc] += AddnalInfl;
585 Inf[elefld][elesrc] -=
588 Inf[elefld][elesrc] += AddnalInfl;
600 Inf[elefld][elesrc] -=
603 Inf[elefld][elesrc] += AddnalInfl;
607 printf(
"REPEATED and reflected\n");
608 printf(
"elefld: %d, elesrc: %d\n", elefld, elesrc);
609 printf(
"xsrc: %lg, ysrc: %lg, zsrc: %lg\n", xsrc, ysrc,
611 printf(
"xrpt: %d, yrpt: %d, zrpt: %d\n", xrpt, yrpt,
613 printf(
"XOfRpt: %lg, YOfRpt: %lg, ZOfRpt: %lg\n",
614 XOfRpt, YOfRpt, ZOfRpt);
615 printf(
"AddnalInfl: %lg\n", AddnalInfl);
616 printf(
"Inf: %lg\n",
Inf[elefld][elesrc]);
642 for (
int row = 1; row <=
NbEqns; ++row) {
643 if (((
EleArr + row - 1)->E.Type == 1) ||
644 ((
EleArr + row - 1)->E.Type == 3))
666 for (
int row = 1; row <=
NbEqns; ++row) {
667 int etfld = (
EleArr + row - 1)->E.Type;
676 int etfld = (
EleArr + col - 1)->E.Type;
693 printf(
"storing the influence matrix in a formatted file ...\n");
698 strcat(InflFile,
"/Infl.out");
699 FILE *fInf = fopen(InflFile,
"w+");
706 for (
int elefld = 1; elefld <=
NbEqns; ++elefld) {
707 for (
int elesrc = 1; elesrc <=
NbUnknowns; ++elesrc)
708 fprintf(fInf,
"%.16lg\n",
Inf[elefld][elesrc]);
719 "LHMatrix - Binary write of Infl matrix not implemented yet.\n");
724 strcat(InflFile,
"/RawInfl.out");
725 FILE *fInf = fopen(InflFile,
"wb");
730 printf(
"\nfInf: %p\n", (
void *)fInf);
733 printf(
"\nNb of items successfully written in raw mode in %s is %d\n",
1242 printf(
"InvertMatrix: matrix decomposition using GSL ... ");
1243 printf(
"no OpenMP implementation ...");
1250 gsl_permutation *perm = gsl_permutation_alloc(
NbUnknowns);
1253 for (
int j = 0; j <
NbEqns; ++j)
1254 gsl_matrix_set(m, i, j,
Inf[i + 1][j + 1]);
1257 gsl_linalg_LU_decomp(m, perm, &s);
1260 gsl_linalg_LU_invert(m, perm, inverse);
1263 for (
int j = 0; j <
NbEqns; ++j)
1264 InvMat[i + 1][j + 1] = gsl_matrix_get(inverse, i, j);
1267 gsl_matrix_free(inverse);
1268 printf(
"InvertMatrix: ... completed using GSL\n");
1272 printf(
"InvertMatrix: matrix decomposition using SVD ... ");
1273 printf(
"no OpenMP implementation ...");
1276 clock_t SVDstartClock = clock();
1277 printf(
"ComputeSolution: Decomposing influence matrix ...\n");
1282 double **SVDInf, *SVDw, **SVDv;
1288 for (
int i = 1; i <=
NbEqns; i++) {
1291 #pragma omp parallel for private(j)
1294 SVDInf[i][j] =
Inf[i][j];
1302 printf(
"ComputeSolution: Matrix decomposition over.\n");
1303 clock_t SVDstopClock = clock();
1305 printf(
"to singular value decompose the influence matrix.\n");
1317 #pragma omp parallel for private(i)
1319 for (i = 1; i <=
NbEqns; i++)
1323 tmpmat[j][i] = SVDInf[i][j] / SVDw[j];
1332 for (
int j = 1; j <=
NbEqns; j++) {
1338#pragma omp parallel for private(k) reduction(+ : sum)
1341 sum += SVDv[i][k] * tmpmat[k][j];
1351 printf(
"InvertMatrix: completed using SVD ...\n");
1357 double d, *col, **y;
1364 for (
int i = 1; i <=
NbEqns; i++)
1368 #pragma omp parallel for private(j)
1371 tmpInf[i][j] =
Inf[i][j];
1374 printf(
"InvertMatrix: matrix decomposition using LU ... ");
1382 #pragma omp parallel for private(i)
1391 #pragma omp parallel for private(i)
1393 for (i = 1; i <=
NbEqns; i++) {
1405 printf(
"InvertMatrix: completed using LU ...\n");
1422 printf(
"storing the inverted matrix in a formatted file ...\n");
1428 strcat(InvMFile,
"/InvMat.out");
1429 fInv = fopen(InvMFile,
"w");
1433 for (
int i = 1; i <=
NbEqns; i++)
1435 fprintf(fInv,
"%.16le\n",
InvMat[i][j]);
1443 neBEMMessage(
"InvertMatrix - Binary write not yet implemented.");
1458 printf(
"DecomposeMatrix: matrix decomposition using SVD ... ");
1461 printf(
"DecomposeMatrix: decomposition completed ...\n");
1466 #pragma omp parallel
1471 #pragma omp for private(j)
1474 if (SVDw[j] > wmax) wmax = SVDw[j];
1481 wmin = wmax * 1.0e-12;
1483 #pragma omp parallel
1488 #pragma omp for private(j)
1491 if (SVDw[j] < wmin) SVDw[j] = 0.0;
1511 "ReadInvertedMatrix: OptFormattedFile and OptUnformattedFile, both are "
1514 " Can not read inverted matrix ... returning ...\n");
1532 strcat(InvMFile,
"/InvMat.out");
1533 fInv = fopen(InvMFile,
"r");
1536 neBEMMessage(
"ReadInvertedMatrix - inverted matrix not found.");
1545 int chkNbEqns, chkNbUnknowns;
1546 fscanf(fInv,
"%d %d\n", &chkNbEqns, &chkNbUnknowns);
1549 "ReadInvertedMatrix - inverted matrix imension do not match!");
1553 printf(
"ReadInvertedMatrix: Matrix dimensions: %d equations, %d unknowns\n",
1557 for (
int i = 1; i <=
NbEqns; i++) {
1560 fscanf(fInv,
"%le\n", &
InvMat[i][j]);
1562 printf(
"\b\b\b\b\b\b");
1570 neBEMMessage(
"ReadInvertedMatrix - Binary read not yet implemented.");
1582 printf(
"In ComputeInfluence ...\n");
1588 printf(
"\nContinuity satisfaction using following parameters ...\n");
1589 printf(
"gtsrc: %d, lxsrc: %lg, lzsrc% lg, dA: %lg\n",
1590 (
EleArr + elesrc - 1)->G.Type, (
EleArr + elesrc - 1)->G.LX,
1591 (
EleArr + elesrc - 1)->G.LZ, (
EleArr + elesrc - 1)->G.dA);
1592 printf(
"xlocal: %lg, ylocal: %lg, zlocal: %lg\n", localP->
X, localP->
Y,
1596 switch ((
EleArr + elefld - 1)
1605 printf(
"Conductors with specific charge not implemented yet.\n");
1632 printf(
"Symmetry boundary, E parallel not implemented yet. \n");
1637 printf(
"Symmetry boundary, E perpendicular not implemented yet. \n");
1642 printf(
"Electric type %d out of range! ... exiting.\n",
1643 (
EleArr + elefld - 1)->E.Type);
1688 printf(
"In SatisfyValue ...\n");
1693 switch ((
EleArr + elesrc - 1)->G.Type) {
1695 value =
RecPot(elesrc, localP);
1700 value =
TriPot(elesrc, localP);
1705 value =
WirePot(elesrc, localP);
1710 printf(
"Geometrical type out of range! ... exiting ...\n");
1727 printf(
"In SatisfyContinuity ...\n");
1747 if ((elefld == elesrc) &&
1748 (fabs(localP->
X) < (
EleArr + elesrc - 1)->G.LX / 2.0) &&
1751 (
EleArr + elesrc - 1)->G.LZ / 2.0))
1753 value = 1.0 / (2.0 *
EPS0 * (
EleArr + elesrc - 1)->E.Lambda);
1758 switch ((
EleArr + elesrc - 1)->G.Type) {
1760 RecFlux(elesrc, localP, &localF);
1763 TriFlux(elesrc, localP, &localF);
1769 printf(
"Geometrical type out of range! ... exiting ...\n");
1904 double value, valueKnCh, valueChUp;
1909 strcat(outfile,
"/BCondns.out");
1910 FILE *fout = fopen(outfile,
"w");
1911 fprintf(fout,
"#BCondn Vector\n");
1912 fprintf(fout,
"#elefld\tAssigned\tBC\tKnCh\tChUp\tRHValue\n");
1914 printf(
"created BCondns.out file ...\n");
1917 for (
int elefld = 1; elefld <=
NbElements; ++elefld) {
1918 value = valueKnCh = valueChUp = 0.0;
1919 switch ((
EleArr + elefld - 1)->E.Type) {
1921 value = (
EleArr + elefld - 1)->BC.Value;
1925 RHS[elefld] = value - valueKnCh - valueChUp;
1928 printf(
"Conducting surface with charge not implemented.\n");
1935 RHS[elefld] = value - valueKnCh - valueChUp;
1942 RHS[elefld] = value - valueKnCh - valueChUp;
1944 (
EleArr + elefld - 1)->Assigned;
1950 RHS[elefld] = value - valueKnCh - valueChUp;
1952 (
EleArr + elefld - 1)->Assigned;
1957 printf(
"Symmetry boundary, E parallel not implemented yet.\n");
1961 printf(
"Symmetry boundary, E perpendicular not implemented yet.\n");
1965 printf(
"elefld in RHVector out of range ... returning\n");
1968 fprintf(fout,
"%d\t%le\t%le\t%le\t%le\t%le\n", elefld,
1969 (
EleArr + elefld - 1)->Assigned, value, valueKnCh, valueChUp,
1978 double assigned, dA, SumAssigned = 0.0;
1980 for (
int ele = 1; ele <=
NbElements; ++ele) {
1981 assigned = (
EleArr + ele - 1)->Assigned;
1982 dA = (
EleArr + ele - 1)->G.dA;
1983 SumAssigned += assigned * dA;
1996 printf(
"computations for RHVector completed ...\n");
2039 double xfld = (
EleArr + elefld - 1)->BC.CollPt.X;
2040 double yfld = (
EleArr + elefld - 1)->BC.CollPt.Y;
2041 double zfld = (
EleArr + elefld - 1)->BC.CollPt.Z;
2050 for (
int elesrc = 1; elesrc <=
NbElements; ++elesrc) {
2051 double assigned = (
EleArr + elesrc - 1)->Assigned;
2052 if (fabs(assigned) <= 1.0e-16)
continue;
2055 if ((
EleArr + elesrc - 1)->E.Type == 0) {
2056 printf(
"Wrong EType for elesrc %d element %d on %dth primitive!\n",
2057 elesrc, (
EleArr + elesrc - 1)->Id,
2058 (
EleArr + elesrc - 1)->PrimitiveNb);
2065 globalP.
X = xfld - pOrigin->
X;
2066 globalP.Y = yfld - pOrigin->
Y;
2067 globalP.Z = zfld - pOrigin->
Z;
2070 double TransformationMatrix[3][3] = {{0.0, 0.0, 0.0},
2075 TransformationMatrix[0][0] = DirCos->
XUnit.
X;
2076 TransformationMatrix[0][1] = DirCos->
XUnit.
Y;
2077 TransformationMatrix[0][2] = DirCos->
XUnit.
Z;
2078 TransformationMatrix[1][0] = DirCos->
YUnit.
X;
2079 TransformationMatrix[1][1] = DirCos->
YUnit.
Y;
2080 TransformationMatrix[1][2] = DirCos->
YUnit.
Z;
2081 TransformationMatrix[2][0] = DirCos->
ZUnit.
X;
2082 TransformationMatrix[2][1] = DirCos->
ZUnit.
Y;
2083 TransformationMatrix[2][2] = DirCos->
ZUnit.
Z;
2085 double InitialVector[3] = {xfld - pOrigin->X, yfld - pOrigin->Y, zfld - pOrigin->Z};
2086 double FinalVector[3] = {0., 0., 0.};
2087 for (
int i = 0; i < 3; ++i) {
2088 for (
int j = 0; j < 3; ++j) {
2089 FinalVector[i] += TransformationMatrix[i][j] * InitialVector[j];
2093 localP.X = FinalVector[0];
2094 localP.Y = FinalVector[1];
2095 localP.Z = FinalVector[2];
2098 switch ((
EleArr + elesrc - 1)->G.Type) {
2100 value += assigned *
RecPot(elesrc, &localP);
2104 value += assigned *
TriPot(elesrc, &localP);
2108 value += assigned *
WirePot(elesrc, &localP);
2112 printf(
"Geometrical type out of range! ... exiting ...\n");
2119 printf(
"value after known charges on elements: %g\n", value);
2130 printf(
"value after known charges at points: %g\n", value);
2139 (
LineKnChArr + line - 1)->Radius, globalP, &tmpglobalF) /
2143 printf(
"value after known charges on lines: %g\n", value);
2151 ((
AreaKnChArr + area - 1)->Vertex), globalP, &tmpglobalF) /
2155 printf(
"value after known charges on areas: %g\n", value);
2167 printf(
"value after known charges in volumes: %g\n", value);
2186 double xfld = (
EleArr + elefld - 1)->BC.CollPt.X;
2187 double yfld = (
EleArr + elefld - 1)->BC.CollPt.Y;
2188 double zfld = (
EleArr + elefld - 1)->BC.CollPt.Z;
2196 for (
int elesrc = 1; elesrc <=
NbElements; ++elesrc) {
2197 double assigned = (
EleArr + elesrc - 1)->Assigned;
2198 if (fabs(assigned) <= 1.0e-16)
continue;
2203 if ((
EleArr + elesrc - 1)->E.Type == 0) {
2204 printf(
"Wrong EType for elesrc %d element %d on %dth primitive!\n",
2205 elesrc, (
EleArr + elesrc - 1)->Id,
2206 (
EleArr + elesrc - 1)->PrimitiveNb);
2216 double TransformationMatrix[3][3] = {{0.0, 0.0, 0.0},
2221 TransformationMatrix[0][0] = DirCos->
XUnit.
X;
2222 TransformationMatrix[0][1] = DirCos->
XUnit.
Y;
2223 TransformationMatrix[0][2] = DirCos->
XUnit.
Z;
2224 TransformationMatrix[1][0] = DirCos->
YUnit.
X;
2225 TransformationMatrix[1][1] = DirCos->
YUnit.
Y;
2226 TransformationMatrix[1][2] = DirCos->
YUnit.
Z;
2227 TransformationMatrix[2][0] = DirCos->
ZUnit.
X;
2228 TransformationMatrix[2][1] = DirCos->
ZUnit.
Y;
2229 TransformationMatrix[2][2] = DirCos->
ZUnit.
Z;
2231 double InitialVector[3] = {xfld - pOrigin->
X, yfld - pOrigin->
Y, zfld - pOrigin->
Z};
2232 double FinalVector[3] = {0., 0., 0.};
2233 for (
int i = 0; i < 3; ++i) {
2234 for (
int j = 0; j < 3; ++j) {
2235 FinalVector[i] += TransformationMatrix[i][j] * InitialVector[j];
2239 localP.X = FinalVector[0];
2240 localP.Y = FinalVector[1];
2241 localP.Z = FinalVector[2];
2249 if ((elefld == elesrc) &&
2250 (fabs(localP.X) < (
EleArr + elesrc - 1)->G.LX / 2.0) &&
2252 (fabs(localP.Z) < (
EleArr + elesrc - 1)->G.LZ / 2.0)) {
2253 value += assigned * 1.0 / (2.0 *
EPS0 * (
EleArr + elesrc - 1)->E.Lambda);
2256 if ((
EleArr + elesrc - 1)->E.Type == 0) {
2257 printf(
"Wrong EType for elesrc %d element %d on %dth primitive!\n",
2258 elesrc, (
EleArr + elesrc - 1)->Id,
2259 (
EleArr + elesrc - 1)->PrimitiveNb);
2264 switch ((
EleArr + elesrc - 1)->G.Type) {
2266 RecFlux(elesrc, &localP, &localF);
2269 TriFlux(elesrc, &localP, &localF);
2272 WireFlux(elesrc, &localP, &localF);
2275 printf(
"Geometrical type out of range! ... exiting ...\n");
2287 value -= assigned * localF.Y;
2294 printf(
"value: %g\n", value);
2369 printf(
"In ValueChUp ...\n");
2373 printf(
"Influence matrix NOT in memory ...\n");
2376 printf(
"reading influence coefficient matrix from formatted file...\n");
2380 strcat(InflFile,
"/Infl.out");
2381 FILE *fInf = fopen(InflFile,
"r");
2388 int chkNbEqns, chkNbUnknowns;
2389 fscanf(fInf,
"%d %d\n", &chkNbEqns, &chkNbUnknowns);
2391 neBEMMessage(
"Solve - matrix dimension do not match!");
2395 printf(
"Solve: Matrix dimensions: %d equations, %d unknowns\n",
NbEqns,
2400 for (
int ifld = 1; ifld <=
NbEqns; ++ifld)
2401 for (
int jsrc = 1; jsrc <=
NbUnknowns; ++jsrc)
2402 fscanf(fInf,
"%le\n", &
Inf[ifld][jsrc]);
2405 printf(
"repeating influence coefficient matrix computation ...\n");
2416 neBEMMessage(
"Solve - Binary read of Infl matrix not implemented yet.\n");
2425 for (
int elesrc = 1; elesrc <=
NbElements; ++elesrc) {
2426 value +=
Inf[elefld][elesrc] * (
EleArr + elesrc - 1)->Assigned;
2428 printf(
"elesrc, Inf, Assigned, value: %d, %lg, %lg, %lg\n", elesrc,
2429 Inf[elefld][elesrc], (
EleArr + elesrc - 1)->Assigned, value);
2433 printf(
"Exiting ValueChUp ...\n");
2442 double **RawInf = NULL;
2448 printf(
"\ncomputing solution for each element: ");
2451 printf(
"%6d ...", i);
2457 #pragma omp parallel for private(j) reduction(+ : sum)
2464 printf(
"\b\b\b\b\b\b\b\b\b\b");
2468 printf(
"\nsolution over for all elements ...\n");
2474 printf(
"\nsolution over for system charge zero constraint ...\n");
2481 "\nsolution over for floating conductor charge zero constraint "
2490 strcat(SolnFile,
"/Soln.out");
2491 FILE* fSoln = fopen(SolnFile,
"w");
2492 if (fSoln == NULL) {
2496 fprintf(fSoln,
"#EleNb\tX\tY\tZ\tSolution\tAssigned\tTotal\n");
2497 for (
int ele = 1; ele <=
NbElements; ++ele) {
2499 fprintf(fSoln,
"%d\t%lg\t%lg\t%lg\t%.16lg\t%.16lg\t%.16lg\n", ele,
2500 (
EleArr + ele - 1)->G.Origin.X, (
EleArr + ele - 1)->G.Origin.Y,
2501 (
EleArr + ele - 1)->G.Origin.Z, (
EleArr + ele - 1)->Solution,
2502 (
EleArr + ele - 1)->Assigned,
2503 ((
EleArr + ele - 1)->Solution + (
EleArr + ele - 1)->Assigned));
2508 fprintf(fSoln,
"#NbSystemChargeZero\tVSystemChargeZero\n");
2512 fprintf(fSoln,
"#NbFloatCon\tVFloatCon\n");
2520 char PrimSolnFile[256];
2522 strcat(PrimSolnFile,
"/PrimSoln.out");
2523 FILE *fPrimSoln = fopen(PrimSolnFile,
"w");
2524 if (fPrimSoln == NULL) {
2528 fprintf(fPrimSoln,
"#PrimNb\tEleBgn\tEleEnd\tX\tY\tZ\tAvChDen\tAvAsgndChDen\n");
2536 area += (
EleArr + ele - 1)->G.dA;
2539 (
EleArr + ele - 1)->Assigned * (
EleArr + ele - 1)->G.dA;
2545 fprintf(fPrimSoln,
"%d\t%d\t%d\t%lg\t%lg\t%lg\t%.16lg\t%.16g\n", prim,
2563 printf(
"Computing solution at the collocation points for comparison.\n");
2567 printf(
"Influence matrix in memory ...\n");
2576 printf(
"Influence matrix in memory ...\n");
2578 printf(
"Influence matrix NOT in memory ...\n");
2581 printf(
"repeating influence coefficient matrix computation ...\n");
2593 "reading influence coefficient matrix from formatted file...\n");
2597 strcat(InflFile,
"/Infl.out");
2598 FILE *fInf = fopen(InflFile,
"r");
2605 int chkNbEqns, chkNbUnknowns;
2606 fscanf(fInf,
"%d %d\n", &chkNbEqns, &chkNbUnknowns);
2608 neBEMMessage(
"Solve - matrix dimension do not match!");
2612 printf(
"Solve: Matrix dimensions: %d equations, %d unknowns\n",
2617 for (
int elefld = 1; elefld <=
NbEqns; ++elefld)
2618 for (
int elesrc = 1; elesrc <=
NbUnknowns; ++elesrc)
2619 fscanf(fInf,
"%le\n", &
Inf[elefld][elesrc]);
2625 "Solve - Binary read of Infl matrix not implemented yet.\n");
2631 "reading influence coefficient matrix from unformatted file "
2636 strcat(InflFile,
"/RawInfl.out");
2637 printf(
"\nread from file %s\n", InflFile);
2639 FILE *fInf = fopen(InflFile,
"rb");
2645 printf(
"\nfInf: %p\n", (
void *)fInf);
2648 printf(
"\nNb of items successfully read from raw mode in %s is %d\n",
2652 for (
int unknown = 1; unknown <=
NbUnknowns; ++unknown)
2653 for (
int eqn = 1; eqn <=
NbEqns; ++eqn)
2655 "Unknown:%d, Eqn:%d => diff Inf: %lg, RawInf: %lg is %lg\n",
2656 unknown, eqn,
Inf[unknown][eqn], RawInf[unknown][eqn],
2657 fabs(
Inf[unknown][eqn] - RawInf[unknown][eqn]));
2664 if (
Inf || RawInf) {
2668 strcat(Chkfile,
"/XChk.out");
2669 FILE *fChk = fopen(Chkfile,
"w");
2674 fprintf(fChk,
"#Row\tGivenPot\tError\n");
2676 int ElementOfMaxError = 1;
2677 double *Error, MaxError = 0.0;
2681 #pragma omp parallel for private(elesrc)
2683 for (
int elefld = 1; elefld <=
NbEqns; elefld++) {
2685 for (elesrc = 1; elesrc <=
NbUnknowns; elesrc++) {
2688 XChk += RawInf[elefld][elesrc] *
Solution[elesrc];
2692 Error[elefld] = fabs(
RHS[elefld] - XChk);
2694 if (Error[elefld] > MaxError) {
2695 MaxError = Error[elefld];
2696 ElementOfMaxError = elefld;
2699 for (
int elefld = 1; elefld <=
NbEqns; elefld++)
2700 fprintf(fChk,
"%d\t%lg\t%lg\n", elefld,
RHS[elefld], Error[elefld]);
2703 printf(
"Computed values at the collocation points for comparison.\n");
2704 printf(
"Error maximum on element %d and its magnitude is %lg.\n",
2705 ElementOfMaxError, MaxError);
2708 fprintf(fChk,
"#Error maximum on element %d and its magnitude is %lg.\n",
2709 ElementOfMaxError, MaxError);
2722 "Solve - Infl matrix not available, re-computation forced.\n");
2726 neBEMMessage(
"Solve - LHMatrix in forced OptRepeatLHMatrix");
2734 strcat(Chkfile,
"/XChk.out");
2735 fChk = fopen(Chkfile,
"w");
2737 neBEMMessage(
"Solve - ChkFile in forced recomputation");
2740 fprintf(fChk,
"#Row\tGivenPot\tComputedPot\tDiff\n");
2742 int ElementOfMaxError = 1;
2743 double Error, MaxError = 0.0;
2744 for (
int elefld = 1; elefld <=
NbEqns; elefld++) {
2746 for (
int elesrc = 1; elesrc <=
NbUnknowns; elesrc++) {
2749 Error = fabs(
RHS[elefld] - XChk);
2750 fprintf(fChk,
"%d\t%lg\t%lg\t%lg\n", elefld,
RHS[elefld], XChk,
2753 if (Error > MaxError) {
2755 ElementOfMaxError = elefld;
2759 printf(
"Computed values at the collocation points for comparison.\n");
2760 printf(
"Error maximum on element %d and its magnitude is %lg.\n",
2761 ElementOfMaxError, MaxError);
2765 "#Error maximum on element %d and its magnitude is %lg.\n",
2766 ElementOfMaxError, MaxError);
2771 neBEMMessage(
"Solve - Infl matrix not available, no validation.\n");
2818 "Properties at non-collocation points on element for estimating "
2823 int PrimitiveOfMaxError = 1;
2824 int ElementOfMaxError = 1;
2825 double MaxError = 0.0;
2826 double xerrMax = 0.0, yerrMax = 0.0, zerrMax = 0.0;
2830 strcat(Errfile,
"/Errors.out");
2831 FILE *fErr = fopen(Errfile,
"w");
2837 "#Prim\tEle\tGType\tIType\txerr\tyerr\tzerr\tGivenBC\tComputVal\tDi"
2855 double normdisp = 1.0e-8;
2857 if ((prim == 91) && (ele == 337))
2868 if ((
EleArr + ele - 1)->G.Type == 2)
continue;
2870 if ((
EleArr + ele - 1)->G.Type == 3)
2875 double x0 = (
EleArr + ele - 1)->G.Vertex[0].
X;
2876 double y0 = (
EleArr + ele - 1)->G.Vertex[0].Y;
2877 double z0 = (
EleArr + ele - 1)->G.Vertex[0].Z;
2878 double x1 = (
EleArr + ele - 1)->G.Vertex[1].X;
2879 double y1 = (
EleArr + ele - 1)->G.Vertex[1].Y;
2880 double z1 = (
EleArr + ele - 1)->G.Vertex[1].Z;
2881 double x2 = (
EleArr + ele - 1)->G.Vertex[2].X;
2882 double y2 = (
EleArr + ele - 1)->G.Vertex[2].Y;
2883 double z2 = (
EleArr + ele - 1)->G.Vertex[2].Z;
2884 double xb = (x0 + x1 + x2) / 3.0;
2885 double yb = (y0 + y1 + y2) / 3.0;
2886 double zb = (z0 + z1 + z2) / 3.0;
2893 PFAtPoint(&globalP, &Potential, &globalF);
2894 Err =
ApplPot[prim] - Potential;
2895 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
2896 prim, ele, 3, 1, xb, yb, zb,
ApplPot[prim], Potential, Err);
2897 if (fabs(Err) > fabs(MaxError)) {
2899 PrimitiveOfMaxError = prim;
2900 ElementOfMaxError = ele;
2908 double xplus = xb + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
2909 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
2910 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
2911 double yplus = yb + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
2912 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
2913 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
2914 double zplus = zb + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
2915 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
2916 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
2920 PFAtPoint(&globalP, &Potential, &globalF);
2924 double value1 = -localF.
Y;
2925 double xminus = xb - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
2926 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
2927 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
2928 double yminus = yb - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
2929 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
2930 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
2931 double zminus = zb - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
2932 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
2933 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
2937 PFAtPoint(&globalP, &Potential, &globalF);
2941 double value2 = -localF.
Y;
2943 Err = epsratio - (value1 / value2);
2944 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
2945 prim, ele, 3, 4, xb, yb, zb, epsratio, (value1 / value2),
2947 if (fabs(Err) > fabs(MaxError)) {
2949 PrimitiveOfMaxError = prim;
2950 ElementOfMaxError = ele;
2959 0.25 * (x0 + 0.5 * (x0 + x1) + 0.5 * (x1 + x2) + 0.5 * (x0 + x2));
2961 0.25 * (y0 + 0.5 * (y0 + y1) + 0.5 * (y1 + y2) + 0.5 * (y0 + y2));
2963 0.25 * (z0 + 0.5 * (z0 + z1) + 0.5 * (z1 + z2) + 0.5 * (z0 + z2));
2971 PFAtPoint(&globalP, &Potential, &globalF);
2972 Err =
ApplPot[prim] - Potential;
2973 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
2974 prim, ele, 3, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
2976 if (fabs(Err) > fabs(MaxError)) {
2978 PrimitiveOfMaxError = prim;
2979 ElementOfMaxError = ele;
2987 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
2988 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
2989 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
2990 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
2991 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
2992 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
2993 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
2994 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
2995 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
2999 PFAtPoint(&globalP, &Potential, &globalF);
3003 double value1 = -localF.
Y;
3004 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3005 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3006 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3007 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3008 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3009 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3010 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3011 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3012 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3016 PFAtPoint(&globalP, &Potential, &globalF);
3020 double value2 = -localF.
Y;
3022 Err = epsratio - (value1 / value2);
3023 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3024 prim, ele, 3, 4, xerr, yerr, zerr, epsratio,
3025 (value1 / value2), Err);
3026 if (fabs(Err) > fabs(MaxError)) {
3028 PrimitiveOfMaxError = prim;
3029 ElementOfMaxError = ele;
3037 xerr = (0.5 * (x0 + x1) + 0.5 * (x1 + x2) + x1) / 3.0;
3038 yerr = (0.5 * (y0 + y1) + 0.5 * (y1 + y2) + y1) / 3.0;
3039 zerr = (0.5 * (z0 + z1) + 0.5 * (z1 + z2) + z1) / 3.0;
3047 PFAtPoint(&globalP, &Potential, &globalF);
3048 Err =
ApplPot[prim] - Potential;
3049 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3050 prim, ele, 3, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
3052 if (fabs(Err) > fabs(MaxError)) {
3054 PrimitiveOfMaxError = prim;
3055 ElementOfMaxError = ele;
3063 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3064 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3065 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3066 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3067 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3068 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3069 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3070 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3071 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3075 PFAtPoint(&globalP, &Potential, &globalF);
3079 double value1 = -localF.
Y;
3080 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3081 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3082 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3083 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3084 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3085 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3086 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3087 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3088 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3092 PFAtPoint(&globalP, &Potential, &globalF);
3096 double value2 = -localF.
Y;
3098 Err = epsratio - (value1 / value2);
3099 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3100 prim, ele, 3, 4, xerr, yerr, zerr, epsratio,
3101 (value1 / value2), Err);
3102 if (fabs(Err) > fabs(MaxError)) {
3104 PrimitiveOfMaxError = prim;
3105 ElementOfMaxError = ele;
3113 xerr = (0.5 * (x0 + x2) + 0.5 * (x1 + x2) + x2) / 3.0;
3114 yerr = (0.5 * (y0 + y2) + 0.5 * (y1 + y2) + y2) / 3.0;
3115 zerr = (0.5 * (z0 + z2) + 0.5 * (z1 + z2) + z2) / 3.0;
3123 PFAtPoint(&globalP, &Potential, &globalF);
3124 Err =
ApplPot[prim] - Potential;
3125 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3126 prim, ele, 3, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
3128 if (fabs(Err) > fabs(MaxError)) {
3130 PrimitiveOfMaxError = prim;
3131 ElementOfMaxError = ele;
3139 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3140 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3141 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3142 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3143 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3144 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3145 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3146 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3147 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3151 PFAtPoint(&globalP, &Potential, &globalF);
3155 double value1 = -localF.
Y;
3156 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3157 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3158 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3159 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3160 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3161 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3162 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3163 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3164 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3168 PFAtPoint(&globalP, &Potential, &globalF);
3172 double value2 = -localF.
Y;
3174 Err = epsratio - (value1 / value2);
3175 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3176 prim, ele, 4, 4, xerr, yerr, zerr, epsratio,
3177 (value1 / value2), Err);
3178 if (fabs(Err) > fabs(MaxError)) {
3180 PrimitiveOfMaxError = prim;
3181 ElementOfMaxError = ele;
3189 if ((
EleArr + ele - 1)->G.Type == 4)
3195 double x0 = (
EleArr + ele - 1)->G.Vertex[0].
X;
3196 double y0 = (
EleArr + ele - 1)->G.Vertex[0].Y;
3197 double z0 = (
EleArr + ele - 1)->G.Vertex[0].Z;
3198 double x1 = (
EleArr + ele - 1)->G.Vertex[1].X;
3199 double y1 = (
EleArr + ele - 1)->G.Vertex[1].Y;
3200 double z1 = (
EleArr + ele - 1)->G.Vertex[1].Z;
3201 double x2 = (
EleArr + ele - 1)->G.Vertex[2].X;
3202 double y2 = (
EleArr + ele - 1)->G.Vertex[2].Y;
3203 double z2 = (
EleArr + ele - 1)->G.Vertex[2].Z;
3204 double x3 = (
EleArr + ele - 1)->G.Vertex[3].X;
3205 double y3 = (
EleArr + ele - 1)->G.Vertex[3].Y;
3206 double z3 = (
EleArr + ele - 1)->G.Vertex[3].Z;
3207 double xo = 0.25 * (x0 + x1 + x2 + x3);
3208 double yo = 0.25 * (y0 + y1 + y2 + y3);
3209 double zo = 0.25 * (z0 + z1 + z2 + z3);
3216 PFAtPoint(&globalP, &Potential, &globalF);
3217 Err =
ApplPot[prim] - Potential;
3218 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3219 prim, ele, 4, 1, xo, yo, zo,
ApplPot[prim], Potential, Err);
3220 if (fabs(Err) > fabs(MaxError)) {
3222 PrimitiveOfMaxError = prim;
3223 ElementOfMaxError = ele;
3231 double xplus = xo + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3232 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3233 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3234 double yplus = yo + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3235 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3236 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3237 double zplus = zo + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3238 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3239 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3243 PFAtPoint(&globalP, &Potential, &globalF);
3247 double dispfld1 =
Epsilon1[prim] * localF.
Y;
3248 double xminus = xo - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3249 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3250 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3251 double yminus = yo - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3252 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3253 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3254 double zminus = zo - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3255 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3256 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3260 PFAtPoint(&globalP, &Potential, &globalF);
3264 double dispfld2 =
Epsilon2[prim] * localF.
Y;
3268 PFAtPoint(&globalP, &Potential, &globalF);
3272 double dispfldo =
Epsilon1[prim] * localF.
Y;
3273 Err = (dispfld2 - dispfld1) /
3275 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3276 prim, ele, 4, 4, xo, yo, zo, dispfld1, dispfld2, Err);
3277 if ((prim == 91) && (ele == 337)) {
3279 double TotalInfl = 0.0;
3280 for (
int elesrc = 1; elesrc <=
NbElements; ++elesrc) {
3283 printf(
"TotalInfl: %lg\n", TotalInfl);
3285 "%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\t%"
3288 dispfld1, dispfld2, dispfldo, Err);
3290 if (fabs(Err) > fabs(MaxError)) {
3292 PrimitiveOfMaxError = prim;
3293 ElementOfMaxError = ele;
3301 double xerr = 0.25 * (x0 + 0.5 * (x1 + x0) + xo + 0.5 * (x0 + x3));
3302 double yerr = 0.25 * (y0 + 0.5 * (y1 + y0) + yo + 0.5 * (y0 + y3));
3303 double zerr = 0.25 * (z0 + 0.5 * (z1 + z0) + zo + 0.5 * (z0 + z3));
3308 PFAtPoint(&globalP, &Potential, &globalF);
3309 Err =
ApplPot[prim] - Potential;
3310 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3311 prim, ele, 4, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
3313 if (fabs(Err) > fabs(MaxError)) {
3315 PrimitiveOfMaxError = prim;
3316 ElementOfMaxError = ele;
3324 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3325 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3326 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3327 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3328 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3329 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3330 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3331 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3332 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3336 PFAtPoint(&globalP, &Potential, &globalF);
3340 double value1 = -localF.
Y;
3341 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3342 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3343 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3344 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3345 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3346 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3347 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3348 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3349 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3353 PFAtPoint(&globalP, &Potential, &globalF);
3357 double value2 = -localF.
Y;
3359 Err = epsratio - (value1 / value2);
3360 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3361 prim, ele, 4, 4, xerr, yerr, zerr, epsratio,
3362 (value1 / value2), Err);
3363 if (fabs(Err) > fabs(MaxError)) {
3365 PrimitiveOfMaxError = prim;
3366 ElementOfMaxError = ele;
3374 xerr = 0.25 * (0.5 * (x1 + x0) + x1 + 0.5 * (x1 + x2) + xo);
3375 yerr = 0.25 * (0.5 * (y1 + y0) + y1 + 0.5 * (y1 + y2) + yo);
3376 zerr = 0.25 * (0.5 * (z1 + z0) + z1 + 0.5 * (z1 + z2) + zo);
3384 PFAtPoint(&globalP, &Potential, &globalF);
3385 Err =
ApplPot[prim] - Potential;
3386 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3387 prim, ele, 4, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
3389 if (fabs(Err) > fabs(MaxError)) {
3391 PrimitiveOfMaxError = prim;
3392 ElementOfMaxError = ele;
3400 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3401 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3402 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3403 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3404 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3405 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3406 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3407 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3408 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3412 PFAtPoint(&globalP, &Potential, &globalF);
3416 double value1 = -localF.
Y;
3417 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3418 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3419 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3420 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3421 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3422 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3423 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3424 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3425 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3429 PFAtPoint(&globalP, &Potential, &globalF);
3433 double value2 = -localF.
Y;
3435 Err = epsratio - (value1 / value2);
3436 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3437 prim, ele, 4, 4, xerr, yerr, zerr, epsratio,
3438 (value1 / value2), Err);
3439 if (fabs(Err) > fabs(MaxError)) {
3441 PrimitiveOfMaxError = prim;
3442 ElementOfMaxError = ele;
3450 xerr = 0.25 * (xo + 0.5 * (x1 + x2) + x2 + 0.5 * (x3 + x2));
3451 yerr = 0.25 * (yo + 0.5 * (y1 + y2) + y2 + 0.5 * (y3 + y2));
3452 zerr = 0.25 * (zo + 0.5 * (z1 + z2) + z2 + 0.5 * (z3 + z2));
3460 PFAtPoint(&globalP, &Potential, &globalF);
3461 Err =
ApplPot[prim] - Potential;
3462 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3463 prim, ele, 4, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
3465 if (fabs(Err) > fabs(MaxError)) {
3467 PrimitiveOfMaxError = prim;
3468 ElementOfMaxError = ele;
3476 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3477 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3478 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3479 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3480 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3481 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3482 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3483 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3484 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3488 PFAtPoint(&globalP, &Potential, &globalF);
3492 double value1 = -localF.
Y;
3493 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3494 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3495 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3496 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3497 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3498 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3499 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3500 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3501 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3505 PFAtPoint(&globalP, &Potential, &globalF);
3509 double value2 = -localF.
Y;
3511 Err = epsratio - (value1 / value2);
3512 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3513 prim, ele, 4, 4, xerr, yerr, zerr, epsratio,
3514 (value1 / value2), Err);
3515 if (fabs(Err) > fabs(MaxError)) {
3517 PrimitiveOfMaxError = prim;
3518 ElementOfMaxError = ele;
3526 xerr = 0.25 * (0.5 * (x0 + x3) + xo + 0.5 * (x3 + x2) + x3);
3527 yerr = 0.25 * (0.5 * (y0 + y3) + yo + 0.5 * (y3 + y2) + y3);
3528 zerr = 0.25 * (0.5 * (z0 + z3) + zo + 0.5 * (z3 + z2) + z3);
3536 PFAtPoint(&globalP, &Potential, &globalF);
3537 Err =
ApplPot[prim] - Potential;
3538 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3539 prim, ele, 4, 1, xerr, yerr, zerr,
ApplPot[prim], Potential,
3541 if (fabs(Err) > fabs(MaxError)) {
3543 PrimitiveOfMaxError = prim;
3544 ElementOfMaxError = ele;
3552 double xplus = xerr + (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3553 xplus += (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3554 xplus += (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3555 double yplus = yerr + (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3556 yplus += (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3557 yplus += (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3558 double zplus = zerr + (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3559 zplus += (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3560 zplus += (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3564 PFAtPoint(&globalP, &Potential, &globalF);
3568 double value1 = -localF.
Y;
3569 double xminus = xerr - (
EleArr + ele - 1)->G.DC.XUnit.X * normdisp;
3570 xminus -= (
EleArr + ele - 1)->G.DC.YUnit.X * normdisp;
3571 xminus -= (
EleArr + ele - 1)->G.DC.ZUnit.X * normdisp;
3572 double yminus = yerr - (
EleArr + ele - 1)->G.DC.XUnit.Y * normdisp;
3573 yminus -= (
EleArr + ele - 1)->G.DC.YUnit.Y * normdisp;
3574 yminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Y * normdisp;
3575 double zminus = zerr - (
EleArr + ele - 1)->G.DC.XUnit.Z * normdisp;
3576 zminus -= (
EleArr + ele - 1)->G.DC.YUnit.Z * normdisp;
3577 zminus -= (
EleArr + ele - 1)->G.DC.ZUnit.Z * normdisp;
3581 PFAtPoint(&globalP, &Potential, &globalF);
3585 double value2 = -localF.
Y;
3587 Err = epsratio - (value1 / value2);
3588 fprintf(fErr,
"%d\t%d\t%d\t%d\t%lg\t%lg\t%lg\t%lg\t%lg\t%lg\n",
3589 prim, ele, 4, 4, xerr, yerr, zerr, epsratio,
3590 (value1 / value2), Err);
3591 if (fabs(Err) > fabs(MaxError)) {
3593 PrimitiveOfMaxError = prim;
3594 ElementOfMaxError = ele;
3606 "#Error maximum on element %d on primitive %d with x,y,z %lg, "
3607 "%lg, %lg and its magnitude is %lg.\n",
3608 ElementOfMaxError, PrimitiveOfMaxError, xerrMax, yerrMax, zerrMax,
3621 strcat(SolnFile,
"/Soln.out");
3622 FILE *fSoln = fopen(SolnFile,
"r");
3624 if (fSoln == NULL) {
3625 neBEMMessage(
"ReadSoln - unable to open solution file.");
3632 fgets(instr, 256, fSoln);
3633 for (
int ele = 1; ele <=
NbElements; ++ele) {
3634 fscanf(fSoln,
"%d %lg %lg %lg %lg\n", &itmp, &dtmp, &dtmp, &dtmp, &sol);
3637 neBEMMessage(
"ReadSolution - ele_itmp in ReadSolution");
3642 printf(
"\nReadSolution: Solution read in for all elements ...\n");
3647 fgets(instr, 256, fSoln);
3650 "ReadSolution: Read in voltage shift to ensure system charge "
3654 fgets(instr, 256, fSoln);
3656 printf(
"ReadSolution: Read in voltage on floating conductor.\n");
3671 const double dA = (
EleArr + ele - 1)->G.dA;
3689 double solnarray[]) {
3693 "WeightingFieldSolution: Capacitance matrix not in memory, can not "
3694 "calculate weighting charges.\n");
3698 for (
int i = 1; i <=
NbUnknowns; i++) solnarray[i] = 0.0;
3700 for (
int ele = 1, InList; ele <=
NbElements; ++ele) {
3701 int prim = (
EleArr + ele - 1)->PrimitiveNb;
3704 for (
int primwtfl = 0; primwtfl < NbPrimsWtField; ++primwtfl) {
3705 if (prim == PrimListWtField[primwtfl]) {
3713 solnarray[i] +=
InvMat[i][ele];
3743 Point3D fldpt,
double distance,
3756 Image.
X += 2.0 * distance;
3776 Image.
Y += 2.0 * distance;
3796 Image.
Z += 2.0 * distance;
3810 printf(
"Axis not chosen properly!!! No reflection occurred!\n");
3823 globalP.
X = fldpt.
X - Image.
X;
3824 globalP.
Y = fldpt.
Y - Image.
Y;
3825 globalP.
Z = fldpt.
Z - Image.
Z;
3844 Image.
X += 2.0 * distance;
3846 MirroredDC->
XUnit.
X = -(
EleArr + elesrc - 1)->G.DC.XUnit.X;
3847 MirroredDC->
XUnit.
Y = (
EleArr + elesrc - 1)->G.DC.XUnit.Y;
3848 MirroredDC->
XUnit.
Z = (
EleArr + elesrc - 1)->G.DC.XUnit.Z;
3849 MirroredDC->
YUnit.
X = -(
EleArr + elesrc - 1)->G.DC.YUnit.X;
3850 MirroredDC->
YUnit.
Y = (
EleArr + elesrc - 1)->G.DC.YUnit.Y;
3851 MirroredDC->
YUnit.
Z = (
EleArr + elesrc - 1)->G.DC.YUnit.Z;
3852 MirroredDC->
ZUnit.
X = -(
EleArr + elesrc - 1)->G.DC.ZUnit.X;
3853 MirroredDC->
ZUnit.
Y = (
EleArr + elesrc - 1)->G.DC.ZUnit.Y;
3854 MirroredDC->
ZUnit.
Z = (
EleArr + elesrc - 1)->G.DC.ZUnit.Z;
3864 Image.
Y += 2.0 * distance;
3866 MirroredDC->
XUnit.
X = (
EleArr + elesrc - 1)->G.DC.XUnit.X;
3867 MirroredDC->
XUnit.
Y = -(
EleArr + elesrc - 1)->G.DC.XUnit.Y;
3868 MirroredDC->
XUnit.
Z = (
EleArr + elesrc - 1)->G.DC.XUnit.Z;
3869 MirroredDC->
YUnit.
X = (
EleArr + elesrc - 1)->G.DC.YUnit.X;
3870 MirroredDC->
YUnit.
Y = -(
EleArr + elesrc - 1)->G.DC.YUnit.Y;
3871 MirroredDC->
YUnit.
Z = (
EleArr + elesrc - 1)->G.DC.YUnit.Z;
3872 MirroredDC->
ZUnit.
X = (
EleArr + elesrc - 1)->G.DC.ZUnit.X;
3873 MirroredDC->
ZUnit.
Y = -(
EleArr + elesrc - 1)->G.DC.ZUnit.Y;
3874 MirroredDC->
ZUnit.
Z = (
EleArr + elesrc - 1)->G.DC.ZUnit.Z;
3884 Image.
Z += 2.0 * distance;
3886 MirroredDC->
XUnit.
X = (
EleArr + elesrc - 1)->G.DC.XUnit.X;
3887 MirroredDC->
XUnit.
Y = (
EleArr + elesrc - 1)->G.DC.XUnit.Y;
3888 MirroredDC->
XUnit.
Z = -(
EleArr + elesrc - 1)->G.DC.XUnit.Z;
3889 MirroredDC->
YUnit.
X = (
EleArr + elesrc - 1)->G.DC.YUnit.X;
3890 MirroredDC->
YUnit.
Y = (
EleArr + elesrc - 1)->G.DC.YUnit.Y;
3891 MirroredDC->
YUnit.
Z = -(
EleArr + elesrc - 1)->G.DC.YUnit.Z;
3892 MirroredDC->
ZUnit.
X = (
EleArr + elesrc - 1)->G.DC.ZUnit.X;
3893 MirroredDC->
ZUnit.
Y = (
EleArr + elesrc - 1)->G.DC.ZUnit.Y;
3894 MirroredDC->
ZUnit.
Z = -(
EleArr + elesrc - 1)->G.DC.ZUnit.Z;
3898 printf(
"Axis not chosen properly!!! No reflection occurred!\n");
3911 globalP.
X = fldpt.
X - Image.
X;
3912 globalP.
Y = fldpt.
Y - Image.
Y;
3913 globalP.
Z = fldpt.
Z - Image.
Z;
double TriPot(int ele, Point3D *localP)
double WirePot(int ele, Point3D *localP)
void TriFlux(int ele, Point3D *localP, Vector3D *localF)
void RecFlux(int ele, Point3D *localP, Vector3D *localF)
double RecPot(int ele, Point3D *localP)
void WireFlux(int ele, Point3D *localP, Vector3D *localF)
int PFAtPoint(Point3D *globalP, double *Potential, Vector3D *globalF)
double LineKnChPF(Point3D LineStart, Point3D LineStop, double radius, Point3D FieldPt, Vector3D *globalF)
double AreaKnChPF(int NbVertices, Point3D *Vertex, Point3D FieldPt, Vector3D *globalF)
double PointKnChPF(Point3D SourcePt, Point3D FieldPt, Vector3D *globalF)
double VolumeKnChPF(int, Point3D *, Point3D, Vector3D *globalF)
ISLESGLOBAL int DebugISLES
NRGLOBAL void svdcmp(double **a, int matrow, int matcol, double *w, double **v)
Point3D ReflectPoint3DByMirrorAtOrigin(Point3D *p1, Vector3D *n)
Point3D RotatePoint3D(Point3D *A, DirnCosn3D *DC, int Sense)
Vector3D RotateVector3D(Vector3D *A, DirnCosn3D *DC, int Sense)
void lubksb(double **a, int n, int *index, double *b)
void ludcmp(double **a, int n, int *index, double *d)
int neBEMMessage(const char *message)
double neBEMTimeElapsed(clock_t t0, clock_t t1)
int neBEMKnownCharges(void)
INTFACEGLOBAL clock_t stopClock
INTFACEGLOBAL int neBEMState
INTFACEGLOBAL clock_t startClock
int ComputeSolution(void)
int DecomposeMatrixSVD(double **SVDInf, double *SVDw, double **SVDv)
double ComputeInfluence(int elefld, int elesrc, Point3D *localP, DirnCosn3D *DirCos)
int ReadInvertedMatrix(void)
double ValueKnCh(int elefld)
double EffectChUp(int elefld)
double ContinuityKnCh(int elefld)
Point3D ReflectPrimitiveOnMirror(char Axis, int primsrc, Point3D srcpt, Point3D fldpt, double distance, DirnCosn3D *MirroredDC)
int WeightingFieldSolution(int NbPrimsWtField, int PrimListWtField[], double solnarray[])
double ValueChUp(int elefld)
double SatisfyContinuity(int elefld, int elesrc, Point3D *localP, DirnCosn3D *DirCos)
Point3D ReflectOnMirror(char Axis, int elesrc, Point3D srcpt, Point3D fldpt, double distance, DirnCosn3D *MirroredDC)
double SatisfyValue(int elesrc, Point3D *localP)
double EffectKnCh(int elefld)
neBEMGLOBAL double ** InvMat
neBEMGLOBAL Element * EleArr
neBEMGLOBAL double * ApplPot
neBEMGLOBAL int DebugLevel
neBEMGLOBAL int NbFloatCon
neBEMGLOBAL int * PeriodicInY
neBEMGLOBAL double VFloatCon
neBEMGLOBAL int OptInvMatProc
neBEMGLOBAL int OptRepeatLHMatrix
neBEMGLOBAL char MeshOutDir[256]
neBEMGLOBAL int * MirrorTypeZ
neBEMGLOBAL double * MirrorDistYFromOrigin
neBEMGLOBAL double * ZPeriod
neBEMGLOBAL PointKnCh * PointKnChArr
neBEMGLOBAL VolumeKnCh * VolumeKnChArr
neBEMGLOBAL int OptFormattedFile
neBEMGLOBAL int OptChargingUp
neBEMGLOBAL double VSystemChargeZero
neBEMGLOBAL int EndOfTime
neBEMGLOBAL double * PrimOriginZ
neBEMGLOBAL int NbPrimitives
neBEMGLOBAL int * PeriodicTypeX
neBEMGLOBAL int NbElements
neBEMGLOBAL int OptEstimateError
neBEMGLOBAL int * PeriodicTypeY
neBEMGLOBAL int NbPointsKnCh
neBEMGLOBAL double * Epsilon1
neBEMGLOBAL double * PrimOriginY
neBEMGLOBAL double * MirrorDistZFromOrigin
neBEMGLOBAL AreaKnCh * AreaKnChArr
neBEMGLOBAL DirnCosn3D * PrimDC
neBEMGLOBAL int OptSystemChargeZero
neBEMGLOBAL int NbLinesKnCh
neBEMGLOBAL int NbFloatingConductors
neBEMGLOBAL int NbConstraints
neBEMGLOBAL double * XPeriod
neBEMGLOBAL int NbVolumesKnCh
neBEMGLOBAL double * AvAsgndChDen
neBEMGLOBAL int * MirrorTypeY
neBEMGLOBAL int NbAreasKnCh
neBEMGLOBAL int * ElementEnd
neBEMGLOBAL double * AvChDen
neBEMGLOBAL int * MirrorTypeX
neBEMGLOBAL int * InterfaceType
neBEMGLOBAL double * Solution
neBEMGLOBAL int * ElementBgn
neBEMGLOBAL double * PrimOriginX
neBEMGLOBAL int OptStoreInflMatrix
neBEMGLOBAL int * PeriodicInZ
neBEMGLOBAL int * PeriodicInX
neBEMGLOBAL int OptForceValidation
neBEMGLOBAL double ** Inf
neBEMGLOBAL int OptUnformattedFile
neBEMGLOBAL int NbUnknowns
neBEMGLOBAL int ModelCntr
neBEMGLOBAL int * PeriodicTypeZ
neBEMGLOBAL LineKnCh * LineKnChArr
neBEMGLOBAL int OptValidateSolution
neBEMGLOBAL int OptStoreInvMatrix
neBEMGLOBAL char BCOutDir[256]
neBEMGLOBAL double * YPeriod
neBEMGLOBAL double * MirrorDistXFromOrigin
neBEMGLOBAL int NbSystemChargeZero
neBEMGLOBAL double * Epsilon2
void free_dmatrix(double **m, long nrl, long, long ncl, long)
void free_dvector(double *v, long nl, long)
int * ivector(long nl, long nh)
double ** dmatrix(long nrl, long nrh, long ncl, long nch)
void free_ivector(int *v, long nl, long)
double * dvector(long nl, long nh)