Welcome, Guest
Username: Password: Remember me

TOPIC: Mesh transformation question re: equally spaced layers

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28499

  • NJ
  • NJ's Avatar
hello everyone

I have a question about mesh transformation (3).

I'm using the code below to set four layers at 1cm intervals from the bottom of the domain so that the first layer is separated form the bottom by 1cm, and next above that by 1cm, etc. I'm using ZPLANE to do this but I realise ZPLANE sets planes at exact heights rather than relative to the bottom of the bed. Running the code does create four layers similar to what I want but they're not equally spaced at 1cm. My code is:

DO IPLAN = 2,5
TRANSF_PLANE%I(IPLAN)=3
ENDDO
ZPLANE%R(2)=0.01D0
ZPLANE%R(3)=0.02D0
ZPLANE%R(4)=0.03D0
ZPLANE%R(5)=0.04D0
DO IPLAN = 6,NPLAN
TRANSF_PLANE%I(IPLAN)=1
ENDDO


How can I create four layers equally spaced at 1cm from the bottom?

Thankyou.
The administrator has disabled public write access.

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28524

  • NJ
  • NJ's Avatar
I coded the below in Calcot to set the first four levels above the bottom at 1cm intervals:
      IF(TRANSF.EQ.0) THEN
     		DO IPOIN = 1,NPOIN2
          		ZZ(IPOIN,2)= ZZ(IPOIN,1) + 0.01D0
			ZZ(IPOIN,3)= ZZ(IPOIN,1) + 0.02D0
			ZZ(IPOIN,4)= ZZ(IPOIN,1) + 0.03D0
			ZZ(IPOIN,5)= ZZ(IPOIN,1) + 0.04D0
       	 ENDDO

This ends in a standard error with no description. The fortran must be ok, but how it fits into Telemac is not working. Does anyone have any pointers on how to implement something like this?
The administrator has disabled public write access.

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28528

  • Leballeur
  • Leballeur's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 434
  • Thank you received: 163
Hello,

I think you're right, you need to code it in calcot.f
But what you have coded is overwritten below in the subroutine, around lines 114-133 for the points for planes prescribed with elevation (and maybe at lines 134-162 for sigma transformation).

Hope it helps.

Regards,
Laurent
The administrator has disabled public write access.
The following user(s) said Thank You: NJ

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28533

  • NJ
  • NJ's Avatar
Thanks for the advice.

I noticed that the elevations are prescribed at the first few bottom layers like I want, but they are at 0.006m intervals rather than 0.01m.

Something is adjusting the layers after I've prescribed them. I haven't discovered what in the code is doing so yet, but I wonder if anyone knows what part of the program re-adjusts these heights after?

In the wiki it says:
The elevation as set by the user can be changed automatically by the program either if the bottom depth is larger or if the free surface elevation is smaller (the elevations of points along a vertical line should increase between the bottom and the free surface).

The layers shouldn't clash with the bottom or the surface however, but the layers are being reduced.
The administrator has disabled public write access.

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28536

  • Leballeur
  • Leballeur's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 434
  • Thank you received: 163
That's what I said in my previous post. The steps 2-3-5 of the subroutine calcot.f are able to modify what you wrote before at the beginning of the subroutine, as described by the wiki.

Maybe you can put some print statements both after your piece of code and at the end of the subroutine to check if the elevation of each levels is what you want for one point of your domain for instance. and then better understand how the subroutine builds the vertical levels.

Regards,
Laurent
The administrator has disabled public write access.
The following user(s) said Thank You: NJ

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28540

  • NJ
  • NJ's Avatar
Thanks again for your advice. I spoke too soon about the code producing the mesh layers at all - debugger says the problem comes from how Telemac calls from CONDIM. I think my original code above is causing the problem as Telemac is struggling to implement it, or at least work it with the rest of Calcot.

Reading CALCOT it seems to give preference to TRANSF.EQ.0 and TRANSF.EQ.5, otherwise it follows steps 2-3-5. Given this, I hoped coding under IF(TRANSF_PLANE%I(I1).EQ.0) THEN would solely implement my code (below).
IF(TRANSF.EQ.0) THEN
	   	DO IPOIN = 1,NPOIN2
          		ZZ(IPOIN,2)= ZZ(IPOIN,1) + 0.01D0
			ZZ(IPOIN,3)= ZZ(IPOIN,1) + 0.02D0
			ZZ(IPOIN,4)= ZZ(IPOIN,1) + 0.03D0
			ZZ(IPOIN,5)= ZZ(IPOIN,1) + 0.04D0
       	 ENDDO
!  SIGMA TRANSFORMATION
	 DO WHILE(I1.NE.NPLAN)
       IF(TRANSF_PLANE%I(I1).EQ.0) THEN
       	 I1=2
!     LOOKS FOR SEQUENCES OF SIGMA TRANSFORMATION PLANES
            I2=I1
           DO WHILE(TRANSF_PLANE%I(I2+1).NE.0.AND.I2+1.NE.NPLAN)
              I2=I2+1
           ENDDO
!           SIGMA TRANSFORMATION FOR PLANES I1 TO I2
!           BETWEEN ALREADY TREATED PLANES I1-1 AND I2+1
           DO IPLAN=I1,I2
             IF(TRANSF_PLANE%I(IPLAN).EQ.1) THEN
                ZSTAR%R(IPLAN)=FLOAT(IPLAN-I1+1)/FLOAT(I2-I1+2)          
             ENDIF
             DO IPOIN = 1,NPOIN2
                ZZ(IPOIN,IPLAN) = ZZ(IPOIN,I1-1)
     &                          + ZSTAR%R(IPLAN)*(  ZZ(IPOIN,I2+1)
     &                                             -ZZ(IPOIN,I1-1) )
              ENDDO
            ENDDO
	  ENDDO

In this case, Telemac just gets stuck calling CONDIM. I left it for an hour and no change.

Otherwise, I altered the code in sectiion 3 to accept my above code in the IF(TRANSF_PLANE%I(I1).EQ.0) in lieu of option TRANSF_PLANE%I 3, by changing the references to TRANSF_PLANE%I(I1).EQ.3 to .EQ.0 (below). However I get an error when Telemac calls CONDIM. So CONDIM seems to be the problem in implementing my code.
I1=2
        DO WHILE(I1.NE.NPLAN)
         [b] IF(TRANSF_PLANE%I(I1).EQ.0)[/b] THEN
            I1=I1+1
          ELSE
!           LOOKS FOR SEQUENCES OF SIGMA TRANSFORMATION PLANES
            I2=I1
            [b]DO WHILE(TRANSF_PLANE%I(I2+1).NE.0.AND.I2+1.NE.NPLAN)[/b]
              I2=I2+1
            ENDDO
!           SIGMA TRANSFORMATION FOR PLANES I1 TO I2
!           BETWEEN ALREADY TREATED PLANES I1-1 AND I2+1
            DO IPLAN=I1,I2
              IF(TRANSF_PLANE%I(IPLAN).EQ.0) THEN
                ZSTAR%R(IPLAN)=FLOAT(IPLAN-I1+1)/FLOAT(I2-I1+2)
!             ELSE
!               ZSTAR%R(IPLAN) HAS BEEN GIVEN BY USER IN CONDIM
              ENDIF
              DO IPOIN = 1,NPOIN2
                ZZ(IPOIN,IPLAN) = ZZ(IPOIN,I1-1)
     &                          + ZSTAR%R(IPLAN)*(  ZZ(IPOIN,I2+1)
     &                                             -ZZ(IPOIN,I1-1) )
              ENDDO
            ENDDO
            I1=I2+1
          ENDIF
        ENDDO
!
The administrator has disabled public write access.

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28541

  • Leballeur
  • Leballeur's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 434
  • Thank you received: 163
Without error messages, it's hard to say what's happen.

Anyway, you have an user defined mesh transformation (TRANSF=0), with a mixed repartition: levels 1 to 5 --> fixed planes (TRANSF_PLANE=3) and levels 6 to NPLAN --> sigma (TRANSF_PLANE=1)
So, what you coded at the beginning of calcot is modifying after in the section "ELSEIF (NPLAN.GT.2) THEN"
- firstly in the step 2) for your planes 1 to 5
- secondly in the step 3) for your planes 6 to NPLAN

I advice you to first understand what these 2 steps do before deleting/modifying them, with some print statements on one node for the 2 simplified cases TRANSF=1 and TRANSF=3.
Then you can better understand what the code do in typical cases, and then you can try to modify it with the combination of both sections.

It's safer to keep the step 4) to check the consistency of the built mesh.
Step 5) is useless while MIN_DZ=0

Regards,
Laurent
The administrator has disabled public write access.
The following user(s) said Thank You: NJ

Mesh transformation question re: equally spaced layers 6 years 10 months ago #28548

  • NJ
  • NJ's Avatar
Thanks for your help and patience Laurent. The script now works and delivers as expected.
The administrator has disabled public write access.
Moderators: pham

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