Welcome, Guest
Username: Password: Remember me

TOPIC: 2D binary boundary forcing

2D binary boundary forcing 2 years 7 months ago #40115

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Hi

I'm trying to implement a 2D binary boundary forcing in a similar way that is done in 3D to provide spatially and temporally varying tracer conditions. I have modified the subroutine read_bin_frliq.f from Telemac3D to create effectively a 2D version (read_bin2d_frliq.f) along with user_bord.f.

The subroutines work in scalar but not parallel. I've got the standard line for dealing with converting the local to global node number which as far as I'm aware should have worked:

IF(NCSIZE.GT.1) N=MESH%KNOLG%I(N)

I created the binary boundary file using the generate_bnd python script included with Telemac (which I've successfully used for 3D models).

My theory is that the binary file is not being partioned properly when running in parallel. If I supply the binary boundary file using the handle Binary Data File 1, partel cannot split the file, but if I use Binary Data File 2 it runs but the simulation produces NaNs. Is there something special about the handle Binary Boundary File in Telemac3D that partel handles differently?

That or there's an error in the code included?!

I'm currently using v8p2r1.

Many thanks

David
Attachments:
The administrator has disabled public write access.

2D binary boundary forcing 2 years 7 months ago #40116

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

For the partitioning, you are right. There are different ways to partition in PARTEL, it is indicated in the telemac2d.dico with the last attribute of SUBMIT. For BINARY DATA FILE 1, it is SELAFIN, which means it is partitionned as a result file in subdomains of computation. For BINARY DATA FILE 2, it is PARAL, which means the file is duplicated for every subdomain, as for BINARY BOUNDARY DATA FILE. That why your implementation better works with BINARY DATA FILE 1 and does not work with BINARY DATA FILE 1.

Anyway, I cannot see any obvious reason why you get NaN. As told in other opsts, you should use a debug configuration with debug options to investigate:
See e.g. the S9.gfortran.debug configuration in the $HOMETEL/configs/systel.edf.cfg configuration file, in particular the flag fflags_debug_gfo for gfortran compiler.
fflags_debug_gfo: -g -Wall -fcheck=all -fbacktrace -fbounds-check -finit-integer=-1 -finit-real=nan -ffpe-trap=invalid,zero,overflow

It will show in which subroutine the issue/nan occurs and may help you to change something in your computation.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: DHaverson

2D binary boundary forcing 2 years 7 months ago #40125

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Many thanks for the reply Chi-Tuan.

Thats good to know. OK, will dig a little deeper and see what I can discover.

Kind regards

David
The administrator has disabled public write access.

2D binary boundary forcing 1 year 9 months ago #41971

  • Sorrymaker
  • Sorrymaker's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 28
  • Thank you received: 5
Hello David,

I'm having the similar case with yours, the calculation just get wrong values while in parallel mode.

I would like to know if you have solved this problem, if so, it would be really appreciated to know the method that you managed ?

Regards,
Grebe
The administrator has disabled public write access.

2D binary boundary forcing 1 year 9 months ago #41972

  • Sorrymaker
  • Sorrymaker's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 28
  • Thank you received: 5
Just a quick reply, I've solved my question in my case:

It's because I read the binary file and put it in a array with the 'local' number. So it's nouse to call the global number while in parallel mode, it'll cause problem since there's no such value in the array with the 'global' number.
I've tested a few situations, and the resultes seem good.
The administrator has disabled public write access.

2D binary boundary forcing 1 year 4 months ago #42853

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Hi Grebe and to others interested.

Yes, you were right, I was having trouble with various calls between global and local node numbering, which I have now resolved.

For those interested I've attached the two fortran subroutines I use to use a 2D binary boundary forcing: one called read_bin2d_frliq.f (reads the 2d boundary file) and my user_bord.f for calling read_bin2d_frliq to applying spatially and temporally varying tracers. These files run in v8p4r0. In you're steering file, the binary boundary file needs to go under BINARY DATA FILE 2.

A note of warning though: to generate the 2D binary boundary file, you need to use the python script converter.py with the generate_bnd option. In Telemac v8p2 the python script works fine for both 2D and 3D files, but since working with v8p4 there is a bug somewhere that incorrectly writes the ipobo array. It works for 3D files but not for 2D. I am yet to find where this happens.

Furthermore, if you are using this for tracer studies, the tracers need to be included in binary file as well, even if its a zero value (i.e. tracer is applied from a source point and not the boundary).

Hope other users find this useful.

David

File Attachment:

File Name: user_bord_2023-06-30.f
File Size: 5 KB


File Attachment:

File Name: read_bin2d_frliq_2023-06-30.f
File Size: 8 KB
The administrator has disabled public write access.
The following user(s) said Thank You: nshettigar

2D binary boundary forcing 1 year 6 days ago #43635

I used V8p2 scripts to creat the boundary condition but it didn't work !!
I took these actions: my main slf file is 2D that I want to extract the BC from.
I used V8p2 boundary generator,
used your fortran file,
define BINARY DATA FILE 2= my boundary condition
but it doesn't work :(
it get "Program received signal SIGSEGV: Segmentation fault - invalid memory reference"
If I run it in parallel it runs, but it doesn't read the BC everything drops
The administrator has disabled public write access.

2D binary boundary forcing 1 year 4 days ago #43637

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Hi

Could you post your cas file, I'll have a look and compare it to mine, see if I can spot anything.

Also one thing to look at (going back over my notes for creating the boundary files) there's a bug in v8p2 (not sure if its corrected in later versions) but date and time stamp is not correct after the creation of the file but you can correct it with the python scripts like this:

python [path to telemac scripts]/scripts/python3/run_selafin.py alter boundary_file.slf --date dd-mm-yyyy --time hh:mm:ss -r

Cheers

David
The administrator has disabled public write access.

2D binary boundary forcing 1 year 4 days ago #43640

Thank you for being so helpful.
I have attached the case files, I have tried these things:
1) it doesn't run on a single core but on multiple cores; however, doesn't read the boundary condition.
2) I have tried BINARY DATA FILE 1 and 2 , it doesn't work
3) I have tried with and without Prescribed elevation and velocity ( it doesn't work)
4) I used V8p2 codes to generate the boundary conditions as well (doesn't work),
I'm running on Windows, and using V8p4

Cheers,
Hamed
Attachments:
The administrator has disabled public write access.

2D binary boundary forcing 1 year 3 days ago #43642

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Hi Hamed

One thing I spotted, you haven't defined the keyword:

BINARY DATA FILE 2 FORMAT = SERAFIN

The default value for BINARY DATA FILE 2 FORMAT is BIN (a standard binary file format) so I think you're getting the segmentation fault because its expecting a different file format.

Hope that solves it.

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

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