Welcome, Guest
Username: Password: Remember me

TOPIC: Calculating streamwise velocity, & variable head losses on an object

Calculating streamwise velocity, & variable head losses on an object 6 years 5 months ago #30698

  • SDAC
  • SDAC's Avatar
Hello,

I have a couple of questions:

1) Is the velocity ux computed in a streamwise direction or in a constant x-direction?
By streamwise direction I mean the ux is in the direction of channel geometry (e.g. following a bend). By x-direction I mean that the ux is modelled in a constant direction despite changes in geometry.

I attached two images to clarify what I mean:

A ) streamwise:
Ux_streamwise.png


B ) x-directional:
Ux_directional.png


2) I want to represent a complex object using head losses. Previously, I selected a zone of nodes on the 2D mesh in BlueKenue using a polygon, then in 3D I applied head losses at every node at every layer in the zone. i.e. head losses are uniformly applied through the water column. This works well.

I also want to model a more complex object, which requires variable head losses vertically. I have a crude schematic of the object I want to model, the nodes in the pink section is where head losses would be applied:

Complexobject.png


I want to model multiple of these objects at different lengths in a channel.
Similar to the uniform method, I selected a zone of nodes in 2D. I have described the upper and lower boundaries of the object using two functions (currently quadratic, but I need to test further which function is the best).

Could I use these functions to determine which nodes on the vertical are applied head losses? E.g. for a given zone, if the z of I3D < the function lower boundary function or > the upper boundary function, the I3D is ignored otherwise a head loss I applied.

Is this possible in Telemac?

I have also thought of a layer-by-layer approach. For a given zone, for any given layer in that zone if the I3D are within the boundary functions a head loss is applied.

I have not seen any work which describes such a method for Telemac. If anyone knows of anything similar to what I want to do I'd greatly appreciate a point in the right direction.

Kind regards.
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30761

  • SDAC
  • SDAC's Avatar
Is there a term which relates to the elevation of individual nodes? I know that ZZ relates to the elevation at the planes, and ZF and ZR relate to the bed elevation.

For example, if I want to apply head losses at nodes I3D between two heights, YU and YL, then I could use something like the below:
IF ZZ(I3D).LT.YU .OR. ZZ(I3D).GT.YL
  THEN
  I3D2 = I3D

NORM =SQRT(UN3%R(I3D2)**2+VN3%R(I3D2)**2+WN3%R(I3D2)**2)
         S1U%R(I3D2)=0.5D0*A*RF*CD2*NORM
         S1V%R(I3D2)=0.5D0*A*RF*CD2*NORM
         S1W%R(I3D2)=0.5D0*A*RF*CD2*NORM
END IF

where ZZ would be the appropriate term for the node elevation.
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30802

  • SDAC
  • SDAC's Avatar
I'm using Z(I3D) to call the elevations of individual nodes.

I've created some simple code to remove nodes outside of two boundaries described by cubic functions, leaving only those between the boundaries. Using the below, only a *very* small number of nodes are affected. Clearly it's not working.

Could using .LT. and .GT. work for applying head losses only to those nodes between the function values?
! determine values for upper (yu) and lower (yl) thresholds using cubic functions

     	yu = (au*(x**3))+(bu*(x**2))+(cu*x)+du
        yl = (al*(x**3))+(bl*(x**2))+(cl*x)+dl

       DO IPLAN = NPLAN-9,NPLAN !for layers at that node
         I3D = I1+NPOIN2*(IPLAN-1) !get the 3D node ID

         DO K = 1,10
         IF (Z(I3D).LT.yu(K)) THEN !check if node elevation below upper boundary
          DO J = 1,10
          IF (Z(I3D).GT.yl(J))THEN !check if node elevation above lower boundary
             I3D2 = I3D  !define nodes within the boundaries

 !apply head losses at nodes
         NORM =SQRT(UN3%R(I3D2)**2+VN3%R(I3D2)**2+WN3%R(I3D2)**2)
         S1U%R(I3D2)=0.5D0*A*CD2*RF*NORM
         S1V%R(I3D2)=0.5D0*A*CD2*RF*NORM
         S1W%R(I3D2)=0.5D0*A*CD2*RF*NORM
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30804

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
I suppose I1 is the indices of a loop between 1 and NPOIN2...
The problem I saw is yu and yl are not array values so yu(K) is not defined...

As I understand your request, for me at each 2D node of the mesh (fixed X and Y) you have 2 formula which gives yl and yu.
So you just have to look on the plane
Make a test on Z(I3D).GT.yl and Z(I3D).LT.yu
If yes, then compute the velocity norm and by consequence the head loss coefficient with the formula and apply it to the I3D node
By default the value should be initialized to 0 for all nodes I think

Regards
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: SDAC

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30819

  • SDAC
  • SDAC's Avatar
Hi,

Thanks for your response.

I'm reviewing my code, and I'm having trouble declaring the X of a node i.e. X(NPOIN2). I get the segmentation fault. My steps are:

Input X in the initial list:
& (S0U,S0V,S0W,S1U,S1V,S1W,
     &  UN3,VN3,WSN3,WN3,
     &  VOLU,VOLUN,T3,Z,X,...

Declare X(NPOIN2)
DOUBLE PRECISION, INTENT(IN)  :: AT,DT,Z(NPOIN3),X(NPOIN2)

Just doing this results in a seg' fault. I've tried declaring just X and got the same result, so it's something to do with how it's being called. I use X later in my calls:
CALL OS( 'X=0      ',X=S1U)
	     CALL OS( 'X=0      ',X=S1V)

This is the only other time it's been used in the code. Could this be the problem?
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30820

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
You can't add variables in the initial list except if you change the interface...
To use common variables like X and Y you usually just have to add:
USE DECLARATIONS_TELEMAC3D, ONLY : X, Y
in the header of the subroutine
In general, X and Y are aliases to MESH3D%X and MESH3D%Y.
You could check this point in point_telemac3d

In the OS call, X is here for the subroutine parameter and there is no reason for a conflict...

Hope this helps
Christophe
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30900

  • SDAC
  • SDAC's Avatar
Thanks for letting me know!

My current code works to a point, but I can't see the influence of the shape in the profile. I think it's to do with the conversion of the 2D to 3D node.

For example, to check if a 3D node at x,y is between the upper boundary value yu and lower value yl, then:
     	yu = (au*(x2**4))+(bu*(x2**3))+(cu*(x2**2))+(du*x2)+eu
        yl = (al*(x2**4))+(bl*(x2**3))+(cl*(x2**2))+(dl*x2)+el

        DO IPLAN = NPLAN-29,NPLAN !for layers at that node
        I3D = I1+NPOIN2*(IPLAN-1) !get the 3D node IDs

        IF (Z(I3D).LT.yu .AND. Z(I3D).GT.yl) THEN !check if I3D is within boundaries

         NORM =SQRT(UN3%R(I3D)**2+VN3%R(I3D)**2+WN3%R(I3D)**2) !if yes, apply drag
         S1U%R(I3D)=0.5D0*A*CD2*RF*NORM
         S1V%R(I3D)=0.5D0*A*CD2*RF*NORM
         S1W%R(I3D)=0.5D0*A*CD2*RF*NORM

Here, at every layer the 2D node I1 is converted into a 3D node I3D at the respective layer. The new 3D node is then checked against the yu/yl at the same location.If it is within those boundaries head losses are applied.

Is it correct to say that all 3D nodes at the specified layers are checked in this manner?
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30914

  • SDAC
  • SDAC's Avatar
I found the problem - I forgot to scale the function. I can do this using the free surface elevation at particular node.

To find the free surface at any particular node, is it something like:

FS = ZF%R(ID)+H%R(ID)?
The administrator has disabled public write access.

Calculating streamwise velocity, & variable head losses on an object 6 years 4 months ago #30803

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
On your first question, event you probably already understand it, the velocity Ux is X-directionnal

Regards
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: SDAC

Calculating streamwise velocity, & variable head losses on an object 6 years 3 months ago #31033

  • SDAC
  • SDAC's Avatar
Revisiting this topic, I noticed some of my lower profile boundaries aren't correct.

The one step that doesn't seem to be working well is scaling the bottom profile per patch. I calculate the profile curve using the function of the profile for a relative length (i.e. 0:1), and then scale that using the max y=f(x) for each location.

A - calculate y = f(x) for all nodes (via Do loop)
y(I,1) = (al*(x2**4))+(bl*(x2**3))+(cl*(x2**2))+(dl*x2)+el

B - find the ys for each patch
y (:,2)=PATCH_NODEIDS
       DO I = 1,SIZE(y(:,1))
          IF (y(I,2)==1)THEN
		y1(I) = y(I,1)
          ELSEIF (y(I,2)==2)THEN
...
C - find the max y for each patch
MAXS(1,1)=  MAXVAL(y1)
           ...

D - use max y as a scaling factor at each patch (via Do loop)
myl = MAXS(PATCH_NODEIDS(I))
              y2 = y * myl


When writing out MAXS(I) at step C all it prints are zeroes. It's not well optimised, but I hope you see what I'm trying to achieve. Does this seem correct to you?

To clarify what I'm aiming for: 2D nodes are used to calculate functions for the upper and lower boundaries of the patch (using coeffs for relative patch length). These calculated ys are then scaled using the elevation values at the 3D nodes with the highest y for each boundary i.e. the free surface elevation for the upper boundary, and the max y for the lower boundary (seen above). The nodes < the y for the upper boundary, and > than the y for the lower boundary have head losses applied.

This works for the upper profile works. The lower it doesn't.


Kind regards,
The administrator has disabled public write access.
Moderators: pham

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.