[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I may be stupid but i didn't understand all of Bob Keys programs.
why so complicated
The easiest way to compute the chemistry is to insert CO3-- in the
expression of alk (A=... below). then alk is a function of hydrogen
ions only which has to be determined from given alk and Sco2.
for positive hydrogen (highly desireable) the function is strictly
monotonous ( negative first derivative) and the second derivative
is positive everywhere.
The following example (obviously vectorizeable) works in course of time integration.
For initialisation i recommend to set Hi deliberately too small,
say 10**-9. Due to the positive curvature the procedure converges
within no more than 8 iterations without overshooting.
If anybody insists to include also PO4 and Si.. (far below any precision
of measurements) it has to be treated like BT.
DO 43 KI=1,2
DO 43 K=1,KE
DO 43 J=1,JE
DO 43 I=1,IE
DADH=C*( 1./(AK2*(1.+T2+T2*T1))- (2.+T2)*(1./AK2+2.*T1/AK2)/