Welcome, Guest
Username: Password: Remember me

TOPIC: Need help programming prosou subroutine using FILPOL function

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7225

  • mathieu5roy
  • mathieu5roy's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 60
  • Thank you received: 7
Hello,

I'm beginner in fortran language programming.

I'm trying to use a spatially varying wind drag coefficient. In order to do this i tried using filpol in prosou.

My code looks like this :

IF(VENT) THEN

NSOM = 4
XSOM(1) = 465100.D0
YSOM(1) = 5565000.D0
XSOM(2) = 509800.D0
YSOM(2) = 5580000.D0
XSOM(3) = 509800.D0
YSOM(3) = 5620000.D0
XSOM(4) = 465100.D0
YSOM(4) = 5620000.D0
DRAG = 3.2D-6
!
CALL FILPOL( FAIR , DRAG , XSOM , YSOM , NSOM , MESH )
! SECTION SUD
NSOM = 4
XSOM(1) = 465100.D0
YSOM(1) = 5523000.D0
XSOM(2) = 509800.D0
YSOM(2) = 5529000.D0
XSOM(3) = 509800.D0
YSOM(3) = 5580000.D0
XSOM(4) = 465100.D0
YSOM(4) = 5565000.D0!
CALL FILPOL( FAIR , DRAG , XSOM , YSOM , NSOM , MESH )
!
! TEMPORARY TREATMENT OF TIDAL FLATS
! THE WIND EFFECT IS ONLY CONSIDERED IF THE WATER DEPTH IS
! GREATER THAN 1 M.
!
! ASSUMES HERE THAT THE WIND IS GIVEN IN P1
!
DO N=1,NPOIN
IF (HN%R(N).GT.HWIND) THEN
WD = SQRT( WINDX%R(N)**2 + WINDY%R(N)**2 )
FU%R(N) = FU%R(N) + FAIR * WINDX%R(N) * WD / HN%R(N)
FV%R(N) = FV%R(N) + FAIR * WINDY%R(N) * WD / HN%R(N)
ENDIF
ENDDO
!
ENDIF

However, I get the following error code saying i'm passing REAL(8) to FAIR, which is not the case since DRAG is initialized as DOUBLE PRECISION.

t2dfort.f:859.19:

CALL FILPOL( FAIR , DRAG , XSOM , YSOM , NSOM , MESH )
1
Error: Type mismatch in argument 'f' at (1); passed REAL(8) to TYPE(bief_obj)
t2dfort.f:870.19:

CALL FILPOL( FAIR , DRAG , XSOM , YSOM , NSOM , MESH )
1
Error: Type mismatch in argument 'f' at (1); passed REAL(8) to TYPE(bief_obj)
... The following command failed for the reason above


Any help would be appreciated

Thanks
The administrator has disabled public write access.

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7226

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1559
  • Thank you received: 602
Hello,

If you look at the types of the expected arguments of the subroutine FILPOL in bief sources, you can see that the 1st argument FAIR in your case is supposed to be a BIEF_OBJ, not a real or a double precision. That is why you got this error.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7228

  • mathieu5roy
  • mathieu5roy's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 60
  • Thank you received: 7
hi thanks for reply. if i understand correctly, i cannot use filpol for a varying FAIR ???


what would be the best way to do this???


Mathieu
The administrator has disabled public write access.

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7235

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
In PROSOU, FAIR is a real. Filpol is curently used to fill a vector with a define value only inside a given polygon.
So you should create your own varaible FAIR as a bief_obj and then you could use filpol.
In prosou, you should also adapt the code to take in account the variability of FAIR in the computation of FU and FV

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

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7245

  • mathieu5roy
  • mathieu5roy's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 60
  • Thank you received: 7
Hello Christophe and Chi-Tuan,

I tried what suggested Christophe but i think i'm missing something

here's what i did :

initializing my own FAIR as bief obj in prosou like this :

TYPE(BIEF_OBJ), INTENT(INOUT) :: FAIR,FU,FV,SMH,FXWAVE,FYWAVE

to take into account FAIR variability i did the following :

FU%R(N) = FU%R(N) + FAIR%R(N) * WINDX%R(N) * WD / HN%R(N)
FV%R(N) = FV%R(N) + FAIR%R(N) * WINDY%R(N) * WD / HN%R(N)

Unfortunately, my code does not reach the FU and FV computation. I get the following error code after the first FILPOL call:

FILPOL (BIEF): IELM = 4 ELEMENT NOT AVAILABLE

In FILPOL, IELM should be 10,11 or 12 for the element type. However, mine is set to 4 which sends me to the error code a couple of lines later.

What am i doing wrong here, and how can i fix this.

thanks a lot

Mathieu
Attachments:
The administrator has disabled public write access.

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7249

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
You cannot use the name FAIR directly as it was an argument of the subroutine for a scalar variable.
When I wrote your own FAIR, that's mean you add a variable MYFAIR with the type bief_obj.
The first time you enter in this subroutine, you have to allocate this variable (bief_allvec) and the you could use it.

Programming in telemac is powerfull but not necessary easy. Did you read the dedicated document telemac-guide-for-programming-v6p0 wrote by Jean-Michel?

Enven the version is now 6.2, the principles stay the same

Hope this helps
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: mathieu5roy

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7263

  • mathieu5roy
  • mathieu5roy's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 60
  • Thank you received: 7
Hello Christophe,

I'm quite aware that programming in telemac is not easy. Anyway, I've taken some time to read the programming guide. I tried replicating the example on p24. Here what i've added in prosou :

TYPE(BIEF_OBJ), INTENT(INOUT) :: MYFAIR

IF(LT.EQ.0) THEN
CALL BIEF_ALLVEC(1,MYFAIR ,'MYFAIR',IELM1,1,1,MESH)
CALL OS('X=C ',X=MYFAIR,C=0.0D0)
ENDIF

Then when i call filpol :

NSOM1 = 4
XSOM1(1) = 465100.D0
YSOM1(1) = 5565000.D0
XSOM1(2) = 509800.D0
YSOM1(2) = 5580000.D0
XSOM1(3) = 509800.D0
YSOM1(3) = 5620000.D0
XSOM1(4) = 465100.D0
YSOM1(4) = 5620000.D0
DRAG = 3.2D-6
!
PRINT *, 'MATHIEU'

CALL FILPOL( MYFAIR , DRAG , XSOM1 , YSOM1 , NSOM1 , MESH )

Everything seems to go fine until T = 0 where i get :

runcode::main:
/media/sf_host/39566/2006_10_07/Calibration:
|runCAS: fail to run

I do not get any other error code, so I'm wondering what im doing bad again...

I used some prints in filpol to see where it crashes and i suspect it is the following line :

IELM = F%ELM

Can you see where i go wrong in this ???

I'm sorry for basic level question but i just need that little push to get me started...

Thanks

Mathieu
The administrator has disabled public write access.

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7264

  • jmhervouet
  • jmhervouet's Avatar
Hello,

If you want a local structure MYFAIR that is done once for all it should be really local, hence have no INTENT(INOUT) which means it is an argument of PROSOU (normally the compiler should not accept this). Then it must not be forgotten between two calls, hence there should be a SAVE command after all declarations. I am also not sure that PROSOU is called for LT=0, as I see a test IF(LT.EQ.1).

So:

TYPE(BIEF_OBJ) :: MYFAIR
LOGICAL DEJA
DATA DEJA/.FALSE./
SAVE

IF(.NOT.DEJA) THEN
CALL BIEF_ALLVEC(1,MYFAIR ,'MYFAIR',IELM1,1,1,MESH)
CALL OS('X=0 ',X=MYFAIR)
DEJA=.TRUE.

NSOM1 = 4
XSOM1(1) = 465100.D0
YSOM1(1) = 5565000.D0
XSOM1(2) = 509800.D0
YSOM1(2) = 5580000.D0
XSOM1(3) = 509800.D0
YSOM1(3) = 5620000.D0
XSOM1(4) = 465100.D0
YSOM1(4) = 5620000.D0
DRAG = 3.2D-6
!
CALL FILPOL( MYFAIR , DRAG , XSOM1 , YSOM1 , NSOM1 , MESH )

ENDIF

PRINT *, 'MATHIEU LT=',LT

and then MYFAIR should be available for all iterations




With best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.

Need help programming prosou subroutine using FILPOL function 11 years 9 months ago #7276

  • mathieu5roy
  • mathieu5roy's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 60
  • Thank you received: 7
Hi Jean-Michel

2 words :: Thank you

Prosou is only called at LT = 1. Plus intent inout on myfair was giving also error code.

Your code is working perfectly,

thanks again

Mathieu
The administrator has disabled public write access.
Moderators: pham

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