Page 1 of 1

Exporting 1D profiles

Posted: Mon Dec 13, 2010 11:31 pm
by Gareth Gretton
Hello,

I'm aware of the functionality in the Code_Saturne GUI for exporting 1D profiles (defined by two
points) and the way that this can be extended in usproj by defining the line by an arbitrary number of points. For those that don't know, this exports data from the cells closest to a set number of points along that line, with the default being 200 (I think).

What I'd like to be able to do is to export data from every cell through which my profile passes. This would sort of 'automatically' set the resolution for the output data in what I would regard as a sensible way!

One suggestion for achieving this end is to check whether a line intersects a cell using something called the "Liang-Basky clipping algorithm". The implementation of this looks fairly straighforward, after a connectivity matrix has been assembled (which lists all the faces belonging to a given cell).

The point of this post is to ask whether anyone has already done this. If not I'll have a go and attach my effort to this thread at an as-yet unspecified future date!

Gareth

Re: Exporting 1D profiles

Posted: Tue Dec 14, 2010 11:17 pm
by Alexandre Douce
Hi Gareth,

As far as I know, nobody has coded a such algorithm for Code_Saturne. This algorithm seems
to be a good idea. Whatever, it needs to construct the connectivity cells-to-faces, which is not available by default. But this connectivity is computed when the lagrangian particles tracking module (lagdeb.f90) is activated. If you are interested I have also a version coded in C :)

Re: Exporting 1D profiles

Posted: Wed Dec 15, 2010 7:22 pm
by Gareth Gretton
Hi Alexandre,

Thanks for your comments. In regards to calculating the cells-to-faces connectivity, a colleague here in Edinburgh has already written some code to do this as we did not realise that this was alread done in lagdeb.f90. I'm just having a look at lagdeb.f90 now and note that it may have a slightly more general algorithm, so possibly I will use that.

Re: Exporting 1D profiles

Posted: Thu Dec 16, 2010 10:44 am
by Alexandre Douce
That's cool! Do you intend to work in usproj.f90 or in cs_gui.c?

Re: Exporting 1D profiles

Posted: Thu Dec 16, 2010 7:49 pm
by David Olivieri
It is created in usinv.f90 as a an external module that can be activated in any subroutine through the use of
use connectivity
I hope this helps
David Olivieri
(Colleague of Gareth)

Re: Exporting 1D profiles

Posted: Thu Dec 16, 2010 9:15 pm
by Gareth Gretton
Hi Alexandre,
I think I'll be working in usproj.f90 just for now - but am I right in guessing that changes to cs_gui.c would affect the GUI itself, and so I'd need to recompile ncs?

Re: Exporting 1D profiles

Posted: Thu Dec 16, 2010 10:11 pm
by Alexandre Douce
If you have already the connectivity in Fortran it is easier to work in usproj.f90. Nevertheless, modifications of cs_gui.c will not affect the GUI if the set up for profiles does not change.

Re: Exporting 1D profiles

Posted: Mon Dec 20, 2010 2:48 pm
by David Olivieri
Dear Alexandre Douce,

   re: translation of comments on subroutine lagdeb.f90

I am writing to you if you know anyone who has translated the comments on subroutine lagdeb.f90, (see attached), into English, since I would like to compare what I have done already in terms of connectivity with this subroutine?

Re: Exporting 1D profiles

Posted: Mon Dec 20, 2010 6:53 pm
by Gareth Gretton
Hi Alexandre/all,

Having looked at lagdeb.f90 I think I see what's going on . . .

However, I think there might be a small (trivial) mistake in the documentation (not in the code itself), specifically in the table which explains itycel.

At the moment the entry reads:

Code: Select all

!        .-----.-------.------.------.-------.------.--------.
!        |  1  |  ...  | iVal | jVal |  ...  |LNDNOD|LNDNOD+1|
!        `-----'-------'------'------'-------'------'--------'
!           1            iPos  iPos+1         nPos-1 nPos=NCELET+1
but as I understand the penultimate entry shouldn't be LNDNOD, but instead "LNDNOD - number of faces associated with final cell + 1".

I may try and come up with a slightly clearer table . . .

Also, I've been having a bash at translating comments from French to English with the aid of Google translate, my French office mates, and my own incredibly limited grasp of French. Results attached!