ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
utils_b.f90
Go to the documentation of this file.
1 ! generated by tapenade (inria, ecuador team)
2 ! tapenade 3.16 (develop) - 22 aug 2023 15:51
3 !
4 module utils_b
5  implicit none
6 
7 contains
8  function char2str(chararray, n)
9  use constants
10  implicit none
11 !
12 ! function arguments.
13 !
14  character, dimension(maxcgnsnamelen), intent(in) :: chararray
15  integer(kind=inttype), intent(in) :: n
16 !
17 ! function type
18 !
19  character(len=n) :: char2str
20 !
21 ! local variables.
22 !
23  integer(kind=inttype) :: i
24  do i=1,n
25  char2str(i:i) = chararray(i)
26  end do
27  end function char2str
28 
29  function tsbeta(degreepolbeta, coefpolbeta, degreefourbeta, &
30 & omegafourbeta, coscoeffourbeta, sincoeffourbeta, t)
31 !
32 ! tsbeta computes the angle of attack for a given time interval
33 ! in a time spectral solution.
34 !
35  use constants
36  use inputphysics, only : equationmode
37  implicit none
38 !
39 ! function type
40 !
41  real(kind=realtype) :: tsbeta
42 !
43 ! function arguments.
44 !
45  integer(kind=inttype), intent(in) :: degreepolbeta
46  integer(kind=inttype), intent(in) :: degreefourbeta
47  real(kind=realtype), intent(in) :: omegafourbeta, t
48  real(kind=realtype), dimension(0:*), intent(in) :: coefpolbeta
49  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourbeta
50  real(kind=realtype), dimension(*), intent(in) :: sincoeffourbeta
51 !
52 ! local variables.
53 !
54  integer(kind=inttype) :: nn
55  real(kind=realtype) :: beta, val
56  intrinsic cos
57  intrinsic sin
58 ! return immediately if this is a steady computation.
59  if (equationmode .eq. steady) then
60  tsbeta = zero
61  return
62  else
63 ! compute the polynomial contribution. if no polynomial was
64 ! specified, the value of index 0 is set to zero automatically.
65  beta = coefpolbeta(0)
66  do nn=1,degreepolbeta
67  beta = beta + coefpolbeta(nn)*t**nn
68  end do
69 ! compute the fourier contribution. again the cosine coefficient
70 ! of index 0 is defaulted to zero if not specified.
71  beta = beta + coscoeffourbeta(0)
72  do nn=1,degreefourbeta
73  val = nn*omegafourbeta*t
74  beta = beta + coscoeffourbeta(nn)*cos(val) + sincoeffourbeta(nn)&
75 & *sin(val)
76  end do
77 ! set tsbeta to phi.
78  tsbeta = beta
79  end if
80  end function tsbeta
81 
82  function tsbetadot(degreepolbeta, coefpolbeta, degreefourbeta, &
83 & omegafourbeta, coscoeffourbeta, sincoeffourbeta, t)
84 !
85 ! tsbeta computes the angle of attack for a given time interval
86 ! in a time spectral solution.
87 !
88  use constants
89  use inputphysics, only : equationmode
90  implicit none
91 !
92 ! function type
93 !
94  real(kind=realtype) :: tsbetadot
95 !
96 ! function arguments.
97 !
98  integer(kind=inttype), intent(in) :: degreepolbeta
99  integer(kind=inttype), intent(in) :: degreefourbeta
100  real(kind=realtype), intent(in) :: omegafourbeta, t
101  real(kind=realtype), dimension(0:*), intent(in) :: coefpolbeta
102  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourbeta
103  real(kind=realtype), dimension(*), intent(in) :: sincoeffourbeta
104 !
105 ! local variables.
106 !
107  integer(kind=inttype) :: nn
108  real(kind=realtype) :: betadot, val
109  intrinsic sin
110  intrinsic cos
111 ! return immediately if this is a steady computation.
112  if (equationmode .eq. steady) then
113  tsbetadot = zero
114  return
115  else
116 ! compute the polynomial contribution. if no polynomial was
117 ! specified, the value of index 0 is set to zero automatically.
118  betadot = zero
119  do nn=1,degreepolbeta
120  betadot = betadot + nn*coefpolbeta(nn)*t**(nn-1)
121  end do
122 ! compute the fourier contribution. again the cosine coefficient
123 ! of index 0 is defaulted to zero if not specified.
124  do nn=1,degreefourbeta
125  val = nn*omegafourbeta
126  betadot = betadot - val*coscoeffourbeta(nn)*sin(val*t) + val*&
127 & sincoeffourbeta(nn)*cos(val*t)
128  end do
129 ! set tsbeta to phi.
130  tsbetadot = betadot
131  end if
132  end function tsbetadot
133 
134  function tsmach(degreepolmach, coefpolmach, degreefourmach, &
135 & omegafourmach, coscoeffourmach, sincoeffourmach, t)
136 !
137 ! tsmach computes the mach number for a given time interval
138 ! in a time spectral solution.
139 !
140  use constants
141  use inputphysics, only : equationmode
142  implicit none
143 !
144 ! function type
145 !
146  real(kind=realtype) :: tsmach
147 !
148 ! function arguments.
149 !
150  integer(kind=inttype), intent(in) :: degreepolmach
151  integer(kind=inttype), intent(in) :: degreefourmach
152  real(kind=realtype), intent(in) :: omegafourmach, t
153  real(kind=realtype), dimension(0:*), intent(in) :: coefpolmach
154  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourmach
155  real(kind=realtype), dimension(*), intent(in) :: sincoeffourmach
156 !
157 ! local variables.
158 !
159  integer(kind=inttype) :: nn
160  real(kind=realtype) :: intervalmach, val
161  intrinsic cos
162  intrinsic sin
163 ! return immediately if this is a steady computation.
164  if (equationmode .eq. steady) then
165  tsmach = zero
166  return
167  else
168 ! compute the polynomial contribution. if no polynomial was
169 ! specified, the value of index 0 is set to zero automatically.
170  intervalmach = coefpolmach(0)
171  do nn=1,degreepolmach
172  intervalmach = intervalmach + coefpolmach(nn)*t**nn
173  end do
174 ! compute the fourier contribution. again the cosine coefficient
175 ! of index 0 is defaulted to zero if not specified.
176  intervalmach = intervalmach + coscoeffourmach(0)
177  do nn=1,degreefourmach
178  val = nn*omegafourmach*t
179  intervalmach = intervalmach + coscoeffourmach(nn)*cos(val) + &
180 & sincoeffourmach(nn)*sin(val)
181  end do
182  print*, 'intsmach', intervalmach, nn, val, t
183 ! set tsmach to phi.
184  tsmach = intervalmach
185  end if
186  end function tsmach
187 
188  function tsmachdot(degreepolmach, coefpolmach, degreefourmach, &
189 & omegafourmach, coscoeffourmach, sincoeffourmach, t)
190 !
191 ! tsmach computes the angle of attack for a given time interval
192 ! in a time spectral solution.
193 !
194  use constants
195  use inputphysics, only : equationmode
196  implicit none
197 !
198 ! function type
199 !
200  real(kind=realtype) :: tsmachdot
201 !
202 ! function arguments.
203 !
204  integer(kind=inttype), intent(in) :: degreepolmach
205  integer(kind=inttype), intent(in) :: degreefourmach
206  real(kind=realtype), intent(in) :: omegafourmach, t
207  real(kind=realtype), dimension(0:*), intent(in) :: coefpolmach
208  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourmach
209  real(kind=realtype), dimension(*), intent(in) :: sincoeffourmach
210 !
211 ! local variables.
212 !
213  integer(kind=inttype) :: nn
214  real(kind=realtype) :: machdot, val
215  intrinsic sin
216  intrinsic cos
217 ! return immediately if this is a steady computation.
218  if (equationmode .eq. steady) then
219  tsmachdot = zero
220  return
221  else
222 ! compute the polynomial contribution. if no polynomial was
223 ! specified, the value of index 0 is set to zero automatically.
224  machdot = zero
225  do nn=1,degreepolmach
226  machdot = machdot + nn*coefpolmach(nn)*t**(nn-1)
227  end do
228 ! compute the fourier contribution. again the cosine coefficient
229 ! of index 0 is defaulted to zero if not specified.
230  do nn=1,degreefourmach
231  val = nn*omegafourmach
232  machdot = machdot - val*coscoeffourmach(nn)*sin(val*t) + val*&
233 & sincoeffourmach(nn)*cos(val*t)
234  end do
235 ! set tsmach to phi.
236  tsmachdot = machdot
237  end if
238  end function tsmachdot
239 
240  function tsalpha(degreepolalpha, coefpolalpha, degreefouralpha, &
241 & omegafouralpha, coscoeffouralpha, sincoeffouralpha, t)
242 !
243 ! tsalpha computes the angle of attack for a given time interval
244 ! in a time spectral solution.
245 !
246  use constants
247  use inputphysics, only : equationmode
248  implicit none
249 !
250 ! function type
251 !
252  real(kind=realtype) :: tsalpha
253 !
254 ! function arguments.
255 !
256  integer(kind=inttype), intent(in) :: degreepolalpha
257  integer(kind=inttype), intent(in) :: degreefouralpha
258  real(kind=realtype), intent(in) :: omegafouralpha, t
259  real(kind=realtype), dimension(0:*), intent(in) :: coefpolalpha
260  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffouralpha
261  real(kind=realtype), dimension(*), intent(in) :: sincoeffouralpha
262 !
263 ! local variables.
264 !
265  integer(kind=inttype) :: nn
266  real(kind=realtype) :: alpha, val
267  intrinsic cos
268  intrinsic sin
269 ! return immediately if this is a steady computation.
270  if (equationmode .eq. steady) then
271  tsalpha = zero
272  return
273  else
274 ! compute the polynomial contribution. if no polynomial was
275 ! specified, the value of index 0 is set to zero automatically.
276  alpha = coefpolalpha(0)
277  do nn=1,degreepolalpha
278  alpha = alpha + coefpolalpha(nn)*t**nn
279  end do
280 ! compute the fourier contribution. again the cosine coefficient
281 ! of index 0 is defaulted to zero if not specified.
282  alpha = alpha + coscoeffouralpha(0)
283  do nn=1,degreefouralpha
284  val = nn*omegafouralpha*t
285  alpha = alpha + coscoeffouralpha(nn)*cos(val) + sincoeffouralpha&
286 & (nn)*sin(val)
287  end do
288 !print *,'intsalpha',alpha,nn,val,t
289 ! set tsalpha to phi.
290  tsalpha = alpha
291  end if
292  end function tsalpha
293 
294  function tsalphadot(degreepolalpha, coefpolalpha, degreefouralpha, &
295 & omegafouralpha, coscoeffouralpha, sincoeffouralpha, t)
296 !
297 ! tsalpha computes the angle of attack for a given time interval
298 ! in a time spectral solution.
299 !
300  use constants
301  use inputphysics, only : equationmode
302  implicit none
303 !
304 ! function type
305 !
306  real(kind=realtype) :: tsalphadot
307 !
308 ! function arguments.
309 !
310  integer(kind=inttype), intent(in) :: degreepolalpha
311  integer(kind=inttype), intent(in) :: degreefouralpha
312  real(kind=realtype), intent(in) :: omegafouralpha, t
313  real(kind=realtype), dimension(0:*), intent(in) :: coefpolalpha
314  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffouralpha
315  real(kind=realtype), dimension(*), intent(in) :: sincoeffouralpha
316 !
317 ! local variables.
318 !
319  integer(kind=inttype) :: nn
320  real(kind=realtype) :: alphadot, val
321  intrinsic sin
322  intrinsic cos
323 ! return immediately if this is a steady computation.
324  if (equationmode .eq. steady) then
325  tsalphadot = zero
326  return
327  else
328 ! compute the polynomial contribution. if no polynomial was
329 ! specified, the value of index 0 is set to zero automatically.
330  alphadot = zero
331  do nn=1,degreepolalpha
332  alphadot = alphadot + nn*coefpolalpha(nn)*t**(nn-1)
333  end do
334 ! compute the fourier contribution. again the cosine coefficient
335 ! of index 0 is defaulted to zero if not specified.
336  do nn=1,degreefouralpha
337  val = nn*omegafouralpha
338  alphadot = alphadot - val*coscoeffouralpha(nn)*sin(val*t) + val*&
339 & sincoeffouralpha(nn)*cos(val*t)
340  end do
341 ! set tsalpha to phi.
342  tsalphadot = alphadot
343  end if
344  end function tsalphadot
345 
346 ! differentiation of derivativerigidrotangle in reverse (adjoint) mode (with options noisize i4 dr8 r8):
347 ! gradient of useful results: timeref derivativerigidrotangle
348 ! with respect to varying inputs: timeref
349  subroutine derivativerigidrotangle_b(degreepolrot, coefpolrot, &
350 & degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t, &
351 & derivativerigidrotangled)
352 !
353 ! derivativerigidrotangle computes the time derivative of the
354 ! rigid body rotation angle at the given time for the given
355 ! arguments. the angle is described by a combination of a
356 ! polynomial and fourier series.
357 !
358  use constants
359  use inputphysics, only : equationmode
360  use flowvarrefstate, only : timeref, timerefd
361  implicit none
362 !
363 ! function type
364 !
365  real(kind=realtype) :: derivativerigidrotangle
366  real(kind=realtype) :: derivativerigidrotangled
367 !
368 ! function arguments.
369 !
370  integer(kind=inttype), intent(in) :: degreepolrot
371  integer(kind=inttype), intent(in) :: degreefourrot
372  real(kind=realtype), intent(in) :: omegafourrot, t
373  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
374  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
375  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
376 !
377 ! local variables.
378 !
379  integer(kind=inttype) :: nn
380  real(kind=realtype) :: dphi, val
381  intrinsic sin
382  intrinsic cos
383 ! return immediately if this is a steady computation.
384  if (equationmode .ne. steady) then
385 ! compute the polynomial contribution.
386  dphi = zero
387  do nn=1,degreepolrot
388  dphi = dphi + nn*coefpolrot(nn)*t**(nn-1)
389  end do
390 ! compute the fourier contribution.
391  do nn=1,degreefourrot
392  val = nn*omegafourrot
393  dphi = dphi - val*coscoeffourrot(nn)*sin(val*t)
394  dphi = dphi + val*sincoeffourrot(nn)*cos(val*t)
395  end do
396  timerefd = timerefd + dphi*derivativerigidrotangled
397  end if
398  end subroutine derivativerigidrotangle_b
399 
400  function derivativerigidrotangle(degreepolrot, coefpolrot, &
401 & degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
402 !
403 ! derivativerigidrotangle computes the time derivative of the
404 ! rigid body rotation angle at the given time for the given
405 ! arguments. the angle is described by a combination of a
406 ! polynomial and fourier series.
407 !
408  use constants
409  use inputphysics, only : equationmode
410  use flowvarrefstate, only : timeref
411  implicit none
412 !
413 ! function type
414 !
415  real(kind=realtype) :: derivativerigidrotangle
416 !
417 ! function arguments.
418 !
419  integer(kind=inttype), intent(in) :: degreepolrot
420  integer(kind=inttype), intent(in) :: degreefourrot
421  real(kind=realtype), intent(in) :: omegafourrot, t
422  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
423  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
424  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
425 !
426 ! local variables.
427 !
428  integer(kind=inttype) :: nn
429  real(kind=realtype) :: dphi, val
430  intrinsic sin
431  intrinsic cos
432 ! return immediately if this is a steady computation.
433  if (equationmode .eq. steady) then
435  return
436  else
437 ! compute the polynomial contribution.
438  dphi = zero
439  do nn=1,degreepolrot
440  dphi = dphi + nn*coefpolrot(nn)*t**(nn-1)
441  end do
442 ! compute the fourier contribution.
443  do nn=1,degreefourrot
444  val = nn*omegafourrot
445  dphi = dphi - val*coscoeffourrot(nn)*sin(val*t)
446  dphi = dphi + val*sincoeffourrot(nn)*cos(val*t)
447  end do
448 ! set derivativerigidrotangle to dphi. multiply by timeref
449 ! to obtain the correct non-dimensional value.
451  end if
452  end function derivativerigidrotangle
453 
454 ! differentiation of mydim in reverse (adjoint) mode (with options noisize i4 dr8 r8):
455 ! gradient of useful results: x y mydim
456 ! with respect to varying inputs: x y
457  subroutine mydim_b(x, xd, y, yd, mydimd)
458  use constants
459  implicit none
460  real(kind=realtype) :: x, y
461  real(kind=realtype) :: xd, yd
462  real(kind=realtype) :: mydim
463  real(kind=realtype) :: mydimd
464  mydim = x - y
465  if (mydim .lt. 0.0) mydimd = 0.0_8
466  xd = xd + mydimd
467  yd = yd - mydimd
468  end subroutine mydim_b
469 
470  function mydim(x, y)
471  use constants
472  implicit none
473  real(kind=realtype) :: x, y
474  real(kind=realtype) :: mydim
475  mydim = x - y
476  if (mydim .lt. 0.0) mydim = 0.0
477  end function mydim
478 
479  function getcorrectfork()
480  use constants
481  use flowvarrefstate, only : kpresent
482  use iteration, only : currentlevel, groundlevel
483  implicit none
484  logical :: getcorrectfork
485  if (kpresent .and. currentlevel .le. groundlevel) then
486  getcorrectfork = .true.
487  else
488  getcorrectfork = .false.
489  end if
490  end function getcorrectfork
491 
492  subroutine terminate(routinename, errormessage)
493 !
494 ! terminate writes an error message to standard output and
495 ! terminates the execution of the program.
496 !
497  use constants
499  implicit none
500 !
501 ! subroutine arguments
502 !
503  character(len=*), intent(in) :: routinename
504  character(len=*), intent(in) :: errormessage
505  end subroutine terminate
506 
507  subroutine rotmatrixrigidbody(tnew, told, rotationmatrix, &
508 & rotationpoint)
509 !
510 ! rotmatrixrigidbody determines the rotation matrix and the
511 ! rotation point to determine the coordinates of the new time
512 ! level starting from the coordinates of the old time level.
513 !
514  use constants
515  use inputmotion
516  use flowvarrefstate, only : lref
517  implicit none
518 !
519 ! subroutine arguments.
520 !
521  real(kind=realtype), intent(in) :: tnew, told
522  real(kind=realtype), dimension(3), intent(out) :: rotationpoint
523  real(kind=realtype), dimension(3, 3), intent(out) :: rotationmatrix
524 !
525 ! local variables.
526 !
527  integer(kind=inttype) :: i, j
528  real(kind=realtype) :: phi
529  real(kind=realtype) :: cosx, cosy, cosz, sinx, siny, sinz
530  real(kind=realtype), dimension(3, 3) :: mnew, mold
531  intrinsic sin
532  intrinsic cos
533 ! determine the rotation angle around the x-axis for the new
534 ! time level and the corresponding values of the sine and cosine.
537  sinx = sin(phi)
538  cosx = cos(phi)
539 ! idem for the y-axis.
542  siny = sin(phi)
543  cosy = cos(phi)
544 ! idem for the z-axis.
547  sinz = sin(phi)
548  cosz = cos(phi)
549 ! construct the transformation matrix at the new time level.
550 ! it is assumed that the sequence of rotation is first around the
551 ! x-axis then around the y-axis and finally around the z-axis.
552  mnew(1, 1) = cosy*cosz
553  mnew(2, 1) = cosy*sinz
554  mnew(3, 1) = -siny
555  mnew(1, 2) = sinx*siny*cosz - cosx*sinz
556  mnew(2, 2) = sinx*siny*sinz + cosx*cosz
557  mnew(3, 2) = sinx*cosy
558  mnew(1, 3) = cosx*siny*cosz + sinx*sinz
559  mnew(2, 3) = cosx*siny*sinz - sinx*cosz
560  mnew(3, 3) = cosx*cosy
561 ! determine the rotation angle around the x-axis for the old
562 ! time level and the corresponding values of the sine and cosine.
565  sinx = sin(phi)
566  cosx = cos(phi)
567 ! idem for the y-axis.
570  siny = sin(phi)
571  cosy = cos(phi)
572 ! idem for the z-axis.
575  sinz = sin(phi)
576  cosz = cos(phi)
577 ! construct the transformation matrix at the old time level.
578  mold(1, 1) = cosy*cosz
579  mold(2, 1) = cosy*sinz
580  mold(3, 1) = -siny
581  mold(1, 2) = sinx*siny*cosz - cosx*sinz
582  mold(2, 2) = sinx*siny*sinz + cosx*cosz
583  mold(3, 2) = sinx*cosy
584  mold(1, 3) = cosx*siny*cosz + sinx*sinz
585  mold(2, 3) = cosx*siny*sinz - sinx*cosz
586  mold(3, 3) = cosx*cosy
587 ! construct the transformation matrix between the new and the
588 ! old time level. this is mnew*inverse(mold). however the
589 ! inverse of mold is the transpose.
590  do j=1,3
591  do i=1,3
592  rotationmatrix(i, j) = mnew(i, 1)*mold(j, 1) + mnew(i, 2)*mold(j&
593 & , 2) + mnew(i, 3)*mold(j, 3)
594  end do
595  end do
596 ! determine the rotation point at the old time level; it is
597 ! possible that this value changes due to translation of the grid.
598 ! ainf = sqrt(gammainf*pinf/rhoinf)
599 ! rotationpoint(1) = lref*rotpoint(1) &
600 ! + machgrid(1)*ainf*told/timeref
601 ! rotationpoint(2) = lref*rotpoint(2) &
602 ! + machgrid(2)*ainf*told/timeref
603 ! rotationpoint(3) = lref*rotpoint(3) &
604 ! + machgrid(3)*ainf*told/timeref
605  rotationpoint(1) = lref*rotpoint(1)
606  rotationpoint(2) = lref*rotpoint(2)
607  rotationpoint(3) = lref*rotpoint(3)
608  end subroutine rotmatrixrigidbody
609 
610  function secondderivativerigidrotangle(degreepolrot, coefpolrot, &
611 & degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
612 !
613 ! 2ndderivativerigidrotangle computes the 2nd time derivative of
614 ! the rigid body rotation angle at the given time for the given
615 ! arguments. the angle is described by a combination of a
616 ! polynomial and fourier series.
617 !
618  use constants
619  use flowvarrefstate, only : timeref
620  use inputphysics, only : equationmode
621  implicit none
622 !
623 ! function type
624 !
625  real(kind=realtype) :: secondderivativerigidrotangle
626 !
627 ! function arguments.
628 !
629  integer(kind=inttype), intent(in) :: degreepolrot
630  integer(kind=inttype), intent(in) :: degreefourrot
631  real(kind=realtype), intent(in) :: omegafourrot, t
632  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
633  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
634  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
635 !
636 ! local variables.
637 !
638  integer(kind=inttype) :: nn
639  real(kind=realtype) :: dphi, val
640  intrinsic sin
641  intrinsic cos
642 ! return immediately if this is a steady computation.
643  if (equationmode .eq. steady) then
645  return
646  else
647 ! compute the polynomial contribution.
648  dphi = zero
649  do nn=2,degreepolrot
650  dphi = dphi + (nn-1)*nn*coefpolrot(nn)*t**(nn-2)
651  end do
652 ! compute the fourier contribution.
653  do nn=1,degreefourrot
654  val = nn*omegafourrot
655  dphi = dphi - val**2*sincoeffourrot(nn)*sin(val*t)
656  dphi = dphi - val**2*coscoeffourrot(nn)*cos(val*t)
657  end do
658 ! set derivativerigidrotangle to dphi. multiply by timeref
659 ! to obtain the correct non-dimensional value.
661  end if
662  end function secondderivativerigidrotangle
663 
664  function rigidrotangle(degreepolrot, coefpolrot, degreefourrot, &
665 & omegafourrot, coscoeffourrot, sincoeffourrot, t)
666 !
667 ! rigidrotangle computes the rigid body rotation angle at the
668 ! given time for the given arguments. the angle is described by
669 ! a combination of a polynomial and fourier series.
670 !
671  use constants
672  use inputphysics, only : equationmode
673  implicit none
674 !
675 ! function type
676 !
677  real(kind=realtype) :: rigidrotangle
678 !
679 ! function arguments.
680 !
681  integer(kind=inttype), intent(in) :: degreepolrot
682  integer(kind=inttype), intent(in) :: degreefourrot
683  real(kind=realtype), intent(in) :: omegafourrot, t
684  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
685  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
686  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
687 !
688 ! local variables.
689 !
690  integer(kind=inttype) :: nn
691  real(kind=realtype) :: phi, val
692  intrinsic cos
693  intrinsic sin
694 ! return immediately if this is a steady computation.
695  if (equationmode .eq. steady) then
697  return
698  else
699 ! compute the polynomial contribution. if no polynomial was
700 ! specified, the value of index 0 is set to zero automatically.
701  phi = coefpolrot(0)
702  do nn=1,degreepolrot
703  phi = phi + coefpolrot(nn)*t**nn
704  end do
705 ! compute the fourier contribution. again the cosine coefficient
706 ! of index 0 is defaulted to zero if not specified.
707  phi = phi + coscoeffourrot(0)
708  do nn=1,degreefourrot
709  val = nn*omegafourrot*t
710  phi = phi + coscoeffourrot(nn)*cos(val) + sincoeffourrot(nn)*sin&
711 & (val)
712  end do
713 ! set rigidrotangle to phi.
714  rigidrotangle = phi
715  end if
716  end function rigidrotangle
717 
718  subroutine setbcpointers(nn, spatialpointers)
719 !
720 ! setbcpointers sets the pointers needed for the boundary
721 ! condition treatment on a general face, such that the boundary
722 ! routines are only implemented once instead of 6 times.
723 !
724  use constants
725  use blockpointers, only : w, p, rlv, rev, gamma, x, d2wall, si, sj&
726 & , sk, s, globalcell, bcdata, nx, il, ie, ib, ny, jl, je, jb, nz, kl,&
729  use bcpointers_b, only : ww0, ww1, ww2, ww3, pp0, pp1, pp2, pp3, &
730 & rlv0, rlv1, rlv2, rlv3, rev0, rev1, rev2, rev3, gamma0, gamma1, &
731 & gamma2, gamma3, gcp, xx, ss, ssi, ssj, ssk, dd2wall, sface, istart, &
732 & iend, jstart, jend, isize, jsize
733  use inputphysics, only : cpmodel, equations
734  implicit none
735 ! subroutine arguments.
736  integer(kind=inttype), intent(in) :: nn
737  logical, intent(in) :: spatialpointers
738 ! determine the sizes of each face and point to just the range we
739 ! need on each face.
740  istart = bcdata(nn)%icbeg
741  iend = bcdata(nn)%icend
742  jstart = bcdata(nn)%jcbeg
743  jend = bcdata(nn)%jcend
744 ! set the size of the subface
745  isize = iend - istart + 1
746  jsize = jend - jstart + 1
747 ! determine the face id on which the subface is located and set
748 ! the pointers accordinly.
749  select case (bcfaceid(nn))
750  case (imin)
751 !---------------------------------------------------------------------------
752  ww3 => w(3, 1:, 1:, :)
753  ww2 => w(2, 1:, 1:, :)
754  ww1 => w(1, 1:, 1:, :)
755  ww0 => w(0, 1:, 1:, :)
756  pp3 => p(3, 1:, 1:)
757  pp2 => p(2, 1:, 1:)
758  pp1 => p(1, 1:, 1:)
759  pp0 => p(0, 1:, 1:)
760  rlv3 => rlv(3, 1:, 1:)
761  rlv2 => rlv(2, 1:, 1:)
762  rlv1 => rlv(1, 1:, 1:)
763  rlv0 => rlv(0, 1:, 1:)
764  rev3 => rev(3, 1:, 1:)
765  rev2 => rev(2, 1:, 1:)
766  rev1 => rev(1, 1:, 1:)
767  rev0 => rev(0, 1:, 1:)
768  gamma3 => gamma(3, 1:, 1:)
769  gamma2 => gamma(2, 1:, 1:)
770  gamma1 => gamma(1, 1:, 1:)
771  gamma0 => gamma(0, 1:, 1:)
772  gcp => globalcell(2, 1:, 1:)
773 !---------------------------------------------------------------------------
774  case (imax)
775  ww3 => w(nx, 1:, 1:, :)
776  ww2 => w(il, 1:, 1:, :)
777  ww1 => w(ie, 1:, 1:, :)
778  ww0 => w(ib, 1:, 1:, :)
779  pp3 => p(nx, 1:, 1:)
780  pp2 => p(il, 1:, 1:)
781  pp1 => p(ie, 1:, 1:)
782  pp0 => p(ib, 1:, 1:)
783  rlv3 => rlv(nx, 1:, 1:)
784  rlv2 => rlv(il, 1:, 1:)
785  rlv1 => rlv(ie, 1:, 1:)
786  rlv0 => rlv(ib, 1:, 1:)
787  rev3 => rev(nx, 1:, 1:)
788  rev2 => rev(il, 1:, 1:)
789  rev1 => rev(ie, 1:, 1:)
790  rev0 => rev(ib, 1:, 1:)
791  gamma3 => gamma(nx, 1:, 1:)
792  gamma2 => gamma(il, 1:, 1:)
793  gamma1 => gamma(ie, 1:, 1:)
794  gamma0 => gamma(ib, 1:, 1:)
795  gcp => globalcell(il, 1:, 1:)
796 !---------------------------------------------------------------------------
797  case (jmin)
798  ww3 => w(1:, 3, 1:, :)
799  ww2 => w(1:, 2, 1:, :)
800  ww1 => w(1:, 1, 1:, :)
801  ww0 => w(1:, 0, 1:, :)
802  pp3 => p(1:, 3, 1:)
803  pp2 => p(1:, 2, 1:)
804  pp1 => p(1:, 1, 1:)
805  pp0 => p(1:, 0, 1:)
806  rlv3 => rlv(1:, 3, 1:)
807  rlv2 => rlv(1:, 2, 1:)
808  rlv1 => rlv(1:, 1, 1:)
809  rlv0 => rlv(1:, 0, 1:)
810  rev3 => rev(1:, 3, 1:)
811  rev2 => rev(1:, 2, 1:)
812  rev1 => rev(1:, 1, 1:)
813  rev0 => rev(1:, 0, 1:)
814  gamma3 => gamma(1:, 3, 1:)
815  gamma2 => gamma(1:, 2, 1:)
816  gamma1 => gamma(1:, 1, 1:)
817  gamma0 => gamma(1:, 0, 1:)
818  gcp => globalcell(1:, 2, 1:)
819 !---------------------------------------------------------------------------
820  case (jmax)
821  ww3 => w(1:, ny, 1:, :)
822  ww2 => w(1:, jl, 1:, :)
823  ww1 => w(1:, je, 1:, :)
824  ww0 => w(1:, jb, 1:, :)
825  pp3 => p(1:, ny, 1:)
826  pp2 => p(1:, jl, 1:)
827  pp1 => p(1:, je, 1:)
828  pp0 => p(1:, jb, 1:)
829  rlv3 => rlv(1:, ny, 1:)
830  rlv2 => rlv(1:, jl, 1:)
831  rlv1 => rlv(1:, je, 1:)
832  rlv0 => rlv(1:, jb, 1:)
833  rev3 => rev(1:, ny, 1:)
834  rev2 => rev(1:, jl, 1:)
835  rev1 => rev(1:, je, 1:)
836  rev0 => rev(1:, jb, 1:)
837  gamma3 => gamma(1:, ny, 1:)
838  gamma2 => gamma(1:, jl, 1:)
839  gamma1 => gamma(1:, je, 1:)
840  gamma0 => gamma(1:, jb, 1:)
841  gcp => globalcell(1:, jl, 1:)
842 !---------------------------------------------------------------------------
843  case (kmin)
844  ww3 => w(1:, 1:, 3, :)
845  ww2 => w(1:, 1:, 2, :)
846  ww1 => w(1:, 1:, 1, :)
847  ww0 => w(1:, 1:, 0, :)
848  pp3 => p(1:, 1:, 3)
849  pp2 => p(1:, 1:, 2)
850  pp1 => p(1:, 1:, 1)
851  pp0 => p(1:, 1:, 0)
852  rlv3 => rlv(1:, 1:, 3)
853  rlv2 => rlv(1:, 1:, 2)
854  rlv1 => rlv(1:, 1:, 1)
855  rlv0 => rlv(1:, 1:, 0)
856  rev3 => rev(1:, 1:, 3)
857  rev2 => rev(1:, 1:, 2)
858  rev1 => rev(1:, 1:, 1)
859  rev0 => rev(1:, 1:, 0)
860  gamma3 => gamma(1:, 1:, 3)
861  gamma2 => gamma(1:, 1:, 2)
862  gamma1 => gamma(1:, 1:, 1)
863  gamma0 => gamma(1:, 1:, 0)
864  gcp => globalcell(1:, 1:, 2)
865 !---------------------------------------------------------------------------
866  case (kmax)
867  ww3 => w(1:, 1:, nz, :)
868  ww2 => w(1:, 1:, kl, :)
869  ww1 => w(1:, 1:, ke, :)
870  ww0 => w(1:, 1:, kb, :)
871  pp3 => p(1:, 1:, nz)
872  pp2 => p(1:, 1:, kl)
873  pp1 => p(1:, 1:, ke)
874  pp0 => p(1:, 1:, kb)
875  rlv3 => rlv(1:, 1:, nz)
876  rlv2 => rlv(1:, 1:, kl)
877  rlv1 => rlv(1:, 1:, ke)
878  rlv0 => rlv(1:, 1:, kb)
879  rev3 => rev(1:, 1:, nz)
880  rev2 => rev(1:, 1:, kl)
881  rev1 => rev(1:, 1:, ke)
882  rev0 => rev(1:, 1:, kb)
883  gamma3 => gamma(1:, 1:, nz)
884  gamma2 => gamma(1:, 1:, kl)
885  gamma1 => gamma(1:, 1:, ke)
886  gamma0 => gamma(1:, 1:, kb)
887  gcp => globalcell(1:, 1:, kl)
888  end select
889  if (spatialpointers) then
890  select case (bcfaceid(nn))
891  case (imin)
892  xx => x(1, :, :, :)
893  ssi => si(1, :, :, :)
894  ssj => sj(2, :, :, :)
895  ssk => sk(2, :, :, :)
896  ss => s(2, :, :, :)
897  case (imax)
898  xx => x(il, :, :, :)
899  ssi => si(il, :, :, :)
900  ssj => sj(il, :, :, :)
901  ssk => sk(il, :, :, :)
902  ss => s(il, :, :, :)
903  case (jmin)
904  xx => x(:, 1, :, :)
905  ssi => sj(:, 1, :, :)
906  ssj => si(:, 2, :, :)
907  ssk => sk(:, 2, :, :)
908  ss => s(:, 2, :, :)
909  case (jmax)
910  xx => x(:, jl, :, :)
911  ssi => sj(:, jl, :, :)
912  ssj => si(:, jl, :, :)
913  ssk => sk(:, jl, :, :)
914  ss => s(:, jl, :, :)
915  case (kmin)
916  xx => x(:, :, 1, :)
917  ssi => sk(:, :, 1, :)
918  ssj => si(:, :, 2, :)
919  ssk => sj(:, :, 2, :)
920  ss => s(:, :, 2, :)
921  case (kmax)
922  xx => x(:, :, kl, :)
923  ssi => sk(:, :, kl, :)
924  ssj => si(:, :, kl, :)
925  ssk => sj(:, :, kl, :)
926  ss => s(:, :, kl, :)
927  end select
928  if (addgridvelocities) then
929  select case (bcfaceid(nn))
930  case (imin)
931  sface => sfacei(1, :, :)
932  case (imax)
933  sface => sfacei(il, :, :)
934  case (jmin)
935  sface => sfacej(:, 1, :)
936  case (jmax)
937  sface => sfacej(:, jl, :)
938  case (kmin)
939  sface => sfacek(:, :, 1)
940  case (kmax)
941  sface => sfacek(:, :, kl)
942  end select
943  end if
944  if (equations .eq. ransequations) then
945  select case (bcfaceid(nn))
946  case (imin)
947  dd2wall => d2wall(2, :, :)
948  case (imax)
949  dd2wall => d2wall(il, :, :)
950  case (jmin)
951  dd2wall => d2wall(:, 2, :)
952  case (jmax)
953  dd2wall => d2wall(:, jl, :)
954  case (kmin)
955  dd2wall => d2wall(:, :, 2)
956  case (kmax)
957  dd2wall => d2wall(:, :, kl)
958  end select
959  end if
960  end if
961  end subroutine setbcpointers
962 
963  subroutine computerootbendingmoment(cf, cm, bendingmoment)
964 ! *
965 ! compute a normalized bending moment coefficient from *
966 ! the force and moment coefficient. at the moment this *
967 ! routine only works for a half body. additional logic *
968 ! would be needed for a full body. *
969 ! *
970  use constants
971  use inputphysics, only : lengthref, pointref, pointrefec, &
972 & liftindex
973  implicit none
974 !input/output variables
975  real(kind=realtype), dimension(3), intent(in) :: cf, cm
976  real(kind=realtype), intent(out) :: bendingmoment
977 !subroutine variables
978  real(kind=realtype) :: elasticmomentx, elasticmomenty, &
979 & elasticmomentz
980  intrinsic sqrt
981  bendingmoment = zero
982  if (liftindex .eq. 2) then
983 !z out wing sum momentx,momentz
984  elasticmomentx = cm(1) + cf(2)*(pointrefec(3)-pointref(3))/&
985 & lengthref - cf(3)*(pointrefec(2)-pointref(2))/lengthref
986  elasticmomentz = cm(3) - cf(2)*(pointrefec(1)-pointref(1))/&
987 & lengthref + cf(1)*(pointrefec(2)-pointref(2))/lengthref
988  bendingmoment = sqrt(elasticmomentx**2 + elasticmomentz**2)
989  else if (liftindex .eq. 3) then
990 !y out wing sum momentx,momenty
991  elasticmomentx = cm(1) + cf(3)*(pointrefec(2)-pointref(2))/&
992 & lengthref + cf(3)*(pointrefec(3)-pointref(3))/lengthref
993  elasticmomenty = cm(2) + cf(3)*(pointrefec(1)-pointref(1))/&
994 & lengthref + cf(1)*(pointrefec(3)-pointref(3))/lengthref
995  bendingmoment = sqrt(elasticmomentx**2 + elasticmomenty**2)
996  end if
997  end subroutine computerootbendingmoment
998 
999  subroutine computeleastsquaresregression(y, x, npts, m, b)
1000 !
1001 ! computes the slope of best fit for a set of x,y data of length
1002 ! npts
1003 !
1004  use constants
1005  implicit none
1006 !subroutine arguments
1007  integer(kind=inttype) :: npts
1008  real(kind=realtype), dimension(npts) :: x, y
1009  real(kind=realtype) :: m, b
1010 !local variables
1011  real(kind=realtype) :: sumx, sumy, sumx2, sumxy
1012  integer(kind=inttype) :: i
1013 !begin execution
1014  sumx = 0.0
1015  sumy = 0.0
1016  sumx2 = 0.0
1017  sumxy = 0.0
1018  do i=1,npts
1019  sumx = sumx + x(i)
1020  sumy = sumy + y(i)
1021  sumx2 = sumx2 + x(i)*x(i)
1022  sumxy = sumxy + x(i)*y(i)
1023  end do
1024  m = (npts*sumxy-sumy*sumx)/(npts*sumx2-sumx**2)
1025  b = (sumy*sumx2-sumx*sumxy)/(npts*sumx2-sumx**2)
1026  end subroutine computeleastsquaresregression
1027 
1028  subroutine computetsderivatives(force, moment, coef0, dcdalpha, &
1029 & dcdalphadot, dcdq, dcdqdot)
1030 !
1031 ! computes the stability derivatives based on the time spectral
1032 ! solution of a given mesh. takes in the force coefficients at
1033 ! all time instantces and computes the agregate parameters
1034 !
1035  use constants
1036  use communication
1037  use inputphysics
1038  use inputtimespectral
1039  use inputtsstabderiv
1040  use flowvarrefstate
1041  use monitor
1042  use section
1043  use inputmotion
1044  implicit none
1045 !
1046 ! subroutine arguments.
1047 !
1048  real(kind=realtype), dimension(3, ntimeintervalsspectral) :: force, &
1049 & moment
1050  real(kind=realtype), dimension(8) :: dcdq, dcdqdot
1051  real(kind=realtype), dimension(8) :: dcdalpha, dcdalphadot
1052  real(kind=realtype), dimension(8) :: coef0
1053 ! working variables
1054  real(kind=realtype), dimension(ntimeintervalsspectral, 8) :: &
1055 & basecoef
1056  real(kind=realtype), dimension(8) :: coef0dot
1057  real(kind=realtype), dimension(ntimeintervalsspectral, 8) :: &
1058 & resbasecoef
1059  real(kind=realtype), dimension(ntimeintervalsspectral) :: &
1060 & intervalalpha, intervalalphadot
1061  real(kind=realtype), dimension(ntimeintervalsspectral) :: &
1062 & intervalmach, intervalmachdot
1063  real(kind=realtype), dimension(nsections) :: t
1064  integer(kind=inttype) :: i, sps, nn
1065 !speed of sound: for normalization of q derivatives
1066  real(kind=realtype) :: a
1067  real(kind=realtype) :: fact, factmoment
1068 ! functions
1069  real(kind=realtype), dimension(ntimeintervalsspectral) :: dphix, &
1070 & dphiy, dphiz
1071  real(kind=realtype), dimension(ntimeintervalsspectral) :: dphixdot, &
1072 & dphiydot, dphizdot
1073  real(kind=realtype) :: derivativerigidrotangle, &
1075  intrinsic sqrt
1076  fact = two/(gammainf*pinf*machcoef**2*surfaceref*lref**2)
1077  factmoment = fact/(lengthref*lref)
1078  if (tsqmode) then
1079  print*, &
1080 & 'ts q mode code needs to be updated in computetsderivatives!'
1081  stop
1082 ! !q is pitch
1083 ! do sps =1,ntimeintervalsspectral
1084 ! !compute the time of this intervavc
1085 ! t = timeunsteadyrestart
1086 ! if(equationmode == timespectral) then
1087 ! do nn=1,nsections
1088 ! t(nn) = t(nn) + (sps-1)*sections(nn)%timeperiod &
1089 ! / (ntimeintervalsspectral*1.0)
1090 ! enddo
1091 ! endif
1092 ! ! compute the time derivative of the rotation angles around the
1093 ! ! z-axis. i.e. compute q
1094 ! dphiz(sps) = derivativerigidrotangle(degreepolzrot, &
1095 ! coefpolzrot, &
1096 ! degreefourzrot, &
1097 ! omegafourzrot, &
1098 ! coscoeffourzrot, &
1099 ! sincoeffourzrot, t)
1100 ! ! add in q_dot computation
1101 ! dphizdot(sps) = secondderivativerigidrotangle(degreepolzrot, &
1102 ! coefpolzrot, &
1103 ! degreefourzrot, &
1104 ! omegafourzrot, &
1105 ! coscoeffourzrot, &
1106 ! sincoeffourzrot, t)
1107 ! end do
1108 ! !now compute dcl/dq
1109 ! do i =1,8
1110 ! call computeleastsquaresregression(basecoef(:,i),dphiz,ntimeintervalsspectral,dcdq(i),coef0(i))
1111 ! end do
1112 ! ! now subtract off estimated cl,cmz and use remainder to compute
1113 ! ! clqdot and cmzqdot.
1114 ! do i = 1,8
1115 ! do sps = 1,ntimeintervalsspectral
1116 ! resbasecoef(sps,i) = basecoef(sps,i)-(dcdq(i)*dphiz(sps)+coef0(i))
1117 ! enddo
1118 ! enddo
1119 ! !now normalize the results...
1120 ! a = sqrt(gammainf*pinfdim/rhoinfdim)
1121 ! dcdq = dcdq*timeref*2*(machgrid*a)/lengthref
1122 ! !now compute dcl/dpdot
1123 ! do i = 1,8
1124 ! call computeleastsquaresregression(resbasecoef(:,i),dphizdot,ntimeintervalsspectral,dcdqdot(i),coef0dot(i))
1125 ! enddo
1126  else if (tsalphamode) then
1127  do sps=1,ntimeintervalsspectral
1128 !compute the time of this interval
1130  if (equationmode .eq. timespectral) then
1131  do nn=1,nsections
1132  t(nn) = t(nn) + (sps-1)*sections(nn)%timeperiod/(&
1134  end do
1135  end if
1136  intervalalpha(sps) = tsalpha(degreepolalpha, coefpolalpha, &
1138 & sincoeffouralpha, t(1))
1139  intervalalphadot(sps) = tsalphadot(degreepolalpha, coefpolalpha&
1141 & sincoeffouralpha, t(1))
1142 ! this call is wrong!!!!
1143 !call getdirangle(veldirfreestream,liftdirection,liftindex,alpha+intervalalpha(sps), beta)
1144  basecoef(sps, 1) = fact*(force(1, sps)*liftdirection(1)+force(2&
1145 & , sps)*liftdirection(2)+force(3, sps)*liftdirection(3))
1146  basecoef(sps, 2) = fact*(force(1, sps)*dragdirection(1)+force(2&
1147 & , sps)*dragdirection(2)+force(3, sps)*dragdirection(3))
1148  basecoef(sps, 3) = force(1, sps)*fact
1149  basecoef(sps, 4) = force(2, sps)*fact
1150  basecoef(sps, 5) = force(3, sps)*fact
1151  basecoef(sps, 6) = moment(1, sps)*factmoment
1152  basecoef(sps, 7) = moment(2, sps)*factmoment
1153  basecoef(sps, 8) = moment(3, sps)*factmoment
1154  end do
1155 !now compute dcl/dalpha
1156  do i=1,8
1157  call computeleastsquaresregression(basecoef(:, i), intervalalpha&
1158 & , ntimeintervalsspectral, dcdalpha(&
1159 & i), coef0(i))
1160  end do
1161 ! now subtract off estimated cl,cmz and use remainder to compute
1162 ! clalphadot and cmzalphadot.
1163  do i=1,8
1164  do sps=1,ntimeintervalsspectral
1165  resbasecoef(sps, i) = basecoef(sps, i) - (dcdalpha(i)*&
1166 & intervalalpha(sps)+coef0(i))
1167  end do
1168  end do
1169 !now compute dci/dalphadot
1170  do i=1,8
1171  call computeleastsquaresregression(resbasecoef(:, i), &
1172 & intervalalphadot, &
1173 & ntimeintervalsspectral, dcdalphadot&
1174 & (i), coef0dot(i))
1175  end do
1176  a = sqrt(gammainf*pinfdim/rhoinfdim)
1177  dcdalphadot = dcdalphadot*2*(machgrid*a)/lengthref
1178  else
1179  call terminate('computetsderivatives', &
1180 & 'not a valid stability motion')
1181  end if
1182  end subroutine computetsderivatives
1183 
1184  subroutine getdirangle(freestreamaxis, liftaxis, liftindex, alpha, &
1185 & beta)
1186 !
1187 ! convert the wind axes to angle of attack and side slip angle.
1188 ! the direction angles alpha and beta are computed given the
1189 ! components of the wind direction vector (freestreamaxis), the
1190 ! lift direction vector (liftaxis) and assuming that the
1191 ! body direction (xb,yb,zb) is in the default ijk coordinate
1192 ! system. the rotations are determined by first determining
1193 ! whether the lift is primarily in the j or k direction and then
1194 ! determining the angles accordingly.
1195 ! direction vector:
1196 ! 1) rotation about the zb or yb -axis: alpha clockwise (cw)
1197 ! (xb,yb,zb) -> (x1,y1,z1)
1198 ! 2) rotation about the yl or z1 -axis: beta counter-clockwise
1199 ! (ccw) (x1,y1,z1) -> (xw,yw,zw)
1200 ! input arguments:
1201 ! freestreamaxis = wind vector in body axes
1202 ! liftaxis = lift direction vector in body axis
1203 ! output arguments:
1204 ! alpha = angle of attack in radians
1205 ! beta = side slip angle in radians
1206 !
1207  use constants
1208  implicit none
1209 !
1210 ! subroutine arguments.
1211 !
1212 ! real(kind=realtype), intent(in) :: xw, yw, zw
1213  real(kind=realtype), dimension(3), intent(in) :: freestreamaxis
1214  real(kind=realtype), dimension(3), intent(in) :: liftaxis
1215  real(kind=realtype), intent(out) :: alpha, beta
1216  integer(kind=inttype), intent(out) :: liftindex
1217 !
1218 ! local variables.
1219 !
1220  real(kind=realtype) :: rnorm
1221  integer(kind=inttype) :: flowindex, i
1222  real(kind=realtype), dimension(3) :: freestreamaxisnorm
1223  integer(kind=inttype) :: temp
1224  intrinsic abs
1225  intrinsic sqrt
1226  intrinsic asin
1227  intrinsic atan2
1228  real(kind=realtype) :: abs0
1229  real(kind=realtype) :: abs1
1230  real(kind=realtype) :: abs2
1231  real(kind=realtype) :: abs3
1232  real(kind=realtype) :: abs4
1233  real(kind=realtype) :: abs5
1234  real(kind=realtype) :: abs6
1235  real(kind=realtype) :: abs7
1236 ! assume domoniate flow is x
1237  flowindex = 1
1238  if (liftaxis(1) .ge. 0.) then
1239  abs0 = liftaxis(1)
1240  else
1241  abs0 = -liftaxis(1)
1242  end if
1243  if (liftaxis(2) .ge. 0.) then
1244  abs2 = liftaxis(2)
1245  else
1246  abs2 = -liftaxis(2)
1247  end if
1248  if (liftaxis(1) .ge. 0.) then
1249  abs4 = liftaxis(1)
1250  else
1251  abs4 = -liftaxis(1)
1252  end if
1253  if (liftaxis(3) .ge. 0.) then
1254  abs6 = liftaxis(3)
1255  else
1256  abs6 = -liftaxis(3)
1257  end if
1258 ! determine the dominant lift direction
1259  if (abs0 .gt. abs2 .and. abs4 .gt. abs6) then
1260  temp = 1
1261  else
1262  if (liftaxis(2) .ge. 0.) then
1263  abs1 = liftaxis(2)
1264  else
1265  abs1 = -liftaxis(2)
1266  end if
1267  if (liftaxis(1) .ge. 0.) then
1268  abs3 = liftaxis(1)
1269  else
1270  abs3 = -liftaxis(1)
1271  end if
1272  if (liftaxis(2) .ge. 0.) then
1273  abs5 = liftaxis(2)
1274  else
1275  abs5 = -liftaxis(2)
1276  end if
1277  if (liftaxis(3) .ge. 0.) then
1278  abs7 = liftaxis(3)
1279  else
1280  abs7 = -liftaxis(3)
1281  end if
1282  if (abs1 .gt. abs3 .and. abs5 .gt. abs7) then
1283  temp = 2
1284  else
1285  temp = 3
1286  end if
1287  end if
1288  liftindex = temp
1289 ! normalize the freestreamdirection vector.
1290  rnorm = sqrt(freestreamaxis(1)**2 + freestreamaxis(2)**2 + &
1291 & freestreamaxis(3)**2)
1292  do i=1,3
1293  freestreamaxisnorm(i) = freestreamaxis(i)/rnorm
1294  end do
1295  if (liftindex .eq. 2) then
1296 ! different coordinate system for aerosurf
1297 ! wing is in z- direction
1298 ! compute angle of attack alpha.
1299  alpha = asin(freestreamaxisnorm(2))
1300 ! compute side-slip angle beta.
1301  beta = -atan2(freestreamaxisnorm(3), freestreamaxisnorm(1))
1302  else if (liftindex .eq. 3) then
1303 ! wing is in y- direction
1304 ! compute angle of attack alpha.
1305  alpha = asin(freestreamaxisnorm(3))
1306 ! compute side-slip angle beta.
1307  beta = atan2(freestreamaxisnorm(2), freestreamaxisnorm(1))
1308  else
1309  call terminate('getdirangle', 'invalid lift direction')
1310  end if
1311  end subroutine getdirangle
1312 
1314 !
1315 ! runs the time spectral stability derivative routines from the
1316 ! main program file
1317 !
1318  use precision
1319  implicit none
1320 !
1321 ! local variables.
1322 !
1323  real(kind=realtype), dimension(8) :: dcdalpha, dcdalphadot, dcdbeta&
1324 & , dcdbetadot, dcdmach, dcdmachdot
1325  real(kind=realtype), dimension(8) :: dcdp, dcdpdot, dcdq, dcdqdot, &
1326 & dcdr, dcdrdot
1327  real(kind=realtype), dimension(8) :: coef0, coef0dot
1328 !call computetsderivatives(coef0,dcdalpha,dcdalphadot,dcdq,dcdqdot)
1329  end subroutine stabilityderivativedriver
1330 
1332 !
1333 ! setcoeftimeintegrator determines the coefficients of the
1334 ! time integration scheme in unsteady mode. normally these are
1335 ! equal to the coefficients corresponding to the specified
1336 ! accuracy. however during the initial phase there are not
1337 ! enough states in the past and the accuracy is reduced.
1338 !
1339  use constants
1340  use inputunsteady
1341  use inputphysics
1342  use iteration
1343  use monitor
1344  implicit none
1345 !
1346 ! local variables.
1347 !
1348  integer(kind=inttype) :: nn, nlevelsset
1349 ! determine which time integrator must be used.
1350 ! modified by hdn
1351  select case (timeaccuracy)
1352  case (firstorder)
1353 ! 1st order. no need to check the number of available
1354 ! states in the past. set the two coefficients and
1355 ! nlevelsset to 2.
1356  coeftime(0) = 1.0_realtype
1357  coeftime(1) = -1.0_realtype
1358  if (useale .and. equationmode .eq. unsteady) then
1359  coeftimeale(1) = 1.0_realtype
1360  coefmeshale(1, 1) = half
1361  coefmeshale(1, 2) = half
1362  end if
1363  nlevelsset = 2
1364 !--------------------------------------------------
1365  case (secondorder)
1366 ! second order time integrator. determine the amount of
1367 ! available states and set the coefficients accordingly.
1368  select case (noldsolavail)
1369  case (1_inttype)
1370  coeftime(0) = 1.0_realtype
1371  coeftime(1) = -1.0_realtype
1372  if (useale .and. equationmode .eq. unsteady) then
1373  coeftimeale(1) = half
1374  coeftimeale(2) = half
1375  coeftimeale(3) = zero
1376  coeftimeale(4) = zero
1377  coefmeshale(1, 1) = half
1378  coefmeshale(1, 2) = half
1379  coefmeshale(2, 1) = half
1380  coefmeshale(2, 2) = half
1381  end if
1382  nlevelsset = 2
1383  case default
1384 ! 2 or bigger.
1385  coeftime(0) = 1.5_realtype
1386  coeftime(1) = -2.0_realtype
1387  coeftime(2) = 0.5_realtype
1388  if (useale .and. equationmode .eq. unsteady) then
1391  coeftimeale(3) = -fourth
1392  coeftimeale(4) = -fourth
1393  coefmeshale(1, 1) = half*(1.0_realtype+1.0_realtype/sqrtthree)
1394  coefmeshale(1, 2) = half*(1.0_realtype-1.0_realtype/sqrtthree)
1395  coefmeshale(2, 1) = coefmeshale(1, 2)
1396  coefmeshale(2, 2) = coefmeshale(1, 1)
1397  end if
1398  nlevelsset = 3
1399  end select
1400 !--------------------------------------------------
1401  case (thirdorder)
1402 ! third order time integrator. determine the amount of
1403 ! available states and set the coefficients accordingly.
1404  select case (noldsolavail)
1405  case (1_inttype)
1406  coeftime(0) = 1.0_realtype
1407  coeftime(1) = -1.0_realtype
1408  if (useale .and. equationmode .eq. unsteady) then
1409  coeftimeale(1) = 1.0_realtype
1410  coefmeshale(1, 1) = half
1411  coefmeshale(1, 2) = half
1412  end if
1413  nlevelsset = 2
1414  case (2_inttype)
1415  coeftime(0) = 1.5_realtype
1416  coeftime(1) = -2.0_realtype
1417  coeftime(2) = 0.5_realtype
1418  if (useale .and. equationmode .eq. unsteady) then
1420  coeftimeale(2) = -fourth
1421  coefmeshale(1, 1) = half*(1.0_realtype+1.0_realtype/sqrtthree)
1422  coefmeshale(1, 2) = half*(1.0_realtype-1.0_realtype/sqrtthree)
1423  coefmeshale(2, 1) = coefmeshale(1, 2)
1424  coefmeshale(2, 2) = coefmeshale(1, 1)
1425  end if
1426  nlevelsset = 3
1427  case default
1428 ! 3 or bigger.
1429  coeftime(0) = 11.0_realtype/6.0_realtype
1430  coeftime(1) = -3.0_realtype
1431  coeftime(2) = 1.5_realtype
1432  coeftime(3) = -(1.0_realtype/3.0_realtype)
1433 ! these numbers are not correct
1434 ! do not use 3rd order ale for now
1435  if (useale .and. equationmode .eq. unsteady) then
1436  print*, 'third-order ale not implemented yet.'
1439  coeftimeale(3) = -fourth
1440  coeftimeale(4) = -fourth
1441  coefmeshale(1, 1) = half*(1.0_realtype+1.0_realtype/sqrtthree)
1442  coefmeshale(1, 2) = half*(1.0_realtype-1.0_realtype/sqrtthree)
1443  coefmeshale(2, 1) = coefmeshale(1, 2)
1444  coefmeshale(2, 2) = coefmeshale(1, 1)
1445  coefmeshale(3, 1) = coefmeshale(1, 2)
1446  coefmeshale(3, 2) = coefmeshale(1, 1)
1447  end if
1448  nlevelsset = 4
1449  end select
1450  end select
1451 ! set the rest of the coefficients to 0 if not enough states
1452 ! in the past are available.
1453  do nn=nlevelsset,noldlevels
1454  coeftime(nn) = zero
1455  end do
1456  end subroutine setcoeftimeintegrator
1457 
1458 ! differentiation of mynorm2 in reverse (adjoint) mode (with options noisize i4 dr8 r8):
1459 ! gradient of useful results: mynorm2
1460 ! with respect to varying inputs: x
1461  subroutine mynorm2_b(x, xd, mynorm2d)
1462  use constants
1463  implicit none
1464  real(kind=realtype), dimension(3), intent(in) :: x
1465  real(kind=realtype), dimension(3) :: xd
1466  real(kind=realtype) :: mynorm2
1467  real(kind=realtype) :: mynorm2d
1468  intrinsic sqrt
1469  real(kind=realtype) :: tempd
1470  xd = 0.0_8
1471  if (x(1)**2 + x(2)**2 + x(3)**2 .eq. 0.0_8) then
1472  tempd = 0.0_8
1473  else
1474  tempd = mynorm2d/(2.0*sqrt(x(1)**2+x(2)**2+x(3)**2))
1475  end if
1476  xd(1) = xd(1) + 2*x(1)*tempd
1477  xd(2) = xd(2) + 2*x(2)*tempd
1478  xd(3) = xd(3) + 2*x(3)*tempd
1479  end subroutine mynorm2_b
1480 
1481  function mynorm2(x)
1482  use constants
1483  implicit none
1484  real(kind=realtype), dimension(3), intent(in) :: x
1485  real(kind=realtype) :: mynorm2
1486  intrinsic sqrt
1487  mynorm2 = sqrt(x(1)**2 + x(2)**2 + x(3)**2)
1488  end function mynorm2
1489 
1490  function iswalltype(btype)
1491  use constants
1492  implicit none
1493  integer(kind=inttype) :: btype
1494  logical :: iswalltype
1495  iswalltype = .false.
1496  if ((btype .eq. nswalladiabatic .or. btype .eq. nswallisothermal) &
1497 & .or. btype .eq. eulerwall) iswalltype = .true.
1498  end function iswalltype
1499 
1500 ! differentiation of cross_prod in reverse (adjoint) mode (with options noisize i4 dr8 r8):
1501 ! gradient of useful results: c
1502 ! with respect to varying inputs: a b c
1503  subroutine cross_prod_b(a, ad, b, bd, c, cd)
1504  use precision
1505  implicit none
1506 ! inputs
1507  real(kind=realtype), dimension(3), intent(in) :: a, b
1508  real(kind=realtype), dimension(3) :: ad, bd
1509 ! outputs
1510  real(kind=realtype), dimension(3) :: c
1511  real(kind=realtype), dimension(3) :: cd
1512  ad = 0.0_8
1513  bd = 0.0_8
1514  ad(1) = ad(1) + b(2)*cd(3) - b(3)*cd(2)
1515  bd(2) = bd(2) + a(1)*cd(3) - a(3)*cd(1)
1516  ad(2) = ad(2) + b(3)*cd(1) - b(1)*cd(3)
1517  bd(1) = bd(1) + a(3)*cd(2) - a(2)*cd(3)
1518  cd(3) = 0.0_8
1519  ad(3) = ad(3) + b(1)*cd(2) - b(2)*cd(1)
1520  bd(3) = bd(3) + a(2)*cd(1) - a(1)*cd(2)
1521  cd(2) = 0.0_8
1522  cd(1) = 0.0_8
1523  end subroutine cross_prod_b
1524 
1525  subroutine cross_prod(a, b, c)
1526  use precision
1527  implicit none
1528 ! inputs
1529  real(kind=realtype), dimension(3), intent(in) :: a, b
1530 ! outputs
1531  real(kind=realtype), dimension(3), intent(out) :: c
1532  c(1) = a(2)*b(3) - a(3)*b(2)
1533  c(2) = a(3)*b(1) - a(1)*b(3)
1534  c(3) = a(1)*b(2) - a(2)*b(1)
1535  end subroutine cross_prod
1536 
1537  subroutine siangle(angle, mult, trans)
1538  use constants
1539  use su_cgns, only : radian, degree
1540  implicit none
1541 !
1542 ! subroutine arguments.
1543 !
1544  integer, intent(in) :: angle
1545  real(kind=realtype), intent(out) :: mult, trans
1546 ! determine the situation we are having here.
1547  if (angle .eq. radian) then
1548 ! angle is already given in radians. no need for a conversion.
1549  mult = one
1550  trans = zero
1551  else if (angle .eq. degree) then
1552 ! angle is given in degrees. a multiplication must be performed.
1553  mult = pi/180.0_realtype
1554  trans = zero
1555  else
1556  call terminate('siangle', &
1557 & 'no idea how to convert this to si units')
1558  end if
1559  end subroutine siangle
1560 
1561  subroutine sidensity(mass, len, mult, trans)
1562 !
1563 ! sidensity computes the conversion from the given density
1564 ! unit, which can be constructed from mass and length, to the
1565 ! si-unit kg/m^3. the conversion will look like:
1566 ! density in kg/m^3 = mult*(density in ncu) + trans.
1567 ! ncu means non-christian units, i.e. everything that is not si.
1568 !
1569  use constants
1570  use su_cgns, only : kilogram, meter
1571  implicit none
1572 !
1573 ! subroutine arguments.
1574 !
1575  integer, intent(in) :: mass, len
1576  real(kind=realtype), intent(out) :: mult, trans
1577 ! determine the situation we are having here.
1578  if (mass .eq. kilogram .and. len .eq. meter) then
1579 ! density is given in kg/m^3, i.e. no need for a conversion.
1580  mult = one
1581  trans = zero
1582  else
1583  call terminate('sidensity', &
1584 & 'no idea how to convert this to si units')
1585  end if
1586  end subroutine sidensity
1587 
1588  subroutine silen(len, mult, trans)
1589 !
1590 ! silen computes the conversion from the given length unit to
1591 ! the si-unit meter. the conversion will look like:
1592 ! length in meter = mult*(length in ncu) + trans.
1593 ! ncu means non-christian units, i.e. everything that is not si.
1594 !
1595  use constants
1596  use su_cgns, only : meter, centimeter, millimeter, foot, inch
1597  implicit none
1598 !
1599 ! subroutine arguments.
1600 !
1601  integer, intent(in) :: len
1602  real(kind=realtype), intent(out) :: mult, trans
1603 ! determine the situation we are having here.
1604  select case (len)
1605  case (meter)
1606  mult = one
1607  trans = zero
1608  case (centimeter)
1609  mult = 0.01_realtype
1610  trans = zero
1611  case (millimeter)
1612  mult = 0.001_realtype
1613  trans = zero
1614  case (foot)
1615  mult = 0.3048_realtype
1616  trans = zero
1617  case (inch)
1618  mult = 0.0254_realtype
1619  trans = zero
1620  case default
1621  call terminate('silen', 'no idea how to convert this to si units')
1622  end select
1623  end subroutine silen
1624 
1625  subroutine sipressure(mass, len, time, mult, trans)
1626 !
1627 ! sipressure computes the conversion from the given pressure
1628 ! unit, which can be constructed from mass, length and time, to
1629 ! the si-unit pa. the conversion will look like:
1630 ! pressure in pa = mult*(pressure in ncu) + trans.
1631 ! ncu means non-christian units, i.e. everything that is not si.
1632 !
1633  use constants
1634  use su_cgns, only : kilogram, meter, second
1635  implicit none
1636 !
1637 ! subroutine arguments.
1638 !
1639  integer, intent(in) :: mass, len, time
1640  real(kind=realtype), intent(out) :: mult, trans
1641 ! determine the situation we are having here.
1642  if (mass .eq. kilogram .and. len .eq. meter .and. time .eq. second) &
1643 & then
1644 ! pressure is given in pa, i.e. no need for a conversion.
1645  mult = one
1646  trans = zero
1647  else
1648  call terminate('sipressure', &
1649 & 'no idea how to convert this to si units')
1650  end if
1651  end subroutine sipressure
1652 
1653  subroutine sitemperature(temp, mult, trans)
1654 !
1655 ! sitemperature computes the conversion from the given
1656 ! temperature unit to the si-unit kelvin. the conversion will
1657 ! look like:
1658 ! temperature in k = mult*(temperature in ncu) + trans.
1659 ! ncu means non-christian units, i.e. everything that is not si.
1660 !
1661  use constants
1662  use su_cgns, only : kelvin, celsius, rankine, fahrenheit
1663  implicit none
1664 !
1665 ! subroutine arguments.
1666 !
1667  integer, intent(in) :: temp
1668  real(kind=realtype), intent(out) :: mult, trans
1669 ! determine the situation we are having here.
1670  select case (temp)
1671  case (kelvin)
1672 ! temperature is already given in kelvin. no need to convert.
1673  mult = one
1674  trans = zero
1675  case (celsius)
1676 ! is it celcius or celsius?
1677 ! temperature is in celsius. only an offset must be applied.
1678  mult = one
1679  trans = 273.16_realtype
1680  case (rankine)
1681 ! temperature is in rankine. only a multiplication needs to
1682 ! be performed.
1683  mult = 5.0_realtype/9.0_realtype
1684  trans = zero
1685  case (fahrenheit)
1686 ! temperature is in fahrenheit. both a multiplication and an
1687 ! offset must be applied.
1688  mult = 5.0_realtype/9.0_realtype
1689  trans = 255.382
1690  case default
1691 ! unknown temperature unit.
1692  call terminate('sitemperature', &
1693 & 'no idea how to convert this to si units')
1694  end select
1695  end subroutine sitemperature
1696 
1697  subroutine siturb(mass, len, time, temp, turbname, mult, trans)
1698 !
1699 ! siturb computes the conversion from the given turbulence
1700 ! unit, which can be constructed from mass, len, time and temp,
1701 ! to the si-unit for the given variable. the conversion will
1702 ! look like: var in si = mult*(var in ncu) + trans.
1703 ! ncu means non-christian units, i.e. everything that is not si.
1704 !
1705  use constants
1706  use su_cgns, only : kilogram, meter, second, kelvin
1707  implicit none
1708 !
1709 ! subroutine arguments.
1710 !
1711  integer, intent(in) :: mass, len, time, temp
1712  character(len=*), intent(in) :: turbname
1713  real(kind=realtype), intent(out) :: mult, trans
1714 ! determine the situation we are having here.
1715  if (mass .eq. kilogram .and. len .eq. meter .and. time .eq. second &
1716 & .and. temp .eq. kelvin) then
1717 ! everthing is already in si units. no conversion needed.
1718  mult = one
1719  trans = zero
1720  else
1721  call terminate('siturb', 'no idea how to convert this to si units'&
1722 & )
1723  end if
1724  end subroutine siturb
1725 
1726  subroutine sivelocity(length, time, mult, trans)
1727 !
1728 ! sivelocity computes the conversion from the given velocity
1729 ! unit, which can be constructed from length and time, to the
1730 ! si-unit m/s. the conversion will look like:
1731 ! velocity in m/s = mult*(velocity in ncu) + trans.
1732 ! ncu means non-christian units, i.e. everything that is not si.
1733 !
1734  use constants
1735  use su_cgns, only : meter, centimeter, millimeter, foot, inch, &
1736 & second
1737  implicit none
1738 !
1739 ! subroutine arguments.
1740 !
1741  integer, intent(in) :: length, time
1742  real(kind=realtype), intent(out) :: mult, trans
1743 ! determine the situation we are having here.
1744 ! first the length.
1745  select case (length)
1746  case (meter)
1747  mult = one
1748  trans = zero
1749  case (centimeter)
1750  mult = 0.01_realtype
1751  trans = zero
1752  case (millimeter)
1753  mult = 0.001_realtype
1754  trans = zero
1755  case (foot)
1756  mult = 0.3048_realtype
1757  trans = zero
1758  case (inch)
1759  mult = 0.0254_realtype
1760  trans = zero
1761  case default
1762  call terminate('sivelocity', &
1763 & 'no idea how to convert this length to si units')
1764  end select
1765 ! and the time.
1766  select case (time)
1767  case (second)
1768  mult = mult
1769  case default
1770  call terminate('sivelocity', &
1771 & 'no idea how to convert this time to si units')
1772  end select
1773  end subroutine sivelocity
1774 ! ----------------------------------------------------------------------
1775 ! |
1776 ! no tapenade routine below this line |
1777 ! |
1778 ! ----------------------------------------------------------------------
1779 
1780 end module utils_b
1781 
Definition: BCData.F90:1
real(kind=realtype), dimension(:, :, :), pointer sfacek
real(kind=realtype), dimension(:, :, :), pointer gamma
logical addgridvelocities
integer(kind=inttype) jl
integer(kind=inttype) nx
real(kind=realtype), dimension(:, :, :), pointer p
integer(kind=inttype) ny
integer(kind=inttype) ie
real(kind=realtype), dimension(:, :, :, :), pointer w
real(kind=realtype), dimension(:, :, :), pointer sfacei
real(kind=realtype), dimension(:, :, :), pointer d2wall
integer(kind=inttype), dimension(:, :, :), pointer globalcell
integer(kind=inttype) jb
integer(kind=inttype) kb
real(kind=realtype), dimension(:, :, :), pointer rlv
integer(kind=inttype), dimension(:), pointer bcfaceid
real(kind=realtype), dimension(:, :, :, :), pointer si
real(kind=realtype), dimension(:, :, :, :), pointer sj
real(kind=realtype), dimension(:, :, :, :), pointer s
real(kind=realtype), dimension(:, :, :), pointer rev
real(kind=realtype), dimension(:, :, :, :), pointer sk
integer(kind=inttype) ib
real(kind=realtype), dimension(:, :, :), pointer sfacej
integer(kind=inttype) nz
integer(kind=inttype) je
integer(kind=inttype) ke
real(kind=realtype), dimension(:, :, :, :), pointer x
integer(kind=inttype) kl
integer(kind=inttype) il
integer adflow_comm_world
integer(kind=inttype), parameter firstorder
Definition: constants.F90:142
integer(kind=inttype), parameter eulerwall
Definition: constants.F90:262
real(kind=realtype), parameter zero
Definition: constants.F90:71
integer(kind=inttype), parameter imax
Definition: constants.F90:293
real(kind=realtype), parameter threefourth
Definition: constants.F90:85
integer(kind=inttype), parameter kmin
Definition: constants.F90:296
real(kind=realtype), parameter pi
Definition: constants.F90:22
integer(kind=inttype), parameter jmax
Definition: constants.F90:295
integer(kind=inttype), parameter nswalladiabatic
Definition: constants.F90:260
integer(kind=inttype), parameter timespectral
Definition: constants.F90:115
integer(kind=inttype), parameter unsteady
Definition: constants.F90:115
real(kind=realtype), parameter one
Definition: constants.F90:72
real(kind=realtype), parameter half
Definition: constants.F90:80
integer(kind=inttype), parameter imin
Definition: constants.F90:292
integer(kind=inttype), parameter steady
Definition: constants.F90:115
real(kind=realtype), parameter two
Definition: constants.F90:73
real(kind=realtype), parameter fourth
Definition: constants.F90:82
integer(kind=inttype), parameter nswallisothermal
Definition: constants.F90:261
real(kind=realtype), parameter sqrtthree
Definition: constants.F90:86
integer(kind=inttype), parameter thirdorder
Definition: constants.F90:142
integer(kind=inttype), parameter secondorder
Definition: constants.F90:142
integer(kind=inttype), parameter kmax
Definition: constants.F90:297
integer(kind=inttype), parameter ransequations
Definition: constants.F90:110
integer(kind=inttype), parameter jmin
Definition: constants.F90:294
real(kind=realtype) rhoinfdim
real(kind=realtype) gammainf
real(kind=realtype) pinfdim
real(kind=realtype) pinf
real(kind=realtype) lref
real(kind=realtype) timeref
real(kind=realtype) timerefd
integer(kind=inttype) degreefouryrot
Definition: inputParam.F90:354
real(kind=realtype) omegafouralpha
Definition: inputParam.F90:404
integer(kind=inttype) degreefourxrot
Definition: inputParam.F90:353
integer(kind=inttype) degreepolxrot
Definition: inputParam.F90:337
real(kind=realtype) omegafouryrot
Definition: inputParam.F90:363
integer(kind=inttype) degreepolyrot
Definition: inputParam.F90:338
real(kind=realtype), dimension(:), allocatable coefpolxrot
Definition: inputParam.F90:345
real(kind=realtype) omegafourzrot
Definition: inputParam.F90:364
real(kind=realtype) omegafourxrot
Definition: inputParam.F90:362
real(kind=realtype), dimension(:), allocatable sincoeffouryrot
Definition: inputParam.F90:385
real(kind=realtype), dimension(:), allocatable coscoeffourxrot
Definition: inputParam.F90:373
real(kind=realtype), dimension(:), allocatable sincoeffourzrot
Definition: inputParam.F90:386
real(kind=realtype), dimension(:), allocatable sincoeffouralpha
Definition: inputParam.F90:415
integer(kind=inttype) degreepolzrot
Definition: inputParam.F90:339
real(kind=realtype), dimension(:), allocatable coefpolalpha
Definition: inputParam.F90:394
real(kind=realtype), dimension(:), allocatable coscoeffouryrot
Definition: inputParam.F90:374
real(kind=realtype), dimension(:), allocatable coscoeffouralpha
Definition: inputParam.F90:409
integer(kind=inttype) degreefourzrot
Definition: inputParam.F90:355
real(kind=realtype), dimension(:), allocatable coefpolzrot
Definition: inputParam.F90:347
real(kind=realtype), dimension(:), allocatable coefpolyrot
Definition: inputParam.F90:346
real(kind=realtype), dimension(3) rotpoint
Definition: inputParam.F90:330
integer(kind=inttype) degreepolalpha
Definition: inputParam.F90:390
integer(kind=inttype) degreefouralpha
Definition: inputParam.F90:399
real(kind=realtype), dimension(:), allocatable coscoeffourzrot
Definition: inputParam.F90:375
real(kind=realtype), dimension(:), allocatable sincoeffourxrot
Definition: inputParam.F90:384
integer(kind=inttype) equations
Definition: inputParam.F90:583
integer(kind=inttype) equationmode
Definition: inputParam.F90:583
real(kind=realtype), dimension(3) pointref
Definition: inputParam.F90:602
integer(kind=inttype) liftindex
Definition: inputParam.F90:592
real(kind=realtype), dimension(3) dragdirection
Definition: inputParam.F90:601
real(kind=realtype), dimension(3) pointrefec
Definition: inputParam.F90:626
real(kind=realtype) lengthref
Definition: inputParam.F90:598
real(kind=realtype) machgrid
Definition: inputParam.F90:593
real(kind=realtype) machcoef
Definition: inputParam.F90:593
real(kind=realtype), dimension(3) liftdirection
Definition: inputParam.F90:600
real(kind=realtype) surfaceref
Definition: inputParam.F90:598
integer(kind=inttype) cpmodel
Definition: inputParam.F90:584
integer(kind=inttype) ntimeintervalsspectral
Definition: inputParam.F90:645
logical useale
Definition: inputParam.F90:754
integer(kind=inttype) timeaccuracy
Definition: inputParam.F90:730
integer(kind=inttype) noldlevels
Definition: iteration.f90:79
real(kind=realtype), dimension(:, :), allocatable coefmeshale
Definition: iteration.f90:109
integer(kind=inttype) currentlevel
Definition: iteration.f90:18
integer(kind=inttype) groundlevel
Definition: iteration.f90:18
real(kind=realtype), dimension(:), allocatable coeftime
Definition: iteration.f90:80
real(kind=realtype), dimension(:), allocatable coeftimeale
Definition: iteration.f90:108
integer(kind=inttype) noldsolavail
Definition: iteration.f90:79
real(kind=realtype) timeunsteadyrestart
Definition: monitor.f90:98
integer, parameter realtype
Definition: precision.F90:112
integer(kind=inttype) nsections
Definition: section.f90:44
type(sectiontype), dimension(:), allocatable sections
Definition: section.f90:46
subroutine siturb(mass, len, time, temp, turbname, mult, trans)
Definition: utils_b.f90:1698
subroutine computerootbendingmoment(cf, cm, bendingmoment)
Definition: utils_b.f90:964
real(kind=realtype) function derivativerigidrotangle(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
Definition: utils_b.f90:402
subroutine sitemperature(temp, mult, trans)
Definition: utils_b.f90:1654
subroutine sidensity(mass, len, mult, trans)
Definition: utils_b.f90:1562
real(kind=realtype) function mydim(x, y)
Definition: utils_b.f90:471
real(kind=realtype) function tsmachdot(degreepolmach, coefpolmach, degreefourmach, omegafourmach, coscoeffourmach, sincoeffourmach, t)
Definition: utils_b.f90:190
character(len=n) function char2str(chararray, n)
Definition: utils_b.f90:9
real(kind=realtype) function tsalphadot(degreepolalpha, coefpolalpha, degreefouralpha, omegafouralpha, coscoeffouralpha, sincoeffouralpha, t)
Definition: utils_b.f90:296
real(kind=realtype) function mynorm2(x)
Definition: utils_b.f90:1482
real(kind=realtype) function tsbetadot(degreepolbeta, coefpolbeta, degreefourbeta, omegafourbeta, coscoeffourbeta, sincoeffourbeta, t)
Definition: utils_b.f90:84
subroutine sipressure(mass, len, time, mult, trans)
Definition: utils_b.f90:1626
subroutine computeleastsquaresregression(y, x, npts, m, b)
Definition: utils_b.f90:1000
real(kind=realtype) function secondderivativerigidrotangle(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
Definition: utils_b.f90:612
subroutine getdirangle(freestreamaxis, liftaxis, liftindex, alpha, beta)
Definition: utils_b.f90:1186
subroutine stabilityderivativedriver()
Definition: utils_b.f90:1314
subroutine rotmatrixrigidbody(tnew, told, rotationmatrix, rotationpoint)
Definition: utils_b.f90:509
logical function getcorrectfork()
Definition: utils_b.f90:480
logical function iswalltype(btype)
Definition: utils_b.f90:1491
subroutine computetsderivatives(force, moment, coef0, dcdalpha, dcdalphadot, dcdq, dcdqdot)
Definition: utils_b.f90:1030
subroutine setcoeftimeintegrator()
Definition: utils_b.f90:1332
real(kind=realtype) function tsalpha(degreepolalpha, coefpolalpha, degreefouralpha, omegafouralpha, coscoeffouralpha, sincoeffouralpha, t)
Definition: utils_b.f90:242
subroutine setbcpointers(nn, spatialpointers)
Definition: utils_b.f90:719
subroutine silen(len, mult, trans)
Definition: utils_b.f90:1589
subroutine terminate(routinename, errormessage)
Definition: utils_b.f90:493
subroutine cross_prod(a, b, c)
Definition: utils_b.f90:1526
subroutine sivelocity(length, time, mult, trans)
Definition: utils_b.f90:1727
subroutine siangle(angle, mult, trans)
Definition: utils_b.f90:1538
subroutine derivativerigidrotangle_b(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t, derivativerigidrotangled)
Definition: utils_b.f90:352
real(kind=realtype) function rigidrotangle(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
Definition: utils_b.f90:666
real(kind=realtype) function tsbeta(degreepolbeta, coefpolbeta, degreefourbeta, omegafourbeta, coscoeffourbeta, sincoeffourbeta, t)
Definition: utils_b.f90:31
subroutine mynorm2_b(x, xd, mynorm2d)
Definition: utils_b.f90:1462
subroutine mydim_b(x, xd, y, yd, mydimd)
Definition: utils_b.f90:458
subroutine cross_prod_b(a, ad, b, bd, c, cd)
Definition: utils_b.f90:1504
real(kind=realtype) function tsmach(degreepolmach, coefpolmach, degreefourmach, omegafourmach, coscoeffourmach, sincoeffourmach, t)
Definition: utils_b.f90:136