void GridPatchCSGLL::ComputeVorticityDivergence( int iDataIndex ) { // Physical constants const PhysicalConstants & phys = m_grid.GetModel().GetPhysicalConstants(); // Working data DataArray4D<double> & dataState = GetDataState(iDataIndex, DataLocation_Node); if (dataState.GetSize(0) < 2) { _EXCEPTIONT( "Insufficient components for vorticity calculation"); } // Get the alpha and beta components of vorticity DataArray3D<double> dataUa; dataUa.SetSize( dataState.GetSize(1), dataState.GetSize(2), dataState.GetSize(3)); DataArray3D<double> dataUb; dataUb.SetSize( dataState.GetSize(1), dataState.GetSize(2), dataState.GetSize(3)); dataUa.AttachToData(&(dataState[0][0][0][0])); dataUb.AttachToData(&(dataState[1][0][0][0])); // Compute the radial component of the curl of the velocity field ComputeCurlAndDiv(dataUa, dataUb); }
void GridPatchCartesianGLL::ComputeVorticityDivergence( int iDataIndex ) { // Physical constants const PhysicalConstants & phys = m_grid.GetModel().GetPhysicalConstants(); // Working data const GridData4D & dataState = GetDataState(iDataIndex, DataLocation_Node); if (dataState.GetComponents() < 2) { _EXCEPTIONT( "Insufficient components for vorticity calculation"); } // Get the alpha and beta components of vorticity GridData3D dataUa; GridData3D dataUb; dataState.GetAsGridData3D(0, dataUa); dataState.GetAsGridData3D(1, dataUb); // Compute the radial component of the curl of the velocity field ComputeCurlAndDiv(dataUa, dataUb); }
void GridPatchCSGLL::TransformHaloVelocities( int iDataUpdate ) { // Indices of velocities const int UIx = 0; const int VIx = 1; // Velocity data DataArray4D<double> * pDataVelocity = &(GetDataState(iDataUpdate, m_grid.GetVarLocation(UIx))); if (pDataVelocity->GetSize(0) < 2) { _EXCEPTIONT("Invalid number of components."); } // Panels in each coordinate direction int ixRightPanel = GetNeighborPanel(Direction_Right); int ixTopPanel = GetNeighborPanel(Direction_Top); int ixLeftPanel = GetNeighborPanel(Direction_Left); int ixBottomPanel = GetNeighborPanel(Direction_Bottom); int ixTopRightPanel = GetNeighborPanel(Direction_TopRight); int ixTopLeftPanel = GetNeighborPanel(Direction_TopLeft); int ixBottomLeftPanel = GetNeighborPanel(Direction_BottomLeft); int ixBottomRightPanel = GetNeighborPanel(Direction_BottomRight); // Post-process velocities across right edge if (ixRightPanel != m_box.GetPanel()) { int i; int j; int jBegin = m_box.GetBInteriorBegin()-1; int jEnd = m_box.GetBInteriorEnd()+1; i = m_box.GetAInteriorEnd(); for (int k = 0; k < pDataVelocity->GetSize(1); k++) { for (j = jBegin; j < jEnd; j++) { CubedSphereTrans::CoVecPanelTrans( ixRightPanel, m_box.GetPanel(), (*pDataVelocity)[0][k][i][j], (*pDataVelocity)[1][k][i][j], tan(m_dANode[i]), tan(m_dBNode[j])); } } } // Post-process velocities across top edge if (ixTopPanel != m_box.GetPanel()) { int i; int j; int iBegin = m_box.GetAInteriorBegin()-1; int iEnd = m_box.GetAInteriorEnd()+1; j = m_box.GetBInteriorEnd(); for (int k = 0; k < pDataVelocity->GetSize(1); k++) { for (i = iBegin; i < iEnd; i++) { CubedSphereTrans::CoVecPanelTrans( ixTopPanel, m_box.GetPanel(), (*pDataVelocity)[0][k][i][j], (*pDataVelocity)[1][k][i][j], tan(m_dANode[i]), tan(m_dBNode[j])); } } } // Post-process velocities across left edge if (ixLeftPanel != m_box.GetPanel()) { int i; int j; int jBegin = m_box.GetBInteriorBegin()-1; int jEnd = m_box.GetBInteriorEnd()+1; i = m_box.GetAInteriorBegin()-1; for (int k = 0; k < pDataVelocity->GetSize(1); k++) { for (j = jBegin; j < jEnd; j++) { CubedSphereTrans::CoVecPanelTrans( ixLeftPanel, m_box.GetPanel(), (*pDataVelocity)[0][k][i][j], (*pDataVelocity)[1][k][i][j], tan(m_dANode[i]), tan(m_dBNode[j])); } } } // Post-process velocities across bottom edge if (ixBottomPanel != m_box.GetPanel()) { int i; int j; int iBegin = m_box.GetAInteriorBegin()-1; int iEnd = m_box.GetAInteriorEnd()+1; j = m_box.GetBInteriorBegin()-1; for (int k = 0; k < pDataVelocity->GetSize(1); k++) { for (i = iBegin; i < iEnd; i++) { CubedSphereTrans::CoVecPanelTrans( ixBottomPanel, m_box.GetPanel(), (*pDataVelocity)[0][k][i][j], (*pDataVelocity)[1][k][i][j], tan(m_dANode[i]), tan(m_dBNode[j])); } } } }