--> //initializations

--> x=0.3 //m (thickness of soil A)
 x  = 

   0.3


--> y=0.3 //m (thickness of soil B)
 y  = 

   0.3


--> z=0.4 //m (Head of reservoir to datum)
 z  = 

   0.4


--> eh1=0.30 // (effective head lost in soil A)
 eh1  = 

   0.3


--> ka=0.5 //mm/sec (coefficient of permeability)
 ka  = 

   0.5


--> //calculations

--> Ph1=x+y+z // (piezometric head at A)
 Ph1  = 

   1.


--> Dh1=(-x)+(-y) // (datum head at A)
 Dh1  = 

  -0.6


--> Th1=Ph1+Dh1 // (total head at A)
 Th1  = 

   0.4


--> HL1=eh1*z // (head loss at A)
 HL1  = 

   0.12


--> Th2=Th1-HL1 // (total head at B)
 Th2  = 

   0.28


--> Dh2=-y // (datum head at B)
 Dh2  = 

  -0.3


--> Ph2=Th2-Dh2 // (piezometric head at B)
 Ph2  = 

   0.58


--> eh2=1-eh1 // (effective head lost in soil B)
 eh2  = 

   0.7


--> HL2=eh2*z // (head loss at B)
 HL2  = 

   0.28


--> ia=HL1/x // (hydraulic gradient at A)
 ia  = 

   0.4


--> ib=HL2/y // (hydraulic gradient at B)
 ib  = 

   0.9333333


--> kb=(ka*ia)/ib // (coefficient of permeability of the soil)
 kb  = 

   0.2142857


--> //results

--> printf('total head at point A=%f',Th1) //m
total head at point A=0.400000
--> printf('piezometric head at point A=%f',Ph1) //m
piezometric head at point A=1.000000
--> printf('total head at point B=%f',Th2) //m
total head at point B=0.280000
--> printf('piezometric head at point B=%f',Ph2) //m
piezometric head at point B=0.580000
--> printf('coefficient of permeability of the soil B=%f',kb) //mm/sec
coefficient of permeability of the soil B=0.214286
