Welcome, Guest
Username: Password: Remember me

TOPIC: extra cpu time when using sinks and sources

extra cpu time when using sinks and sources 9 years 10 months ago #15457

  • Svensmolders
  • Svensmolders's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 105
  • Thank you received: 20
Hi everybody,

we developed a new subroutine to use culverts in T3D. This subroutine is based on sinks and sources subroutine. We noticed that when we use sinks and sources that our computation time significantly increases.
After profiling the simulation with and without sinks nd sources we found that a lot of cpu time is used by a subroutine 'vector' called by the subroutine 'sinks and sources'. It seems that for every source a DO loop calls 'vector'. I added a figure showing the cpu using time of all subroutines/modules used in our simulation.

I guess that making this part of the code perform better will be a difficult task. Are there others who are using sinks and sources who also experienced this? Is this known to the developers and is this something that could be adressed in the future?

Best regards,

Sven
The administrator has disabled public write access.

extra cpu time when using sinks and sources 9 years 10 months ago #15459

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

The figure is missing.

Regards
Christophe
The administrator has disabled public write access.

extra cpu time when using sinks and sources 9 years 10 months ago #15461

  • Svensmolders
  • Svensmolders's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 105
  • Thank you received: 20
Yes I got the message that the figure was too large (=484 kb)
If I change it to jpeg the numbers in the figure are no longer readable.

But we noticed that if we use 80 sources (40 culverts) that our computation needs 1/3 more time, which is a heavy cost for our very large model :(

If I read the code correctly a vector with the size of all nodes is made for every source. It would be more optimal to uses only 1 vector with all sources inside. I guess the problem was the 3D where you could possibly have two sources at the same coordinate.

Sven
The administrator has disabled public write access.

extra cpu time when using sinks and sources 9 years 10 months ago #15463

  • jmhervouet
  • jmhervouet's Avatar
Hello,

It is exactly like what you say, and one vector is necessary per source, hence your problem with 80 sources.

The problem is that the variational formulation makes that the flux brought by the source is also spread on the first row of neighbours around the source, and these fluxes must not be mixed with those stemming from other sources because they will be multiplied separately by the tracers values at the sources.

There are several solutions :

1) to have a "Dirac" option for sources like in Telemac-2D: all discharge on the source point. Then we can mix all discharges in the same vector.

2) if the sources are sufficiently far from each other (no other source in the neighbours of neighbours of a source) again all discharges may be added on the same vector.

3) without tracers, the vectors can be added without problem.

This is however a heavy change because subroutines cvdf3d, diff3d, murd3d, prediv and tridw2 must be changed.

I would prefer the Dirac option, which is more like a mass-lumping approach. It seems to me that in this case what we have in the vectors simplifies and is just the discharge of the source, so that it would be much easier to implement : there would be a single vector SOURCES%ADR(1) only containing the discharges QSCE2 corresponding to every source.

With best regards,

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

extra cpu time when using sinks and sources 9 years 10 months ago #15464

  • Svensmolders
  • Svensmolders's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 105
  • Thank you received: 20
Hello Jean-Michel,

thanks for the quick and clear reply.

My first quick attempt was to put all discharges of QSCE2 in SOURCES%ADR(1) but I didn't see the flux was spread to the neighbours.
The 'Dirac' option seems to be the only option since we have tracers and we have several source close to each other.
I don't think we have the time to make all these changes to the code, unless the extra computation time will cost us too much.
Anyway if I have some extra time I will first try to make the subroutine 'culvert' that we made completely independant from 'sinks and sources'
It would be a nice challenge to spped up the computation using the Dirac option. I keep you updated

Sven
The administrator has disabled public write access.

extra cpu time when using sinks and sources 9 years 10 months ago #15466

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Given the fact that we use more and more mass-lumping, maybe we should move to a Dirac option as only possibility, that would be a big simplification, I put this on my list for the next release.

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

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