Journal cover Journal topic
Wind Energy Science The interactive open-access journal of the European Academy of Wind Energy
Journal topic
WES | Articles | Volume 4, issue 4
Wind Energ. Sci., 4, 619–632, 2019
https://doi.org/10.5194/wes-4-619-2019
© Author(s) 2019. This work is distributed under
the Creative Commons Attribution 4.0 License.
Wind Energ. Sci., 4, 619–632, 2019
https://doi.org/10.5194/wes-4-619-2019
© Author(s) 2019. This work is distributed under
the Creative Commons Attribution 4.0 License.

Research article 12 Nov 2019

Research article | 12 Nov 2019

Adjoint-based calibration of inlet boundary condition for atmospheric computational fluid dynamics solvers

Adjoint-based calibration of inlet boundary condition for atmospheric computational fluid dynamics solvers
Siamak Akbarzadeh1, Hassan Kassem2, Renko Buhr1, Gerald Steinfeld1, and Bernhard Stoevesandt2 Siamak Akbarzadeh et al.
  • 1ForWind, Center for Wind Energy Research, Carl von Ossietzky University Oldenburg, Küpkersweg 70, 26129 Oldenburg, Germany
  • 2Fraunhofer Institute for Wind Energy Systems – Fraunhofer IWES, Küpkersweg 70, 26129 Oldenburg, Germany

Correspondence: Siamak Akbarzadeh (siamak.akbarzadeh@uni-oldenburg.de)

Abstract
Back to toptop

A continuous adjoint solver is developed for calibration of the inlet velocity profile boundary condition (BC) for computational fluid dynamics (CFD) simulations of the neutral atmospheric boundary layer (ABL). The adjoint solver uses interior domain wind speed observations to compute the gradient of a calibration function with respect to inlet velocity speed and wind direction. The solver has been implemented in the open-source CFD package OpenFOAM coupled with the local gradient-based “CONMIN-frcg” solver of the DAKOTA optimization package. The feasibility of the optimizer output is continuously monitored during the calibration process. The inlet flow profile is considered acceptable only if it can be fitted to a logarithmic or power law function with a tolerance of 3 %. Otherwise, the optimization takes the last fitted profile and asks for a new gradient evaluation. The newly developed framework has been applied in two cases, namely the Ishihara case and Kassel domain. By using the measurements over the hill in the Ishihara case, the method was able to predict the velocity profiles upstream and downstream of the hill accurately. For the Kassel domain, despite the complexity of the site, the method managed to achieve the targeted profile within a reasonable number of the solver calls.

1 Introduction
Back to toptop

The wind energy industry is growing very fast and a comprehensive site assessment is a key factor in planning, installation and performance of wind farms. As a result, the interaction of the atmospheric boundary layer (ABL) flow and wind turbines is one of the most important aspects of the site assessments for wind farms. Over the last decades with the development of powerful computers the computational fluid dynamics (CFD) has become one of the leading tools for microscale simulation of the wind flow over complex terrains. However, in general, developing algorithms that capture all the physics of such complex flow regimes is an ongoing research in CFD.

In CFD simulations of atmospheric flows the correct boundary conditions (BCs) are often unknown but measurement data (wind speed, wind direction, etc.) within the area of interest is available. Using the measurement data and an inverse analysis, the unknown BCs can be obtained with an optimization algorithm. This approach is called open boundary optimization and has been successfully tried in oceanography (Seiler1993; Chen et al.2013) and numerical wind prediction (NWP) models (Schneiderbauer and Pirker2011). Another approach is to use observations and statistical analysis (Glover et al.2011) to calibrate the CFD model parameters (e.g., inflow and turbulence model constants).

The solution to an optimization problem can be found with different methods. However, the methods such as genetic algorithm and evolutionary strategies (Davis1991; Michalewicz1996) require a large number of function evaluations which in CFD applications can be computationally very expensive. Alternatively, the gradient-based optimizers (Ruder2016) use the derivative of cost function with respect to the design parameters. Then, the optimal solution can be obtained using the gradient and a relatively less cost function evaluation. Gradient computation with the finite-difference (FD) method is relatively simple. However, for a high number of design parameters it is prohibitively expensive. In the adjoint method, the sensitivity of the objective function can be calculated independently from the number of parameters, and this considerably reduces the cost of computation.

Since the first application of the adjoint method into compressible CFD models by Pironneau (1974), the adjoint-based optimization methods have been extensively used in shape and topology optimization (Jameson et al.1998; Kämmerer et al.2003; Li et al.2006; Othmer and Grahs2005; Othmer et al.2006). The adjoint gradient computation can be categorized into two main groups: (1) continuous adjoint and (2) discrete adjoint. In the continuous method (Jameson1988), the adjoint equations are first derived and then discretized. In the discrete adjoint (Giles and Pierce2000), using the chain rule, the adjoint solver is derived by line-by-line differentiation of the discretized original (primal) flow solver code. The discrete adjoint differentiation can also be automated using algorithmic differentiation (AD) (Griewank and Walther2008).

In principle, both methods can be applied to any algorithm and model which is continuously differentiable. However, the manually derived discrete adjoint differentiation of big CFD codes is laborious and error prone. Although, the AD tools can be seen as an interesting solution to this problem, their application to the codes which are written in high-level languages (e.g., C++) is still limited in terms of memory requirement and performance. A comparison of these two adjoint approaches can be found here (Giles and Pierce2000; Nadarajah and Jameson2000, 2001).

The discrete adjoint version of OpenFOAM-based solvers has been presented before (Towara and Naumann2013; Towara et al.2015). More recently a hybrid approach has also been introduced (He et al.2018) in which some parts of the code are differentiated by finite difference, and better performance is reported in comparison to the pure discrete adjoint version of the code. Despite all these improvements, the continuous adjoint version of OpenFOAM solvers are still more popular.

The adjoint method has been well applied to different problems in atmospheric science such as wind turbine blade shape optimization (Dhert et al.2017), wind-farm control (Goit et al.2016; Munters and Meyers2017; Vali et al.2019) and wind-farm layout optimization (King et al.2017). Bauweraerts and Meyers (2018) have used the adjoint method and large eddy simulation (LES)-based 4D-Var data assimilation to estimate the turbulent flow field of an atmospheric boundary layer domain from lidar data. Although compared to the Reynolds Averaged Navier–Stokes (RANS) models, the LES can provide more accurate predictions of the flow field, it is still mainly used as a research tool due to its demanding computing power.

The effect of inflow boundary wind speed and its direction are significant parameters in ABL CFD simulation, but they are not often known. The focus of this paper is on the adjoint gradient-based calibration of the inlet velocity profile and inflow wind direction (WD) for a RANS-based ABL flow, which is a very common CFD solver in the wind energy industry, with only a few wind speed measurements from a metrological mast at the site. The available continuous adjoint solver of OpenFOAM CFD tool package (adjointShapeOptimizationFoam), which is for topology optimization of duct flows, is further developed to compute the gradients.

The structure of the paper is as follows: the gradient-based optimization and the theory of the adjoint method are briefly presented in Sect. 2. The derivation of the adjoint equations and its BCs from the primal flow model is explained in Sect. 3. Finally, the numerical results and the conclusions are presented in Sects. 4 and 5.

2 Gradient-based optimization and adjoint method theory
Back to toptop

In gradient-based optimization or calibration, one needs to compute the gradient of a smooth cost function, J, with respect to the design parameters, α, at each design step,

(1)αn+1=αn+Aαn,dJdα=αn+(Δα)n,

where 𝔸 is an optimization algorithm operator that returns a perturbation Δα to the current design αn. The procedure is repeated until a convergence criterion is reached. The design parameters, α, are chosen based on the optimization problem and its parametrization.

In CFD applications, computing the term dJdα includes the differentiation of the steady-state partial differential equation (PDE) governing equation of the flow,

(2)R(ψ,α)=0Rψψα+Rα=0,

where R is the residual vector of the discretized flow equations that is driven to zero and ψ stands for state variables (velocity, pressure, temperature, etc.). Eq. (2) results in a linear system,

(3)Rψψα=-Rα,

in which the term Rψ is Jacobian and ψα represents the perturbation of flow fields. Using the chain rule, the total derivative can be then computed by

(4)dJdα=Jα+Jψψα.

Several methods can be used to compute the gradient from Eq. (4). For instance the complex variable technique, which overcomes the problem of choosing step width in the finite-difference method, or the forward mode (tangent linearization) application of algorithmic differentiation (AD). However, all these methods are computationally expensive when the design space is large. This is due the fact that in Eq. (4) the term ψα requires an expensive PDE simulation, which satisfies Eq. (3) for every dimension in the design space, αi. As will be shown in the following, in the adjoint method the sensitivity can be obtained without computing this expensive term.

From Eq. (3) we can write the perturbation term as

(5)ψα=-Rψ-1Rα

leading to

(6)dJdα=Jα-JψRψ-1Rα=Jα+-JψRψ-1Rα.

The terms in the bracket can be identified as the adjoint system of equations from which the adjoint variable, ψ, can be introduced as

(7)ψT=-JψRψ-1orRψTψ=-JψT.

In this way, instead of solving a PDE simulation for every design variable, the adjoint system of equations needs to be solved only once. As a result, the computational cost of the gradient becomes independent of the number of design parameters (Giles et al.2003; Mavriplis2007; Nielsen et al.2010):

(8)dJdα=Jα+ψTRα.
3 Derivation of the continuous adjoint solver for ABL inflow calibration
Back to toptop

3.1 Flow model

The ABL flow model for cases of neutral stratification consists of steady-state Reynolds Averaged Navier–Stokes (RANS) for incompressible fluid flows (Rebollo and Lewandowski2014), which results in the following equations for momentum and continuity:

(9)R1,R2,R3T=(U)U+p-2νeffD(U),(10)R4=-U,

where (R1, R2, R3) and R4 denote the discretized flow equations, R=(R1, R2, R3, R4)T, in Eq. (2). The variables U and p are the state variables velocity vector and modified pressure, νeff stands for the sum of kinematic and turbulent viscosity, and D is the rate of strain tensor, D=12(U+(U)T). Throughout this work, the standard kϵ turbulence model with the addition of a forest model is used.

3.1.1 Inflow boundary

The properties of the inflow boundary have an important effect on the solution of the interior domain. With the increasing application of LES, hybrid RANS-LES and direct numerical simulation (DNS) methods, the inflow turbulence generation has become the subject of many research works in recent decades. For a review of such methods and their application in wind energy, we refer to Wu (2017) and Stevens and Meneveau (2017). However, due to computational cost, it is still popular in the wind energy industry to use the RANS model with an inflow boundary obtained from either an analytical formula or a one-dimensional (1-D) simulation. The idea of the latter method is to solve a zero-pressure gradient equation for a 1-D domain with periodic boundary conditions in the stream- and span-wise directions (Chang et al.2018):

(11)UxUzz=0,

where x (horizontal) and z (vertical) are the Cartesian coordinates. The inflow profile and its turbulent characteristics are obtained from this 1-D simulation and then are mapped to the 3-D inlet boundary.

3.1.2 Forest effect

Forest canopies modify the available free volume of the terrain domain and introduce an explicit drag term to the momentum equation as below:

(12)FD=-12ρCdA(z)|U|U

with density ρ, leaf-level canopy drag coefficient Cd and leaf area density A(z). The effects of the forest in the turbulence models such as kϵ for ABL flows have been extensively discussed in the literature and several formulas are presented to make the turbulence model consistent with the modified momentum equation. For more details, the reader may be referred to Lopes da Costa (2007).

3.2 Adjoint model

Calibration algorithms seek to maximize the agreement between simulation outputs and measurements. In the context of ABL-based model calibration, the data are often wind speed and direction at one or more locations of a potential wind-farm site. The CFD-based calibration can be formulated as a constrained optimization problem with a scalar objective function:

(13)minimizeJUM,US,α=i=1kUMi-USi2;subjecttoR(U,p,α)=0,

where R stands for the spatial residual of the flow equations with U and p the discretized velocity and pressure, respectively. UMi and USi are the measured and simulated wind velocities at the same location in the domain, respectively. The variable α represents the design variables which are considered to be the velocity at inlet faces of the CFD mesh through this work.

The derivation of adjoint equations as in the preceding section is arguably the most straightforward way to introduce the adjoint equations and understand their advantages. However, the first developments for using the adjoint equations in CFD applications were done using a Lagrange multiplier argument (Hinze et al.2008). From this point of view, the inner product of the PDE of flow equations and a new set of variables vanishes the variations of state variables, Uα and pα. By introducing the adjoint variables U and p for adjoint velocity and adjoint pressure, respectively, ψT=(U, p), the cost function can be reformulated to a Lagrange function as

(14)L:=J+ΩUxR1T+UyR2T+UzR3T+pR4TdΩ=J+Ω(U,p)RdΩ,

where Ux, Uy and Uz are the adjoint velocity components and Ω is the flow domain. For the sensitivities of the cost function with respect to the design parameters, we have to compute the total variation of L:

(15)dLdα=Jα+JUUα+Jppα+Ω(U,p)RUUα+Rppα+(U,p)RαdΩ.

Choosing the Lagrange multipliers such that the variation with respect to the state variables vanishes, leads to

(16)JUUα+Jppα+Ω(U,p)RUUα+RppαdΩ=0.

Then the sensitivity of the cost function can be given by

(17)dLdα=Jα+Ω(U,p)RαdΩ,

which excludes the state variable sensitivities.

The theory presented here is based on the work of Othmer (2008), which derives an adjoint solver for topology optimization of duct flows to reduce the pressure loss between inlet and outlet boundaries. A more detailed derivation of the model is given by Hinterberger and Olesen (2011). By neglecting the turbulent viscosity variation, assuming the “frozen turbulence” hypothesis; replacing the derivative of Eq. (9) with the forest source term; and inserting Eq. (10) into Eq. (16), this gives

(18)JUUα+Jppα+ΩUUαU+(U)Uα-2νeffDUα+12CDAUαU+|U|UαdΩ-ΩpUαdΩ+ΩUpαdΩ=0.

Decomposition of parts into interior domain, Ω, and its boundaries, Γ, leads to reformulation of Eq. (18) as follows

(19)ΓUn+JΓppαdΓ+ΓnUU+U(Un)+2νeffnD(U)-pn+JΓUUαdΓ+Γ-2νeffnDUαUdΓ+Ω-U+JΩppαdΩ+Ω-UU-(U)U-2νeffD(U)+12CDA|U|U+p+JΩUUαdΩ=0.

JΓ and JΩ, respectively, stand for the part of the cost function which is dependent on the flow state values on the boundary and volume of the domain. Due to the definition of the cost function (Eq. 13), its direct variation comes only from the interior domain JΓU=0,JΓp=0. Moreover, it does not have any derivative of the pressure field JΩp=0. The only derivative of the cost function is with respect to the inflow and velocity in the interior of the domain and at the locations where the measurements are available. From the latter we have

(20)JΩU=-2UMi-USii=1,2,.

Using Eq. (19) and (20) the adjoint equations can be derived as

(21)-UU-(U)U=-p+2νeffD(U)+2ωiUMi-USi-12CDA|U|U,(22)U=0,

where ωi is the volume of the cell in which the measurement is located.

3.2.1 Boundary conditions

The boundary integrals of Eq. (19) can be mathematically reformulated and reduced to

(23)Γ[Un]pαdΓ=0,(24)Γ[n(UU)+νeff(n)U-pn]UαdΓ-Γνeff(n)UαUdΓ=0,

where n is the unit normal vector from the boundary faces. Except for the inlet, which is the design space, the adjoint BCs should be chosen such that the above equations are held.

Generally, for an ABL CFD domain no-slip wall (zero fixed velocity) and zero-pressure gradient conditions are imposed on the ground. For a wall type of boundary in which Uα is zero, the first integral of Eq. (24) is canceled. Then, the only way to satisfy the conditions,

(25)Un=0,(26)(n)UαU=0,

is to apply a no-slip (U=0) condition on the ground. No BC can be derived on the ground for the adjoint pressure but consistent with the primal a zero gradient condition is applied.

For the top and outlet boundaries of the domain a zero gradient velocity ((n)Uα=0) and zero fixed pressure (p=0) are the common conditions for the primal system. These conditions fulfill Eq. (23) and cancel the second integral of Eq. (24). The only term that remains is the first term of Eq. (24), which needs to be zeroed out,

(27)n(UU)+νeff(n)U-pnUα=0.

After decomposition into tangent and normal components it can be shown that the relations below should hold

(28)p=UU+UnUn+νeff(n)Un,(29)0=UnUt+νeff(n)Ut,

where subscripts n and t represent the normal and in-plane components, respectively. The adjoint BCs can be summarized as

(30)ground(wall):U=0,np=0;(31)top/outlet:p=UU+UnUn+νeff(n)Un,Ut=0.

It is worth mentioning that the last term of the adjoint pressure, which includes the kinematic viscosity, in implementation is often neglected (Nilsson et al.2014). Moreover, the adjoint variables at the inlet should not be chosen to zero out the inlet velocity perturbations because the design variables are the inlet velocities. Instead, the zero gradient condition is imposed on the inlet for both adjoint velocity and adjoint pressure to have a well-posed system. Finally, from the integral over the boundary term in Eq. (19) it is clear one needs to evaluate the following expression,

(32)Jα=JUinlet=nUinletUinlet+UinletUinletn+2νeffnDUinlet,

to compute the sensitivity.

3.2.2 Wind direction effect

As it was mentioned before, in ABL CFD simulations it is common to simulate first a 1-D domain with a periodic boundary to obtain the inflow boundary condition. Then the cell center velocity of the 1-D run is copied directly to its counterpart boundary face in the 3-D domain. As a requirement, the number of cells in the 1-D mesh and faces in the vertical direction of the 3-D inflow boundary should be the same (see Fig. 1). Moreover, and ideally, the face center heights in the 3-D mesh are equal to their counterpart cell height in 1-D. Although, in current work, a circular inflow–outflow boundary is considered, with some small modification in the code the method can also be applied to other boundary shapes.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f01

Figure 1The inflow velocities of each cell from 1-D precursor run (a) are copied to the boundary of the 3-D domain (b), which has a similar number of cells in the vertical direction. Ideally the height of each face in the 3-D domain boundary is exactly the same as its counterpart cell in the 1-D mesh.

Download

The inflow wind direction (WD) effect can be expressed by a rotation angle, θ, which rotates the inflow from its default west-to-east (WD = 270) direction,

(33)WD=270-θ,(34)Uinletx=U1-Dcos(θ),(35)Uinlety=U1-Dsin(θ),(36)Uinletz=0.

The differentiation of Eqs. (34) and (35) gives

(37)UinletxU1-D=cos(θ);Uinletxθ=-U1-Dsin(θ);

(38)UinletyU1-D=sin(θ);Uinletyθ=U1-Dcos(θ).

The adjoint solver which was explained in the previous section computes the derivative of the cost function with respect to 3-D inflow velocities at each face of the boundary:

(39)JUinletx|i,j;JUinlety|i,j;i=1,,n;j=1,,m,

where i and j represent the row- and column-wise position of a face on the boundary and the total number of the faces in the 3-D circular boundary is N=n×m.

Using the chain rule, one can compute the sensitivity with respect to each cell of the 1-D inflow velocity as follows

(40)JU1-D|i=j=1mJUinletx|i,jUinletxU1-D+j=1mJUinlety|i,jUinletyU1-D=j=1mJUinletx|i,jcos(θ)+j=1mJUinlety|i,jsin(θ).

Eq. (40) means the x and y gradient components of the 3-D inflow faces at the same column j are accumulated and then multiplied by cos (θ) and sin (θ), respectively, before being summed. For the sake of clarity, Eq. (40) can be rewritten as

(41)JU1-D=JU3-Dxcos(θ)+JU3-Dysin(θ).

Using the same analogy, it can be shown that the sensitivity with respect to rotation angle can be obtained by

(42)Jθ=-JU3-DxU1-Dsin(θ)+JU3-DyU1-Dcos(θ),

where the dot sign stands for the inner product of the two vectors.

4 Numerical results
Back to toptop

The adjoint solver and Eq. (32) are implemented based on the “simpleFoam” incompressible CFD solver of OpenFOAM-4.1. In this section, first the accuracy of the gradients obtained by the developed solver is tested against the 2nd-order FD method in a simple 3-D domain. Then, the inflow calibration of a real complex terrain is presented. For all the simulations in this work the general roughness length of the domain is z0=0.05 (m) and the turbulent eddies are modeled by standard kϵ model with canopy model by Liu et al. (1996). Moreover, an ABL wall function is used to apply the roughness-related logarithmic law near to the ground, which is consistent with Monin–Obukhov similarity theory (Chang et al.2018).

4.1 Gradient verification

A cylindrical domain with 1000 m radius and 300 m height is chosen. The mesh of the domain has 209 000 hexahedral cells in which the inflow–outflow boundary has 49 rows and 172 columns and a total number of 8428 faces (N=49×172=8428). The topoSet utility of OpenFOAM is used to select a number of cells as forest in a box size of 300 m in x and y and 40 m in z direction. The canopy drag and leaf area density for all forest cells are Cd=0.3 and A=0.0033 m−1, respectively. The operational Reynolds number based on the free-stream velocity, forest area height and air kinematic viscosity is Reh=4.8×105.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f02

Figure 2The CFD-simulated velocity obtained from the reference simulation (WD = 270): the general view of the domain including the cubic forest and the velocity field on a plane at the center of the domain, y=0(a). The red line on the plane represents the location of desired target velocity profile (see Fig. 3). The velocity field on a plane at z=45 m above the ground (b).

Download

For the primal CFD simulation of a circular domain the standard “inletOutlet” BC is used which checks if the flow is flowing into the domain or out of it and switches between fixed value and zero gradient, respectively. This BC is further developed to apply the derived adjoint BCs in a similar way and based on the flow direction on the boundary.

The gradient evaluation is carried out for a simulation in which the inflow wind direction is WD = 240. To have some reference wind speeds the terrain is simulated assuming the wind blows from west to east (WD = 270). The domain and the velocity field on the planes y=0 m and z=45 m are shown in Fig. 2. The 1-D inflow boundary and the target velocity profiles in the domain are plotted in Fig. 3. The forest effect can be seen in the flow field and on the wind shear of the profile. Please note that the 30 difference between these two simulations is not the step size for the finite-difference computation. The finite-difference step size for gradient validation of wind direction is 0.3.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f03

Figure 3The 1-D inflow boundary (a) and the velocity profile and its selected target speeds in the domain (b).

Download

The gradients obtained by the developed adjoint solver are plotted against the 2nd-order FD gradients in Fig. 4. In general, the trends of the sensitivity profiles are similar. Moreover, the gradients are in excellent agreement except only for the heights between 50 and 100 m in which the maximum relative error is ϵrel=0.10. This difference can be traced back to grid resolution and the derivation of the adjoint equations and BCs which includes some simplifications such as the assumption of the frozen turbulence.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f04

Figure 4Comparison of the inflow boundary gradients by finite differences (FD) and via the adjoint approach.

Download

The wind direction gradients are tabulated in Table 1. The derivative of calibration cost function with respect to the change in wind direction is much higher than the change in the inflow boundary. Here also, there is a good agreement between the FD and the adjoint gradients and the relative error of wind direction sensitivity is close to that of inflow gradients. This is of course not surprising because it was shown in the previous section the sensitivity with respect to θ is obtained by mathematical operations only after the adjoint gradients are available. That said, the accuracy of the gradients computed by the adjoint solver and their signs show that they can be used for the purpose of the gradient-based calibration.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f05

Figure 5The calibration flowchart of the inflow boundary using the DAKOTA optimization package and the developed adjoint solver.

Download

Table 1Comparison of the wind direction gradients by finite differences (FD) and via the adjoint approach.

Download Print Version | Download XLSX

4.2 Inflow calibration

For the cases, studied in this section, the in-house terrainMesher software of the Fraunhofer IWES is used to generate the mesh. The primal flow field is simulated with an in-house CFD solver (Chang et al.2018). The solver is a customized ABL-based version of the simpleFoam solver in the OpenFOAM package with a modified kϵ turbulence model which behaves like a standard model for the neutral condition.

To optimize the inlet velocity profile, the primal and adjoint solvers are coupled with the DAKOTA optimization package (Adams et al.2017). The local gradient-based “CONMIN-frcg” solver of DAKOTA is used, which is based on the conjugate-gradient algorithm by Fletcher and Reeves (Reeves and Fletcher1964; Hager and Zhang2006). Starting from an initial guess, the algorithm updates the design parameters, αn, using the recurrence of Eq. (1) in which

(43)(Δα)n=snDn

and the positive step size sn is obtained by a line search, and the directions 𝔻 are generated by the following rules:

(44)Dn+1=-gn+1+βnDn;gn=JαnT;βn=gn+12gn2;D0=-g0.

Figure 5 shows the flow chart of the calibration, in which all the steps are followed sequentially. The optimizer starts with an initial guess (both inlet velocity and WD) and repeatedly asks either for the cost function value or the gradients. The primal and the adjoint solvers provide the required information, whenever it is needed, and this process continues until a certain convergence criterion is satisfied.

As a simplistic method, the inflow boundary of a RANS ABL domain can be represented by an empirical power law function or an analytically obtained logarithmic function, which is based on the Monin–Obukhov similarity theory (MOST) (Foken2006). During optimization, the optimizer may ask for a cost function evaluation with a new inflow boundary, which is highly unrealistic for an ABL domain, leading to poor numerical stability or even divergence. One may assume that the inflow boundary is an analytical empirical function and, instead of the inflow velocities, calibrate the parameters of that function. Having the gradient via adjoint solver and using the chain rule, the gradient of the cost function with respect to these parameters can be easily obtained. However, the inflow boundary of a real 3-D complex terrain is neither a power law nor a logarithmic function and such parametrization may fail.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f06

Figure 6Main dimensions of the test case with 1000 m length in the y direction. The velocity flow field on the plane at the center of the domain, y=0.

Download

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f07

Figure 7Optimization history (a) and inlet velocity profile comparison (b).

Download

A simple approach is used in this study. This part is called the feasibility check in the optimization flow chart and is a Python script. First of all, the optimizer output is smoothed to avoid having any spikes in the inflow profile. Then it is checked whether a logarithmic, f1(x)=Aln(Bx+C), or a power law, f2(x)=A(xB)C, function could be fitted into it. If either of these functions is fitted and its coefficient of determination is above 0.96, the smoothed inflow from optimizer (not the fitted profile!) is accepted for the CFD solver. Otherwise, the optimization takes the last fitted profile and asks for a new gradient evaluation. In this way, the inflow boundary is not necessarily a logarithmic or power law profile, and, moreover, it is not so unrealistic to be problematic for the solver. As an alternative, constraints or a penalization term can be added to the objective function. This will be explored in future works when for instance the inflow turbulence properties are also considered design parameters.

4.2.1 Ishihara case

As a case study, an ABL domain with a 3-D hill at the center is considered (see Fig. 6). The hill has the shape z=hcos2(x2+y2/2L) with h=40 m and L=100 m. The scaled wind tunnel study of the case has been presented by Ishihara et al. (1999). The domain is meshed with 2×106 hexahedral elements. The roughness value of the domain is set to be z0=0.04 m. The operational Reynolds number based on the free-stream velocity, hill height and air kinematic viscosity is Reh=1.5×104.

Using Ishihara et al. (1999) wind tunnel measurements, the x component of the velocity over the hill (Ux) is used for the inflow velocity calibration. The velocity flow field at the center of the domain and the wake behind the hill can be seen in Fig. 6. Both the primal and the adjoint solvers have parallel scalability of OpenFOAM toolbox. The runtime of the adjoint solver is 60 %–70 % of the primal flow simulation, which has 30 min wall-clock time run with 24 CPU cores. It is worth noting that in the adjoint solver there is no adjoint turbulence equation to be solved.

The stopping criterion is such that the absolute error between the measurements and the simulated velocities over the hill is ϵabs<0.1 m s−1. Figure 7 shows the history of optimization and the comparison of inlet velocity profiles. The optimization has converged with 14 primal and 12 adjoint calls. The optimal velocity profile is in good agreement with the experiment. There is a small deviation starting from the height zh>2. However, the comparison of the normalized velocity profiles over the hill, shown in Fig. 8, confirms that the optimized inlet boundary is able to reproduce the experiment velocity profiles.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f08

Figure 8Normalized vertical profiles of longitudinal velocity component on the central plane of the hill. Uh is the velocity at the hill height in the undisturbed region of the domain between inlet and hill.

Download

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f09

Figure 9The cylindrical domain of the Kassel terrain (a) and the velocity field at the site at 40 m perpendicular distance from the terrain's surface points, which is simulated with WD = 213 (b). This simulation was used as the reference for the calibration.

Download

4.2.2 Kassel case

For the second case study, the neutral condition of “Kassel Experiment” is considered. The domain, located near Kassel in Germany, is one of the cases of the New European Wind Atlas (NEWA) project (EU-ERA-NET(Accessed September 92018). There are two meteorological masts at the site including a 200 m high mast (MM200). The wind rose of the site, provided by NEWA, indicates that most of the time the wind blows from the southwest (SW) to northeast (NE).

The site is represented by a cylindrical domain with 15 km radius and 4 km height (see Fig. 9). The structured mesh is generated with the Fraunhofer IWES in-house software “terrainMesher” with 80 cells in the vertical direction. A mesh independence study is conducted to verify the suitability of a mesh of 7×106 hexahedral elements. The vicinity of the hill (zhill=428 m) where the MM200 mast is installed consists of forested area. The leaf area density of the site is obtained from the airborne lidar data and is provided by the NEWA project (Dörenkämper2018).

Although the wind speed measurements of the MM200 mast from the site are available, there is not enough information for wind direction at certain heights. This information is necessary for the adjoint solver in which the difference between the components of the measured and simulated velocities is a force term on the right-hand side of the adjoint momentum equation (Eq. 21). Moreover, in the calibration of the solver with real measurements, it would become difficult to discuss the source of error when there is a discrepancy between the target and the calibrated profiles. This is because, aside from the inflow calibration process, which is the aim of the current study, many other parameters (e.g., turbulence model and the accuracy of forest and ground roughness map) are involved. Instead of using the real measurements of the mast, the velocity profile near to the mast from a reference simulation is considered. The selected wind speeds can be regarded as some pseudo-measurements.

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f10

Figure 10Inflow boundary calibration for the Kassel domain; cost function convergence (a), wind direction history (b) and gradients history (c).

Download

https://www.wind-energ-sci.net/4/619/2019/wes-4-619-2019-f11

Figure 11The target, initial and optimized 1-D inflow velocity (a). The velocity profile over the hill from which the pseudo-measurements are chosen (b).

Download

The initial guess WD is defined as 270, meaning wind blows from west to east. The turbulent properties of the inflow boundary are not part of the design parameters; but instead, in each new flow solver call of the optimization, the turbulent parameters of the kϵ model inside of the domain are initialized with the last converged solution. In this way, the turbulence model parameters are also gradually updated toward the end of the optimization when the inlet boundary velocities have reached their optimum value. The adjoint solver runtime for this case is also 60 %–70 % of the primal solver wall-clock time, which is 33 min with 120 CPU cores.

The convergence criterion is defined such that the optimization stops when the absolute difference between simulated and measured value, ϵabs, at all heights is below a certain value. Figure 10 shows the history of optimization and gradients. The optimization has called for a total number of 41 primal solver runs for cost function evaluation. In addition eight adjoint gradient evaluations were required. The optimization convergence graph shows that there is a spike both in the cost function and the wind direction. This can be explained by the fact that in early iterations the derivative of cost function with respect to the WD is much bigger than with respect to inflow. The optimizer updates the WD based on the first gradient computation. This continues for a few iterations until the cost function value, instead of decreasing, increases. Then the optimizer calls for a new gradient computation. From that point onward both the inlet velocities and the wind direction are gradually updated. The optimum WD is found as 216.

The initial and optimal results are compared in Fig. 11. The calibration is stopped based on a criterion, which is defined as ϵabs<0.2 m s−1. Although there is a very small deviation between target and optimized inflow profiles, the velocity profile near to the MM200 mast is in good agreement with the pseudo-measurements at all five selected heights and its error is well below the accepted threshold. Here a couple of points should also be noted. Firstly, a tighter error criterion would increase the calibration iterations and subsequently the number of CFD solver calls. Secondly, the sensitivity of wind speed at a certain point in the domain with respect to a very small change in the inflow boundary is dependent on many parameters such as terrain complexity, wind direction, CFD model, etc., and cannot be easily generalized.

5 Conclusions
Back to toptop

In this paper, it has been shown that the ABL CFD solvers can be calibrated via adjoint-based inlet boundary optimization. Based on the frozen turbulence hypothesis and using the reference wind speeds at certain heights inside of the domain, the adjoint equations and its boundary conditions for such problems are derived. The developed solver has been coupled with the DAKOTA optimization package and applied to two 3-D terrains for a neutral stratification condition: (1) the Ishihara test case and (2) the Kassel case. For the Ishihara test case, the optimal inflow was reached with 14 primal and 12 adjoint solver calls. The calibration of the inflow and its directions for the complex terrain of Kassel was achieved after 41 primal and 8 adjoint solver calls. In both cases, an absolute error between the measurements and the simulated velocities was used as a stopping criterion.

The main conclusion remarks of the study can be summarized as follows. (a) The developed calibration framework and the adjoint solver can be successfully applied to even complex domains. (b) The feasibility check of the optimizer output is crucial. Otherwise, at some point in the calibration process, the requested inflow leads to either poor performance or even complete failure (i.e., divergence) of the CFD solver. (c) The convergence criterion can have a big impact on the total number of solver calls. One possibility is to associate the criterion with the uncertainty of the measurements, which can be explored in future work. (d) The process can be further improved to reduce the number of CFD solver calls. For instance, a quasi-Newton optimizer (e.g., BFGS, the Broyden–Fletcher–Goldfarb–Shanno algorithm) or a better parametrization could be used. (e) The presented adjoint solver has the potential to be further developed by including Coriolis force, turbulence model and thermal stratification.

Data availability
Back to toptop
Data availability. 

The forested hill Kassel of Rödeser Berg in Germany is one of the cases of the New European Wind Atlas (NEWA) project (https://map.neweuropeanwindatlas.eu/, last access: November 2019). The “Kassel Experiment” data used in this work are available at https://windbench.net/newa-r-deser-berg-2017-blind-test (last access: November 2019).

Author contributions
Back to toptop
Author contributions. 

SA conceived the presented idea, developed the theory and implemented it. HK generated the mesh and provided the settings for primal flow simulations. RB helped carry out the simulations and post-processing of the results. GS and BS supervised the work. All authors discussed the results and contributed to the final article.

Competing interests
Back to toptop
Competing interests. 

The authors declare that they have no conflict of interest.

Acknowledgements
Back to toptop
Acknowledgements. 

The work presented in this paper was part of the ETESIAN (FKZ 0324000D) project. The ETESIAN project was funded by the German Federal Ministry for Economic Affairs and Energy due to a decision of the German Bundestag. Moreover, the Kassel domain, which was used for the numerical results, is a test case from the NEWA project. The NEWA project was funded by the German Federal Ministry for Economic Affairs and Energy (ref. no. 0325832A/B) on the basis of a decision by the German Bundestag with further financial support from NEWA ERA-NET Plus, topic FP7-ENERGY.2013.10.1.2. The simulations were performed at the high-performance computing cluster EDDY, located at the University of Oldenburg (Germany), and funded by the Federal Ministry for Economic Affairs and Energy (Bundesministerium für Wirtschaft und Energie) under grant number 0324005.

Financial support
Back to toptop
Financial support. 

This research has been supported by the German Federal Ministry for Economic Affairs and Energy (grant nos. FKZ0324000D, 0324005 and 0325832A/B) and the German Bundestag with further financial support from NEWA ERA-NET Plus (grant no. FP7-ENERGY.2013.10.1.2).

Review statement
Back to toptop
Review statement. 

This paper was edited by Raúl Bayoán Cal and reviewed by four anonymous referees.

References
Back to toptop

Adams, B. M., Ebeida, M. S., Eldred, M. S., Geraci, G., Jakeman, J. D., Maupin, K. A., Monschke, J. A., Swiler, L. P., Stephens, J. A., Vigil, D. M., and Wildey, T. M.: DAKOTA, a multilevel parallel object-oriented framework for design optimization, parameter estimation, uncertainty quantification, and sensitivity analysis, Tech. rep., Sandia Technical Report SAND2014-4633, Sandia National Laboratories, Albuquerque, NM, 2017. a

Bauweraerts, P. and Meyers, J.: Towards an adjoint based 4D-Var state estimation for turbulent flow, J. Phys.: Conf. Ser., 1037, 072055, https://doi.org/10.1088/1742-6596/1037/7/072055, 2018. a

Chang, C.-Y., Schmidt, J., Dörenkämper, M., and Stoevesandt, B.: A consistent steady state CFD simulation method for stratified atmospheric boundary layer flows, J. Wind Eng. Indust. Aerodynam., 172, 55–67, https://doi.org/10.1016/j.jweia.2017.10.003, 2018. a, b, c

Chen, H., Miao, C., and Lv, X.: Estimation of open boundary conditions for an internal tidal model with adjoint method: a comparative study on optimization methods, Math. Probl. Eng., https://doi.org/10.1155/2013/802136, 2013. a

Davis, L.: Handbook of genetic algorithms, Van Nostrand Reinhold, New York, NY, 1991. a

Dhert, T., Ashuri, T., and Martins, J. R.: Aerodynamic shape optimization of wind turbine blades using a Reynolds-averaged Navier–Stokes model and an adjoint method, Wind Energy, 20, 909–926, https://doi.org/10.1002/we.2070, 2017. a

Dörenkämper, M.: NEWA-Rödeser Berg 2017-Blind Test, Data Source (ALS data): Hessische Verwaltung für Bodenmanagement und Geoinformation, availabl e at: https://windbench.net/newa-r-deser-berg-2017-blind-test/, last access: 9 September 2018. a

EU-ERA-NET: The New European Wind Atlas (NEWA) project, available at: http://www.neweuropeanwindatlas.eu/, last access: 9 September 2018. a

Foken, T.: 50 years of the Monin–Obukhov similarity theory, Bound.-Lay. Meteorol., 119, 431–447, https://doi.org/10.1007/s10546-006-9048-6, 2006. a

Giles, M. B. and Pierce, N. A.: An introduction to the adjoint approach to design, Flow Turbul. Combust., 65, 393–415, https://doi.org/10.1023/A:1011430410075, 2000. a, b

Giles, M. B., Duta, M. C., Müller, J.-D., and Pierce, N. A.: Algorithm developments for discrete adjoint methods, AIAA J., 41, 198–205, https://doi.org/10.2514/2.1961, 2003. a

Glover, N., Guillas, S., and Malki-Epshtein, L.: Statistical calibration of CFD modelling for street canyon flows, in: Proceedings of Building Simulation 2011: 12th Conference of International Building Performance Simulation Association, 14–16 November 2011, Sydney, Australia, 1513–1520, 2011. a

Goit, J., Munters, W., and Meyers, J.: Optimal coordinated control of power extraction in LES of a wind farm with entrance effects, Energies, 9, 29, https://doi.org/10.3390/en9010029, 2016. a

Griewank, A. and Walther, A.: Evaluating derivatives: principles and techniques of algorithmic differentiation, SIAM, Philadelphia, PA, 2008. a

Hager, W. W. and Zhang, H.: A survey of nonlinear conjugate gradient methods, Pacif. J. Optimiz., 2, 35–58, 2006. a

He, P., Mader, C. A., Martins, J. R., and Maki, K. J.: An aerodynamic design optimization framework using a discrete adjoint approach with OpenFOAM, Comput. Fluids, 168, 285–303, https://doi.org/10.1016/j.compfluid.2018.04.012, 2018. a

Hinterberger, C. and Olesen, M.: Industrial application of continuous adjoint flow solvers for the optimization of automotive exhaust systems, CFD & Optimization, Antalya, Turkey, 2011. a

Hinze, M., Pinnau, R., Ulbrich, M., and Ulbrich, S.: Optimization with PDE constraints, in: vol. 23, Springer Science & Business Media, New York, NY, 2008. a

Ishihara, T., Hibi, K., and Oikawa, S.: A wind tunnel study of turbulent flow over a three-dimensional steep hill, J. Wind Eng. Indust. Aerodynam., 83, 95–107, https://doi.org/10.1016/S0167-6105(99)00064-1, 1999. a, b

Jameson, A.: Aerodynamic Design via Control Theory, J. Scient. Comput., 3, 233–260, https://doi.org/10.1007/BF01061285, 1988. a

Jameson, A., Martinelli, L., and Pierce, N.: Optimum Aerodynamic Design using the Navier–Stokes equations, Theor. Comput. Fluid Dynam., 10, 213–237, https://doi.org/10.1007/s001620050060, 1998. a

Kämmerer, S., Mayer, J., Paffrath, M., Wever, U., and Jung, A.: Three-dimensional optimization of turbomachinery bladings using sensitivity analysis, ASME Turbo Expo: Power for Land, Sea, and Air, 6, 1093–1101, https://doi.org/10.1115/GT2003-38037, 2003. a

King, R. N., Dykes, K., Graf, P., and Hamlington, P. E.: Optimization of wind plant layouts using an adjoint approach, Wind Energ. Sci., 2, 115–131, https://doi.org/10.5194/wes-2-115-2017, 2017. a

Li, H.-D., He, L., Li, Y., and Wells, R.: Blading aerodynamics design optimization with mechanical and aeromechanical constraints, ASME Turbo Expo: Power for Land, Sea, and Air, 6, 1319–1328, https://doi.org/10.1115/GT2006-90503, 2006. a

Liu, J., Chen, J., Black, T., and Novak, M.: Eε modelling of turbulent air flow downwind of a model forest edge, Bound.-Lay. Meteorol., 77, 21–44, https://doi.org/10.1007/BF00121857, 1996. a

Lopes da Costa, J.: Atmospheric Flow Over Forested and Non-Forested Complex Terrain, PhD thesis, University of Porto, Porto, 2007. a

Mavriplis, D. J.: Discrete adjoint-based approach for optimization problems on three-dimensional unstructured meshes, AIAA J., 45, 741–750, https://doi.org/10.2514/1.22743, 2007. a

Michalewicz, Z.: Evolution strategies and other methods, in: Genetic algorithms + data structures = evolution programs, 159–177, Springer, Berlin, 1996. a

Munters, W. and Meyers, J.: An optimal control framework for dynamic induction control of wind farms and their interaction with the atmospheric boundary layer, Philos. T. Roy. Soc. A, 375, 20160100, https://doi.org/10.1098/rsta.2016.0100, 2017. a

Nadarajah, S. and Jameson, A.: A Comparison of the Continuous and Discrete AIAA CP-00-0667, Adjoint Approach to Automatic Aerodynamic Optimization, Reno, NV, 2000. a

Nadarajah, S. and Jameson, A.: Studies Of The Continuous And Discrete Adjoint Approaches To Viscous Automatic Aerodynamic Shape Optimization, in: 15th AIAA Computational Fluid Dynamics Conference, AIAA, Anaheim, CA, p. 2530, 2001. a

Nielsen, E. J., Diskin, B., and Yamaleev, N. K.: Discrete adjoint-based design optimization of unsteady turbulent flows on dynamic unstructured grids, AIAA J., 48, 1195, https://doi.org/10.2514/1.J050035, 2010. a

Nilsson, U., Lindblad, D., and Petit, O.: Description of adjointShapeOptimizationFoam and how to implement new objective functions, in: course at Chalmers University of Technology, Enero, 2014. a

Othmer, C.: A continuous adjoint formulation for the computation of topological and surface sensitivities of ducted flows, Int. J. Numer. Meth. Fluids, 58, 861–877, https://doi.org/10.1002/fld.1770, 2008. a

Othmer, C. and Grahs, T.: Approaches to fluid dynamic optimization in the car development process, in: Eurogen, FLM, Munich, 2005. a

Othmer, C., Kaminski, T., and Giering, R.: Computation of topological sensitivities in fluid dynamics: cost function versatility, in: Eccomas CFD 2006, edited by: Wesseling, P., Oñate, E., and Périaux, J., Citeseer, Delft, 2006. a

Pironneau, O.: On Optimum Design in Fluid Mechanics, J. Fluid Mech., 64, 97–110, https://doi.org/10.1017/S0022112074002023, 1974. a

Rebollo, T. C. and Lewandowski, R.: Mathematical and numerical foundations of turbulence models and applications, Springer, New York, NY, 2014. a

Reeves, C. M. and Fletcher, R.: Function minimization by conjugate gradients, Comput. J., 7, 149–154, https://doi.org/10.1093/comjnl/7.2.149, 1964. a

Ruder, S.: An overview of gradient descent optimization algorithms, arXiv preprint arXiv:1609.04747, 2016. a

Schneiderbauer, S. and Pirker, S.: Determination of open boundary conditions for computational fluid dynamics (CFD) from interior observations, Appl. Math. Model., 35, 763–780, https://doi.org/10.1016/j.apm.2010.07.032, 2011. a

Seiler, U.: Estimation of open boundary conditions with the adjoint method, J. Geophys. Res.-Oceans, 98, 22855–22870, https://doi.org/10.1029/93JC02376, 1993. a

Stevens, R. J. and Meneveau, C.: Flow structure and turbulence in wind farms, Annu. Rev. Fluid Mech., 49, 311–339, https://doi.org/10.1146/annurev-fluid-010816-060206, 2017. a

Towara, M. and Naumann, U.: A Discrete Adjoint Model for OpenFOAM, Procedia Comput. Sci., 18, 429–438, https://doi.org/10.1016/j.procs.2013.05.206, 2013.  a

Towara, M., Schanen, M., and Naumann, U.: Mpi-parallel discrete adjoint openfoam, Procedia Comput. Sci., 51, 19–28, https://doi.org/10.1016/j.procs.2015.05.181, 2015. a

Vali, M., Petrović, V., Boersma, S., van Wingerden, J.-W., Pao, L. Y., and Kühn, M.: Adjoint-based model predictive control for optimal energy extraction in waked wind farms, Control Eng. Pract., 84, 48–62, https://doi.org/10.1016/j.conengprac.2018.11.005, 2019. a

Wu, X.: Inflow turbulence generation methods, Annu. Rev. Fluid Mech., 49, 23–49, https://doi.org/10.1146/annurev-fluid-010816-060322, 2017. a

Publications Copernicus
Download
Short summary
The numerical flow simulation solvers are extensively used for site assessment in the wind energy industry. However, due to the complexity of flow regimes, it is essential to calibrate the important parameters of such algorithms with measurement data. In this paper, we present a computationally cheap (adjoint) solver that can be coupled with any standard gradient-based optimizer to calibrate the inflow boundary of a CFD solver using the wind speed measurements from the interior of a domain.
The numerical flow simulation solvers are extensively used for site assessment in the wind...
Citation