163 REAL,
PARAMETER :: sigma = 0.1
164 REAL,
DIMENSION(2),
PARAMETER :: x1 = (/ 1.0, 0. /)
165 REAL,
DIMENSION(2),
PARAMETER :: x2 = (/ 1.0, pi /)
166 REAL,
DIMENSION(2),
PARAMETER :: x3 = (/ 0.9, 3./4.*pi /)
167 REAL,
DIMENSION(2),
PARAMETER :: x4 = (/ 1.0, -pi/2. /)
170 REAL,
PARAMETER :: gn = 1.
171 REAL,
PARAMETER :: p0 = 1.
172 REAL,
PARAMETER :: p = 10.
173 REAL,
PARAMETER :: t = p*p0
175 REAL,
PARAMETER :: flaring = 0.05
176 REAL,
PARAMETER :: rg = 8.31
177 REAL,
PARAMETER :: mu = 6.02e-04
178 REAL,
PARAMETER :: gamma = 5./3.
180 REAL,
PARAMETER :: rmin = 0.4
181 REAL,
PARAMETER :: rmax = 2.0
182 INTEGER,
PARAMETER :: yres = 128
183 INTEGER,
PARAMETER :: xres = yres/4
184 INTEGER,
PARAMETER :: onum = p * 1
185 REAL,
PARAMETER ::
omega = 1.0
187 CLASS(
fosite),
ALLOCATABLE :: sim
189 REAL,
DIMENSION(:,:,:),
POINTER :: numpot, anapot
196 CALL sim%InitFosite()
201 CALL setattr(sim%config,
"/mesh/rmin", 0.2)
202 CALL setattr(sim%config,
"/mesh/rmax", 1.8)
203 CALL setattr(sim%config,
"/mesh/inum", 64)
204 CALL setattr(sim%config,
"/mesh/jnum", 192)
208 CALL initdata(sim%Timedisc,sim%Mesh,sim%Physics,sim%Sources)
213 print *,
"max local relative error: ",maxval(abs((numpot-anapot)/anapot))
214 print *,
"global relative error: ",sum(abs(numpot-anapot))/sum(abs(anapot))
228 CLASS(fosite),
INTENT(INOUT) :: Sim
229 TYPE(Dict_TYP),
POINTER :: config
232 TYPE(Dict_TYP),
POINTER :: mesh,boundary,timedisc,datafile,&
233 fluxes,physics,grav,rotframe,sources
235 CHARACTER(LEN=1) :: str
241 "units" / geometrical)
246 "variables" / primitive, &
247 "limiter" / monocent, &
251 "meshtype" / midpoint, &
252 "geometry" / cylindrical, &
267 "decomposition" / (/ -1, 1/))
273 "western" / noslip, &
274 "eastern" / noslip, &
275 "southern" / periodic, &
276 "northern" / periodic, &
277 "bottomer" / reflecting, &
278 "topper" / reflecting)
282 "output/accel" / 1, &
283 "self/gtype" / spectral, &
284 "self/green" / green, &
285 "self/sigma" / sigma)
289 "stype" / rotating_frame, &
305 "tol_rel" / 1.0e-3, &
308 "dtlimit" / 1.0e-10, &
309 "maxiter" / 2000000000, &
310 "output/solution" / 1)
312 WRITE(str,
'(I1)')green
315 "fileformat" / vtk, &
316 "filename" / (
"orbitingcylinders_" // str), &
320 "physics" / physics, &
323 "boundary" / boundary, &
324 "sources" / sources, &
325 "timedisc" / timedisc, &
326 "datafile" / datafile)
331 SUBROUTINE initdata(Timedisc,Mesh,Physics,Sources)
334 CLASS(timedisc_base),
INTENT(INOUT) :: Timedisc
335 CLASS(mesh_base),
INTENT(IN) :: Mesh
336 CLASS(physics_base),
INTENT(INOUT) :: Physics
337 CLASS(sources_base),
POINTER :: Sources
340 INTEGER :: i,j,k,dir,ig
341 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX) :: r,r1,r2,r3
342 CLASS(sources_base),
POINTER :: sp
343 CLASS(sources_gravity),
POINTER :: gp
345 r = mesh%radius%bcenter
348 IF (
ASSOCIATED(sp).EQV..false.)
RETURN 350 CLASS IS(sources_gravity)
358 anapot => timedisc%solution%data4d(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX,1)
359 numpot => gp%glist%pot(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX,1)
363 r1 =
rsq(mesh,mesh%radius%bcenter,x1)
364 r2 =
rsq(mesh,mesh%radius%bcenter,x3)
365 r3 =
rsq(mesh,mesh%radius%bcenter,x4)
366 timedisc%pvar%data4d(:,:,:,physics%DENSITY) &
367 = 2.0 / (2.*pi*sigma**2) * exp(-sqrt(r1)/sigma) &
368 + 0.5 / (2.*pi*sigma**2) * exp(-sqrt(r2)/sigma) &
369 + 1.0 / (2.*pi*sigma**2) * exp(-sqrt(r3)/sigma)
371 r1 = sqrt(
rsq(mesh,mesh%radius%faces(:,:,:,1),x1)) / (2.*sigma)
372 r2 = sqrt(
rsq(mesh,mesh%radius%faces(:,:,:,1),x3)) / (2.*sigma)
373 r3 = sqrt(
rsq(mesh,mesh%radius%faces(:,:,:,1),x4)) / (2.*sigma)
374 DO k=mesh%KGMIN,mesh%KGMAX
375 DO j=mesh%JGMIN,mesh%JGMAX
376 DO i=mesh%IGMIN,mesh%IGMAX
377 timedisc%solution%data4d(i,j,k,1) &
379 = -2.0 * r1(i,j,k)/sigma*(fgsl_sf_bessel_ic0(r1(i,j,k))*fgsl_sf_bessel_kc1(r1(i,j,k))&
380 -fgsl_sf_bessel_ic1(r1(i,j,k))*fgsl_sf_bessel_kc0(r1(i,j,k))) &
381 -0.5 * r2(i,j,k)/sigma*(fgsl_sf_bessel_ic0(r2(i,j,k))*fgsl_sf_bessel_kc1(r2(i,j,k))&
382 -fgsl_sf_bessel_ic1(r2(i,j,k))*fgsl_sf_bessel_kc0(r2(i,j,k))) &
383 -1.0 * r3(i,j,k)/sigma*(fgsl_sf_bessel_ic0(r3(i,j,k))*fgsl_sf_bessel_kc1(r3(i,j,k))&
384 -fgsl_sf_bessel_ic1(r3(i,j,k))*fgsl_sf_bessel_kc0(r3(i,j,k)))
397 timedisc%pvar%data4d(:,:,:,physics%PRESSURE) = 1.0
398 timedisc%pvar%data4d(:,:,:,physics%XVELOCITY) = 0.0
399 timedisc%pvar%data4d(:,:,:,physics%YVELOCITY) = 0.0
401 r1 =
rsq(mesh,mesh%radius%bcenter,x1)
402 r2 =
rsq(mesh,mesh%radius%bcenter,x3)
403 r3 =
rsq(mesh,mesh%radius%bcenter,x4)
404 timedisc%pvar%data4d(:,:,:,physics%DENSITY) &
405 = 2.0 / (2.*pi*sigma**2) * exp(-r1/(2.*sigma**2)) &
406 + 0.5 / (2.*pi*sigma**2) * exp(-r2/(2.*sigma**2)) &
407 + 1.0 / (2.*pi*sigma**2) * exp(-r3/(2.*sigma**2))
409 r1 =
rsq(mesh,mesh%radius%faces(:,:,:,1),x1)
410 r2 =
rsq(mesh,mesh%radius%faces(:,:,:,1),x3)
411 r3 =
rsq(mesh,mesh%radius%faces(:,:,:,1),x4)
413 timedisc%solution%data4d(:,:,:,1) &
414 = - 2.0 / sqrt(r1) * erf(sqrt(r1 / 2.) / sigma) &
415 - 0.5 / sqrt(r2) * erf(sqrt(r2 / 2.) / sigma) &
416 - 1.0 / sqrt(r3) * erf(sqrt(r3 / 2.) / sigma)
417 timedisc%pvar%data4d(:,:,:,physics%PRESSURE) = 1.0
418 timedisc%pvar%data4d(:,:,:,physics%XVELOCITY) = 0.0
419 timedisc%pvar%data4d(:,:,:,physics%YVELOCITY) = 0.0
421 r1 =
rsq(mesh,mesh%curv%bcenter,x1)
422 r2 =
rsq(mesh,mesh%curv%bcenter,x2)
423 timedisc%pvar%data4d(:,:,:,physics%DENSITY) = 0.02/(3.2*pi) &
424 + 0.99 * ( exp(-0.5*(r1/sigma**2))/(2.*pi*sigma**2) &
425 + exp(-0.5*(r2/sigma**2))/(2.*pi*sigma**2))
427 timedisc%pvar%data4d(:,:,:,physics%PRESSURE) = 0.02/(3.2*pi) &
428 + gn / (2.*pi*sigma**2) &
429 * (
ei(-(r1/sigma**2)) -
ei(-0.5*(r1/sigma**2)) &
430 +
ei(-(r2/sigma**2)) -
ei(-0.5*(r2/sigma**2)))
432 timedisc%pvar%data4d(:,:,:,physics%XVELOCITY) = 0.0
433 timedisc%pvar%data4d(:,:,:,physics%YVELOCITY) = r - r*
omega 437 SELECT TYPE(bound => timedisc%Boundary%boundary(dir)%p)
438 CLASS IS (boundary_noslip)
439 DO k=mesh%KMIN,mesh%KMAX
440 DO j=mesh%JMIN,mesh%JMAX
448 bound%data(ig,j,k,physics%YVELOCITY) &
449 = timedisc%pvar%data4d(i,j,k,physics%YVELOCITY)
456 CALL physics%Convert2Conservative(timedisc%pvar,timedisc%cvar)
459 FUNCTION rsq(Mesh,r,x)
RESULT(res)
463 REAL,
DIMENSION(2) :: x
464 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX) :: r
465 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX) :: res
469 res = r**2 + x(1)**2 - 2.*r*x(1) * cos(mesh%curv%bcenter(:,:,:,2)-x(2))
elemental real function, public bessel_k1(x)
Compute the modified Bessel function of the second kind as polynomial expansion, which has been propo...
pure real function, dimension(size(ephir%data2d, dim=1)) omega(ephir, velocity)
subroutine initdata(Mesh, Physics, Fluxes, Timedisc)
elemental real function, public bessel_k0e(x)
Compute the exponential scaled modified Bessel function of the second kind e.g. K0e = EXP(x) * K0(x) ...
real function, dimension(mesh%igmin:mesh%igmax, mesh%jgmin:mesh%jgmax, mesh%kgmin:mesh%kgmax) rsq(Mesh, r, x)
elemental real function, public ei(x)
Computes the exponential integral Ei(x) for x != 0 Ei(x) := int_-oo^x exp(t)/t dt Implementation simi...
elemental real function, public bessel_i1(x)
Compute the modified Bessel function of the first kind as polynomial expansion, which has been propos...
subroutine makeconfig(Sim, config)
program orbitingcylinders
elemental real function, public bessel_k0(x)
Compute the modified Bessel function of the second kind as polynomial expansion, which has been propo...
elemental real function, public bessel_i0(x)
Compute the modified Bessel function of the first kind as polynomial expansion, which has been propos...