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

TOPIC: prescribe flowrate at liquid boundaries by programming functions

prescribe flowrate at liquid boundaries by programming functions 9 years 10 months ago #15480

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Yes, K(J) must be a true global number in the initial mesh, and then you must check that the result KLOC(J) is not 0.

Regards,

JMH
The administrator has disabled public write access.

prescribe flowrate at liquid boundaries by programming functions 9 years 10 months ago #15493

  • o.gourgue
  • o.gourgue's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 155
  • Thank you received: 11
Thank you for your help.

The error was simpler than that, it was actually a Fortran beginner mistake. I'll put the solution below, in case another Fortran beginner faces the same situation.

I was declaring K and KLOC as allocatable arrays.

INTEGER, ALLOCATABLE :: K(:), KLOC(:)

I was then assigning hard coded values to K (later they will be read from an external file):

IF (I.EQ.1) THEN
	K = (/ 860, 861, 862, 863 /)
ELSEIF (I.EQ.2) THEN
	K = (/ 850, 851, 852, 853 /)
ELSEIF (I.EQ.3) THEN
	K = (/ 839, 840, 841, 842 /)
ENDIF

But I forgot to create storage for KLOC (with ALLOCATE) before calling GLOBAL_TO_LOCAL_POINT. Now, I do it like this:

ALLOCATE(KLOC(SIZE(K)))
! IN PARALLEL
IF(NCSIZE.GT.1) THEN
	DO J = 1, SIZE(K)
		KLOC(J) = GLOBAL_TO_LOCAL_POINT(K(J), MESH)
	ENDDO
! IN SERIAL
ELSE
	KLOC = K
ENDIF

The entire working FORTRAN file is attached.
Attachments:
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.