Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

difference between pcols and ncols in CAM

jatkinson1000

Jack
New Member
What version of the code are you using?
release-cesm2.1.5-0-g7a6c5b0

Have you made any changes to files in the source tree?
Yes, various in development of a new parameterisation.

Describe every step you took leading up to the problem:
No problem, but seeking clarification for understanding and to avoid potential issues later

If this is a port to a new machine: Please attach any files you added or changed for the machine port (e.g., config_compilers.xml, config_machines.xml, and config_batch.xml) and tell us the compiler version you are using on this machine.
Please attach any log files showing error messages or other useful information.

No, building on Derecho

Describe your problem or question:
I am writing some new code, and outputting some of the new variables to file, and wanted some clarification on the difference between `ncols` and `pcols`.
My understanding is that `pcols` is the number of columns per chunk?

When defining variables that will be written to file using the `outfld()` subroutine should these always be defined as having dimension `pcols`?

I see elsewhere a variable `ncols` obtained through the `get_ncols_p` subroutine, or carried around in the `state` variable.
From what I can tell this is the number of 'used' columns in a chunk, which could be less than the total number of columns in the chunk `pcols`?

What I want to know is am I correct, and if not, what are these variables, and most importantly, what size should the arrays I am writing out using `outfld()` be.

Anso any guidance about when to iterate over ncols vs when to iterate over pcols.

Thank you in advance.
 

peverley

Courtney Peverley
Moderator
Staff member
Hi Jack,

You are correct. I will elaborate a bit further to say that "pcols" is the MAXIMUM number of columns per chunk, while "ncols" is the actual number of columns on each chunk.

In general, you'll want to iterate over ncol. But using "pcols" as the input to the "outfld()" calls is common practice.

Hope that helps
Courtney
 
Vote Upvote 0 Downvote
Top