Welcome, Guest
Username: Password: Remember me

TOPIC: Calling different mesh zones to assign head losses

Calling different mesh zones to assign head losses 6 years 7 months ago #29725

  • SDAC
  • SDAC's Avatar
Thanks for sending the code across!

However, your code doesn't apply the head losses either for this case. Therefore I'm assuming it's not a coding issue, and has to do with the private variable being read. However, applying the limit IF(ABS(A-1.D0).LT.1.D-6) doesn't work either.
The values stored on my mesh arrays are either integers or have maximum of 4 decimal places. What other examples of private arrays I can find on the forum have large single precision values on their meshes. Maybe the is some issue here.
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29726

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 584
  • Thank you received: 106
Hi!

If you tried my piece of code on your test mesh with DRAG as PRIVATE VARIABLE no 1 then it is normal that you don't see anything: DRAG is equal to 1 on all your nodes which means that my code will apply a drag term on all the 3D nodes since I apply it on all planes unlike what you want to do. Make a test by putting some nodes with DRAG = 0 and see what happens?

The values stored in your mesh are of format double precision, even if you enter integer values in Blue Kenue or other pre-processing software. So this should not be the issue.

Good luck!
PL
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29727

  • SDAC
  • SDAC's Avatar
Hi!

I used a private variable with 0 in places (specifically, the ROUGH variable with 0 where there's 1 in the file I sent) and still didn't get a result.

I assume you specify the first private variable by inputting it as the first one after NAME OF 2D PRIVATE VARIABLES in the car file?
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29734

  • SDAC
  • SDAC's Avatar
I should note that the results i'm getting are the same as the results when I don't use the code, so it could be an issue with how PRIVE being used defined/called within the code...
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29765

  • SDAC
  • SDAC's Avatar
This is my more optimised code: the run with hard-coded nodes runs well. Run with PRIVE replacing the coded nodes and there's no drag effect. I've also noticed that the drag effect in the hard-coded runs is only applied at the surface nodes. I think this may be a loop issue.

Also, using the .EQ. sign results in a segmentation fault when using PRIVE, although .GT. is fine. This was surprising as the array being read has values up to 4 at the nodes. Perhaps syntax?

My current method is, declare variables:
USE DECLARATIONS_TELEMAC3D, ONLY: PRIVE2D, NPLAN

Call:
CALL OS( 'X=0      ',X=S1U)
	     CALL OS( 'X=0      ',X=S1V)
      S1U%TYPR='Q'
	 S1V%TYPR='Q'
      IF(NONHYD) THEN
        S0W%TYPR='0'
        S1W%TYPR='Q'
	  CALL OS( 'X=0      ',X=S1W)
	ENDIF

Apply loop for prescribing head losses at layers:
DO I=1,NPOIN2
	  IF (ABS(PRIVE2D%ADR(1)%P%R(I)-2.D0).LT.2.D0)THEN
   			DO IPLAN = NPLAN-13,NPLAN
				I3D = I+NPOIN2*(IPLAN-1)
			     AREA = 24.3816D0
				ENDDO
				END IF

	  IF (ABS(PRIVE2D%ADR(1)%P%R(I)-3.D0).LT.3.D0)THEN
   			DO IPLAN = NPLAN-13,NPLAN
				I3D = I+NPOIN2*(IPLAN-1)
			     AREA = 77.6668D0
				ENDDO
				END IF
	
	   IF (ABS(PRIVE2D%ADR(1)%P%R(I)-4.D0).LT.4.D0)THEN
   			DO IPLAN = NPLAN-13,NPLAN
				I3D = I+NPOIN2*(IPLAN-1)
			     AREA = 27D0	
				ENDDO
				END IF

	 NORM =SQRT(UN3%R(I3D)**2+VN3%R(I3D)**2+WN3%R(I3D)**2)
			S1U%R(I3D)=0.5D0*AREA*CD2*NORM
			S1V%R(I3D)=0.5D0*AREA*CD2*NORM
			S1W%R(I3D)=0.5D0*AREA*CD2*NORM
			END DO


I've tested:

- The arrays are succesfully read by Telemac - "Variables are found in the geometry file"
- Hard-coding the node IDs works - the drag terms are applied successfully to the nodes.
- Replacing the hard-coded node IDs with the PRIVE test and the model runs but no drag terms are applied.
- Applying a limit to make sure no nodes are missed due to slight differences due to DP cpnversion doesn't change anything.
- Testing different private variables with irregularly spaced nodes-for-drag doesn't change anything: no head losses are prescribed at all and the results look as it does without any drag.
-Inserting the PRIVE integral fraction directly into the equations results in *something* prescribed to the desired layers, but those layers inhibit flow across all the nodes on the layers even when the private variables are spread irregularly (i.e. some nodes should have drag and others not at each layer).

I am using v7p2r3 - as I want to use the latest LIPS advection scheme. I assume nothing has changed with Private variables? (I've not found any documentation if so)

I think I'm close, however i'm still puzzled over why the loop is fine with hard-coded nodes and not with the private array

File Attachment:

File Name: roughness_test2.zip
File Size: 153 KB
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29769

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 584
  • Thank you received: 106
Hi,

I think you should simplify you case to the maximum until you manage to have the head losses taken into account using PRIVE and then progressively add complexity with layer treatment etc.

I am not sure what is the aim of the following IF tests:

IF (ABS(PRIVE2D%ADR(1)%P%R(I)-2.D0).LT.2.D0) : true for PRIVE = 1 or 2 or 3
IF (ABS(PRIVE2D%ADR(1)%P%R(I)-3.D0).LT.3.D0) : true for PRIVE = 1 or 2 or 3 or 4
IF (ABS(PRIVE2D%ADR(1)%P%R(I)-4.D0).LT.4.D0) : true for PRIVE = 1 or 2 or 3 or 4

Are you sure you don't want to do
IF (ABS(PRIVE2D%ADR(1)%P%R(I)-2.D0).LT.1.D-6), in order to identify nodes at which PRIVE2D is 2, for this example?

This is independant of the advection schemes, so you can run it with LIPS, it should work the same way.

Good luck!
PL
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29770

  • SDAC
  • SDAC's Avatar
Ah, yes that slipped me by!

Using Pilou's code (example given below) I've noticed that:

If the argument is PRIVE%ADR(1)%P%R(I).GT.0.1D0 or similar:

then the case runs and applies drag to all nodes at the prescribed layers, ignoring the distribution of node values in the private array (most of the nodes values = 0 so drag shouldn't be applied at all nodes).

If the argument is PRIVE%ADR(1)%P%R(I).EQ.1D0 or similar (including the cleaner test mentioned earlier):

then the case runs and doesn't apply any drag, and the results are like a run without the code.

This suggests: the array has values >0.1 but don't match exactly with 1. The distribution of drag is what I would expect if the array had a uniform distribution of node values >0.1D0, not the more scattered distribution of node values actually in the variable where most of the nodes have values of 0.

The only variables in my current .slf file are the BOTTOM geometry file and the variable ROUGH which contains the specific nodes where I want the drag terms to be applied with values >0

It's like the code is using the node values in the array as a benchmark for applying the code, rather than using the node values in the array to find the places where the code should be applied. i.e. it applies the fortran code to all nodes if the array has node values >0.01, rather than applying the code only to the selected nodes which have values >0.01 (as an example).

Questions:

1) I had assumed that PRIVE%ADR(1)%P%R(I) extracts the node values from the private variables that match the test (e.g. (I).EQ.2D0) and the line I3D=I+NPOIN2*(IPLAN-1) finds the 3D node IDs for those matching values. After the code should apply the drag only to those specific nodes. Is this correct?

2) If not, are there alternative codes for applying the fortran codes to only the specific nodes? Reading the forum, I had assumed that my code was doing that anyway...

3) What is the test for finding out what values Telemac is reading from the private array? I've used some different print* arguments but I've not had any luck e.g.

print *,'PRIVE2D READ VALUES ',PRIVE%ADR(1)%P%R(I)

Thanks for your continued patience and advice!
DO I=1,NPOIN2 
 !       IF (PRIVE%ADR(1)%P%R(I).GT.2.1) THEN
          DO IPLAN=5,NPLAN 
            I3D = I+NPOIN2*(IPLAN-1) 
            NORM=SQRT(UN3%R(I3D)**2+VN3%R(I3D)**2+WN3%R(I3D)**2) 
            S1U%R(I3D)= 0.5D0 * AREA * NORM * CD
            S1V%R(I3D)= 0.5D0 * AREA * NORM * CD
!            S1W%R(I3D)= 0.5D0 *AREA * NORM * CD
          ENDDO
 !       ENDIF
      ENDDO
Attachments:
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 7 months ago #29771

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 584
  • Thank you received: 106
Hi,

In your version the IF test is commented out so you don't apply any filter based on what you have in PRIVE2D. Beware also that the IF test that you have is using the 3D PRIVE array and not the PRIVE2D array in which the values of ROUGH are stored.

You really need to be careful when making changes as it is very easy to make small mistakes that can take a long time to get rid of...

Questions 1 and 2.
In my method i use the PRIVE2D variables as filters for identifying 2D nodes where i want to make a give treatment. What I put in PRIVE2D usually is dummy values, just to identify where I want a treatment (eg 1) or not (0). I then insert a IF test to identify those 2D nodes and after loop on the vertical planes to apply the treatment to the nodes located on the same vertical.

Question 3.
You can save S1U etc in the 3D PRIVE arrays as result variables in the 3D result file. I can't give an example now since i'm writing from my phone but read the manual, there should be some example.

Good luck!
PL
The administrator has disabled public write access.
The following user(s) said Thank You: SDAC

Calling different mesh zones to assign head losses 6 years 7 months ago #29803

  • SDAC
  • SDAC's Avatar
Hi!

Thanks for you patience. I see I left some errors in the version I uploaded :dry: With the errors corrected the IF test still results in a drag-less flow.

Thanks for clarifying - odd that it doesn't work for me despite all the checks.

I'm trying an alternative to see if I have better luck, inspired by the FIND_VARIABLE approach in the SYSPHE forum I want Telemac to internally handle the formatted file in a manner that's compatible with parallel. e.g.
CALL FIND_VARIABLE ('SERAFIN', T3D_FILES(T3DGEO),'ROUGH   ', A, MESH2D%NPOIN,IERR)

To clarify, I'm defining 'A' as the variable found in the array'ROUGH' in the geo file, however I receive the error:

... checking the executable
CALL FIND_VARIABLE('SERAFIN ', T3D_FILES(T3DGEO)
11111111111111111111111111111111111
Error: Type mismatch in argument 'fid' at (1); passed TYPE(bief_file) to INTEGER

Looking through the forum I assume this from an incorrect declaration or a poor assumption of the syntax by myself. I've declared A as a DOUBLE PRECISION, is this incorrect?

My other alternative would be to load the node ID and coefficient value in a text file, but this wouldn't work in parallel which I need.
The administrator has disabled public write access.

Calling different mesh zones to assign head losses 6 years 6 months ago #29842

  • SDAC
  • SDAC's Avatar
Update:

Using FIND_VARIABLE doesn't work either. I used WRITE(*,*) PRIVE%ADR(1)%P%R(I) in the original code, which printed out values not contained within my geo file:
MASS BALANCE
INITIAL MASS OF WATER IN THE DOMAIN : 293.24745667252597
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229
2.2090332867566489E-229

================================================================================
ITERATION 25 TIME 0 D 0 H 0 MN 15.0000 S ( 15.0000 S)
================================================================================
ELEVATION AT THE BOUNDARY READ IN THE ASCII FILE
2.2090332867566489E-229

I get a similar issue when using FIND_VARIABLE, but with incredibly high numbers instead:
MASS BALANCE
INITIAL MASS OF WATER IN THE DOMAIN : 293.24745667252597
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
1.7976931348623157E+308
================================================================================
ITERATION 25 TIME 0 D 0 H 0 MN 15.0000 S ( 15.0000 S)
================================================================================
ELEVATION AT THE BOUNDARY READ IN THE ASCII FILE
1.7976931348623157E+308

Telemac is reading the right variable in the geo file as shown by "VARIABLE ROUGH FOUND IN THE GEOMETRY FILE". These values would explain why the tests don't work, however I don't understand where they're coming from.

Telemac isn't taking the values directly from the array. What/are there any steps are there between Telemac reading the file and calling it for use in fortran?
The administrator has disabled public write access.
Moderators: pham

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