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

Modifying Source Code CLM

Attempting to modify CanopyFluxesMod.F90.

I am implementing a non-linear calculation that is only valid over specific temperature and relative humidity conditions. In the interest of parallelizing computer code, I am using a WHERE statement:

do f = 1, fn
p = filterp(f)
c = pcolumn(p)
g = pgridcell(p)
l = plandunit(p)

WHERE ((t_ref2m(p).GT.324.15_r8) .AND. (t_ref2m(p).LT.293.15_r8))
hi_ref2m(p) = -999.999_r8
END WHERE

end do

However, I am receiving errors:
"
error #6090: An array-valued operand is required in this context.
WHERE ((t_ref2m(p).GT.324.15_r8) .AND. (t_ref2m(p).LT.293.15_r8))
-------------------------------------^

error #6087: An array assignment statement is required in this context. [HI_REF2M]
hi_ref2m(p) = -999.999_r8
-----^
"
My understanding is that the value (p) is a vector, and I need to convert it into an array. Unfortunately, in hunting down "filterp(f)", I find that they are related to:

"
integer, intent(in) :: lbp, ubp ! pft bounds
"

I do not know how to fix this error.
I would appreciate some insight into fixing this problem.

Thanks,

Jonathan R. Buzan
PhD Student, Earth and Atmospheric Sciences
Purdue University
jbuzan@purdue.edu
 

slevis

Moderator
Staff member
No idea if this has anything to do with the error you got, but I'm noticing unbalanced parentheses in the statement that you showed us...

Sam
 
Thanks for the reply.

The equation has a whole slew of statements. When I copy pasted, I only gave the first statement, which is why there is an 'extra' parentheses. I had an earlier bug where the computer had issues with the parentheses, and I have fixed that. Now the problem is with 'array assignment.'

Jonathan R. Buzan
PhD Student, Earth and Atmospheric Sciences
Purdue University
jbuzan@purdue.edu
 

erik

Erik Kluzek
CSEG and Liaisons
Staff member
Jonathan

for a where statement you need to give it an entire array -- not a single element with a (p) index.
So it should be...

WHERE ((t_ref2m.GT.324.15_r .AND. (t_ref2m.LT.293.15_r)
hi_ref2m = -999.999_r8
END WHERE
 
Ah. Okay, the code crunches.
How do I know if the code is parallelized? In the short term, this is okay if it is not parallelized. However, in the long term, I will need the code to be parallelized.

-Jonathan
 

erik

Erik Kluzek
CSEG and Liaisons
Staff member
Jonathan

CLM runs in parallel as it runs over different grid cells in clm_driver.F90. The code you have added is deep down inside that which is already running parallel. There is no need to worry that your code at this level is parallel. As a matter of fact if you tried to add parallel directives it would only screw up and slow down the existing parallel structure of clm. As long as you are running over more than one point the code is running in parallel with the number of processors given in the env_mach_pes.xml file when you create a case.
 
Top