lib/field/vfield.cc
/**
 ********************************************************************************************************************************************
 * \brief   Operator to compute the divergence of the vector field
 *
 *          The operator computes the divergence of a face-centered staggered vector field, and stores it into a cell centered
 *          scalar field as defined by the tensor operation:
 *          \f$ \nabla . \mathbf{v} = \frac{\partial \mathbf{v}}{\partial x} +
 *                                    \frac{\partial \mathbf{v}}{\partial y} +
 *                                    \frac{\partial \mathbf{v}}{\partial z} \f$.
 *
 * \param   divV is a pointer to a scalar field (sfield) into which the computed divergence must be written.
 ********************************************************************************************************************************************
 */
\brief   Operator to compute the divergence of the vector field
The operator computes the divergence of a face-centered staggered vector field, and stores it into a cell centered
scalar field as defined by the tensor operation:
\f$ \nabla .

\param   divV is a pointer to a scalar field (sfield) into which the computed divergence must be written.
\ brief Operator to compute the divergence of the vector field The operator computes the divergence of a face - centered staggered vector field and stores it into a cell centered scalar field as defined by the tensor operation : \ f$ \ nabla . \ param divV is a pointer to a scalar field ( sfield ) into which the computed divergence must be written .
void vfield::divergence(plainsf &divV, const sfield &P) {
    blitz::firstIndex i;
    blitz::secondIndex j;
    blitz::thirdIndex k;
    blitz::Range xStag, yStag, zStag;
    xStag = blitz::Range(P.F.fCore.lbound(0), P.F.fCore.ubound(0));
    yStag = blitz::Range(P.F.fCore.lbound(1), P.F.fCore.ubound(1));
    zStag = blitz::Range(P.F.fCore.lbound(2), P.F.fCore.ubound(2));
    divV = 0.0;
#ifdef PLANAR
    divV.F(P.F.fCore) = gridData.xi_xStaggr(xStag)(i)*(Vx.F(P.F.fCore) - Vx.F(P.F.fCLft))/gridData.dXi + 
                        gridData.zt_zStaggr(zStag)(k)*(Vz.F(P.F.fCore) - Vz.F(P.F.fCBot))/gridData.dZt;
#else
    divV.F(P.F.fCore) = gridData.xi_xStaggr(xStag)(i)*(Vx.F(P.F.fCore) - Vx.F(P.F.fCLft))/gridData.dXi + 
                        gridData.et_yStaggr(yStag)(j)*(Vy.F(P.F.fCore) - Vy.F(P.F.fCFrt))/gridData.dEt + 
                        gridData.zt_zStaggr(zStag)(k)*(Vz.F(P.F.fCore) - Vz.F(P.F.fCBot))/gridData.dZt;
#endif
}
void vfield :: divergence ( plainsf & divV , const sfield & P ) { blitz :: firstIndex i ; blitz :: secondIndex j ; blitz :: thirdIndex k ; blitz :: Range xStag , yStag , zStag ; xStag = blitz :: Range ( P . F . fCore . lbound ( 0 ) , P . F . fCore . ubound ( 0 ) ) ; yStag = blitz :: Range ( P . F . fCore . lbound ( 1 ) , P . F . fCore . ubound ( 1 ) ) ; zStag = blitz :: Range ( P . F . fCore . lbound ( 2 ) , P . F . fCore . ubound ( 2 ) ) ; divV = 0.0 ; #ifdef PLANAR divV . F ( P . F . fCore ) = gridData . xi_xStaggr ( xStag ) ( i ) * ( Vx . F ( P . F . fCore ) - Vx . F ( P . F . fCLft ) ) / gridData . dXi + gridData . zt_zStaggr ( zStag ) ( k ) * ( Vz . F ( P . F . fCore ) - Vz . F ( P . F . fCBot ) ) / gridData . dZt ; #else divV . F ( P . F . fCore ) = gridData . xi_xStaggr ( xStag ) ( i ) * ( Vx . F ( P . F . fCore ) - Vx . F ( P . F . fCLft ) ) / gridData . dXi + gridData . et_yStaggr ( yStag ) ( j ) * ( Vy . F ( P . F . fCore ) - Vy . F ( P . F . fCFrt ) ) / gridData . dEt + gridData . zt_zStaggr ( zStag ) ( k ) * ( Vz . F ( P . F . fCore ) - Vz . F ( P . F . fCBot ) ) / gridData . dZt ; #endif }
\brief   Operator to compute the divergence of the vector field
          The operator computes the divergence of a face-centered staggered vector field, and stores it into a cell centered
          scalar field as defined by the tensor operation:
          \f$ \nabla .
\ brief Operator to compute the divergence of the vector field The operator computes the divergence of a face - centered staggered vector field and stores it into a cell centered scalar field as defined by the tensor operation : \ f$ \ nabla .