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

TOPIC: Computing the average velocity

Computing the average velocity 10 years 3 months ago #13895

  • yinyue1215
  • yinyue1215's Avatar
Hello,

I am running my case with Smagorinsky turbulence model. The velocities in the result file are instantaneous. Are there anyone know how to compute and printout average velocities directly. For instance, I need averages for each 10 seconds. If need programming, any guides?

Cheers
Best Regards
Yue
The administrator has disabled public write access.

Computing the average velocity 10 years 3 months ago #13903

  • jmhervouet
  • jmhervouet's Avatar
Hello,

In your case I would advise to take subroutine utimp (from library telemac3d) in your FORTRAN FILE and implement it, it is called at every time step. There you can build the average velocities in private arrays.

For example for averaging U and V, you ask for 2 private arrays in the parameter file:

NUMBER OF PRIVATE ARRAYS : 2

then in UTIMP you can average in time double precision arrays U%R and V%R, using arguments LT or TIME, and put the average into :

PRIVE%ADR(1)%P%R and PRIVE%ADR(2)%P%R

Then you will get these values in your results file by adding P1 and P2 in the list of variables for graphic printouts.

Here is a tentative short code for an averaging over 10 time steps, to be put in UTIMP:

! Initialising to 0 for time steps 1, 11, 21, etc.
IF(LT-1.EQ.10*((LT-1)/10)) THEN
CALL OS('X=0 ',X=PRIVE%ADR(1)%P)
CALL OS('X=0 ',X=PRIVE%ADR(2)%P)
ENDIF
! adding during 10 time steps
CALL OS('X=X+Y ',X=PRIVE%ADR(1)%P,Y=U)
CALL OS('X=X+Y ',X=PRIVE%ADR(2)%P,Y=V)
! averaging after 10, 20, 30 time steps, etc.
IF(LT.EQ.10*(LT/10)) THEN
CALL OS('X=CX ',X=PRIVE%ADR(1)%P,C=0.1D0)
CALL OS('X=CX ',X=PRIVE%ADR(2)%P,C=0.1D0)
ENDIF

You can refer to the guide for programming in the Telemac system which is available on this website, to understand what is OS, what is %ADR and %R.


With best regards,

Jean-Michel Hervouet

P.S. sometimes the spaces are not clear in the posts, so:
'X=CX ' we have into quotes X=CX followed by 4 spaces.
The administrator has disabled public write access.

Computing the average velocity 10 years 3 months ago #13908

  • yinyue1215
  • yinyue1215's Avatar
Hello, Jean-Michel

Thank you for your explanation. It's very helpful.

Best Regards
Yue
The administrator has disabled public write access.

Computing the average velocity 10 years 3 months ago #13943

  • yinyue1215
  • yinyue1215's Avatar
Hello Jean-Michel,

I find I can't only printout averages results at the time steps I want. "NUMBER OF FIRST TIME STEP FOR GRAPHIC PRINTOUTS" doesn't print results at this time step unless "PRINTOUT PERIOD = 1"

For example
if I set NUMBER TIME STEP = 1000

NUMBER OF FIRST TIME STEP FOR GRAPHIC PRINTOUTS = 981

GRAPHIC PRINTOUT PERIOD = 10

It gives the result at time step 990,1000

If I set NUMBER TIME STEP = 1000

NUMBER OF FIRST TIME STEP FOR GRAPHIC PRINTOUTS = 985

GRAPHIC PRINTOUT PERIOD = 10

It will give the result at time step 990, 1000

I am struggling with the time step setting

Best Regards
Yue
The administrator has disabled public write access.

Computing the average velocity 10 years 3 months ago #13945

  • jmhervouet
  • jmhervouet's Avatar
Hello,

What you say is in agreement with what is programmed. I understand that you perhaps would like to have the steps 981 991 1001, etc., but it is not programmed like that. The period is counted from the first time step, not from the first time step for graphic printouts. This is done at the beginning of subroutines bief_desimp (library bief) and preres_telemac3d (library telemac3d). You would have to slightly change them to get the sequence you wish, introducing the first time step for graphic printouts in the test deciding whether we issue results or not.

Regards,

JMH
The administrator has disabled public write access.

Computing the average velocity 10 years 3 months ago #13946

  • yinyue1215
  • yinyue1215's Avatar
Hi Jean-Michel,

I checked subroutines bief_desimp, it is programed like what you say. Now I understand how I get my results. Thank you very much.

Best Regards
Yue
The administrator has disabled public write access.

Computing the average velocity 10 years 1 month ago #14381

  • mary
  • mary's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Thank you received: 1
Hello,

I was interested in computing the averaged velocity and this post was really useful. I would like to ask only how should I proceed to get a single output file of the average velocities in the parallel mode. From previous posts I saw that I have to change in telemac3d.dico the formatted results file to "SCAL" such that I have only one result file. Then I added the following lines to the code:

IF(NCSIZE.GT.1) THEN
PRIVE%ADR(2)%P%R=
& P_DMAX(PRIVE%ADR(2)%P%R)
& +P_DMIN(PRIVE%ADR(2)%P%R)
ENDIF

The problem is that my output from scalar mode is different from the output in parallel mode (taking into account these lines)...
Could you explain me better the functions P_DMAX,P_DMIN and P_DSUM please? I have already looked into the programming guide but I couldn't understand well the meaning...

Thank you!!
Maria
The administrator has disabled public write access.

Computing the average velocity 10 years 1 month ago #14384

  • jmhervouet
  • jmhervouet's Avatar
Hello Maria,

If you explain what you really want I can tell you what to do. P_DMIN and P_DMAX are for single values and the minimum and/or maximum is taken over all processors, PRIVE%ADR(2)%P%R has a variable size depending on processor number, so what you intend to do is a mystery (and I am surprised that your compiler does not complain). If it is a matter of averaging a velocity on a few time steps there is no parallelism issue, and you can build a variable that would give this average for all points and would be in the results file.

Regards,

Jean-Michel
The administrator has disabled public write access.

Computing the average velocity 10 years 1 month ago #14385

  • mary
  • mary's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Thank you received: 1
Hello Jean Michel,

Thank you for the reply. What I need is a single output file, in parallel mode, where I can have for example daily outputs with the averaged velocity values for each day. My doubts rely in obtaining the single file in parallel mode.
I'm a bit confused because sometimes I see that we need to use the functions P_DMAX,P_DMIN.

Thank you for your help.


Kind regards,
Maria
The administrator has disabled public write access.
The following user(s) said Thank You: Svensmolders

Computing the average velocity 10 years 1 month ago #14386

  • jmhervouet
  • jmhervouet's Avatar
Hello,

OK, I understand that you want to output a single value that is something like a discharge or a mass over the whole domain (so not defined on every node). In the case of a mass the function to call is P_DSUM (summing the mass on every processor to get the overall mass).

P_DMAX would be to get for example the maximum depth on all the domain for example.

Regards,

JM
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: pham

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