void setNewLinkState(int j) // // Input: j = link index // Output: none // Purpose: updates state of link after current time step under // Steady Flow or Kinematic Wave flow routing // { int k; double a, y1, y2; Link[j].newDepth = 0.0; Link[j].newVolume = 0.0; if ( Link[j].type == CONDUIT ) { // --- find avg. depth from entry/exit conditions k = Link[j].subIndex; a = 0.5 * (Conduit[k].a1 + Conduit[k].a2); Link[j].newVolume = a * link_getLength(j) * Conduit[k].barrels; y1 = xsect_getYofA(&Link[j].xsect, Conduit[k].a1); y2 = xsect_getYofA(&Link[j].xsect, Conduit[k].a2); Link[j].newDepth = 0.5 * (y1 + y2); // --- update depths at end nodes updateNodeDepth(Link[j].node1, y1 + Link[j].offset1); updateNodeDepth(Link[j].node2, y2 + Link[j].offset2); // --- check if capacity limited if ( Conduit[k].a1 >= Link[j].xsect.aFull ) Conduit[k].capacityLimited = TRUE; else Conduit[k].capacityLimited = FALSE; } }
void setNewLinkState(int j) // // Input: j = link index // Output: none // Purpose: updates state of link after current time step under // Steady Flow or Kinematic Wave flow routing // { int k; float a, y1, y2; Link[j].newDepth = 0.0; Link[j].newVolume = 0.0; if ( Link[j].type == CONDUIT ) { // --- find avg. depth from entry/exit conditions k = Link[j].subIndex; a = 0.5 * (Conduit[k].a1 + Conduit[k].a2); // avg. area Link[j].newVolume = a * Conduit[k].length * Conduit[k].barrels; y1 = xsect_getYofA(&Link[j].xsect, Conduit[k].a1); y2 = xsect_getYofA(&Link[j].xsect, Conduit[k].a2); Link[j].newDepth = 0.5 * (y1 + y2); // --- update depths at end nodes updateNodeDepth(Link[j].node1, y1 + Link[j].z1); updateNodeDepth(Link[j].node2, y2 + Link[j].z2); } }
void setNewLinkState(Project* project, int j) // // Input: j = link index // Output: none // Purpose: updates state of link after current time step under // Steady Flow or Kinematic Wave flow routing // { int k; double a, y1, y2; project->Link[j].newDepth = 0.0; project->Link[j].newVolume = 0.0; if ( project->Link[j].type == CONDUIT ) { // --- find avg. depth from entry/exit conditions k = project->Link[j].subIndex; a = 0.5 * (project->Conduit[k].a1 + project->Conduit[k].a2); project->Link[j].newVolume = a * link_getLength(project, j) * project->Conduit[k].barrels; y1 = xsect_getYofA(project, &project->Link[j].xsect, project->Conduit[k].a1); y2 = xsect_getYofA(project, &project->Link[j].xsect, project->Conduit[k].a2); project->Link[j].newDepth = 0.5 * (y1 + y2); // --- update depths at end nodes updateNodeDepth(project, project->Link[j].node1, y1 + project->Link[j].offset1); updateNodeDepth(project, project->Link[j].node2, y2 + project->Link[j].offset2); // --- check if capacity limited if ( project->Conduit[k].a1 >= project->Link[j].xsect.aFull ) { project->Conduit[k].capacityLimited = TRUE; project->Conduit[k].fullState = ALL_FULL; //(5.1.008) } else { project->Conduit[k].capacityLimited = FALSE; project->Conduit[k].fullState = 0; //(5.1.008) } } }