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

TOPIC: Energy Extraction

Energy Extraction 11 years 4 months ago #9574

  • dsc1r12
  • dsc1r12's Avatar
I am having a similar problem to ucs803, I am trying to calculate the energy extraction in a defined area in a simple open channel flow. The area contains a defined number of tidal turbines, I have edited the dragfo subroutine to include a calculation for power, in the same format that is used for calculating the drag force, however when I run the code I get an error that 'A dummy argument name is req'd in this context. [POWER] type(BIEF_OBJ), intent(INOUT) :: POWER'

Does this mean I need to define POWER somewhere else?

I have attached my dragfo subroutine, any help would be much appreciated.

Cheers

Danny
Attachments:
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9591

  • jmhervouet
  • jmhervouet's Avatar
Hello,

You cannot give an INTENT(INOUT) for a local variable, so just suppress the INTENT. However you have to allocate POWER once (see BIEF_ALLVEC in the guide for programming) and once only, and you need to keep it from one call to the other with a SAVE command.

Another possibility would be to use the private arrays (keyword PRIVATE ARRAYS = 1 for example). With a command :

USE DECLARATIONS_TELEMAC2D, ONLY : PRIVE

at the beginning of the subroutine. Then you can use :

PRIVE%ADR(1)%P%R as the double precision array that can store the power, and you can see it in the same way in other subroutines, and have it in the graphic outputs just by adding N in the VARIABLES FOR GRAPHIC PRINTOUTS (see user manual).

With best regards,

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

Energy Extraction 11 years 4 months ago #9734

  • dsc1r12
  • dsc1r12's Avatar
Hi Jean Michel,

Thanks for your reply, I have got to a stage where I have simply defined power as real(8) power(1000), in the same way that fdrag is defined, and then done a simple calculation power(m)= fdrag(m) * UDRAG to calculate power. Now I want to output the power so that I can see it in Blue Kenue as an animation, to do this do I need to define power in the declarations file? Also, how do I assign it to variable n so that the steering file will recognize it?

I have tried declaring power in the declarations file by putting TYPE(BIEF_OBJ), TARGET :: power, and adding n to the outputs in the steering file. When I do this a new variable 23 appears in the results in Blue Kenue, however it appears as a red mesh that does not change with time which must be incorrect.

I have attached the new dragfo file.

Thanks for your help.

Danny
Attachments:
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9737

  • jmhervouet
  • jmhervouet's Avatar
Hello,

You're nearly done but read my previous message, variable 23 is the array PRIVE%ADR(1)%P%R, so this is where you must copy the computed power. So a loop to copy power(m) into PRIVE%ADR(1)%P%R(m), and then you understand that creating the BIEF_OBJ power is useless and you can use PRIVE instead. You can also define power as a double precision array pointer and do :

power => PRIVE%ADR(1)%P%R

and power will be an alias for PRIVE%ADR(1)%P%R


Regards,

JMH
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9751

  • dsc1r12
  • dsc1r12's Avatar
Hi JMH,

I have checked the declarations_telemac2d.f file and there is already a line for 'TYPE(BIEF_OBJ), TARGET :: PRIVE', so I have kept it as it was (I have removed the 'TYPE(BIEF_OBJ), TARGET :: power' line).
I have put the command 'power => PRIVE%ADR(1)%P%R' in the same do loop that is used to calculate drag at each point on the mesh inside the defined array in the dragfo.f file, however when I try to run the code I get an error message as follows...

t2dfort.f(284): error #6793: The POINTER attribute is required [POWER]
power => PRIVE%ADR(1)%P%R

However if I use the command 'PRIVE%ADR(1)%P%R = power(m)' the code does run, is this OK?

By doing this variable 23 still remains constant at 2.176e-13 when animated in Blue Kenue so cannot be correct, I do not understand why though.

Th number of private arrays defined in the steering file was already set to 1, so I have left that alone (and also tried putting it to 2 and this has no effect).

It seems the issue must be in copying the power values calculated at each node in the specified area to the values over to the PRIVE%ADR(1)%P%R structure, any further insight would be much appreciated, I have attached the latest dragfo file, along with the declarations file.

Cheers

Danny
Attachments:
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9753

  • jmhervouet
  • jmhervouet's Avatar
Hello,

power must be declared as a double precision pointer :

DOUBLE PRECISION, POINTER :: power(:)

then you can work on power as on PRIVE%ADR(1)%P%R

If you keep your previous implementation and copy power on PRIVE it should be in a loop on m from 1 to PRIVE%ADR(1)%P%DIM1:

PRIVE%ADR(1)%P%R(m) = power(m)

Rega&rds,

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

Energy Extraction 11 years 4 months ago #9754

  • dsc1r12
  • dsc1r12's Avatar
Hi JMH,

I have delared power as a double precision pointer in the dargfo file and removed the line 'real(8) power(1000)'.

However I do not understand what you mean by copy power on PRIVE? How would this look in the dragfo or declarations file?

Cheers

Danny
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9755

  • dsc1r12
  • dsc1r12's Avatar
Hi JMH,

I have declared power as a double precision pointer in the dargfo file and removed the line 'real(8) power(1000)'.

However I do not understand what you mean by copy power on PRIVE? How would this look in the dragfo or declarations file?

Cheers

Danny
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9756

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Well, let's take the pointer solution and forget the copy, this is more elegant, so power is a double precision pointer:

power => PRIVE%ADR(1)%P%R

Now you build power :

for every point m you do:

power(m)=... your formula (what you did before actually)


and that's all, this is in PRIVE, because power points to PRIVE%ADR(1)%P%R, you should see it in the outputs of variable 23.

Regards,

JMH
The administrator has disabled public write access.

Energy Extraction 11 years 4 months ago #9757

  • dsc1r12
  • dsc1r12's Avatar
Thanks JMH,

I'm almost there I think, the only issue now is that when animating power in Blue Kenue, the simulation remains constant the whole way through the simulation which cannot be correct, I am assuming this must be because some sort of save command is required to save the data from each timestep for the power calculated, would I be correct in saying this? If so would I also be correct in saying that to do this an alteration to the 'DOUBLE PRECISION, POINTER :: power(:)' command is needed, as suggested on pg 14 of the Synthese? I have been playing around this without any luck unfortunately.

Danny
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.