ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
utils_fast_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 !
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  function derivativerigidrotangle(degreepolrot, coefpolrot, &
347 & degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
348 !
349 ! derivativerigidrotangle computes the time derivative of the
350 ! rigid body rotation angle at the given time for the given
351 ! arguments. the angle is described by a combination of a
352 ! polynomial and fourier series.
353 !
354  use constants
355  use inputphysics, only : equationmode
356  use flowvarrefstate, only : timeref
357  implicit none
358 !
359 ! function type
360 !
361  real(kind=realtype) :: derivativerigidrotangle
362 !
363 ! function arguments.
364 !
365  integer(kind=inttype), intent(in) :: degreepolrot
366  integer(kind=inttype), intent(in) :: degreefourrot
367  real(kind=realtype), intent(in) :: omegafourrot, t
368  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
369  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
370  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
371 !
372 ! local variables.
373 !
374  integer(kind=inttype) :: nn
375  real(kind=realtype) :: dphi, val
376  intrinsic sin
377  intrinsic cos
378 ! return immediately if this is a steady computation.
379  if (equationmode .eq. steady) then
381  return
382  else
383 ! compute the polynomial contribution.
384  dphi = zero
385  do nn=1,degreepolrot
386  dphi = dphi + nn*coefpolrot(nn)*t**(nn-1)
387  end do
388 ! compute the fourier contribution.
389  do nn=1,degreefourrot
390  val = nn*omegafourrot
391  dphi = dphi - val*coscoeffourrot(nn)*sin(val*t)
392  dphi = dphi + val*sincoeffourrot(nn)*cos(val*t)
393  end do
394 ! set derivativerigidrotangle to dphi. multiply by timeref
395 ! to obtain the correct non-dimensional value.
397  end if
398  end function derivativerigidrotangle
399 
400 ! differentiation of mydim in reverse (adjoint) mode (with options noisize i4 dr8 r8):
401 ! gradient of useful results: y mydim
402 ! with respect to varying inputs: x y
403  subroutine mydim_fast_b(x, xd, y, yd, mydimd)
404  use constants
405  implicit none
406  real(kind=realtype) :: x, y
407  real(kind=realtype) :: xd, yd
408  real(kind=realtype) :: mydim
409  real(kind=realtype) :: mydimd
410  mydim = x - y
411  if (mydim .lt. 0.0) mydimd = 0.0_8
412  xd = mydimd
413  yd = yd - mydimd
414  end subroutine mydim_fast_b
415 
416  function mydim(x, y)
417  use constants
418  implicit none
419  real(kind=realtype) :: x, y
420  real(kind=realtype) :: mydim
421  mydim = x - y
422  if (mydim .lt. 0.0) mydim = 0.0
423  end function mydim
424 
425  function getcorrectfork()
426  use constants
427  use flowvarrefstate, only : kpresent
428  use iteration, only : currentlevel, groundlevel
429  implicit none
430  logical :: getcorrectfork
431  if (kpresent .and. currentlevel .le. groundlevel) then
432  getcorrectfork = .true.
433  else
434  getcorrectfork = .false.
435  end if
436  end function getcorrectfork
437 
438  subroutine terminate(routinename, errormessage)
439 !
440 ! terminate writes an error message to standard output and
441 ! terminates the execution of the program.
442 !
443  use constants
445  implicit none
446 !
447 ! subroutine arguments
448 !
449  character(len=*), intent(in) :: routinename
450  character(len=*), intent(in) :: errormessage
451  end subroutine terminate
452 
453  subroutine rotmatrixrigidbody(tnew, told, rotationmatrix, &
454 & rotationpoint)
455 !
456 ! rotmatrixrigidbody determines the rotation matrix and the
457 ! rotation point to determine the coordinates of the new time
458 ! level starting from the coordinates of the old time level.
459 !
460  use constants
461  use inputmotion
462  use flowvarrefstate, only : lref
463  implicit none
464 !
465 ! subroutine arguments.
466 !
467  real(kind=realtype), intent(in) :: tnew, told
468  real(kind=realtype), dimension(3), intent(out) :: rotationpoint
469  real(kind=realtype), dimension(3, 3), intent(out) :: rotationmatrix
470 !
471 ! local variables.
472 !
473  integer(kind=inttype) :: i, j
474  real(kind=realtype) :: phi
475  real(kind=realtype) :: cosx, cosy, cosz, sinx, siny, sinz
476  real(kind=realtype), dimension(3, 3) :: mnew, mold
477  intrinsic sin
478  intrinsic cos
479 ! determine the rotation angle around the x-axis for the new
480 ! time level and the corresponding values of the sine and cosine.
483  sinx = sin(phi)
484  cosx = cos(phi)
485 ! idem for the y-axis.
488  siny = sin(phi)
489  cosy = cos(phi)
490 ! idem for the z-axis.
493  sinz = sin(phi)
494  cosz = cos(phi)
495 ! construct the transformation matrix at the new time level.
496 ! it is assumed that the sequence of rotation is first around the
497 ! x-axis then around the y-axis and finally around the z-axis.
498  mnew(1, 1) = cosy*cosz
499  mnew(2, 1) = cosy*sinz
500  mnew(3, 1) = -siny
501  mnew(1, 2) = sinx*siny*cosz - cosx*sinz
502  mnew(2, 2) = sinx*siny*sinz + cosx*cosz
503  mnew(3, 2) = sinx*cosy
504  mnew(1, 3) = cosx*siny*cosz + sinx*sinz
505  mnew(2, 3) = cosx*siny*sinz - sinx*cosz
506  mnew(3, 3) = cosx*cosy
507 ! determine the rotation angle around the x-axis for the old
508 ! time level and the corresponding values of the sine and cosine.
511  sinx = sin(phi)
512  cosx = cos(phi)
513 ! idem for the y-axis.
516  siny = sin(phi)
517  cosy = cos(phi)
518 ! idem for the z-axis.
521  sinz = sin(phi)
522  cosz = cos(phi)
523 ! construct the transformation matrix at the old time level.
524  mold(1, 1) = cosy*cosz
525  mold(2, 1) = cosy*sinz
526  mold(3, 1) = -siny
527  mold(1, 2) = sinx*siny*cosz - cosx*sinz
528  mold(2, 2) = sinx*siny*sinz + cosx*cosz
529  mold(3, 2) = sinx*cosy
530  mold(1, 3) = cosx*siny*cosz + sinx*sinz
531  mold(2, 3) = cosx*siny*sinz - sinx*cosz
532  mold(3, 3) = cosx*cosy
533 ! construct the transformation matrix between the new and the
534 ! old time level. this is mnew*inverse(mold). however the
535 ! inverse of mold is the transpose.
536  do j=1,3
537  do i=1,3
538  rotationmatrix(i, j) = mnew(i, 1)*mold(j, 1) + mnew(i, 2)*mold(j&
539 & , 2) + mnew(i, 3)*mold(j, 3)
540  end do
541  end do
542 ! determine the rotation point at the old time level; it is
543 ! possible that this value changes due to translation of the grid.
544 ! ainf = sqrt(gammainf*pinf/rhoinf)
545 ! rotationpoint(1) = lref*rotpoint(1) &
546 ! + machgrid(1)*ainf*told/timeref
547 ! rotationpoint(2) = lref*rotpoint(2) &
548 ! + machgrid(2)*ainf*told/timeref
549 ! rotationpoint(3) = lref*rotpoint(3) &
550 ! + machgrid(3)*ainf*told/timeref
551  rotationpoint(1) = lref*rotpoint(1)
552  rotationpoint(2) = lref*rotpoint(2)
553  rotationpoint(3) = lref*rotpoint(3)
554  end subroutine rotmatrixrigidbody
555 
556  function secondderivativerigidrotangle(degreepolrot, coefpolrot, &
557 & degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
558 !
559 ! 2ndderivativerigidrotangle computes the 2nd time derivative of
560 ! the rigid body rotation angle at the given time for the given
561 ! arguments. the angle is described by a combination of a
562 ! polynomial and fourier series.
563 !
564  use constants
565  use flowvarrefstate, only : timeref
566  use inputphysics, only : equationmode
567  implicit none
568 !
569 ! function type
570 !
571  real(kind=realtype) :: secondderivativerigidrotangle
572 !
573 ! function arguments.
574 !
575  integer(kind=inttype), intent(in) :: degreepolrot
576  integer(kind=inttype), intent(in) :: degreefourrot
577  real(kind=realtype), intent(in) :: omegafourrot, t
578  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
579  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
580  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
581 !
582 ! local variables.
583 !
584  integer(kind=inttype) :: nn
585  real(kind=realtype) :: dphi, val
586  intrinsic sin
587  intrinsic cos
588 ! return immediately if this is a steady computation.
589  if (equationmode .eq. steady) then
591  return
592  else
593 ! compute the polynomial contribution.
594  dphi = zero
595  do nn=2,degreepolrot
596  dphi = dphi + (nn-1)*nn*coefpolrot(nn)*t**(nn-2)
597  end do
598 ! compute the fourier contribution.
599  do nn=1,degreefourrot
600  val = nn*omegafourrot
601  dphi = dphi - val**2*sincoeffourrot(nn)*sin(val*t)
602  dphi = dphi - val**2*coscoeffourrot(nn)*cos(val*t)
603  end do
604 ! set derivativerigidrotangle to dphi. multiply by timeref
605 ! to obtain the correct non-dimensional value.
607  end if
608  end function secondderivativerigidrotangle
609 
610  function rigidrotangle(degreepolrot, coefpolrot, degreefourrot, &
611 & omegafourrot, coscoeffourrot, sincoeffourrot, t)
612 !
613 ! rigidrotangle computes the rigid body rotation angle at the
614 ! given time for the given arguments. the angle is described by
615 ! a combination of a polynomial and fourier series.
616 !
617  use constants
618  use inputphysics, only : equationmode
619  implicit none
620 !
621 ! function type
622 !
623  real(kind=realtype) :: rigidrotangle
624 !
625 ! function arguments.
626 !
627  integer(kind=inttype), intent(in) :: degreepolrot
628  integer(kind=inttype), intent(in) :: degreefourrot
629  real(kind=realtype), intent(in) :: omegafourrot, t
630  real(kind=realtype), dimension(0:*), intent(in) :: coefpolrot
631  real(kind=realtype), dimension(0:*), intent(in) :: coscoeffourrot
632  real(kind=realtype), dimension(*), intent(in) :: sincoeffourrot
633 !
634 ! local variables.
635 !
636  integer(kind=inttype) :: nn
637  real(kind=realtype) :: phi, val
638  intrinsic cos
639  intrinsic sin
640 ! return immediately if this is a steady computation.
641  if (equationmode .eq. steady) then
643  return
644  else
645 ! compute the polynomial contribution. if no polynomial was
646 ! specified, the value of index 0 is set to zero automatically.
647  phi = coefpolrot(0)
648  do nn=1,degreepolrot
649  phi = phi + coefpolrot(nn)*t**nn
650  end do
651 ! compute the fourier contribution. again the cosine coefficient
652 ! of index 0 is defaulted to zero if not specified.
653  phi = phi + coscoeffourrot(0)
654  do nn=1,degreefourrot
655  val = nn*omegafourrot*t
656  phi = phi + coscoeffourrot(nn)*cos(val) + sincoeffourrot(nn)*sin&
657 & (val)
658  end do
659 ! set rigidrotangle to phi.
660  rigidrotangle = phi
661  end if
662  end function rigidrotangle
663 
664  subroutine setbcpointers(nn, spatialpointers)
665 !
666 ! setbcpointers sets the pointers needed for the boundary
667 ! condition treatment on a general face, such that the boundary
668 ! routines are only implemented once instead of 6 times.
669 !
670  use constants
671  use blockpointers, only : w, p, rlv, rev, gamma, x, d2wall, &
672 & si, sj, sk, s, globalcell, bcdata, nx, il, ie, ib, ny, jl, je, jb, &
675  use bcpointers, only : ww0, ww1, ww2, ww3, pp0, pp1, pp2, pp3, rlv0,&
677 & gamma3, gcp, xx, ss, ssi, ssj, ssk, dd2wall, sface, istart, iend, &
678 & jstart, jend, isize, jsize
679  use inputphysics, only : cpmodel, equations
680  implicit none
681 ! subroutine arguments.
682  integer(kind=inttype), intent(in) :: nn
683  logical, intent(in) :: spatialpointers
684 ! determine the sizes of each face and point to just the range we
685 ! need on each face.
686  istart = bcdata(nn)%icbeg
687  iend = bcdata(nn)%icend
688  jstart = bcdata(nn)%jcbeg
689  jend = bcdata(nn)%jcend
690 ! set the size of the subface
691  isize = iend - istart + 1
692  jsize = jend - jstart + 1
693 ! determine the face id on which the subface is located and set
694 ! the pointers accordinly.
695  select case (bcfaceid(nn))
696  case (imin)
697 !---------------------------------------------------------------------------
698  ww3 => w(3, 1:, 1:, :)
699  ww2 => w(2, 1:, 1:, :)
700  ww1 => w(1, 1:, 1:, :)
701  ww0 => w(0, 1:, 1:, :)
702  pp3 => p(3, 1:, 1:)
703  pp2 => p(2, 1:, 1:)
704  pp1 => p(1, 1:, 1:)
705  pp0 => p(0, 1:, 1:)
706  rlv3 => rlv(3, 1:, 1:)
707  rlv2 => rlv(2, 1:, 1:)
708  rlv1 => rlv(1, 1:, 1:)
709  rlv0 => rlv(0, 1:, 1:)
710  rev3 => rev(3, 1:, 1:)
711  rev2 => rev(2, 1:, 1:)
712  rev1 => rev(1, 1:, 1:)
713  rev0 => rev(0, 1:, 1:)
714  gamma3 => gamma(3, 1:, 1:)
715  gamma2 => gamma(2, 1:, 1:)
716  gamma1 => gamma(1, 1:, 1:)
717  gamma0 => gamma(0, 1:, 1:)
718  gcp => globalcell(2, 1:, 1:)
719 !---------------------------------------------------------------------------
720  case (imax)
721  ww3 => w(nx, 1:, 1:, :)
722  ww2 => w(il, 1:, 1:, :)
723  ww1 => w(ie, 1:, 1:, :)
724  ww0 => w(ib, 1:, 1:, :)
725  pp3 => p(nx, 1:, 1:)
726  pp2 => p(il, 1:, 1:)
727  pp1 => p(ie, 1:, 1:)
728  pp0 => p(ib, 1:, 1:)
729  rlv3 => rlv(nx, 1:, 1:)
730  rlv2 => rlv(il, 1:, 1:)
731  rlv1 => rlv(ie, 1:, 1:)
732  rlv0 => rlv(ib, 1:, 1:)
733  rev3 => rev(nx, 1:, 1:)
734  rev2 => rev(il, 1:, 1:)
735  rev1 => rev(ie, 1:, 1:)
736  rev0 => rev(ib, 1:, 1:)
737  gamma3 => gamma(nx, 1:, 1:)
738  gamma2 => gamma(il, 1:, 1:)
739  gamma1 => gamma(ie, 1:, 1:)
740  gamma0 => gamma(ib, 1:, 1:)
741  gcp => globalcell(il, 1:, 1:)
742 !---------------------------------------------------------------------------
743  case (jmin)
744  ww3 => w(1:, 3, 1:, :)
745  ww2 => w(1:, 2, 1:, :)
746  ww1 => w(1:, 1, 1:, :)
747  ww0 => w(1:, 0, 1:, :)
748  pp3 => p(1:, 3, 1:)
749  pp2 => p(1:, 2, 1:)
750  pp1 => p(1:, 1, 1:)
751  pp0 => p(1:, 0, 1:)
752  rlv3 => rlv(1:, 3, 1:)
753  rlv2 => rlv(1:, 2, 1:)
754  rlv1 => rlv(1:, 1, 1:)
755  rlv0 => rlv(1:, 0, 1:)
756  rev3 => rev(1:, 3, 1:)
757  rev2 => rev(1:, 2, 1:)
758  rev1 => rev(1:, 1, 1:)
759  rev0 => rev(1:, 0, 1:)
760  gamma3 => gamma(1:, 3, 1:)
761  gamma2 => gamma(1:, 2, 1:)
762  gamma1 => gamma(1:, 1, 1:)
763  gamma0 => gamma(1:, 0, 1:)
764  gcp => globalcell(1:, 2, 1:)
765 !---------------------------------------------------------------------------
766  case (jmax)
767  ww3 => w(1:, ny, 1:, :)
768  ww2 => w(1:, jl, 1:, :)
769  ww1 => w(1:, je, 1:, :)
770  ww0 => w(1:, jb, 1:, :)
771  pp3 => p(1:, ny, 1:)
772  pp2 => p(1:, jl, 1:)
773  pp1 => p(1:, je, 1:)
774  pp0 => p(1:, jb, 1:)
775  rlv3 => rlv(1:, ny, 1:)
776  rlv2 => rlv(1:, jl, 1:)
777  rlv1 => rlv(1:, je, 1:)
778  rlv0 => rlv(1:, jb, 1:)
779  rev3 => rev(1:, ny, 1:)
780  rev2 => rev(1:, jl, 1:)
781  rev1 => rev(1:, je, 1:)
782  rev0 => rev(1:, jb, 1:)
783  gamma3 => gamma(1:, ny, 1:)
784  gamma2 => gamma(1:, jl, 1:)
785  gamma1 => gamma(1:, je, 1:)
786  gamma0 => gamma(1:, jb, 1:)
787  gcp => globalcell(1:, jl, 1:)
788 !---------------------------------------------------------------------------
789  case (kmin)
790  ww3 => w(1:, 1:, 3, :)
791  ww2 => w(1:, 1:, 2, :)
792  ww1 => w(1:, 1:, 1, :)
793  ww0 => w(1:, 1:, 0, :)
794  pp3 => p(1:, 1:, 3)
795  pp2 => p(1:, 1:, 2)
796  pp1 => p(1:, 1:, 1)
797  pp0 => p(1:, 1:, 0)
798  rlv3 => rlv(1:, 1:, 3)
799  rlv2 => rlv(1:, 1:, 2)
800  rlv1 => rlv(1:, 1:, 1)
801  rlv0 => rlv(1:, 1:, 0)
802  rev3 => rev(1:, 1:, 3)
803  rev2 => rev(1:, 1:, 2)
804  rev1 => rev(1:, 1:, 1)
805  rev0 => rev(1:, 1:, 0)
806  gamma3 => gamma(1:, 1:, 3)
807  gamma2 => gamma(1:, 1:, 2)
808  gamma1 => gamma(1:, 1:, 1)
809  gamma0 => gamma(1:, 1:, 0)
810  gcp => globalcell(1:, 1:, 2)
811 !---------------------------------------------------------------------------
812  case (kmax)
813  ww3 => w(1:, 1:, nz, :)
814  ww2 => w(1:, 1:, kl, :)
815  ww1 => w(1:, 1:, ke, :)
816  ww0 => w(1:, 1:, kb, :)
817  pp3 => p(1:, 1:, nz)
818  pp2 => p(1:, 1:, kl)
819  pp1 => p(1:, 1:, ke)
820  pp0 => p(1:, 1:, kb)
821  rlv3 => rlv(1:, 1:, nz)
822  rlv2 => rlv(1:, 1:, kl)
823  rlv1 => rlv(1:, 1:, ke)
824  rlv0 => rlv(1:, 1:, kb)
825  rev3 => rev(1:, 1:, nz)
826  rev2 => rev(1:, 1:, kl)
827  rev1 => rev(1:, 1:, ke)
828  rev0 => rev(1:, 1:, kb)
829  gamma3 => gamma(1:, 1:, nz)
830  gamma2 => gamma(1:, 1:, kl)
831  gamma1 => gamma(1:, 1:, ke)
832  gamma0 => gamma(1:, 1:, kb)
833  gcp => globalcell(1:, 1:, kl)
834  end select
835  if (spatialpointers) then
836  select case (bcfaceid(nn))
837  case (imin)
838  xx => x(1, :, :, :)
839  ssi => si(1, :, :, :)
840  ssj => sj(2, :, :, :)
841  ssk => sk(2, :, :, :)
842  ss => s(2, :, :, :)
843  case (imax)
844  xx => x(il, :, :, :)
845  ssi => si(il, :, :, :)
846  ssj => sj(il, :, :, :)
847  ssk => sk(il, :, :, :)
848  ss => s(il, :, :, :)
849  case (jmin)
850  xx => x(:, 1, :, :)
851  ssi => sj(:, 1, :, :)
852  ssj => si(:, 2, :, :)
853  ssk => sk(:, 2, :, :)
854  ss => s(:, 2, :, :)
855  case (jmax)
856  xx => x(:, jl, :, :)
857  ssi => sj(:, jl, :, :)
858  ssj => si(:, jl, :, :)
859  ssk => sk(:, jl, :, :)
860  ss => s(:, jl, :, :)
861  case (kmin)
862  xx => x(:, :, 1, :)
863  ssi => sk(:, :, 1, :)
864  ssj => si(:, :, 2, :)
865  ssk => sj(:, :, 2, :)
866  ss => s(:, :, 2, :)
867  case (kmax)
868  xx => x(:, :, kl, :)
869  ssi => sk(:, :, kl, :)
870  ssj => si(:, :, kl, :)
871  ssk => sj(:, :, kl, :)
872  ss => s(:, :, kl, :)
873  end select
874  if (addgridvelocities) then
875  select case (bcfaceid(nn))
876  case (imin)
877  sface => sfacei(1, :, :)
878  case (imax)
879  sface => sfacei(il, :, :)
880  case (jmin)
881  sface => sfacej(:, 1, :)
882  case (jmax)
883  sface => sfacej(:, jl, :)
884  case (kmin)
885  sface => sfacek(:, :, 1)
886  case (kmax)
887  sface => sfacek(:, :, kl)
888  end select
889  end if
890  if (equations .eq. ransequations) then
891  select case (bcfaceid(nn))
892  case (imin)
893  dd2wall => d2wall(2, :, :)
894  case (imax)
895  dd2wall => d2wall(il, :, :)
896  case (jmin)
897  dd2wall => d2wall(:, 2, :)
898  case (jmax)
899  dd2wall => d2wall(:, jl, :)
900  case (kmin)
901  dd2wall => d2wall(:, :, 2)
902  case (kmax)
903  dd2wall => d2wall(:, :, kl)
904  end select
905  end if
906  end if
907  end subroutine setbcpointers
908 
909  subroutine computerootbendingmoment(cf, cm, bendingmoment)
910 ! *
911 ! compute a normalized bending moment coefficient from *
912 ! the force and moment coefficient. at the moment this *
913 ! routine only works for a half body. additional logic *
914 ! would be needed for a full body. *
915 ! *
916  use constants
918  implicit none
919 !input/output variables
920  real(kind=realtype), dimension(3), intent(in) :: cf, cm
921  real(kind=realtype), intent(out) :: bendingmoment
922 !subroutine variables
923  real(kind=realtype) :: elasticmomentx, elasticmomenty, &
924 & elasticmomentz
925  intrinsic sqrt
926  bendingmoment = zero
927  if (liftindex .eq. 2) then
928 !z out wing sum momentx,momentz
929  elasticmomentx = cm(1) + cf(2)*(pointrefec(3)-pointref(3))/&
930 & lengthref - cf(3)*(pointrefec(2)-pointref(2))/lengthref
931  elasticmomentz = cm(3) - cf(2)*(pointrefec(1)-pointref(1))/&
932 & lengthref + cf(1)*(pointrefec(2)-pointref(2))/lengthref
933  bendingmoment = sqrt(elasticmomentx**2 + elasticmomentz**2)
934  else if (liftindex .eq. 3) then
935 !y out wing sum momentx,momenty
936  elasticmomentx = cm(1) + cf(3)*(pointrefec(2)-pointref(2))/&
937 & lengthref + cf(3)*(pointrefec(3)-pointref(3))/lengthref
938  elasticmomenty = cm(2) + cf(3)*(pointrefec(1)-pointref(1))/&
939 & lengthref + cf(1)*(pointrefec(3)-pointref(3))/lengthref
940  bendingmoment = sqrt(elasticmomentx**2 + elasticmomenty**2)
941  end if
942  end subroutine computerootbendingmoment
943 
944  subroutine computeleastsquaresregression(y, x, npts, m, b)
945 !
946 ! computes the slope of best fit for a set of x,y data of length
947 ! npts
948 !
949  use constants
950  implicit none
951 !subroutine arguments
952  integer(kind=inttype) :: npts
953  real(kind=realtype), dimension(npts) :: x, y
954  real(kind=realtype) :: m, b
955 !local variables
956  real(kind=realtype) :: sumx, sumy, sumx2, sumxy
957  integer(kind=inttype) :: i
958 !begin execution
959  sumx = 0.0
960  sumy = 0.0
961  sumx2 = 0.0
962  sumxy = 0.0
963  do i=1,npts
964  sumx = sumx + x(i)
965  sumy = sumy + y(i)
966  sumx2 = sumx2 + x(i)*x(i)
967  sumxy = sumxy + x(i)*y(i)
968  end do
969  m = (npts*sumxy-sumy*sumx)/(npts*sumx2-sumx**2)
970  b = (sumy*sumx2-sumx*sumxy)/(npts*sumx2-sumx**2)
971  end subroutine computeleastsquaresregression
972 
973  subroutine computetsderivatives(force, moment, coef0, dcdalpha, &
974 & dcdalphadot, dcdq, dcdqdot)
975 !
976 ! computes the stability derivatives based on the time spectral
977 ! solution of a given mesh. takes in the force coefficients at
978 ! all time instantces and computes the agregate parameters
979 !
980  use constants
981  use communication
982  use inputphysics
984  use inputtsstabderiv
985  use flowvarrefstate
986  use monitor
987  use section
988  use inputmotion
989  implicit none
990 !
991 ! subroutine arguments.
992 !
993  real(kind=realtype), dimension(3, ntimeintervalsspectral) :: force, &
994 & moment
995  real(kind=realtype), dimension(8) :: dcdq, dcdqdot
996  real(kind=realtype), dimension(8) :: dcdalpha, dcdalphadot
997  real(kind=realtype), dimension(8) :: coef0
998 ! working variables
999  real(kind=realtype), dimension(ntimeintervalsspectral, 8) :: &
1000 & basecoef
1001  real(kind=realtype), dimension(8) :: coef0dot
1002  real(kind=realtype), dimension(ntimeintervalsspectral, 8) :: &
1003 & resbasecoef
1004  real(kind=realtype), dimension(ntimeintervalsspectral) :: &
1005 & intervalalpha, intervalalphadot
1006  real(kind=realtype), dimension(ntimeintervalsspectral) :: &
1007 & intervalmach, intervalmachdot
1008  real(kind=realtype), dimension(nsections) :: t
1009  integer(kind=inttype) :: i, sps, nn
1010 !speed of sound: for normalization of q derivatives
1011  real(kind=realtype) :: a
1012  real(kind=realtype) :: fact, factmoment
1013 ! functions
1014  real(kind=realtype), dimension(ntimeintervalsspectral) :: dphix, &
1015 & dphiy, dphiz
1016  real(kind=realtype), dimension(ntimeintervalsspectral) :: dphixdot, &
1017 & dphiydot, dphizdot
1018  real(kind=realtype) :: derivativerigidrotangle, &
1020  intrinsic sqrt
1021  fact = two/(gammainf*pinf*machcoef**2*surfaceref*lref**2)
1022  factmoment = fact/(lengthref*lref)
1023  if (tsqmode) then
1024  print*, &
1025 & 'ts q mode code needs to be updated in computetsderivatives!'
1026  stop
1027 ! !q is pitch
1028 ! do sps =1,ntimeintervalsspectral
1029 ! !compute the time of this intervavc
1030 ! t = timeunsteadyrestart
1031 ! if(equationmode == timespectral) then
1032 ! do nn=1,nsections
1033 ! t(nn) = t(nn) + (sps-1)*sections(nn)%timeperiod &
1034 ! / (ntimeintervalsspectral*1.0)
1035 ! enddo
1036 ! endif
1037 ! ! compute the time derivative of the rotation angles around the
1038 ! ! z-axis. i.e. compute q
1039 ! dphiz(sps) = derivativerigidrotangle(degreepolzrot, &
1040 ! coefpolzrot, &
1041 ! degreefourzrot, &
1042 ! omegafourzrot, &
1043 ! coscoeffourzrot, &
1044 ! sincoeffourzrot, t)
1045 ! ! add in q_dot computation
1046 ! dphizdot(sps) = secondderivativerigidrotangle(degreepolzrot, &
1047 ! coefpolzrot, &
1048 ! degreefourzrot, &
1049 ! omegafourzrot, &
1050 ! coscoeffourzrot, &
1051 ! sincoeffourzrot, t)
1052 ! end do
1053 ! !now compute dcl/dq
1054 ! do i =1,8
1055 ! call computeleastsquaresregression(basecoef(:,i),dphiz,ntimeintervalsspectral,dcdq(i),coef0(i))
1056 ! end do
1057 ! ! now subtract off estimated cl,cmz and use remainder to compute
1058 ! ! clqdot and cmzqdot.
1059 ! do i = 1,8
1060 ! do sps = 1,ntimeintervalsspectral
1061 ! resbasecoef(sps,i) = basecoef(sps,i)-(dcdq(i)*dphiz(sps)+coef0(i))
1062 ! enddo
1063 ! enddo
1064 ! !now normalize the results...
1065 ! a = sqrt(gammainf*pinfdim/rhoinfdim)
1066 ! dcdq = dcdq*timeref*2*(machgrid*a)/lengthref
1067 ! !now compute dcl/dpdot
1068 ! do i = 1,8
1069 ! call computeleastsquaresregression(resbasecoef(:,i),dphizdot,ntimeintervalsspectral,dcdqdot(i),coef0dot(i))
1070 ! enddo
1071  else if (tsalphamode) then
1072  do sps=1,ntimeintervalsspectral
1073 !compute the time of this interval
1075  if (equationmode .eq. timespectral) then
1076  do nn=1,nsections
1077  t(nn) = t(nn) + (sps-1)*sections(nn)%timeperiod/(&
1079  end do
1080  end if
1081  intervalalpha(sps) = tsalpha(degreepolalpha, coefpolalpha, &
1083 & sincoeffouralpha, t(1))
1084  intervalalphadot(sps) = tsalphadot(degreepolalpha, coefpolalpha&
1086 & sincoeffouralpha, t(1))
1087 ! this call is wrong!!!!
1088 !call getdirangle(veldirfreestream,liftdirection,liftindex,alpha+intervalalpha(sps), beta)
1089  basecoef(sps, 1) = fact*(force(1, sps)*liftdirection(1)+force(2&
1090 & , sps)*liftdirection(2)+force(3, sps)*liftdirection(3))
1091  basecoef(sps, 2) = fact*(force(1, sps)*dragdirection(1)+force(2&
1092 & , sps)*dragdirection(2)+force(3, sps)*dragdirection(3))
1093  basecoef(sps, 3) = force(1, sps)*fact
1094  basecoef(sps, 4) = force(2, sps)*fact
1095  basecoef(sps, 5) = force(3, sps)*fact
1096  basecoef(sps, 6) = moment(1, sps)*factmoment
1097  basecoef(sps, 7) = moment(2, sps)*factmoment
1098  basecoef(sps, 8) = moment(3, sps)*factmoment
1099  end do
1100 !now compute dcl/dalpha
1101  do i=1,8
1102  call computeleastsquaresregression(basecoef(:, i), intervalalpha&
1103 & , ntimeintervalsspectral, dcdalpha(&
1104 & i), coef0(i))
1105  end do
1106 ! now subtract off estimated cl,cmz and use remainder to compute
1107 ! clalphadot and cmzalphadot.
1108  do i=1,8
1109  do sps=1,ntimeintervalsspectral
1110  resbasecoef(sps, i) = basecoef(sps, i) - (dcdalpha(i)*&
1111 & intervalalpha(sps)+coef0(i))
1112  end do
1113  end do
1114 !now compute dci/dalphadot
1115  do i=1,8
1116  call computeleastsquaresregression(resbasecoef(:, i), &
1117 & intervalalphadot, &
1118 & ntimeintervalsspectral, dcdalphadot&
1119 & (i), coef0dot(i))
1120  end do
1121  a = sqrt(gammainf*pinfdim/rhoinfdim)
1122  dcdalphadot = dcdalphadot*2*(machgrid*a)/lengthref
1123  else
1124  call terminate('computetsderivatives', &
1125 & 'not a valid stability motion')
1126  end if
1127  end subroutine computetsderivatives
1128 
1129  subroutine getdirangle(freestreamaxis, liftaxis, liftindex, alpha, &
1130 & beta)
1131 !
1132 ! convert the wind axes to angle of attack and side slip angle.
1133 ! the direction angles alpha and beta are computed given the
1134 ! components of the wind direction vector (freestreamaxis), the
1135 ! lift direction vector (liftaxis) and assuming that the
1136 ! body direction (xb,yb,zb) is in the default ijk coordinate
1137 ! system. the rotations are determined by first determining
1138 ! whether the lift is primarily in the j or k direction and then
1139 ! determining the angles accordingly.
1140 ! direction vector:
1141 ! 1) rotation about the zb or yb -axis: alpha clockwise (cw)
1142 ! (xb,yb,zb) -> (x1,y1,z1)
1143 ! 2) rotation about the yl or z1 -axis: beta counter-clockwise
1144 ! (ccw) (x1,y1,z1) -> (xw,yw,zw)
1145 ! input arguments:
1146 ! freestreamaxis = wind vector in body axes
1147 ! liftaxis = lift direction vector in body axis
1148 ! output arguments:
1149 ! alpha = angle of attack in radians
1150 ! beta = side slip angle in radians
1151 !
1152  use constants
1153  implicit none
1154 !
1155 ! subroutine arguments.
1156 !
1157 ! real(kind=realtype), intent(in) :: xw, yw, zw
1158  real(kind=realtype), dimension(3), intent(in) :: freestreamaxis
1159  real(kind=realtype), dimension(3), intent(in) :: liftaxis
1160  real(kind=realtype), intent(out) :: alpha, beta
1161  integer(kind=inttype), intent(out) :: liftindex
1162 !
1163 ! local variables.
1164 !
1165  real(kind=realtype) :: rnorm
1166  integer(kind=inttype) :: flowindex, i
1167  real(kind=realtype), dimension(3) :: freestreamaxisnorm
1168  integer(kind=inttype) :: temp
1169  intrinsic abs
1170  intrinsic sqrt
1171  intrinsic asin
1172  intrinsic atan2
1173  real(kind=realtype) :: abs0
1174  real(kind=realtype) :: abs1
1175  real(kind=realtype) :: abs2
1176  real(kind=realtype) :: abs3
1177  real(kind=realtype) :: abs4
1178  real(kind=realtype) :: abs5
1179  real(kind=realtype) :: abs6
1180  real(kind=realtype) :: abs7
1181 ! assume domoniate flow is x
1182  flowindex = 1
1183  if (liftaxis(1) .ge. 0.) then
1184  abs0 = liftaxis(1)
1185  else
1186  abs0 = -liftaxis(1)
1187  end if
1188  if (liftaxis(2) .ge. 0.) then
1189  abs2 = liftaxis(2)
1190  else
1191  abs2 = -liftaxis(2)
1192  end if
1193  if (liftaxis(1) .ge. 0.) then
1194  abs4 = liftaxis(1)
1195  else
1196  abs4 = -liftaxis(1)
1197  end if
1198  if (liftaxis(3) .ge. 0.) then
1199  abs6 = liftaxis(3)
1200  else
1201  abs6 = -liftaxis(3)
1202  end if
1203 ! determine the dominant lift direction
1204  if (abs0 .gt. abs2 .and. abs4 .gt. abs6) then
1205  temp = 1
1206  else
1207  if (liftaxis(2) .ge. 0.) then
1208  abs1 = liftaxis(2)
1209  else
1210  abs1 = -liftaxis(2)
1211  end if
1212  if (liftaxis(1) .ge. 0.) then
1213  abs3 = liftaxis(1)
1214  else
1215  abs3 = -liftaxis(1)
1216  end if
1217  if (liftaxis(2) .ge. 0.) then
1218  abs5 = liftaxis(2)
1219  else
1220  abs5 = -liftaxis(2)
1221  end if
1222  if (liftaxis(3) .ge. 0.) then
1223  abs7 = liftaxis(3)
1224  else
1225  abs7 = -liftaxis(3)
1226  end if
1227  if (abs1 .gt. abs3 .and. abs5 .gt. abs7) then
1228  temp = 2
1229  else
1230  temp = 3
1231  end if
1232  end if
1233  liftindex = temp
1234 ! normalize the freestreamdirection vector.
1235  rnorm = sqrt(freestreamaxis(1)**2 + freestreamaxis(2)**2 + &
1236 & freestreamaxis(3)**2)
1237  do i=1,3
1238  freestreamaxisnorm(i) = freestreamaxis(i)/rnorm
1239  end do
1240  if (liftindex .eq. 2) then
1241 ! different coordinate system for aerosurf
1242 ! wing is in z- direction
1243 ! compute angle of attack alpha.
1244  alpha = asin(freestreamaxisnorm(2))
1245 ! compute side-slip angle beta.
1246  beta = -atan2(freestreamaxisnorm(3), freestreamaxisnorm(1))
1247  else if (liftindex .eq. 3) then
1248 ! wing is in y- direction
1249 ! compute angle of attack alpha.
1250  alpha = asin(freestreamaxisnorm(3))
1251 ! compute side-slip angle beta.
1252  beta = atan2(freestreamaxisnorm(2), freestreamaxisnorm(1))
1253  else
1254  call terminate('getdirangle', 'invalid lift direction')
1255  end if
1256  end subroutine getdirangle
1257 
1259 !
1260 ! runs the time spectral stability derivative routines from the
1261 ! main program file
1262 !
1263  use precision
1264  implicit none
1265 !
1266 ! local variables.
1267 !
1268  real(kind=realtype), dimension(8) :: dcdalpha, dcdalphadot, dcdbeta&
1269 & , dcdbetadot, dcdmach, dcdmachdot
1270  real(kind=realtype), dimension(8) :: dcdp, dcdpdot, dcdq, dcdqdot, &
1271 & dcdr, dcdrdot
1272  real(kind=realtype), dimension(8) :: coef0, coef0dot
1273 !call computetsderivatives(coef0,dcdalpha,dcdalphadot,dcdq,dcdqdot)
1274  end subroutine stabilityderivativedriver
1275 
1277 !
1278 ! setcoeftimeintegrator determines the coefficients of the
1279 ! time integration scheme in unsteady mode. normally these are
1280 ! equal to the coefficients corresponding to the specified
1281 ! accuracy. however during the initial phase there are not
1282 ! enough states in the past and the accuracy is reduced.
1283 !
1284  use constants
1285  use inputunsteady
1286  use inputphysics
1287  use iteration
1288  use monitor
1289  implicit none
1290 !
1291 ! local variables.
1292 !
1293  integer(kind=inttype) :: nn, nlevelsset
1294 ! determine which time integrator must be used.
1295 ! modified by hdn
1296  select case (timeaccuracy)
1297  case (firstorder)
1298 ! 1st order. no need to check the number of available
1299 ! states in the past. set the two coefficients and
1300 ! nlevelsset to 2.
1301  coeftime(0) = 1.0_realtype
1302  coeftime(1) = -1.0_realtype
1303  if (useale .and. equationmode .eq. unsteady) then
1304  coeftimeale(1) = 1.0_realtype
1305  coefmeshale(1, 1) = half
1306  coefmeshale(1, 2) = half
1307  end if
1308  nlevelsset = 2
1309 !--------------------------------------------------
1310  case (secondorder)
1311 ! second order time integrator. determine the amount of
1312 ! available states and set the coefficients accordingly.
1313  select case (noldsolavail)
1314  case (1_inttype)
1315  coeftime(0) = 1.0_realtype
1316  coeftime(1) = -1.0_realtype
1317  if (useale .and. equationmode .eq. unsteady) then
1318  coeftimeale(1) = half
1319  coeftimeale(2) = half
1320  coeftimeale(3) = zero
1321  coeftimeale(4) = zero
1322  coefmeshale(1, 1) = half
1323  coefmeshale(1, 2) = half
1324  coefmeshale(2, 1) = half
1325  coefmeshale(2, 2) = half
1326  end if
1327  nlevelsset = 2
1328  case default
1329 ! 2 or bigger.
1330  coeftime(0) = 1.5_realtype
1331  coeftime(1) = -2.0_realtype
1332  coeftime(2) = 0.5_realtype
1333  if (useale .and. equationmode .eq. unsteady) then
1336  coeftimeale(3) = -fourth
1337  coeftimeale(4) = -fourth
1338  coefmeshale(1, 1) = half*(1.0_realtype+1.0_realtype/sqrtthree)
1339  coefmeshale(1, 2) = half*(1.0_realtype-1.0_realtype/sqrtthree)
1340  coefmeshale(2, 1) = coefmeshale(1, 2)
1341  coefmeshale(2, 2) = coefmeshale(1, 1)
1342  end if
1343  nlevelsset = 3
1344  end select
1345 !--------------------------------------------------
1346  case (thirdorder)
1347 ! third order time integrator. determine the amount of
1348 ! available states and set the coefficients accordingly.
1349  select case (noldsolavail)
1350  case (1_inttype)
1351  coeftime(0) = 1.0_realtype
1352  coeftime(1) = -1.0_realtype
1353  if (useale .and. equationmode .eq. unsteady) then
1354  coeftimeale(1) = 1.0_realtype
1355  coefmeshale(1, 1) = half
1356  coefmeshale(1, 2) = half
1357  end if
1358  nlevelsset = 2
1359  case (2_inttype)
1360  coeftime(0) = 1.5_realtype
1361  coeftime(1) = -2.0_realtype
1362  coeftime(2) = 0.5_realtype
1363  if (useale .and. equationmode .eq. unsteady) then
1365  coeftimeale(2) = -fourth
1366  coefmeshale(1, 1) = half*(1.0_realtype+1.0_realtype/sqrtthree)
1367  coefmeshale(1, 2) = half*(1.0_realtype-1.0_realtype/sqrtthree)
1368  coefmeshale(2, 1) = coefmeshale(1, 2)
1369  coefmeshale(2, 2) = coefmeshale(1, 1)
1370  end if
1371  nlevelsset = 3
1372  case default
1373 ! 3 or bigger.
1374  coeftime(0) = 11.0_realtype/6.0_realtype
1375  coeftime(1) = -3.0_realtype
1376  coeftime(2) = 1.5_realtype
1377  coeftime(3) = -(1.0_realtype/3.0_realtype)
1378 ! these numbers are not correct
1379 ! do not use 3rd order ale for now
1380  if (useale .and. equationmode .eq. unsteady) then
1381  print*, 'third-order ale not implemented yet.'
1384  coeftimeale(3) = -fourth
1385  coeftimeale(4) = -fourth
1386  coefmeshale(1, 1) = half*(1.0_realtype+1.0_realtype/sqrtthree)
1387  coefmeshale(1, 2) = half*(1.0_realtype-1.0_realtype/sqrtthree)
1388  coefmeshale(2, 1) = coefmeshale(1, 2)
1389  coefmeshale(2, 2) = coefmeshale(1, 1)
1390  coefmeshale(3, 1) = coefmeshale(1, 2)
1391  coefmeshale(3, 2) = coefmeshale(1, 1)
1392  end if
1393  nlevelsset = 4
1394  end select
1395  end select
1396 ! set the rest of the coefficients to 0 if not enough states
1397 ! in the past are available.
1398  do nn=nlevelsset,noldlevels
1399  coeftime(nn) = zero
1400  end do
1401  end subroutine setcoeftimeintegrator
1402 
1403  function mynorm2(x)
1404  use constants
1405  implicit none
1406  real(kind=realtype), dimension(3), intent(in) :: x
1407  real(kind=realtype) :: mynorm2
1408  intrinsic sqrt
1409  mynorm2 = sqrt(x(1)**2 + x(2)**2 + x(3)**2)
1410  end function mynorm2
1411 
1412  function iswalltype(btype)
1413  use constants
1414  implicit none
1415  integer(kind=inttype) :: btype
1416  logical :: iswalltype
1417  iswalltype = .false.
1418  if ((btype .eq. nswalladiabatic .or. btype .eq. nswallisothermal) &
1419 & .or. btype .eq. eulerwall) iswalltype = .true.
1420  end function iswalltype
1421 
1422  subroutine cross_prod(a, b, c)
1423  use precision
1424  implicit none
1425 ! inputs
1426  real(kind=realtype), dimension(3), intent(in) :: a, b
1427 ! outputs
1428  real(kind=realtype), dimension(3), intent(out) :: c
1429  c(1) = a(2)*b(3) - a(3)*b(2)
1430  c(2) = a(3)*b(1) - a(1)*b(3)
1431  c(3) = a(1)*b(2) - a(2)*b(1)
1432  end subroutine cross_prod
1433 
1434  subroutine siangle(angle, mult, trans)
1435  use constants
1436  use su_cgns, only : radian, degree
1437  implicit none
1438 !
1439 ! subroutine arguments.
1440 !
1441  integer, intent(in) :: angle
1442  real(kind=realtype), intent(out) :: mult, trans
1443 ! determine the situation we are having here.
1444  if (angle .eq. radian) then
1445 ! angle is already given in radians. no need for a conversion.
1446  mult = one
1447  trans = zero
1448  else if (angle .eq. degree) then
1449 ! angle is given in degrees. a multiplication must be performed.
1450  mult = pi/180.0_realtype
1451  trans = zero
1452  else
1453  call terminate('siangle', &
1454 & 'no idea how to convert this to si units')
1455  end if
1456  end subroutine siangle
1457 
1458  subroutine sidensity(mass, len, mult, trans)
1459 !
1460 ! sidensity computes the conversion from the given density
1461 ! unit, which can be constructed from mass and length, to the
1462 ! si-unit kg/m^3. the conversion will look like:
1463 ! density in kg/m^3 = mult*(density in ncu) + trans.
1464 ! ncu means non-christian units, i.e. everything that is not si.
1465 !
1466  use constants
1467  use su_cgns, only : kilogram, meter
1468  implicit none
1469 !
1470 ! subroutine arguments.
1471 !
1472  integer, intent(in) :: mass, len
1473  real(kind=realtype), intent(out) :: mult, trans
1474 ! determine the situation we are having here.
1475  if (mass .eq. kilogram .and. len .eq. meter) then
1476 ! density is given in kg/m^3, i.e. no need for a conversion.
1477  mult = one
1478  trans = zero
1479  else
1480  call terminate('sidensity', &
1481 & 'no idea how to convert this to si units')
1482  end if
1483  end subroutine sidensity
1484 
1485  subroutine silen(len, mult, trans)
1486 !
1487 ! silen computes the conversion from the given length unit to
1488 ! the si-unit meter. the conversion will look like:
1489 ! length in meter = mult*(length in ncu) + trans.
1490 ! ncu means non-christian units, i.e. everything that is not si.
1491 !
1492  use constants
1493  use su_cgns, only : meter, centimeter, millimeter, foot, inch
1494  implicit none
1495 !
1496 ! subroutine arguments.
1497 !
1498  integer, intent(in) :: len
1499  real(kind=realtype), intent(out) :: mult, trans
1500 ! determine the situation we are having here.
1501  select case (len)
1502  case (meter)
1503  mult = one
1504  trans = zero
1505  case (centimeter)
1506  mult = 0.01_realtype
1507  trans = zero
1508  case (millimeter)
1509  mult = 0.001_realtype
1510  trans = zero
1511  case (foot)
1512  mult = 0.3048_realtype
1513  trans = zero
1514  case (inch)
1515  mult = 0.0254_realtype
1516  trans = zero
1517  case default
1518  call terminate('silen', 'no idea how to convert this to si units')
1519  end select
1520  end subroutine silen
1521 
1522  subroutine sipressure(mass, len, time, mult, trans)
1523 !
1524 ! sipressure computes the conversion from the given pressure
1525 ! unit, which can be constructed from mass, length and time, to
1526 ! the si-unit pa. the conversion will look like:
1527 ! pressure in pa = mult*(pressure in ncu) + trans.
1528 ! ncu means non-christian units, i.e. everything that is not si.
1529 !
1530  use constants
1531  use su_cgns, only : kilogram, meter, second
1532  implicit none
1533 !
1534 ! subroutine arguments.
1535 !
1536  integer, intent(in) :: mass, len, time
1537  real(kind=realtype), intent(out) :: mult, trans
1538 ! determine the situation we are having here.
1539  if (mass .eq. kilogram .and. len .eq. meter .and. time .eq. second) &
1540 & then
1541 ! pressure is given in pa, i.e. no need for a conversion.
1542  mult = one
1543  trans = zero
1544  else
1545  call terminate('sipressure', &
1546 & 'no idea how to convert this to si units')
1547  end if
1548  end subroutine sipressure
1549 
1550  subroutine sitemperature(temp, mult, trans)
1551 !
1552 ! sitemperature computes the conversion from the given
1553 ! temperature unit to the si-unit kelvin. the conversion will
1554 ! look like:
1555 ! temperature in k = mult*(temperature in ncu) + trans.
1556 ! ncu means non-christian units, i.e. everything that is not si.
1557 !
1558  use constants
1559  use su_cgns, only : kelvin, celsius, rankine, fahrenheit
1560  implicit none
1561 !
1562 ! subroutine arguments.
1563 !
1564  integer, intent(in) :: temp
1565  real(kind=realtype), intent(out) :: mult, trans
1566 ! determine the situation we are having here.
1567  select case (temp)
1568  case (kelvin)
1569 ! temperature is already given in kelvin. no need to convert.
1570  mult = one
1571  trans = zero
1572  case (celsius)
1573 ! is it celcius or celsius?
1574 ! temperature is in celsius. only an offset must be applied.
1575  mult = one
1576  trans = 273.16_realtype
1577  case (rankine)
1578 ! temperature is in rankine. only a multiplication needs to
1579 ! be performed.
1580  mult = 5.0_realtype/9.0_realtype
1581  trans = zero
1582  case (fahrenheit)
1583 ! temperature is in fahrenheit. both a multiplication and an
1584 ! offset must be applied.
1585  mult = 5.0_realtype/9.0_realtype
1586  trans = 255.382
1587  case default
1588 ! unknown temperature unit.
1589  call terminate('sitemperature', &
1590 & 'no idea how to convert this to si units')
1591  end select
1592  end subroutine sitemperature
1593 
1594  subroutine siturb(mass, len, time, temp, turbname, mult, trans)
1595 !
1596 ! siturb computes the conversion from the given turbulence
1597 ! unit, which can be constructed from mass, len, time and temp,
1598 ! to the si-unit for the given variable. the conversion will
1599 ! look like: var in si = mult*(var in ncu) + trans.
1600 ! ncu means non-christian units, i.e. everything that is not si.
1601 !
1602  use constants
1603  use su_cgns, only : kilogram, meter, second, kelvin
1604  implicit none
1605 !
1606 ! subroutine arguments.
1607 !
1608  integer, intent(in) :: mass, len, time, temp
1609  character(len=*), intent(in) :: turbname
1610  real(kind=realtype), intent(out) :: mult, trans
1611 ! determine the situation we are having here.
1612  if (mass .eq. kilogram .and. len .eq. meter .and. time .eq. second &
1613 & .and. temp .eq. kelvin) then
1614 ! everthing is already in si units. no conversion needed.
1615  mult = one
1616  trans = zero
1617  else
1618  call terminate('siturb', 'no idea how to convert this to si units'&
1619 & )
1620  end if
1621  end subroutine siturb
1622 
1623  subroutine sivelocity(length, time, mult, trans)
1624 !
1625 ! sivelocity computes the conversion from the given velocity
1626 ! unit, which can be constructed from length and time, to the
1627 ! si-unit m/s. the conversion will look like:
1628 ! velocity in m/s = mult*(velocity in ncu) + trans.
1629 ! ncu means non-christian units, i.e. everything that is not si.
1630 !
1631  use constants
1632  use su_cgns, only : meter, centimeter, millimeter, foot, inch, &
1633 & second
1634  implicit none
1635 !
1636 ! subroutine arguments.
1637 !
1638  integer, intent(in) :: length, time
1639  real(kind=realtype), intent(out) :: mult, trans
1640 ! determine the situation we are having here.
1641 ! first the length.
1642  select case (length)
1643  case (meter)
1644  mult = one
1645  trans = zero
1646  case (centimeter)
1647  mult = 0.01_realtype
1648  trans = zero
1649  case (millimeter)
1650  mult = 0.001_realtype
1651  trans = zero
1652  case (foot)
1653  mult = 0.3048_realtype
1654  trans = zero
1655  case (inch)
1656  mult = 0.0254_realtype
1657  trans = zero
1658  case default
1659  call terminate('sivelocity', &
1660 & 'no idea how to convert this length to si units')
1661  end select
1662 ! and the time.
1663  select case (time)
1664  case (second)
1665  mult = mult
1666  case default
1667  call terminate('sivelocity', &
1668 & 'no idea how to convert this time to si units')
1669  end select
1670  end subroutine sivelocity
1671 ! ----------------------------------------------------------------------
1672 ! |
1673 ! no tapenade routine below this line |
1674 ! |
1675 ! ----------------------------------------------------------------------
1676 
1677 end module utils_fast_b
1678 
Definition: BCData.F90:1
real(kind=realtype), dimension(:, :), pointer rlv2
Definition: BCPointers.F90:12
real(kind=realtype), dimension(:, :), pointer gamma2
Definition: BCPointers.F90:14
real(kind=realtype), dimension(:, :), pointer rev0
Definition: BCPointers.F90:13
integer(kind=inttype), dimension(:, :), pointer gcp
Definition: BCPointers.F90:18
real(kind=realtype), dimension(:, :, :), pointer ww0
Definition: BCPointers.F90:10
real(kind=realtype), dimension(:, :), pointer dd2wall
Definition: BCPointers.F90:17
real(kind=realtype), dimension(:, :, :), pointer ssk
Definition: BCPointers.F90:15
real(kind=realtype), dimension(:, :), pointer pp3
Definition: BCPointers.F90:11
real(kind=realtype), dimension(:, :), pointer rlv0
Definition: BCPointers.F90:12
integer(kind=inttype) istart
Definition: BCPointers.F90:20
integer(kind=inttype) iend
Definition: BCPointers.F90:20
real(kind=realtype), dimension(:, :), pointer rlv1
Definition: BCPointers.F90:12
real(kind=realtype), dimension(:, :), pointer pp1
Definition: BCPointers.F90:11
real(kind=realtype), dimension(:, :), pointer pp0
Definition: BCPointers.F90:11
real(kind=realtype), dimension(:, :), pointer rev2
Definition: BCPointers.F90:13
real(kind=realtype), dimension(:, :, :), pointer ww3
Definition: BCPointers.F90:10
real(kind=realtype), dimension(:, :), pointer rev1
Definition: BCPointers.F90:13
integer(kind=inttype) jsize
Definition: BCPointers.F90:21
real(kind=realtype), dimension(:, :), pointer sface
Definition: BCPointers.F90:17
real(kind=realtype), dimension(:, :, :), pointer ssj
Definition: BCPointers.F90:15
integer(kind=inttype) jend
Definition: BCPointers.F90:21
real(kind=realtype), dimension(:, :), pointer rlv3
Definition: BCPointers.F90:12
real(kind=realtype), dimension(:, :, :), pointer ww1
Definition: BCPointers.F90:10
real(kind=realtype), dimension(:, :), pointer gamma3
Definition: BCPointers.F90:14
real(kind=realtype), dimension(:, :), pointer pp2
Definition: BCPointers.F90:11
real(kind=realtype), dimension(:, :, :), pointer xx
Definition: BCPointers.F90:16
integer(kind=inttype) jstart
Definition: BCPointers.F90:21
real(kind=realtype), dimension(:, :), pointer gamma1
Definition: BCPointers.F90:14
real(kind=realtype), dimension(:, :, :), pointer ww2
Definition: BCPointers.F90:10
integer(kind=inttype) isize
Definition: BCPointers.F90:20
real(kind=realtype), dimension(:, :, :), pointer ss
Definition: BCPointers.F90:16
real(kind=realtype), dimension(:, :), pointer gamma0
Definition: BCPointers.F90:14
real(kind=realtype), dimension(:, :), pointer rev3
Definition: BCPointers.F90:13
real(kind=realtype), dimension(:, :, :), pointer ssi
Definition: BCPointers.F90:15
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
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 silen(len, mult, trans)
logical function getcorrectfork()
subroutine computetsderivatives(force, moment, coef0, dcdalpha, dcdalphadot, dcdq, dcdqdot)
real(kind=realtype) function tsalphadot(degreepolalpha, coefpolalpha, degreefouralpha, omegafouralpha, coscoeffouralpha, sincoeffouralpha, t)
subroutine terminate(routinename, errormessage)
subroutine rotmatrixrigidbody(tnew, told, rotationmatrix, rotationpoint)
subroutine sipressure(mass, len, time, mult, trans)
subroutine sivelocity(length, time, mult, trans)
subroutine setcoeftimeintegrator()
real(kind=realtype) function rigidrotangle(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
real(kind=realtype) function mydim(x, y)
real(kind=realtype) function tsmach(degreepolmach, coefpolmach, degreefourmach, omegafourmach, coscoeffourmach, sincoeffourmach, t)
subroutine sitemperature(temp, mult, trans)
real(kind=realtype) function secondderivativerigidrotangle(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
subroutine getdirangle(freestreamaxis, liftaxis, liftindex, alpha, beta)
logical function iswalltype(btype)
subroutine siangle(angle, mult, trans)
subroutine computerootbendingmoment(cf, cm, bendingmoment)
real(kind=realtype) function derivativerigidrotangle(degreepolrot, coefpolrot, degreefourrot, omegafourrot, coscoeffourrot, sincoeffourrot, t)
real(kind=realtype) function tsalpha(degreepolalpha, coefpolalpha, degreefouralpha, omegafouralpha, coscoeffouralpha, sincoeffouralpha, t)
subroutine computeleastsquaresregression(y, x, npts, m, b)
subroutine setbcpointers(nn, spatialpointers)
subroutine sidensity(mass, len, mult, trans)
real(kind=realtype) function tsbetadot(degreepolbeta, coefpolbeta, degreefourbeta, omegafourbeta, coscoeffourbeta, sincoeffourbeta, t)
character(len=n) function char2str(chararray, n)
Definition: utils_fast_b.f90:9
subroutine siturb(mass, len, time, temp, turbname, mult, trans)
subroutine cross_prod(a, b, c)
real(kind=realtype) function tsmachdot(degreepolmach, coefpolmach, degreefourmach, omegafourmach, coscoeffourmach, sincoeffourmach, t)
real(kind=realtype) function tsbeta(degreepolbeta, coefpolbeta, degreefourbeta, omegafourbeta, coscoeffourbeta, sincoeffourbeta, t)
subroutine stabilityderivativedriver()
subroutine mydim_fast_b(x, xd, y, yd, mydimd)
real(kind=realtype) function mynorm2(x)