add new task       

Task ID:  1775  SWIM layering problem    
 
Created by hut104 on 2013-08-16 2:23 PM, 1651 days ago
Project:  Module Code
Category:  Bug
Priority:  [no priority]
Assigned to:  [not assigned]  
Status:  Submitted
Apsim Version:7.6beta
Your Name:Neil Huth
Contact Details:
 
 

show inline images      show change history

 comment 34892 posted by zur003 on 2013-09-17 5:22 PM, 1619 days ago 

Hmmm. This is trickier than it appears at first glance. The SWIM User's Manual describes the relationship between soil "nodes" and soil "layers", but there are some ambiguities when starting with "layers",  then trying to derive "nodes" from them. Treating these as 0-based arrays, the real trick is finding a suitable value for node[1] (or x(1) in the fortran source). The even-numbered nodes are well-defined, as are remaining odd-numbered nodes, once the first has been established.

Presumably the nodes should always be in ascending order (x(0) < x(1) < x(2) < x(3), etc.), so the challenge is finding a "reasonable" value for x(1) that also allows these inequalities to be met. That sounds simple, but it's easy to create pathological conditions where the inequalities fail. I'm testing an algorithm that tries to handle this, but I'm not entirely satisfied with it.

Are there good reasons why the nodes couldn't just be taken as 0 and the bottoms of the soil layers? This would make the node layer one element longer than the dlayer array.

 comment 34887 posted by zur003 on 2013-09-17 2:10 PM, 1619 days ago 

The problem is actually a bit more general than that. The current algorithm will give a "bad" node structure whenever the top layer is greater than or equal to the second in thickness.

 comment 34879 posted by hut104 on 2013-08-16 2:23 PM, 1651 days ago 

SWIM needs to calculate a node structure (x) from the simulation layer structure (dlayer) in order to solve its equations.  The code for doing this seems to work for all situations, except for times when the top 2 layers are of exactly the same thickness.