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

TOPIC: Read information from a file

Read information from a file 13 years 6 months ago #1567

  • kroptia
  • kroptia's Avatar
Hello everyone,
I would like to "import" data from a file (for example "condition_lim.data").
I know for the moment that limwac.f allow you to specify boundary condition, but how can I get it from a file? :huh:

In my file "condition_lim.data", each line has the same number of the boundary nodes.
And one line represent a time.

Thank you for your (futur) help.

Kroptia
The administrator has disabled public write access.

Re:Read information from a file 13 years 6 months ago #1568

  • giovanni.mattarolo
  • giovanni.mattarolo's Avatar
Hello,

if I understood well, you would like to impose wave boundary conditions that change in time and along the boundaries, and you would like to read those conditions from a formatted file.

In this case, unluckily, there are not shortcuts : you have to code this approach in the subroutine LIMWAC.f and specify that at each time step you read the b.c. wave spectra parameters for each node at the boundaries from an external file.

Pay attention: if the file containing the b.c. does not have one of the formats automatically read by TOMAWAC, you have to specify correctly its location.
During the simulation a temporary folder is created, which is located in the steering file folder and which TOMAWAC make reference to: if your condition_lim.data file is placed in the same folder of the steering file and you want to open it and read it (you code this in the subroutine LIMWAC.f), the filename to specify
is NOT: 'condition_lim.data',
it is: '../condition_lim.data'.

Hope it helps,

Giovanni
The administrator has disabled public write access.

Re:Read information from a file 13 years 6 months ago #1569

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi

About the file location, you could also use dedicated files:
- BINARY FILE 1 (the channel in your program will be 24)
- FORMATTED FILE 1 (the channel in your program will be 26)

Using such files allow you to never take care about the location of file and make an automatic treatment for opening/closing. Moreover, this is the only solution for parallelism

Regards
Christophe
The administrator has disabled public write access.

Re:Read information from a file 13 years 6 months ago #1572

  • kroptia
  • kroptia's Avatar
Hi,
That's exactly what I meant.
But are they keywords? I mean, "BINARY/FORMATTED FILE 1" are keywords that I have to put in the steering file ?

And after, will I have to treat data like I should do in a fortran code ? (I mean "import & copy" data in a matrix)
The administrator has disabled public write access.

Re:Read information from a file 13 years 6 months ago #1573

  • giovanni.mattarolo
  • giovanni.mattarolo's Avatar
Hi,

the answer is YES for both of your questions :
- you have to specify the BINARY/FORMATTED FILE 1 in the steering file
- you have to manage the read and write operations of the file within the fortran program (e.g. by modifying the subroutine LIMWAC.f)

Kind regards,

Giovanni
The administrator has disabled public write access.

Re:Read information from a file 13 years 6 months ago #1574

  • kroptia
  • kroptia's Avatar
Thank you. I sucess to import my data.
But I have a question about boundary condition:

For example, I have 2 nodes for my boundary condition like that :
X
X
(where X are my nodes)

My question is : How can I specify, in limwac.f, the value of Hm0(for example) for both nodes? Because their values are differents.
The administrator has disabled public write access.

Re:Read information from a file 13 years 6 months ago #1579

  • giovanni.mattarolo
  • giovanni.mattarolo's Avatar
Hi,

you have to specify directly in LIMWAC.f (or you can create another subroutine for this specific purpose) the wave conditions for each node of the boundaries, i.e. to do a loop over the nodes at the boundaries and associate the wave spectra parameters read from your data file to the corresponding node.
As I wrote in a previous post, this is the only way to implement this in TOMAWAC (no shortcuts, as I wrote in a previous post).

Something that could help you : the numbering of the boundary points first delineates the domain contour in the counterclockwise direction, then the islands in the clockwise direction. You can make use of this for selecting easily the nodes of the liquid boundaries and define their boundary conditions.

Kind regards,

Giovanni
The administrator has disabled public write access.

Re:Read information from a file 13 years 5 months ago #1651

  • kroptia
  • kroptia's Avatar
Thank you, but now I have another challenge, because I'm using parallel computation, and the numbering has changed.
I'll try to fix it, and I will give a feedback soon.
The administrator has disabled public write access.

Re:Read information from a file 13 years 5 months ago #1652

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
In order to use parallelism, you should avoid any direct reference to node numbering in your program because this number change in each submodel.
For example, in your model, you have only 1 point with the number 1 but if you use parallelism with 8 subdomain, you will have 8 nodes with the number 1 (1 in each subdomain).
The main point you should know for the parallelism in telemac:
There is a vector in the telemac description names KNOLG that gives for each local node the corresponding numbering in the global model.
Have a look in the sources (search KNOLG and you will find example of how to use it)

Good luck
Christophe
The administrator has disabled public write access.

Re:Read information from a file 13 years 5 months ago #1653

  • jmhervouet
  • jmhervouet's Avatar
Hello,

The person in charge of Tomawac (Giovanni Mattarolo) is not here today but basically you have in subroutine LIMWAC an array called BOUNDARY_COLOUR that gives you the original boundary point number when you are in parallel.

If K is the original boundary point number, in parallel the point L so that :

BOUNDARY_COLOUR%I(L)=K is your original point

You can program a loop to find it, keeping in mind that not all the sub-domains will contain it, so for example :

Suppose you look for boundary point 132

L=0
DO I=1,NPTFR
IF(BOUNDARY_COLOUR%I(I).EQ.132) L=I
ENDDO

IF(L.GT.0) THEN
Do here to point L what you do in scalar mode with point 132.
ENDIF

This will work also in scalar mode

Best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: tfouquet

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