48 REAL,
PARAMETER :: gn = 6.6742e-11
50 REAL,
PARAMETER :: tsim = 1.0e-0
52 REAL,
PARAMETER :: gamma = 1.4
53 REAL,
PARAMETER :: mass = 1.0e+0
54 REAL,
PARAMETER :: centmass = 1.0e+2
55 REAL,
PARAMETER :: rsph = 30.0
56 REAL,
PARAMETER :: ecc = 0.0
57 REAL,
PARAMETER :: vol0 = 4*pi/3 * rsph*rsph*rsph / (1.-ecc*ecc)
59 REAL,
PARAMETER ::
omega = 1.0e-7
60 REAL,
PARAMETER :: omega_frame = 0.0*
omega
61 REAL,
PARAMETER :: eta_p = 100.0
65 REAL,
PARAMETER :: eta_rho = 1.0e-6
68 INTEGER,
PARAMETER :: mgeo = cylindrical
70 INTEGER,
PARAMETER :: xres = 150
71 INTEGER,
PARAMETER :: yres = 1
72 INTEGER,
PARAMETER :: zres = xres
73 REAL,
PARAMETER :: rmax = 1.5
74 REAL,
PARAMETER :: gpar = 0.5*rsph
76 INTEGER,
PARAMETER :: onum = 10
77 CHARACTER(LEN=256),
PARAMETER &
79 CHARACTER(LEN=256),
PARAMETER &
80 :: ofname =
'collapse_cyl_rhs1_150'
86 CLASS(
fosite),
ALLOCATABLE :: sim
93 IF (sim%GetRank().EQ.0)
THEN
107 CALL initdata(sim%Mesh, sim%Physics, sim%Timedisc)
110 ok = .NOT.sim%aborted
113 IF (sim%GetRank().EQ.0)
THEN
115 tap_check(ok,
"Finished simulation")
131 TYPE(dict_typ),
POINTER :: config
134 INTEGER :: bc(6),sgbc
135 TYPE(dict_typ),
POINTER :: mesh,physics, boundary, datafile, rotframe, &
136 sources, timedisc, fluxes, grav, pmass, selfgravity
137 REAL :: x1,x2,y1,y2,z1,z2
145 x1 = 2.*x2 / (xres+2)
152 x1 = 2.*x2 / (xres+2)
164 x1 = atan(-rmax*rsph/gpar)
165 x2 = atan(rmax*rsph/gpar)
167 y1 = 2.*y2 / (yres+2)
177 CALL sim%Error(
"InitProgram",
"geometry not supported for collapse simulation")
181 mesh => dict(
"meshtype" / midpoint, &
186 "omega" / omega_frame, &
195 "output/radius" / 1, &
196 "output/volume" / 1, &
201 bc(west) = reflecting
202 bc(east) = reflecting
203 bc(south) = reflecting
204 bc(north) = reflecting
211 bc(east) = reflecting
214 bc(bottom)= reflecting
224 bc(west) = reflecting
225 bc(east) = reflecting
226 bc(south) = reflecting
227 bc(north) = reflecting
238 CALL sim%Error(
"InitProgram",
"geometry not supported for collapse simulation")
242 boundary => dict(
"western" / bc(west), &
243 "eastern" / bc(east), &
244 "southern" / bc(south), &
245 "northern" / bc(north), &
246 "bottomer" / bc(bottom), &
250 physics => dict(
"problem" / euler, &
257 p0 = 4.0/3.0*pi*gn*rho0**2*rsph**2 / eta_p
260 tau = sqrt((rsph**3)/gn/(4./3.*pi*rsph**3*rho0 + centmass))
263 fluxes => dict(
"order" / linear, &
265 "variables" / primitive, &
266 "limiter" / vanleer, &
270 pmass => dict(
"gtype" / pointmass, &
289 grav => dict(
"stype" / gravity, &
294 sources => dict(
"grav" / grav)
297 IF (omega_frame.GT.tiny(omega_frame))
THEN
298 rotframe => dict(
"stype" / rotating_frame, &
301 CALL setattr(sources,
"rotframe", rotframe)
307 "method" / modified_euler, &
310 "stoptime" / (tsim * tau), &
311 "dtlimit" / 1.0e-9, &
313 "maxiter" / 10000000)
317 "fileformat" / vtk, &
319 "filename" / (trim(odir) // trim(ofname)), &
322 config => dict(
"mesh" / mesh, &
323 "physics" / physics, &
324 "boundary" / boundary, &
326 "timedisc" / timedisc, &
327 "sources" / sources, &
328 "datafile" / datafile)
335 CLASS(mesh_base) :: Mesh
336 CLASS(physics_base) :: Physics
337 CLASS(timedisc_base):: Timedisc
339 CHARACTER(LEN=64) :: value
341 TYPE(marray_base) :: ez,posvec
343 INTENT(IN) :: mesh,physics
344 INTENT(INOUT) :: timedisc
349 ez%data2d(:,1:2) = 0.0
352 CALL mesh%geometry%Convert2Curvilinear(mesh%bcenter,ez%data4d,ez%data4d)
355 posvec = marray_base(3)
356 posvec%data4d = mesh%posvec%bcenter
358 SELECT TYPE(pvar => timedisc%pvar)
359 TYPE IS(statevector_euler)
361 WHERE (mesh%radius%data2d(:,2).LE.rsph)
362 pvar%density%data1d(:) = rho0
364 pvar%density%data1d(:) = rho0 * eta_rho
367 pvar%velocity = (
omega-omega_frame) * (ez.x.posvec)
369 pvar%pressure%data1d(:) = p0
371 CALL sim%Error(
"collapse::InitData",
"physics not supported in this setup")
374 CALL physics%Convert2Conservative(timedisc%pvar,timedisc%cvar)
376 CALL mesh%Info(
" DATA-----> initial condition: " // &
377 "Homogenious density with uniform angular frequency")
378 IF (centmass.GT.tiny(centmass))
THEN
379 WRITE (
value,
"(E12.4)") sqrt(rsph**3/(centmass*physics%constants%GN))
380 CALL mesh%Info(
" " // &
381 "timescale of pointmass: " //trim(
value))
383 IF (mass .GT. tiny(mass))
THEN
384 WRITE(
value,
"(E12.4)") sqrt(3.0*pi/(4.0*rho0*physics%constants%GN))
385 CALL mesh%Info(
" " // &
386 "timescale of self-gravity: " //trim(
value))
389 WRITE (
value,
"(E12.4)")
omega
390 CALL mesh%Info(
" " // &
391 "angular velocity: " // trim(
value))
394 WRITE (
value,
"(E12.4)") tau
395 CALL mesh%Info(
" " // &
396 "free-fall time: " //trim(
value))
398 SELECT TYPE(bwest => timedisc%Boundary%Boundary(west)%p)
399 CLASS IS(boundary_custom)
400 IF(mgeo.EQ.spherical)
THEN
401 CALL bwest%SetCustomBoundaries(mesh,physics, &
402 (/custom_nograd,custom_reflect,custom_reflect,custom_fixed,custom_reflect/))
403 bwest%data(:,:,:,physics%ZVELOCITY) = 0.0
404 ELSE IF(mgeo.EQ.cylindrical)
THEN
405 CALL bwest%SetCustomBoundaries(mesh,physics, &
407 (/custom_nograd,custom_reflect,custom_fixed,custom_nograd,custom_reflect/))
408 bwest%data(:,:,:,physics%YVELOCITY) = 0.0
412 SELECT TYPE(bbottom => timedisc%Boundary%Boundary(bottom)%p)
413 CLASS IS(boundary_fixed)
414 IF(mgeo.EQ.cylindrical)
THEN
415 bbottom%fixed(:,:,:) = .true.
416 bbottom%data(:,:,1,:) = timedisc%pvar%data4d(:,:,mesh%KMIN,:)
417 bbottom%data(:,:,2,:) = timedisc%pvar%data4d(:,:,mesh%KMIN,:)
419 CLASS IS(boundary_farfield)
420 bbottom%data(:,:,1,:) = timedisc%pvar%data4d(:,:,mesh%KMIN,:)
421 bbottom%data(:,:,2,:) = timedisc%pvar%data4d(:,:,mesh%KMIN,:)
424 SELECT TYPE(btop => timedisc%Boundary%Boundary(top)%p)
425 CLASS IS(boundary_fixed)
426 IF(mgeo.EQ.cylindrical)
THEN
427 btop%fixed(:,:,:) = .true.
428 btop%data(:,:,1,:) = timedisc%pvar%data4d(:,:,mesh%KMAX,:)
429 btop%data(:,:,2,:) = timedisc%pvar%data4d(:,:,mesh%KMAX,:)
431 CLASS IS(boundary_farfield)
432 btop%data(:,:,1,:) = timedisc%pvar%data4d(:,:,mesh%KMAX,:)
433 btop%data(:,:,2,:) = timedisc%pvar%data4d(:,:,mesh%KMAX,:)
subroutine initdata(Mesh, Physics, Fluxes, Timedisc)
subroutine makeconfig(Sim, config)
pure real function, dimension(size(ephir%data2d, dim=1)) omega(ephir, velocity)