evaluate 1d fourier series from given cos/sin coefficients and mode numbers xn SUM(xc(0:n_max)COS(xn(0:n_max)zeta)+xs(0:n_max)SIN(xn(0:n_max)zeta) evaluate all derivatives 1,2,3 alongside
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n_max |
number of modes is n_max+1 (0...n_max) |
||
| integer, | intent(in) | :: | xn(0:n_max) |
array of mode numbers |
||
| real(kind=wp), | intent(in) | :: | xc(0:n_max) |
cosine coefficients |
||
| real(kind=wp), | intent(in) | :: | xs(0:n_max) |
sine coefficients |
||
| real(kind=wp), | intent(in) | :: | zeta |
angular position [0,2pi] |
||
| real(kind=wp), | intent(out) | :: | x |
value at zeta |
||
| real(kind=wp), | intent(out) | :: | xp |
1st derivative in zeta |
||
| real(kind=wp), | intent(out) | :: | xpp |
2nd derivative in zeta |
||
| real(kind=wp), | intent(out) | :: | xppp |
3rd derivative in zeta |
||
| real(kind=wp), | intent(out) | :: | xp4 |
4th derivative in zeta |
PURE SUBROUTINE eval_fourier1d(n_max,xn,xc,xs,zeta,x,xp,xpp,xppp,xp4) ! MODULES IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES INTEGER , INTENT(IN ) :: n_max !! number of modes is n_max+1 (0...n_max) INTEGER , INTENT(IN ) :: xn(0:n_max) !! array of mode numbers REAL(wp) , INTENT(IN ) :: xc(0:n_max) !! cosine coefficients REAL(wp) , INTENT(IN ) :: xs(0:n_max) !! sine coefficients REAL(wp) , INTENT(IN ) :: zeta !! angular position [0,2pi] !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL(wp) , INTENT(OUT) :: x !! value at zeta REAL(wp) , INTENT(OUT) :: xp !! 1st derivative in zeta REAL(wp) , INTENT(OUT) :: xpp !! 2nd derivative in zeta REAL(wp) , INTENT(OUT) :: xppp !! 3rd derivative in zeta REAL(wp) , INTENT(OUT) :: xp4 !! 4th derivative in zeta !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES REAL(wp),DIMENSION(0:n_max) :: cos_nzeta,sin_nzeta,xtmp,xptmp !=================================================================================================================================== cos_nzeta=COS(REAL(xn,wp)*zeta) sin_nzeta=SIN(REAL(xn,wp)*zeta) xtmp = xc*cos_nzeta+xs*sin_nzeta xptmp= REAL(xn,wp)*(-xc*sin_nzeta+xs*cos_nzeta) x = SUM(xtmp) xp = SUM(xptmp) xpp = SUM(REAL(-xn*xn,wp)*xtmp) xppp = SUM(REAL(-xn*xn,wp)*xptmp) xp4 = SUM(REAL(xn**4,wp)*xtmp) END SUBROUTINE eval_fourier1d