Welcome, Guest
Username: Password: Remember me

TOPIC: Prescribed tracer boundary variable in space

Prescribed tracer boundary variable in space 10 years 6 months ago #13035

  • chimhill
  • chimhill's Avatar
Hello,

is it possible to set the values of several tracers to vary along the boundary and to be constant in time by just modifying the boundary conditions file and/or the steering file?
In the manual it states that in case of an inflowing open boundary with prescribed tracer (LITBOR =5) you can simply change the TBOR variable of the boundary conditions file, which works fine for me as long as there is only one tracer.

I would like to do the same, but for more than one tracer (in both telemac2d and telemac3d).
I'm afraid, I'm not familiar with neither Fortran nor the Telemac-code(yet), so if the solution is to modify the bord.f/bord3d.f file could anybody give me a hint as to which lines have to be modified and how?

Thanks a lot in advance!
The administrator has disabled public write access.

Prescribed tracer boundary variable in space 10 years 6 months ago #13037

  • jmhervouet
  • jmhervouet's Avatar
Hello,

What has worked with 1 tracer should work as well with several. All the variables concerning tracers are in blocks and you can see in bord and bord3d the loops of ITRAC from 1 to NTRAC, the only thing to know is how to deal with blocks. When you deal with velocities which are not in blocks, you get the prescribed values at UBOR%R, in blocks the prescribed values of tracer ITRAC are in TBOR%ADR(ITRAC)%P%R. You can add tests in loops over ITRAC to set different values depending on the tracer.

With best regards,

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

Prescribed tracer boundary variable in space 10 years 6 months ago #13040

  • chimhill
  • chimhill's Avatar
Hello,

thank you very much for the quick answer!

For one tracer I did not modify the bord.f code but just changed the TBOR value to be variable in space in the .cli-boundary file and deleted the keyword "PRESCRIBED TRACERS VALUES" in the cas-file, so that was easily done without programming.

I was hoping to resolve it in a similar way for more than one tracer, but if it's not possible I'll have a look into the code.

I will let you know if I'm successful!

Best wishes.
The administrator has disabled public write access.

Prescribed tracer boundary variable in space 10 years 6 months ago #13056

  • chimhill
  • chimhill's Avatar
Hello,

I was a bit reluctant to touch anything in the source code but actually it was rather straightforward to change it according to my needs.

I left the keyword PRESCRIBED TRACERS VALUES in the steering file, as some of the tracers should be just constant in time and space over the boundary.

For 2D I copied the bord.f file into my case directory and added a few lines after line 293 as follows:
ITRAC=2
TBOR%ADR(ITRAC)%P%R(3383) = 0.1
...
e.g. to assign a value of 0.1 for the second tracer at boundary node 3383 (there is no rule as to how the values will change across the boundary, so I won't loop but just assign the values one by one - not very elegant but it works).
I also added the line "FORTRAN FILE = bord.f" in the steering file.

For 3D I copied the bord3d.f file into my case directory and added a few lines after line 439:
DO NP=1,NPLAN
K=3383
IBORD = (NP-1)*NPTFR2+K
TABORL%ADR(ITRAC)%P%R(IBORD)= 0.1
...
ENDDO
As the values should be constant over the vertical I could use a loop here.
I also added the line "FORTRAN FILE = bord3d.f" in the steering file.

So thanks again for the advice, Mr. Hervouet! :)

Kind regards!
The administrator has disabled public write access.

Prescribed tracer boundary variable in space 10 years 6 months ago #13057

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Congratulations, you are a specialist now!

Just keep in mind that your implementation is not valid in parallel. It would be just a little bit more complex but well, not so.

Regards,

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

Prescribed tracer boundary variable in space 10 years 6 months ago #13060

  • chimhill
  • chimhill's Avatar
Hello,

Thanks for the hint and the nice answer!
I have tried to run the code in parallel and as you have predicted it did not work. As the ultimate aim would be to run it in parallel I have tried to alter the code, but I got stuck:

bord.f
I understand that in line 288 it is checked for parallel processors and if there are any the local node number (for the sub-domain) is converted to a global node number (for the whole domain) before calling the routine tr. As N has been assigned just the line above as NBOR(K) I assume that there is also a local and a global version of K. So in the statement TBOR%ADR(ITRAC)%P%R(K) = Z in the parallel version K would not be my global node number as I see it also in the boundary conditions file, but a local one.
As I only know the global number of the boundary node, I was thinking just to translate it into a local one by using MESH%KNOGL%I(3383) (just the opposite as KNOLG as I read in the [url=http://wiki.opentelemac.org/doku.php?id=programing_guide:structures_in_bief&s[]=knolg]wiki[/url]). So effectively I put
IF(NCSIZE.GT.1) THEN
TBOR%ADR(ITRAC)%P%R(MESH%KNOGL%I(3383)) = 0.1
ENDIF
but it was obiously not the solution seeing that the program crashed...

Thus I would be grateful to get some more advice. Is it correct that the K used in parallel computation in the bord-file is a local version? Or does the trick lie somewher else? Is it actually sufficient to change the bord routine or do I also have to go into the tr routine?

Thanks for your help!
Best regards.
The administrator has disabled public write access.

Prescribed tracer boundary variable in space 10 years 6 months ago #13061

  • jmhervouet
  • jmhervouet's Avatar
Hello,

The array KNOGL will be soon suppressed (think it may be 10000 larger than the others if you have 10000 processors, so it was not a good idea to introduce it).
In your case it is anyway not relevant because it applies to the global numbering, moreover KNOGL may return 0 in some subdomains, causing a crash.

I would suggest a specific loop like the following simplified example (the loop may be the same for all your points):

IF(NCSIZE.GT.1) THEN
DO K=1,NPTFR
IF(MESH%KNOLG%I(NBOR(K)).EQ.3383) THEN
TBOR%ADR(ITRAC)%P%R(K) = 0.1D0
ENDIF
ENDDO
ELSE
TBOR%ADR(ITRAC)%P%R(3383) = 0.1D0
ENDIF


With best regards,

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

Prescribed tracer boundary variable in space 10 years 6 months ago #13063

  • chimhill
  • chimhill's Avatar
Hello,

great, this works just fine! :-)
I have just tried it in 2D so far, but I hope I'll get it to run in 3D as well (I'll try these days).

Thanks a lot!
I was really enjoying this! :-)

Best wishes

P.S.: Just for the records: before the program actually didn't crash because of my modifications of the code, but because the coordinates of my source did not correspond exactly to a mesh point. Anyhow it didn't work properly anyway and I am much happier with the code you gave me!
The administrator has disabled public write access.

Prescribed tracer boundary variable in space 10 years 6 months ago #13064

  • chimhill
  • chimhill's Avatar
Hello,

in the end I tried it right away and also in 3D it seems to work fine after some modifications of the bord3d.f file, e.g.:

ITRAC=2
DO NP=1,NPLAN
DO K=1,NPTFR2
IF(NCSIZE.GT.1) THEN
IF(MESH2D%KNOLG%I(NBOR2%I(K)).EQ.3383) THEN
IBORD = (NP-1)*NPTFR2+K
TABORL%ADR(ITRAC)%P%R(IBORD)= 0.1D0
ENDIF
ELSE
ENDIF
ENDDO
K=3383
IBORD = (NP-1)*NPTFR2+K
TABORL%ADR(ITRAC)%P%R(IBORD)= 0.1D0
ENDDO

Thank you again for the hints and the quick responses!

With best regards
The administrator has disabled public write access.
Moderators: pham

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