Welcome, Guest
Username: Password: Remember me

TOPIC: modification of Tracers in Fortran script - updated

modification of Tracers in Fortran script - updated 10 years 11 months ago #11281

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
Dear Jean-Michel,

Thanks for your help last week with Fortran tracers coding. The salinity with three layers worked fine now, but I still have problem with script when I add the temperature. I changed it slightly many times but when I run the case it run ok but when I looked at results it did not really take in consideration the requested tracers. So there must be some mistakes in my script in IF/ELSE statemnets. I have it below. Please advise. Thanks.

! TRACERS INITIALIZATION
!
IF(NTRAC.NE.0) THEN
DO ITRAC=1,NTRAC
CALL OS('X=C ',X=TA%ADR(ITRAC)%P,C=TRAC0(ITRAC))
IF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'SALINITY') THEN
DO IPLAN=1,NPLAN
DO I=1,NPOIN2
J=NPOIN2*(IPLAN-1)+I
IF(IPLAN.GT.18) THEN
TA%ADR(ITRAC)%P%R(J)=0.D0
ELSEIF (IPLAN.GT.15.AND.IPLAN.LE.28) THEN
TA%ADR(ITRAC)%P%R(J)=14.D0
ELSE
TA%ADR(ITRAC)%P%R(J)=34.D0
ENDIF
ENDDO
ENDDO
ELSEIF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'TEMPERATURE ºC') THEN
DO IPLAN=1,NPLAN
DO I=1,NPOIN2
J=NPOIN2*(IPLAN-1)+I
IF(IPLAN.GT.18) THEN
TA%ADR(ITRAC)%P%R(J)=-0.29D0
ELSEIF (IPLAN.GT.15.AND.IPLAN.LE.28) THEN
TA%ADR(ITRAC)%P%R(J)=1.D0
ELSE
TA%ADR(ITRAC)%P%R(J)=4.3D0
ENDIF
ENDDO
ENDDO
ENDIF
ENDDO
ENDIF



Kind Regards!

Violeta
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11282

  • riadh
  • riadh's Avatar
Hello Violeta

I'm not sure that your tests are working like that. First, verify that you get in the loop by introducing a write (WRITE(LU,*)'I m in first loop' for example).
I think that the following line
IF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'SALINITY') THEN
must be changed to
IF(TA%ADR(ITRAC)%P%NAME(1:7).EQ.'SALINIT') THEN

and the line
ELSEIF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'TEMPERATURE ºC') THEN
must be changed to
ELSEIF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'TEMP') THEN

Eventually, verify your tracer values: Am I wrong or you are inverting values ? (14 and 34 seems to be temperature not salinity and 0.29 seems to be salinity not a temperature)

I hope that this helps

Riadh ATA
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11283

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
Hello Riadh,

Thanks for your reply. I will make the changes you suggested and try again. My values for salinity are : 34, 14 and 0 for levels: 0-15; 16-28 and 29-30. And temperature values are 4.3; 1 and -0.29 for same levels division as salinity. Basically I am trying to create define stratification with three well defined levels: bottom level 4.3 temp and 34 salinity; middle level 1degree temp and 14 salinity and top surface level -0.29 temp and 0 salinity. I managed to create three levels but for salinity, the minute I add temperature I am getting nothing for both tracers, so I assume that my Fortran script is wrong. I will try as you suggested and see if it works. Thanks a mil.

Kind Regards!

Violeta
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11290

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
Hello Riadh,

Thanks again for your help yesterday. I tried to use Write argument, but I am doing something wrong as it runs but does not produce any results for salinity and temperature. It seems that I do not have logical argument even if it does not show any error. I am new to Fortran90 and I have looked at books and some staff on google but it presents very simple cases. Can you please advise what to change on below. Also when I tried to change statement IF(TA%ADR(ITRAC)%P%NAME(1:7).EQ.'SALINIT') THEN, it did not accept as it exceeds the number of subintegers, so I had to change 7 to 4. Thanks.


IF(NTRAC.NE.0) THEN
DO ITRAC=1,NTRAC
CALL OS('X=C ',X=TA%ADR(ITRAC)%P,C=TRAC0(ITRAC))
IF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'SALI') THEN
WRITE(LU,*) 'CONDIM: TRACERS INITIALIZATION'
DO IPLAN=1,NPLAN
DO I=1,NPOIN2
J=NPOIN2*(IPLAN-1)+I
IF(IPLAN.GT.18) THEN
TA%ADR(ITRAC)%P%R(J)=0.D0
ELSEIF (IPLAN.GT.15.AND.IPLAN.LE.28) THEN
TA%ADR(ITRAC)%P%R(J)=14.D0
ELSE
TA%ADR(ITRAC)%P%R(J)=34.D0
ENDIF
ENDDO
ENDDO
STOP
ELSEIF(TA%ADR(ITRAC)%P%NAME(1:4).EQ.'TEMP') THEN
WRITE(LU,*) 'CONDIM: TRACERS INITIALIZATION'
DO IPLAN=1,NPLAN
DO I=1,NPOIN2
J=NPOIN2*(IPLAN-1)+I
IF(IPLAN.GT.18) THEN
TA%ADR(ITRAC)%P%R(J)=0.29D0
ELSEIF (IPLAN.GT.15.AND.IPLAN.LE.28) THEN
TA%ADR(ITRAC)%P%R(J)=1.D0
ELSE
TA%ADR(ITRAC)%P%R(J)=4.3D0
ENDIF
ENDDO
ENDDO
STOP
ENDIF
ENDDO
ENDIF


Kind Regards!

Violeta
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11291

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

Maybe a stupid remark but did you give a name to your tracers?
If not, the default name is something like "TRACER XX"
Maybe you could join the steering file...

Regards
Christophe
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11293

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
Hi Christophe,

Thanks for your reply. I have number of tracers=2 and Names of tracers=Salinity and Temperature in my steering file. When I have just Salinity tracer with three stratification layers then I get realistic results but when I add the Temperature to Fortran file then it does not work. There could be mistakes in steering file but most likely it is Fortran that is wrong as I have done only simple cases in Fortran before and I have not used Write command. I have attached the steering and Fortran files. Please advise. Thanks.

Kind Regards!

Violeta
Attachments:
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11292

  • riadh
  • riadh's Avatar
Hello Violeta

Your program looks fine and I can not detect any wrong statement. Nevertheless, you tell that you can not see any output in the listing when adding write(lu,*). This means that you never get in the loop. You need,therefore, to verify if you have introduced the right number of tracers with the right names i.e.
NUMBER OF TRACERS = 2 (at least for temperature and salinity)
NAMES OF TRACERS = TEMPERATURE °C ';
'SALINITY G/L '
if you have only these two tracers, otherwise you need to introduce more names.
Check these points and if it does not help to overcome your problems, send us your case with all your files and I will try to diagnose the problem.

With my best regards
Riadh
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11294

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
Hello Christophe/Riadh,

Thanks for looking into it. I have attached all 4 files I am using for this case. I have just amended the fortran file to read same code as on my earlier post. Please ignore the fortan I attached previously as it contains mistakes. Maybe I need to add extra values for tracers in cas file as I have three layers now. Please advise. Thanks a mil.


Kind Regards!

Violeta
Attachments:
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11295

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
The Selafin file is attached now, it was too big to put on one post.

Cheers,

Violeta
The administrator has disabled public write access.

modification of Tracers in Fortran script - updated 10 years 11 months ago #11296

  • 716469
  • 716469's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 303
  • Thank you received: 6
it is still too big. The area I am working on is huge, but I do not think that selafin file is the problem as it runs for one tracer fine.

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

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