Welcome, Guest
Username: Password: Remember me

TOPIC: Custom function

Custom function 11 years 3 days ago #11092

  • Mat
  • Mat's Avatar
Hello,

I want to write a complicated geometrical function in order to modify the bathymetry of a model. This function will be called several times to modify different zones of the domain.

I'm looking for a step by step method to indicate where I should put that function in the numerous .f files, and how I can call it.

Thanks!
The administrator has disabled public write access.

Custom function 11 years 3 days ago #11093

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
Hello,

you can use the CORFON-like subroutine (called at the start of the simulation). You can find one in every module. An example of use of which can be found in examples\telemac2d\hydraulic_jump\

Hope this helps.

Sébastien.
The administrator has disabled public write access.
The following user(s) said Thank You: Mat

Custom function 11 years 3 days ago #11105

  • jmhervouet
  • jmhervouet's Avatar
Hello,

As it must be done several times, I suggest to do this in subroutine utimp_telemac2d, which is just there for users and is called at every time step.

There the bottom will be ZF, as a BIEF_OBJ object (see programming guide), which means that the double precision bottom is in array ZF%R. You have time in the arguments of this subroutine. Assume that you want to raise the bottom of 1 m at the fifth time step, add :

INTEGER I
IF(LTL.EQ.5) THEN
DO I=1,ZF%DIM1
ZF%R(I)=ZF%R(I)
ENDO
ENDIF

All variables in telemac2d are seen here, thanks to the USE DECLARATIONS_TELEMAC2D.


Regards,

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

Custom function 11 years 3 days ago #11127

  • Mat
  • Mat's Avatar
Hello,

many tanks for the quick response. Actually, the function I would like to write is very similar to INPOLY.f subroutine. Imagine I want to modify the bathymetry inside a large number of polygon, let say 25. I want to write a mathematical function with input a polygon, and output a boolean or an integer. This function will be called several times (25 times) inside CORFON or any other subroutine. Is that possible?

Thanks again.

Mat
The administrator has disabled public write access.

Custom function 11 years 2 days ago #11128

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Of course it is possible, I just thought that you meant several times at different time steps. If the modification of bottom is done once at the beginning, then it is to be done in corfon.

Regards,

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

Custom function 11 years 2 days ago #11131

  • Mat
  • Mat's Avatar
Hello Jean-Michel,

thanks again for your reply. I'm new with telemac AND fortran. I just can't see were I should write my custom mathematical function. In a new .f?
The administrator has disabled public write access.

Custom function 11 years 2 days ago #11134

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
yes -- just create a new .f file, add all the code you wish to modify in it, one subroutine after the other (including your own) and add the keyword FORTRAN FILE to your steering file.

That should do it.

Hope this helps,
Sébastien.
The administrator has disabled public write access.
The following user(s) said Thank You: Mat

Custom function 11 years 2 days ago #11135

  • Mat
  • Mat's Avatar
OK! seems like it should work. For my understanding, the "steering file" is the "cas" file?

Thank you all!
The administrator has disabled public write access.

Custom function 11 years 2 days ago #11139

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
yes -- the CAS file.

Good luck.
Sébastien.
The administrator has disabled public write access.
Moderators: pham

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