# Print statement work weirdly

**URL:** <https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281>\
**Category:** Rose/Cylc and FCM\
**Created:** [11 December 2023 10:55 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281 "2023-12-11T10:55:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [11 December 2023 10:55 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/1 "2023-12-11T10:55:18Z")

</div>

Dear Patrick,

Hope this finds you well.

Recently I found my printing write out is working weirdly using the same branch and the same suite but it is printing multiple times for each time step which was working properly before. I am not sure what has been going on. I have been spent time trying to diagnose it myself but no luck. I wonder if you could shed some light on this.  
This is the job.out  
time 25200  
al = 3.128454  
aj = 9.3981804E-08  
al = 3.128454  
aj = 9.3981804E-08  
al = 3.128454  
aj = 9.3981804E-08  
al = 3.128454  
aj = 1.2224722E-07  
al = 3.128454  
aj = 1.2224722E-07  
al = 3.128454  
aj = 1.2224722E-07  
al = 3.128454  
aj = 1.2224722E-07  
al = 3.128454  
aj = 1.2224722E-07  
al = 3.128454  
aj = 1.2224722E-07  
and this is bit of code the printing statement is regarding to.

 ![Screenshot 2023-12-11 at 10.29.27](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/a93ab490474254fab98f5a753d765d13bff5ea49.png)

Thanks a lot.

Best,  
Wenyao

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [11 December 2023 11:00 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/2 "2023-12-11T11:00:30Z")

</div>

Previously it would only be printed three time one for each iteration and the values are the same. I remembered this because I asked about why it’s printing three times but now it suddenly didn’t work. Would the problem with the branch or the rose suite that I have modified.

Thanks again for your time.

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [11 December 2023 12:41 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/3 "2023-12-11T12:41:52Z")

</div>

Hi Wenyao:  
Which suite is this for? Where is the log file and the JULES source code?  
I am busy till after Wednesday right now. I can try to look at it after Wednesday.  
Patrick

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [11 December 2023 15:41 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/4 "2023-12-11T15:41:22Z")

</div>

Dear Patrick,

Thanks for your reply. it is the u-al752 suite on my local copy it is u-cz703. The JULES source code is at [https://code.metoffice.gov.uk/trac/jules/browser/main/branches/dev/wenyaogan/r24333\_pmodel/src/science/surface/leaf\_jls\_mod.F90?rev=27230](https://code.metoffice.gov.uk/trac/jules/browser/main/branches/dev/wenyaogan/r24333_pmodel/src/science/surface/leaf_jls_mod.F90?rev=27230).

Your help is very much appreciated. Thanks again.

Best,  
Wenyao

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [14 December 2023 13:21 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/5 "2023-12-14T13:21:35Z")

</div>

Hi Wenyao:  
I just looked at your JULES source code and the latest log file for your suite u-cz703. It doesn’t look like it is having the same problem anymore. Did you fix it? What did you change in order to fix it?  
Patrick

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [14 December 2023 14:05 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/6 "2023-12-14T14:05:29Z")

</div>

Dear Patrick,

Thanks for your reply. I am not sure what you mean that the problem disappears. I think it is still printing multiple times than it should be printing. I have attached part of my log file and you can see that the al,aj which should be printing three times for once has been printed again and again and the problem doesn’t go away when I try to print in other parts of the code where I have not interfered with. I am genuinely conf

used about what’s going on. It would be great if you can take a look?

Best,  
Wenyao

(Attachment job(1).out.filepart.zip is missing)

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [14 December 2023 14:07 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/7 "2023-12-14T14:07:07Z")

</div>

Sorry in this case it is the k. K is the iteration value from 1 to 3. That means for one time step k should be looping to 3 and stop but its doing the iteration multiple times.

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [14 December 2023 14:14 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/8 "2023-12-14T14:14:23Z")

</div>

![](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/da48d52a523457d7bcffa32a9e96004e1a19e999.png)

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [14 December 2023 14:21 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/9 "2023-12-14T14:21:16Z")

</div>

I’m sorry, I can’t find “print ‘k’” in your code. Where is it? Also, if you used longer strings than just one letter (in this case, '‘k’), it would be easier to find the strings in your code.  
Patrick

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [14 December 2023 14:26 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/10 "2023-12-14T14:26:59Z")

</div>

Also, you’re printing out the ‘Time’ every 800 time steps.  
maybe the first loop of k from 1 to 3 is for Time=800, and the next time k loops from 1 to 3, that isn’t for Time=800, but instead for Time=801?  
Patrick

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [14 December 2023 18:29 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/11 "2023-12-14T18:29:30Z")

</div>

Dear Patrick,

Thanks for your support. I thought I should align with the running time step which is half hourly? Also, Can you confirm it’s in the name list in the rose suite? I don’t remember changing the print time settings.

Sorry for the confusion, you should be able to find the print k statement at line 1414 in the sf\_stom file for the revision version 27273.

many

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [14 December 2023 18:38 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/12 "2023-12-14T18:38:34Z")

</div>

![](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/00fb7d0b17facb595722de367f1e8dcd2640c8e2.png)

Print\_step has been set to 48 as default.

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [15 December 2023 07:47 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/13 "2023-12-15T07:47:55Z")

</div>

Hi Wenyao  
Maybe you can try changing print\_step from 48 to 1?  
Then, it will print the Time every time\_step instead of every 48 time\_steps.  
Patrick

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [15 December 2023 08:45 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/14 "2023-12-15T08:45:40Z")

</div>

Hi again, Wenyao:  
Another suggestion:  
You might consider putting more print statements in your code, for example, at the beginning of the sf\_stom subroutine. That way, you can figure out how many times the sf\_stom subroutine is called for each time the print k statement (on line 1414) is called. You might need other print statements, too.  
Patrick

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [15 December 2023 19:07 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/16 "2023-12-15T19:07:01Z")

</div>

Dear Partick,

I am writing to tell you that I have tested it with JULES trunk 7.4 and it turns out sf\_stom has been called for several times at one timestep and I have got no idea why is this happening.

 ![Screenshot 2023-12-15 at 19.04.13](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/5b67794492fc6a1195ba849950e40e114d0b808e.jpeg)

Best,  
Wenyao

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [15 December 2023 20:17 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/17 "2023-12-15T20:17:24Z")

</div>

Dear Patrick,

Thanks for your advice. I have added print statements for sf\_stom and leaf to track.This is the log for sf\_stom and leaf run. You can see two major issues, sf\_stom has been called several times at one timestep and both two options of photo\_model were run.

 ![Screenshot 2023-12-15 at 20.14.12](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/8620dfebfc90ed2209bd7b58261cf7e43484283c.jpeg)

I have set it to run photo\_model as faqurha model and somehow it will go and print statement under the photo\_model = collatz section. I have got no idea why this is happening. Only of these models should be run.

 ![Screenshot 2023-12-15 at 20.06.55](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/b04b0a7d9fc6f6fbb8677929d9d116859b269dde.png)  
 ![Screenshot 2023-12-15 at 19.55.09](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/e1086d70bf563005a27860bf91b73e5b55470b7e.png)

And as you can also seen sf\_stom has been called only once in the JULES code (as well as physiol) but when printing sf\_stom seems to be run multiple time.

 ![Screenshot 2023-12-15 at 20.00.05](https://europe1.discourse-cdn.com/flex013/uploads/cms_support/original/1X/6cb2741065729809c18a6b74645cf8ea9ff64510.png)

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [18 December 2023 10:41 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/18 "2023-12-18T10:41:30Z")

</div>

Hi Wenyao  
There are 9 PFTs. Maybe it’s running multiple times through your code because it runs once for each PFT? If I remember correctly, in the original version of the code, the C3 PFTs used the Farquhar model and the C4 PFTs used the Collatz model for photosynthesis (or maybe it’s the other way around). Does this explain things?

On a related note, I can’t look at your two files  
/home/users/gwy1998/JULES/r24333\_pmodel/src/science/surface/leaf\_jls\_mod.F90  
/home/users/gwy1998/JULES/r24333\_pmodel/src/science/surface/sf\_stom\_jls\_mod.F90

It says permission denied, when I try to look at those two files. Maybe you can fix that?  
Patrick

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [18 December 2023 14:20 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/19 "2023-12-18T14:20:11Z")

</div>

Dear Patrick,

Thanks for your help. I am not sure why you cant access the code. I did not put any locker on it. How do I give you the permission?

Best,

Wenyao

---

<div class="post-metadata">

**Author:** ![pmcguire](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@pmcguire](https://cms-helpdesk.ncas.ac.uk/u/pmcguire)\
**Post date:** [18 December 2023 14:42 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/20 "2023-12-18T14:42:24Z")

</div>

Hi Wenyao:  
Did the PFT advice help?

To give me permissions to view the file, you can use the command `chmod 744 filename`.  
Patrick

---

<div class="post-metadata">

**Author:** ![gwy](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gwy](https://cms-helpdesk.ncas.ac.uk/u/gwy)\
**Post date:** [18 December 2023 15:09 UTC](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281/21 "2023-12-18T15:09:25Z")

</div>

Dear Patrick,

I am trying to verify if it is the case. If it is due to PFTs I guess it should be run parallelly to each other? How do they output programme know which GPP to output. Does it also identify which PFT it is?

I have unlocked the permission. You should be able to access the files now. Thanks again for your help.

Best,

Wenyao

[Next page](https://cms-helpdesk.ncas.ac.uk/t/print-statement-work-weirdly/1281.md?page=2)
