class BoundaryCondition { // supplies statevar values and possibly a volume flux or velocity profile. // the main model is responsible for figuring out what to do with it. // can be used as a true boundary condition, as a lateral river input, or // a mechanism for linking one Slice with another. // by default (until addVar() is used), does nothing. Returning null should be // treated by the main model as "no particular opinion: use a zero-gradient // condition or something equally simple." Slice env; float Qr = 0; float[] u = null; String[] names = new String[0]; float[] values = new float[0]; BoundaryCondition() { } BoundaryCondition(Slice env) { this.env = env; } BoundaryCondition(Slice env, float Qr) { this.env = env; this.Qr = Qr; } void addVar(String name, float value) { names = (String[])append(names,name); values = (float[])append(values,value); } int getVarIndex(String name) { for (int i=0; i env.z_w[k+1]) { // too deep v[k] = 0; } else if (-h < env.z_w[k]) { // fully in input layer float dQ = env.dz[k] / h * Q; v[k] = dQ / Axz; } else { // partially in input layer float dQ = (env.z_w[k+1] - (-h)) / h * Q; v[k] = dQ / Axz; } } setVelocity(v); } float[] getVelocity() {return getVelocity(env.time.current[0]);} float[] getVelocity(float ti) { return u; } } // -------------------------------------------------------------------- /* class NetcdfBoundaryCondition extends BoundaryCondition { // reads a netcdf file and saves time-depth fields for some number of statevars float[][][] tzvalues; float[] tbc, zbc; float[] volFlux = null; NetcdfBoundaryCondition() {} NetcdfBoundaryCondition(Slice env, String ncfilename) { this.env = env; NetcdfFile nc = nc_open(ncfilename); tbc = nc_read1D(nc,"t"); zbc = nc_read1D(nc,"z"); tzvalues = new float[0][tbc.length][zbc.length]; // look for statevars in the netcdf file for (int vi=0; vi