Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: changing the values of (BIEF_OBJ) variables

changing the values of (BIEF_OBJ) variables 1 year 5 months ago #42657

  • MartinPHYS
  • MartinPHYS's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 24
  • Thank you received: 1
Hello,

I am wondering what I am doing wrong when trying to set the values of BIEF_OBJ variables, such as U, V, H, and ZF. I am trying to use the user_bord subroutine to set the values of these variables, for example to set the value of U to 'value' at border node K (where K is the index of a loop through NPTFR) I write:

U%R(NBOR(K)) = 'value'

but this does not work. If I set the value of LIUBOR to 6 (prescribed velocity) and instead write in the loop:

UBOR(K,1) = 'value'

then the code works and the velocity is set to the correct value I want. The issue with this fix is that I do not want to have the value of LIUBOR set to 6 because I must then supply a prescribed velocity. I want the velocity to be free up until I change the value at a certain time threshold. Also, I want to change the value of certain bottom elevations, ZF, and I cannot use this fix for that variable as you do not prescribe bottom elevations.

I can supply my entire code, but I will need to add enough comments to it first so that it can be interpreted.
The administrator has disabled public write access.

changing the values of (BIEF_OBJ) variables 1 year 5 months ago #42660

  • MartinPHYS
  • MartinPHYS's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 24
  • Thank you received: 1
I've attached my user_bord.f file
Attachments:
The administrator has disabled public write access.

changing the values of (BIEF_OBJ) variables 1 year 5 months ago #42682

  • MartinPHYS
  • MartinPHYS's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 24
  • Thank you received: 1
I am also working on another part of my user_bord subroutine and have come across another error that I can't seem to fix:

When looping through the boundary elements, "DO IELEM=1, MESH%NELEB", I try to reference the velocity components at point NG1, as defined in figure 5.5 on page 83 of the developer's manual with the following lines:

U%R(MESH%IKLE%R(IELEM,1))
V%R(MESH%IKLE%R(IELEM,1))

but gfortran gives me an error of:


119 | Uout(countout) = U%R(MESH%IKLE%R(IELEM,1))
|
1
Error: Rank mismatch in array reference at (1)

I am trying to find a fix in the manual but everything I try gives me a similar error. Can anyone help me with my syntax or point me towards a resource that may help?
The administrator has disabled public write access.

changing the values of (BIEF_OBJ) variables 1 year 5 months ago #42712

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1549
  • Thank you received: 598
Hello again,

Be careful when you manipulate BIEF_OBJ.
Suffix %R is for real and %I is for integer.

If you do not know, you can use the old (but very common) method to print values and messages.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: MartinPHYS

changing the values of (BIEF_OBJ) variables 1 year 5 months ago #42711

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1549
  • Thank you received: 598
Hello,

You should look at how BORD subroutine is implemented. Both UBOR+VBOR and U+V arrays are filled in.

What do you mean by "but this does not work." in your 1st post? Please write the listing file if there is a written error or tell more.

What you can try is to use BOUNDARY_COLOUR array as it is done in BORD_TIDE subroutine. It is an array which corresponds to the last column of the boundary conditions file if you use SERAFIN format. If you do not change it, it corresponds to the number of the line (and number of the boundary nodes) and it works in parallel (as partitionned). Convenient if you need to locate a boundary node for boundary treatments.

Be careful if you implement something with hard-coded number of nodes, the numbering is not the same in parallel.

If you want to change bottom elevation, if it is for every time step, you can implement someting in USER_CORFON subroutine.
If you want to change it from a particular time step, you can e.g. modify TELEMAC2D subroutine.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: MartinPHYS

changing the values of (BIEF_OBJ) variables 1 year 5 months ago #42723

  • MartinPHYS
  • MartinPHYS's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 24
  • Thank you received: 1
Be careful when you manipulate BIEF_OBJ.
Suffix %R is for real and %I is for integer.

-Thanks for this clarification, it is what I suspected but I was not quite sure. I've tried both and neither have worked for me. I'll keep trying things out.
You should look at how BORD subroutine is implemented. Both UBOR+VBOR and U+V arrays are filled in.

-I have been using the bord.f subroutine for guidance. I am using essentially the same syntax that is used.
What do you mean by "but this does not work." in your 1st post? Please write the listing file if there is a written error or tell more.

-To clarify, the fortran compiler doesn't give me any error and the telemac system runs as usual, but the values I want are not imposed. It runs as if I had not modified the user_bord.f file at all. This made me think that my algorithm was wrong, but when I changed the method to instead change the UBOR and VBOR values the program worked, so I suspected that it was something that I was doing with the syntax of U%R and V%R. Does LIHBOR and LIUBOR need to be set to a specific value in order to change U%R and V%R at the boundary nodes?
What you can try is to use BOUNDARY_COLOUR array as it is done in BORD_TIDE subroutine. It is an array which corresponds to the last column of the boundary conditions file if you use SERAFIN format. If you do not change it, it corresponds to the number of the line (and number of the boundary nodes) and it works in parallel (as partitioned). Convenient if you need to locate a boundary node for boundary treatments

-I will look into this, thanks.
What I want though, when I write:
U%R(MESH%IKLE%R(IELEM,1)), which I guess should be,
U%R(MESH%IKLE%I(IELEM,1))
is to get the velocity at the nodes which are adjacent to the boundary nodes and not boundary nodes themselves. i.e. the nodes that flow into the boundary nodes. For this I figured I must loop through each of the boundary elements and pick the node that is itself not a boundary node using the example outlined in figure 5.5 on page 83 of the developer's manual.
Be careful if you implement something with hard-coded number of nodes, the numbering is not the same in parallel

-Yes, my code isn't very general yet I am just trying to get it to work properly for one particular mesh and then I will make it a bit more sophisticated. I am not using any parallel computation at this point.
The administrator has disabled public write access.

changing the values of (BIEF_OBJ) variables 1 year 4 months ago #42743

  • MartinPHYS
  • MartinPHYS's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 24
  • Thank you received: 1
I am now trying to modify the bottom elevation at every time step by modifying the user_corfon.f file, which I've attached.

When compiling the attached file I get the following errors:

30 | INTEGER, INTENT(IN) :: NPOIN,NPTFR
| 1
Error: Name ‘npoin’ at (1) is an ambiguous reference to ‘npoin’ from current program unit

31 | INTEGER, INTENT(INOUT) :: LIHBOR(NPTFR),LIUBOR(NPTFR)
| 1
Error: Name ‘nptfr’ at (1) is an ambiguous reference to ‘nptfr’ from current program unit

32 | INTEGER, INTENT(IN) :: NBOR(NPTFR)
| 1
Error: Name ‘nptfr’ at (1) is an ambiguous reference to ‘nptfr’ from current program unit

34 | DOUBLE PRECISION, INTENT(INOUT) :: ZF(NPOIN)
| 1
Error: Name ‘npoin’ at (1) is an ambiguous reference to ‘npoin’ from current program unit

35 | TYPE(BIEF_MESH), INTENT(INOUT) :: MESH
| 1
Error: Name ‘mesh’ at (1) is an ambiguous reference to ‘mesh’ from current program unit

47 | DO BPTA = 1, NPTFR
| 1
Error: Name ‘nptfr’ at (1) is an ambiguous reference to ‘nptfr’ from current program unit

48 | IF(LIHBOR(BPTA).EQ.5.AND.LIUBOR(BPTA).EQ.4) THEN
| 1
Error: Name ‘lihbor’ at (1) is an ambiguous reference to ‘lihbor’ from current program unit

51 | Zout(countout) = ZF%R(NBOR(BPTA))
| 1
Error: Name ‘zf’ at (1) is an ambiguous reference to ‘zf’ from current program unit


56 | DO BPTA = 1, NPTFR
| 1
Error: Name ‘nptfr’ at (1) is an ambiguous reference to ‘nptfr’ from current program unit


57 | IF(LIHBOR(BPTA).EQ.4.AND.LIUBOR(BPTA).EQ.5) THEN
| 1
Error: Name ‘lihbor’ at (1) is an ambiguous reference to ‘lihbor’ from current program unit

60 | ZF%R(NBOR(BPTA)) = Zout(36-countin)
| 1
Error: Name ‘zf’ at (1) is an ambiguous reference to ‘zf’ from current program unit


I think this is because I am declaring the variables wrong maybe? I am not sure what to do to fix this.
Attachments:
The administrator has disabled public write access.

changing the values of (BIEF_OBJ) variables 1 year 4 months ago #42751

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1549
  • Thank you received: 598
Hello,

Hello Martin,

Indeed, you cannot declare a variable more than once.
If you add USE DECLARATIONS_TELEMAC2D statement, if a variable has already been declared inside, it cannot be declare in the same subroutine.
If you need to use a variable not provided from the arguments of subroutine, you should declare with ONLY (see the original BORD subroutine e.g.).

In your case, ZF,LIHBOR,LIUBOR,NPOIN,NPTFR,MESH are declared in DECLARATIONS_TELEMAC2D subroutine, that is why you get the error messages.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: MartinPHYS

changing the values of (BIEF_OBJ) variables 1 year 4 months ago #42744

  • MartinPHYS
  • MartinPHYS's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 24
  • Thank you received: 1
Hello again,

I have been working on the problem where I set the values of velocity at the boundary nodes to "value" by using the line:

V%R(NBOR(BPTA)) = "value"

As suggested, I used print statements to try and find out where the problem lies. Now when I tell the program to print V%R(NBOR(BPTA)) after setting it to "value", it prints the correct value. However, when I end the simulation to check the results, the velocity at NBOR(BPTA) is never changed to "value", It remains constant throughout the simulation as if I never changed anything. Do I need to "return" the new velocities back to the bord routine before the loop ends? It seems that after I set the velocities to the desired value the information is lost before it gets back to the main telemac program. Can someone explain to me what happens to the velocity information once it is set in user_bord.f ?

I have attached a newer version of my user_bord.f file, although it is very similar to the one already attached.

-Martin
Attachments:
The administrator has disabled public write access.

changing the values of (BIEF_OBJ) variables 1 year 4 months ago #42752

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1549
  • Thank you received: 598
Hello again,

If you want to prescribe a value for a liquid boundary node, you have to use a dedicated value for LIUBOR (= 5 or 6) or LIMPRO arrays (see PROPIN_TELEMAC2D subroutine).

If you want the value for velocity components to be prescribed only from one specific time step, I think you should change LIUBOR + LIVBOR arrays for the wished boundary nodes in TELEMAC2D subroutine before the first use of PROPIN_TELEMAC2D subroutine.

In your case, you modify the velocity components if LIUBOR = 4 but to really prescribe values, you can read in PROPAG subroutine that LIMPRO has to be equal to KDIR, convention for Dirichet type.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: MartinPHYS
  • Page:
  • 1
  • 2
Moderators: pham

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