Return to sw_functions.c CVS log Up to [Development] / JSOC / proj / sharp / apps

### Diff for /JSOC/proj/sharp/apps/sw_functions.c between version 1.1 and 1.2

version 1.1, 2012/08/23 08:38:33 version 1.2, 2012/08/27 19:55:49
 Line 70  int computeAbsFlux(float *bz, int *dims,
 Line 70  int computeAbsFlux(float *bz, int *dims,
{         {
for (i = 0; i < nx; i++)                 for (i = 0; i < nx; i++)
{                 {
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;                    if ( mask[j * nx + i] < 70 ) continue;
sum += (fabs(bz[j * nx + i]));                   sum += (fabs(bz[j * nx + i]));
//sum += (fabs(bz[j * nx + i]))*inverseMu[j * nx + i]; // use this with mu function                   //sum += (fabs(bz[j * nx + i]))*inverseMu[j * nx + i]; // use this with mu function
 Line 137  int computeGamma(float *bx, float *by, f
 Line 137  int computeGamma(float *bx, float *by, f
{               {
if (bh[j * nx + i] > 100)                 if (bh[j * nx + i] > 100)
{                   {
//if (mask[j * nx + i] != 90 ) continue;                      if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
sum += (atan (fabs( bz[j * nx + i] / bh[j * nx + i] ))* (180./PI));                     sum += (atan (fabs( bz[j * nx + i] / bh[j * nx + i] ))* (180./PI));
}                   }
 Line 251  int computeBtotalderivative(float *bt, i
 Line 250  int computeBtotalderivative(float *bt, i
for (j = 0; j <= ny-1; j++)             for (j = 0; j <= ny-1; j++)
{             {
// if ( (derx_bt[j * nx + i]-dery_bt[j * nx + i]) == 0) continue;                // if ( (derx_bt[j * nx + i]-dery_bt[j * nx + i]) == 0) continue;
//if (mask[j * nx + i] != 90 ) continue;                 if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
sum += sqrt( derx_bt[j * nx + i]*derx_bt[j * nx + i]  + dery_bt[j * nx + i]*dery_bt[j * nx + i]  ); /* Units of Gauss */                sum += sqrt( derx_bt[j * nx + i]*derx_bt[j * nx + i]  + dery_bt[j * nx + i]*dery_bt[j * nx + i]  ); /* Units of Gauss */
}             }
 Line 342  int computeBhderivative(float *bh, int *
 Line 340  int computeBhderivative(float *bh, int *
for (j = 0; j <= ny-1; j++)             for (j = 0; j <= ny-1; j++)
{             {
// if ( (derx_bh[j * nx + i]-dery_bh[j * nx + i]) == 0) continue;                // if ( (derx_bh[j * nx + i]-dery_bh[j * nx + i]) == 0) continue;
//if (mask[j * nx + i] != 90 ) continue;                 if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
sum += sqrt( derx_bh[j * nx + i]*derx_bh[j * nx + i]  + dery_bh[j * nx + i]*dery_bh[j * nx + i]  ); /* Units of Gauss */                sum += sqrt( derx_bh[j * nx + i]*derx_bh[j * nx + i]  + dery_bh[j * nx + i]*dery_bh[j * nx + i]  ); /* Units of Gauss */
}             }
 Line 431  int computeBzderivative(float *bz, int *
 Line 428  int computeBzderivative(float *bz, int *
for (j = 0; j <= ny-1; j++)             for (j = 0; j <= ny-1; j++)
{             {
// if ( (derx_bz[j * nx + i]-dery_bz[j * nx + i]) == 0) continue;                // if ( (derx_bz[j * nx + i]-dery_bz[j * nx + i]) == 0) continue;
//if (mask[j * nx + i] != 90 ) continue;                 if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
sum += sqrt( derx_bz[j * nx + i]*derx_bz[j * nx + i]  + dery_bz[j * nx + i]*dery_bz[j * nx + i]  ); /* Units of Gauss */                sum += sqrt( derx_bz[j * nx + i]*derx_bz[j * nx + i]  + dery_bz[j * nx + i]*dery_bz[j * nx + i]  ); /* Units of Gauss */
}             }
 Line 556  int computeJz(float *bx, float *by, int
 Line 552  int computeJz(float *bx, float *by, int
for (j = 0; j <= ny-1; j++)             for (j = 0; j <= ny-1; j++)
{             {
// if ( (derx[j * nx + i]-dery[j * nx + i]) == 0) continue;                // if ( (derx[j * nx + i]-dery[j * nx + i]) == 0) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;                 if (mask[j * nx + i] < 70 ) continue;
//if (mask[j * nx + i] != 90 ) continue;
curl +=     (derx[j * nx + i]-dery[j * nx + i])*(1/cdelt1)*(rsun_obs/rsun_ref)*(0.00010)*(1/MUNAUGHT)*(1000.); /* curl is in units of mA / m^2 */                curl +=     (derx[j * nx + i]-dery[j * nx + i])*(1/cdelt1)*(rsun_obs/rsun_ref)*(0.00010)*(1/MUNAUGHT)*(1000.); /* curl is in units of mA / m^2 */
us_i += fabs(derx[j * nx + i]-dery[j * nx + i])*(1/cdelt1)*(rsun_ref/rsun_obs)*(0.00010)*(1/MUNAUGHT);         /* us_i is in units of A  / m^2 */                us_i += fabs(derx[j * nx + i]-dery[j * nx + i])*(1/cdelt1)*(rsun_ref/rsun_obs)*(0.00010)*(1/MUNAUGHT);         /* us_i is in units of A  / m^2 */
jz[j * nx + i] = (derx[j * nx + i]-dery[j * nx + i]);                                                          /* jz is in units of Gauss/pix */                jz[j * nx + i] = (derx[j * nx + i]-dery[j * nx + i]);                                                          /* jz is in units of Gauss/pix */
 Line 602  int computeAlpha(float *bz, int *dims, f
 Line 597  int computeAlpha(float *bz, int *dims, f
{           {
for (j = 1; j < ny-1; j++)             for (j = 1; j < ny-1; j++)
{               {
//if (mask[j * nx + i] != 90 ) continue;                  if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
if isnan(jz[j * nx + i]) continue;                 if isnan(jz[j * nx + i]) continue;
if isnan(bz[j * nx + i]) continue;                 if isnan(bz[j * nx + i]) continue;
if (bz[j * nx + i] == 0.0) continue;                 if (bz[j * nx + i] == 0.0) continue;
 Line 646  int computeHelicity(float *bz, int *dims
 Line 640  int computeHelicity(float *bz, int *dims
{         {
for (i = 0; i < nx; i++)                 for (i = 0; i < nx; i++)
{                 {
//if (mask[j * nx + i] != 90 ) continue;                  if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
if isnan(jz[j * nx + i]) continue;                 if isnan(jz[j * nx + i]) continue;
if isnan(bz[j * nx + i]) continue;                 if isnan(bz[j * nx + i]) continue;
if (bz[j * nx + i] == 0.0) continue;                 if (bz[j * nx + i] == 0.0) continue;
 Line 692  int computeSumAbsPerPolarity(float *bz,
 Line 685  int computeSumAbsPerPolarity(float *bz,
{           {
for (j = 0; j < ny; j++)             for (j = 0; j < ny; j++)
{               {
//if (mask[j * nx + i] != 90 ) continue;                  if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
if (bz[j * nx + i] >  0) sum1 += ( jz[j * nx + i])*(1/cdelt1)*(0.00010)*(1/MUNAUGHT)*(rsun_ref/rsun_obs);                 if (bz[j * nx + i] >  0) sum1 += ( jz[j * nx + i])*(1/cdelt1)*(0.00010)*(1/MUNAUGHT)*(rsun_ref/rsun_obs);
if (bz[j * nx + i] <= 0) sum2 += ( jz[j * nx + i])*(1/cdelt1)*(0.00010)*(1/MUNAUGHT)*(rsun_ref/rsun_obs);                 if (bz[j * nx + i] <= 0) sum2 += ( jz[j * nx + i])*(1/cdelt1)*(0.00010)*(1/MUNAUGHT)*(rsun_ref/rsun_obs);
}               }
 Line 733  int computeFreeEnergy(float *bx, float *
 Line 725  int computeFreeEnergy(float *bx, float *
{           {
for (j = 0; j < ny; j++)             for (j = 0; j < ny; j++)
{               {
//if (mask[j * nx + i] != 90 ) continue;                   if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
sum += ((    ((bx[j * nx + i])*(bx[j * nx + i]) + (by[j * nx + i])*(by[j * nx + i]) ) -  ((bpx[j * nx + i])*(bpx[j * nx + i]) + (bpy[j * nx + i])*(bpy[j * nx + i]))  )/8.*PI);                  sum += ((    ((bx[j * nx + i])*(bx[j * nx + i]) + (by[j * nx + i])*(by[j * nx + i]) ) -  ((bpx[j * nx + i])*(bpx[j * nx + i]) + (bpy[j * nx + i])*(bpy[j * nx + i]))  )/8.*PI);
}               }
 Line 767  int computeShearAngle(float *bx, float *
 Line 758  int computeShearAngle(float *bx, float *
{           {
for (j = 0; j < ny; j++)             for (j = 0; j < ny; j++)
{               {
//if (mask[j * nx + i] != 90 ) continue;                   if (mask[j * nx + i] < 70 ) continue;
if ( (mask[j * nx + i] != 7) && (mask[j * nx + i] != 5) ) continue;
if isnan(bpx[j * nx + i]) continue;                  if isnan(bpx[j * nx + i]) continue;
if isnan(bpy[j * nx + i]) continue;                  if isnan(bpy[j * nx + i]) continue;
if isnan(bpz[j * nx + i]) continue;                  if isnan(bpz[j * nx + i]) continue;

Legend:
 Removed from v.1.1 changed lines Added in v.1.2