## 1. Introduction

One of the difficult problems in shallow-water modeling is the uncertainty of the open boundary condition (OBC). At open boundaries where the numerical grid ends, the fluid motion should be unrestricted. Ideal open boundaries are transparent to motions. Two approaches, local type and inverse type, are available for determining the OBC. The local-type approach determines the OBC from the solution of the governing equations near the boundary. The problem now becomes selection from a set of ad hoc OBCs. Since any ad hoc OBC will introduce inaccuracies into a numerical solution (Chapman 1985), it is important to choose a best one from ad hoc OBCs for a particular ocean model. Using a barotropic coastal ocean model, Chapman (1985) evaluated several of the most used ad hoc OBCs (clamped, sponge, radiation) and found that the best OBC consists of a sponge at the outer edge of the model domain with an Orlanski radiation condition (Orlanski 1976) and that the clamped OBC is probably the worst choice. Applying these results to other ocean models needs further investigation. The local approach suffers drawbacks that may restrict its use: no observational data considered and the ill-posedness of the primitive equations model with ad hoc OBC, that is, it is hard to prove the existence of a unique solution (Bennett 1992; Oliger and Sundstrom 1978). To improve the local approach by using observations at open boundaries, Shulman and Lewis (1995) proposed a method for determining OBCs of the shallow-water model. Their method is based on the integration of governing equations forward in time and the selection of OBCs via a specific inverse problem that minimizes a measure of difference (energy flux) between the values of observed and predicted variables at open boundaries. Thus, their method helps us to select the proper ad hoc OBC by using observations at the open boundaries.

Without any ad hoc OBCs, the inverse-type approach can determine the OBC from a “best” fit between model solutions and interior observations. The most popular scheme for this approach is an adjoint method, which consists of four elements: set of control parameters or control vector (e.g., the unknown OBC), numerical ocean model, cost function, and adjoint equation. The cost function is usually defined by the difference between observations and their model counterparts. The adjoint equation is derived from minimizing the cost function with respect to the control parameters. Using an adjoint method, the initial-value problem of ocean model with the OBC becomes integration of both the governing equations and the equation for the control parameters forward and backward in time. For a comprehensive discussion of the adjoint method, the reader is referred to the numerous papers on that subject, for example, Seiler (1993). The advantage of using the adjoint method is the well posedness and the use of observational data. Seiler (1993) successfully determines the unknown OBCs for a quasigeostrophic ocean by using the adjoint method. The disadvantages that may restrict its use are the requirement of large amounts of computer time and memory; problems of stable integration of the adjoint equation; ocean-model dependency of the adjoint equation; and difficulty in deriving the adjoint equation when the model contains rapidly changing processes, such as ocean mixed layer dynamics.

We propose a simplified method that overcomes the disadvantage of the current inverse-type approach. This method can determine OBCs of *any ocean model* (i.e., a universal method) from interior observations. The essence of the method is to seek the relationship among three vectors: open boundary parameter vector **B**, observation vector **O,** and solution vector **S**. If **B** is given, we can integrate the numerical ocean model and get the solution vector **S**. If **B** is unknown, the optimization method is used to determine **B** by minimizing the root-mean-square (rms) difference between **O** and **S.**

## 2. Optimization method

### a. Three vectors

*r*denotes the position of any point along the open boundary Γ, the boundary values of any variable

*η*is a function of

*r,*

*η*

^{(b)}=

*η*

^{(b)}(

*r*). Let

*f*

_{1}(

*r*),

*f*

_{2}(

*r*), . . . ,

*f*

_{n}(

*r*) be a series of known basis functions. We expand the function

*η*

^{(b)}(

*r*) into

*η*

^{(b)}(

*r*) becomes the determination of a set of parameters

*b*

_{1},

*b*

_{2}, . . . ,

*b*

_{n}. The

*n*-dimensional vector,

*m*observations (

*O*

_{1},

*O*

_{2}, . . . ,

*O*

_{m}) located at the interior (Fig. 1). An

*m*-dimensional vector

**O**can be constructed by

**B**is given, we can solve the dynamic system and obtain the solution

*S.*At the same locations where the observations take place, the solutions are

*S*

_{1},

*S*

_{2}, . . . ,

*S*

_{m}, which form a solution vector

### b. Optimization method for determining B

**S**depends on

**B.**Change of the boundary vector

**B**(boundary conditions) leads to a change of

**S**(solutions). Inversely, we may determine

**B**by minimizing

*I*;

*b*

_{1},

*b*

_{2}, . . . ,

*b*

_{n},

*n*×

*m*Jacobian matrix

**R**

*R*

_{ij}}.

**B***, a solution vector

**S*** is obtained by solving the numerical ocean model. The rms between

**S*** and

**O**might not be minimal. We update the boundary parameter vector components by increments {

*δ*

*b*

_{i}|

*i*= 1, 2, . . . ,

*n*}, and therefore components of the solution vector become

*n*linear algebraic equations for {

*δ*

*b*

_{i}},

*O*

_{j}and

*S**

_{j}

*R*

_{ij}} is determined and

*P*

_{il}

### c. Determination of the Jacobian matrix by a multiperturbation method

*δ*

*bi*(

*i*= 1, 2, . . . ,

*n*). Therefore, the determination of the Jacobian matrix is the key issue. We propose a simple multiperturbation method on the first-guess boundary parameter vector

**B*** to get the Jacobian matrix. The vector

**B*** at the initial state (

*t*= 0) of any numerical ocean model is set to be a zero vector,

**B**at time step

*k*is set to be the same as the determined boundary parameter vector at time step

*k*− 1,

**B**

*k*

**B**

*k*

*k*

*n*-dimensional unit vectors

**c**

^{(i)}:

**B**

^{(i)}

**B**

*ε*

_{b}

**c**

^{(i)}

*i*

*n,*

*ε*

_{b}is a small positive number. Using the

*n*+ 1 sets of boundary parameter vectors

**B***,

**B**

^{(1)},

**B**

^{(2)}, . . . ,

**B**

^{(n)}, we obtain

*n*+ 1 sets of solution vectors for that time step,

**S***,

**S**

^{(1)},

**S**

^{(2)}, . . . ,

**S**

^{(n)}. The Jacobian matrix (8) denotes the rate of change of the solution vector with the boundary parameter vector; therefore, it can be computed by

*m*-dimensional vectors

**e**

^{(1)},

**e**

^{(2)}, . . . ,

**e**

^{(n)}are defined by

**e**

^{(i)}

**S**

^{(i)}

**S**

*i*

*n.*

### d. Iteration process

*δ*

**B**≡ (

*δ*

*b*

_{1},

*δ*

*b*

_{2}, . . . ,

*δ*

*b*

_{n}) is obtained. We replace

**B*** by

**B*** +

*δ*

**B**and repeat the process (Fig. 2) until reaching a certain criterion

*ε*is a small positive number (user input). As soon as the inequality (19) is satisfied, the iteration stops and the final

**B*** becomes the optimal boundary parameter vector for the next time step.

### e. Reference model

A model with a given boundary condition (called reference boundary condition) is needed for error estimation. We run the model with the given reference boundary condition and obtain the solution for interior points, **O** = (*O*_{1}, *O*_{2}, . . . , *O*_{m}), which are taken as “observations.” We also expand the reference boundary values into basis functions (1) to obtain the reference boundary vector **B**^{(ref)} = (*b*^{ref}_{1}*b*^{ref}_{2}*b*^{ref}_{n}

### f. Smoothing *δ*B

Both observational (instrument) and computational (numerical) errors perturb the values of **B**. When the reference model results are used, there is no instrument error in observations. But the computational errors still cause errors in **B**. For prognostic ocean models, the errors of **B** feed back to the next step model integration. Error accumulation in each time step may cause computational instability. We use linear regression for smoothing *δ***B** to reduce high-frequency modes. The procedure is as follows: 1) For the first 11 time steps, we do not do any smoothing, and after the 11th time step, we use the smoothing technique. 2) For each time step *k* (*k* > 11), we maintain smoothed values of each component at the previous 11 steps, *δ**b*^{(s)}_{j}*k* − 11), *δ**b*^{(s)}_{j}*k* − 10), . . . , *δ**b*^{(s)}_{j}*k* − 1). Here the superscript *s* indicates smoothed value. 3) We fit a linear regression to fit the 12 values: *δ**b*^{(s)}_{j}*k* − 11), *δ**b*^{(s)}_{j}*k* − 10), . . . , *δ**b*^{(s)}_{j}*k* − 1), and *δ**b*_{j}(*k*). 4) We obtain the value at the time step *k* from the regression, *δ**b*^{(s)}_{j}*k*). 5) We replace *δ**b*_{j}(*k*) by *δ**b*^{(s)}_{j}*k*). Such a treatment (Fig. 3) will filter out high-frequency noise in the derived open boundary parameter vector.

### g. Random noises added on “observations”

*δ*

*O*is a random variable with a zero mean and a standard deviation of

*σ*.

### h. Relative errors

**O**and unknown open boundary condition, we use the optimization method to obtain the values at the open boundary,

**B**= (

*b*

_{1},

*b*

_{2}, . . . ,

*b*

_{n}). Then we integrate the same model with the computed open boundary condition and get the solutions at the observational points,

**S**= (

*S*

_{1},

*S*

_{2}, . . . ,

*S*

_{m}). The relative errors,

*E*

^{(B)}and

*E*

^{(O)}, the better the optimization method.

## 3. Linear ocean models

### a. Jacobian matrix

### b. Example—Csanady’s shelf model

We use a steady-state shelf circulation model proposed by Csanady (1978) as an example to show how to obtain the Jacobian matrix **R***y* axis coincides with the coast and positive *x* points offshore. The water depth is a function only of offshore distance, that is, *h* = *h*(*x*). As pointed out by Csanady (1978), this model is appropriate for simulating mean flow along such a coast driven by mean wind stress.

*u, v*) without wind forcing become

*η*is the surface elevation,

*r*the bottom resistance coefficient,

*f*the Coriolis parameter, and

*g*the gravity. Eliminating

*u*and

*v*from (22)–(24) leads to a single equation for the surface elevation

*η*:

*x*

_{0}= 140 km and

*x*

_{1}= 180 km are the offshore location of the shelf break and slope edge, respectively. Following Wang (1982), we chose

*f*= 10

^{−4}s

^{−1}, and

*r*= 0.1 cm s

^{−1}, and use the boundary condition at the coast (

*x*= 0),

*y*= 0),

*η*

*y*

*y*playing the role of time. We solve (25) numerically by the Gaussian elimination method under the boundary conditions (26)–(27) to obtain the first-guess solution at the interior. The spatial increments are Δ

*x*= 2 km, Δ

*y*= 10 km. We use the five basis functions

*f*

_{1}(

*y*),

*f*

_{2}(

*y*), . . . ,

*f*

_{5}(

*y*) (Fig. 5) for

*η*

^{(b)}. The first guess for

**B**is the zero vector. For simplicity and no loss of generality, we choose five equally spaced points on an interior line paralleling to the

*y*axis as observation points. In this case,

**R**

**e**

^{(1)}

**e**

^{(2)}

**e**

^{(3)}

**e**

^{(4)}

**e**

^{(5)}

### c. Error estimation

For simplicity, we choose Wang’s (1982) solution along with the open boundary condition as a reference model for the error estimation. Five observation points are equally spaced and located along lines paralleling to the *y* axis. These lines are represented by their *x* coordinate. Wang’s (1982) solution at the five points is taken as observations, **O** = (*O*_{1}, *O*_{2}, *O*_{3}, *O*_{4}, *O*_{5}), and the Wang’s open boundary vector is denoted by **B**^{(ref)} = (*b*^{ref}_{1}*b*^{ref}_{2}*b*^{ref}_{3}*b*^{ref}_{4}*b*^{ref}_{5}*δ***B**.

The five observation points are given as **O** with unknown open boundary condition. Using the optimization method, we obtain values at the open boundary, **B** = (*b*_{1}, *b*_{2}, *b*_{3}, *b*_{4}, *b*_{5}). Then, we integrate the Csanady model (24) with the computed open boundary condition, and get the solutions at the same five points, **S** = (*S*_{1}, *S*_{2}, *S*_{3}, *S*_{4}, *S*_{5}). Since the observation points are on the lines paralleling the *y* axis in this study, *E*^{(B)} and *E*^{(O)} depend only on *x.* Surprisingly, both *E*^{(B)} and *E*^{(O)} are extremely small (Fig. 6). When the observation points are chosen near the coast, the relative errors are on the order of 10^{−6}–10^{−7}. At the shelf break (*x* = *x*_{0}, *x*_{0} = 140 km), *E*^{(B)} is on the order of 10^{−6}. Passing the shelf break, *E*^{(B)} and *E*^{(O)} decrease very fast offshore and are on the order of 10^{−16} near the open boundary.

## 4. Nonlinear ocean model

### a. Example—Princeton Ocean Model (POM)

We apply the optimization method to determine the open boundary conditions of a flat bay centered at 35°N and bounded by three rigid boundaries. This bay expands 1000 km in both the north–south and east–west directions. The northern, southern, and western boundaries are rigid, and the eastern boundary is open. The Cartesian coordinate system is chosen with the origin at the southwest corner. The *x* axis points toward the east, and the *y* axis toward the north (Fig. 7a). The circulation in the bay is modeled with the Princeton Ocean Model (POM) developed by Blumberg and Mellor (1987). POM is a primitive equation model with a free surface and a level-2 turbulence closure scheme (Mellor and Yamada 1982). A description of the model code can be found in Mellor (1991). We use the 2D version of POM to illustrate the usefulness of the optimization method for determining the open boundary conditions.

*x*= 1000 km) forming a closed rectangular domain (Fig. 7b), called domain B. The POM model was integrated from the following initial conditions,

The time step was chosen as 2 min. The horizontal resolution was 50 km. Bottom stress is parameterized by the quadratic drag relation. Horizontal kinematic viscosity is set to be 500 m^{2} s^{−1}.

### b. Boundary vector

*x*= 1000 km) as the reference open boundary condition for the domain A integration. The velocity at

*x*= 1000 km for the domain B run is nearly zonal,

*v*

*u*

*x*

*f*

_{1}(

*y*) and

*f*

_{2}(

*y*) (Figs. 9a,b),

*u*

^{(b)}

*y, t*

*b*

_{1}

*t*

*f*

_{1}

*y*

*b*

_{2}

*t*

*f*

_{2}

*y*

*b*

_{1}(

*t*) and

*b*

_{2}(

*t*), as shown in Fig. 9c. After plotting the time series (from day 5 to day 30) of the reference open boundary values and the corresponding expanded values (Fig. 10), we find that the boundary parameters can be well represented by the two-dimensional vector,

**B**

*t*

*b*

_{1}

*t*

*b*

_{2}

*t*

### c. Reference model

We choose the POM model solution for domain A computed with the reference open boundary condition determined by the two time series *b*_{1}(*t*), *b*_{2}(*t*) (Fig. 9) as a reference model. We ran the reference model for 90 days with known boundary conditions (three rigid and one reference open boundary condition). Figure 11 shows the horizontal velocity of the reference model run for two different times (30 day and 90 day). We will use the reference model results to verify the optimization method.

### d. Three cases

A random number generator (Fortran function, Ranf) was used to produce random disturbances for each observational point independently with mean value of zero and standard deviation of 0.01 m s^{−1}. In order to test the performance of the optimization method, we ran three cases: 1) without smoothing on *δ***B** and without random noise added to the observations, 2) with smoothing on *δ***B** and without random noise added to the observations, and 3) with both smoothing on *δ***B** and random noise added to the observations.

Eighteen randomly picked points are treated as observational points (Fig. 12). The reference model solution at the 18 points is the observations, **O** = (*O*_{1}, *O*_{2}, . . . , *O*_{18}). Using the optimization method, we obtain the temporally varying *b*_{1}(*t*) and *b*_{2}(*t*) for the three cases. For case 1 (Fig. 13a), both *b*_{1} and *b*_{2} fit the reference values (Fig. 9c) very well until the 35th day. After that day, *b*_{1} and *b*_{2} change rapidly with time and finally blow up at the 45th day. For case 2 (Fig. 13b), both *b*_{1} and *b*_{2} fit the reference values (Fig. 9c) very well. For case 3 (Fig. 13c), both *b*_{1} and *b*_{2} are very close to the reference values (Fig. 9c) with small perturbations. Figure 13 tells us that smoothing on *δ***B** is a key issue for this method.

We integrate the POM for domain A with the computed open boundary conditions from *b*_{1} and *b*_{2} for the three cases. The 30th day’s horizontal velocity fields (Fig. 14) for the three cases all agree quite well with the reference model results (Fig. 11a), and the 90th day’s horizontal velocity fields (Fig. 15) for cases 2 and 3 agree quite well with the reference model results (Fig. 11b).

### e. Error estimation

Similar to the linear case, we use 18 interior observations **O**, the reference boundary vector **B**^{ref} = (*b*^{ref}_{1}*b*^{ref}_{2}**B** = (*b*_{1}, *b*_{2}), and the interior solution **S** = (*S*_{1}, *S*_{2}, . . . , *S*_{18}) for error estimation.

The boundary errors *E*^{(B)} for the three cases are shown in Fig. 16. When there is no smoothing on *δ***B** (case 1), *E*^{(B)} keeps very small values (10^{−12}–10^{−13}) for the first few days. After the eighth day, *E*^{(B)} increases exponentially with time and reaches the order of 1 at the 45th day. This indicates that we cannot use the optimization method without smoothing on *δ***B**. When there is smoothing on *δ***B** and no noise added to the observations (case 2), *E*^{(B)} has larger values (∼10^{−2}) than case 1 at the beginning, then rapidly decreases with time during the first 10 days and gradually decreases with time afterward. After 10 days of integration, the magnitude of *E*^{(B)} is on the order of 10^{−4}–10^{−5}. When there is smoothing on *δ***B** and noise added to the observations (case 3), *E*^{(B)} fluctuates around 10^{−2.5} (≃3.162 × 10^{−3}) with the maximum value near 10^{−1.5} (≃0.03) and the minimum value around 10^{−4}. Figure 16 indicates that smoothing on *δ***B** is very important for this method.

The interior errors *E*^{(O)} for the three cases are shown in Fig. 17. When there is no smoothing on *δ***B** (case 1), *E*^{(O)} keeps very small values (10^{−13}) for the first few days and then increases exponentially with time and reaches the order of 1 at the 45th day. When there is smoothing on *δ***B** and no noise added to the observations (case 2), *E*^{(O)} has larger values (∼10^{−2}) than case 1 at the beginning then rapidly decreases with time during first 10 days and gradually decreases with time afterward. After 10 days of integration, the magnitude of *E*^{(O)} is on the order of 10^{−4}–10^{−5}. When there is smoothing on *δ***B** and noise added to the observations (case 3), *E*^{(O)} fluctuates around 10^{−2.2} (≃6.3 × 10^{−3}) with the maximum value near 10^{−2} and the minimum value around 10^{−2.4} (≃3.9 × 10^{−3}). Both Figs. 16 and 17 indicate that smoothing on *δ***B** is very important for determining open boundary conditions.

## 5. Conclusions

The proposed optimization method provides a useful scheme to obtain unknown open boundary values from known interior values. Different from the adjoint method, this scheme can be easily incorporated into any ocean models.

Extremely small computational errors are found in applying this method to the Csanady shelf model, which proves the feasibility of using this optimization method for linear models.

For time-dependent dynamical models, when the temporally varying values are given at interior observation points, the optimization method can be used for each time step to obtain the unknown open boundary values for that time step.

For a primitive equation model with turbulent mixing processes (e.g., POM), it is very important to use smoothing on the open boundary parameter vector. If smoothing is not used, POM can be integrated only within a certain period (45 days in our case) and will blow up afterward. If smoothing is used, the model is computationally stable.

This optimization method performs well even when random noises are added to the observational points (case 3). This indicates that we can use real-time data to invert for the unknown open boundary values.

## Acknowledgments

This research is sponsored by the Office of Naval Research (ONR) Naval Ocean Modeling and Prediction (NOMP) Program and the Naval Postgraduate School.

## REFERENCES

Bennett, A., 1992:

*Inverse Methods in Physical Oceanography.*Cambridge University Press, 346 pp.Blumberg, A. F., and G. L. Mellor, 1987: A description of a three-dimensional coastal ocean circulation model.

*Three Dimensional Coastal Ocean Models,*N. S. Heaper, Ed., Amer. Geophys. Union, 1–16.Chapman, D., 1985: Numerical treatment of cross-shelf open boundaries in a barotropic ocean model.

*J. Phys. Oceanogr.,***15,**1060–1075.Csanady, G. T., 1978: The arrested topographic waves.

*J. Phys. Oceanogr.,***8,**47–62.Mellor, G. L., 1991:

*User’s Guide for a Three Dimensional, Primitive Equation, Numerical Ocean Model.*Princeton University.———, and T. Yamada, 1982: Development of a turbulence closure model for geophysical fluid problems.

*Rev. Geophys. Space Phys.,***20**(4), 851–875.Oliger, J., and A. Sundstrom, 1978: Theoretical and practical aspects of some initial boundary value problems in fluid dynamics.

*SIAM J. Appl. Math,***35**(3), 419–446.Orlanski, I., 1976: A simple boundary condition for unbounded hyperbolic flows.

*J. Comput. Phys.,***21,**251–269.Seiler, U., 1993: Estimation of the open boundary conditions with the adjoint method.

*J. Geophys. Res.,***98**(C12), 22 855–22 870.Shulman, I., and J. K. Lewis, 1995: Optimization approach to the treatment of open boundary conditions.

*J. Phys. Oceanogr.,***25,**1006–1011.Wang, D. P., 1982: Effects of continental slope on the mean shelf circulation.

*J. Phys. Oceanogr.,***12,**1524–1526.