57 REAL,
PARAMETER :: gn = 6.6742d-8
58 REAL,
PARAMETER :: rg = 8.31447d+7
59 REAL,
PARAMETER :: msun = 1.989d+33
60 REAL,
PARAMETER :: au = 1.49597870691e+13
61 REAL,
PARAMETER :: year = 3.15576e+7
62 REAL,
PARAMETER :: mscale = msun
64 REAL,
PARAMETER :: tsim = 6.0
65 REAL,
PARAMETER :: mu = 2.35d+0
66 REAL,
PARAMETER :: valpha = 0.05
68 REAL,
PARAMETER :: mbh = 1.0*mscale
69 REAL,
PARAMETER :: mdisk = 0.1*mscale
70 REAL,
PARAMETER :: t_init = 120.0
71 REAL,
PARAMETER :: t_min = 10.0
73 REAL,
PARAMETER :: beta_c = 10.0
74 REAL,
PARAMETER :: gamma = 1.6
76 INTEGER,
PARAMETER :: mgeo = logcylindrical
77 REAL,
PARAMETER :: gpar = au
78 REAL,
PARAMETER :: rmin = 1.0*gpar
79 REAL,
PARAMETER :: rmax = 25.0*gpar
80 INTEGER,
PARAMETER :: xres = 256
81 INTEGER,
PARAMETER :: yres = xres*3
82 INTEGER,
PARAMETER :: zres = 1
85 REAL,
PARAMETER :: noise = 0.3
87 INTEGER,
PARAMETER :: onum = 100
88 CHARACTER(LEN=256),
PARAMETER &
90 CHARACTER(LEN=256) :: ofname =
'sgdisk' 92 CLASS(
fosite),
ALLOCATABLE :: sim
93 REAL :: csiso,
omega,orp
99 CALL asl_library_initialize()
102 CALL sim%InitFosite()
105 CALL initdata(sim%Mesh, sim%Physics, sim%Timedisc, sim%Fluxes, sim%Sources, &
106 sim%Timedisc%pvar, sim%Timedisc%cvar)
111 CALL asl_library_finalize()
121 CLASS(fosite),
INTENT(INOUT) :: Sim
122 TYPE(Dict_TYP),
POINTER :: config
123 TYPE(Dict_TYP),
POINTER :: mesh, physics, fluxes, boundary, grav,&
124 sources, timedisc, datafile, cooling, &
125 rotframe, pmass, self, damping
128 csiso = sqrt(rg/mu*t_init)
130 orp = 2.*pi/(sqrt(gn*mbh/rmax**3.))
136 "meshtype" / midpoint, &
141 "xmin" / log(rmin/gpar), &
142 "xmax" / log(rmax/gpar), &
149 "decomposition" / (/ -1, 1, 1/), &
152 "output/position_vector" / 1, &
168 "southern" / periodic, &
169 "northern" / periodic, &
170 "bottomer" / reflecting, &
171 "topper" / reflecting)
178 "variables" / primitive, &
179 "passive_limiting" / .false., &
180 "limiter" / vanleer, &
186 "stype" / rotating_frame)
191 "gtype" / pointmass, &
193 "output/position" / 1)
197 "stype" / disk_cooling, &
198 "output/Qcool" / 1, &
199 "rhomin" / 1.0e-30, &
205 "gtype" / spectral, &
206 "output/potential" / 1, &
214 "output/potential" / 1, &
216 "output/height" / 1, &
221 "cooling" / cooling, &
226 CALL setattr(sources,
"damping",damping)
230 "method" / modified_euler, &
232 "dtlimit" / 1.0e-50, &
233 "tol_rel" / 1.0e-3, &
235 "tol_abs" / (/ 1.0e-16, 1.0, 1.0e-16, 1.0 /), &
236 "output/energy" / 1, &
238 "stoptime" / (orp*tsim), &
241 "checkdata" / ior(check_nothing,check_tmin), &
242 "maxiter" / 100000000)
246 "fileformat" / xdmf, &
247 "filename" / (trim(odir) // trim(ofname)), &
251 "physics" / physics, &
254 "boundary" / boundary, &
255 "sources" / sources, &
256 "timedisc" / timedisc, &
257 "datafile" / datafile)
262 SUBROUTINE initdata(Mesh,Physics,Timedisc,Fluxes,Sources,pvar,cvar)
266 CLASS(mesh_base),
INTENT(IN) :: Mesh
267 CLASS(physics_base),
INTENT(INOUT) :: Physics
268 CLASS(timedisc_base),
INTENT(INOUT) :: Timedisc
269 CLASS(fluxes_base),
INTENT(INOUT) :: Fluxes
270 CLASS(sources_base),
POINTER :: Sources
271 CLASS(marray_compound),
INTENT(INOUT):: pvar,cvar
274 CLASS(sources_base),
POINTER :: sp
275 CLASS(sources_gravity),
POINTER :: gp
281 REAL,
DIMENSION(:,:,:),
POINTER :: r, Sigma
282 REAL,
DIMENSION(:,:,:,:),
POINTER :: r_vec
283 CHARACTER(LEN=32) :: mdisk_str
284 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX) &
292 r => mesh%RemapBounds(mesh%radius%bcenter(:,:,:))
293 r_vec => mesh%RemapBounds(mesh%posvec%bcenter(:,:,:,:))
295 sigma => mesh%RemapBounds(pvar%data4d(:,:,:,physics%DENSITY))
300 CALL random_number(rands)
302 CALL asl_random_create(rng, asl_randommethod_mt19937_64)
303 CALL asl_random_distribute_uniform(rng)
304 n = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)
305 CALL asl_random_generate_d(rng, n, rands)
307 rands = rands * noise * 2.0 + (1.0 - noise)
308 sigma = rands*(rmin/r(:,:,:))
311 CALL asl_random_destroy(rng)
315 mass = sum(mesh%volume%data3d(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX) * &
316 sigma(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX))
319 mesh%comm_cart,ierror)
322 sigma(:,:,:) = sigma(:,:,:) * mdisk / mass
325 SELECT TYPE(phys => physics)
327 pvar%data4d(:,:,:,physics%PRESSURE) = &
328 csiso*csiso*pvar%data4d(:,:,:,physics%DENSITY)/gamma
330 SELECT TYPE(pvarious => pvar)
332 CALL phys%UpdateSoundSpeed(pvarious)
338 IF (
ASSOCIATED(sp).EQV..false.)
RETURN 340 CLASS IS(sources_gravity)
347 CALL gp%UpdateGravity(mesh,physics,fluxes,pvar,0.0,0.0)
350 pvar%data2d(:,physics%XVELOCITY:physics%YVELOCITY) = 0.0
355 pvar%data4d(:,:,:,physics%XVELOCITY:physics%XVELOCITY+physics%VDIM-1) = &
356 timedisc%GetCentrifugalVelocity(mesh,physics,fluxes,sources,(/0.,0.,1./),gp%accel%data4d)
358 IF (mesh%FARGO.EQ.2) &
359 timedisc%w(:,:) = sqrt(physics%constants%GN*mbh/r(:,mesh%JMIN,:))-mesh%OMEGA*r(:,mesh%JMIN,:)
362 pvar%data4d(:,:,:,physics%YVELOCITY) = pvar%data4d(:,:,:,physics%YVELOCITY) &
363 - mesh%OMEGA*r(:,:,:)
366 CALL physics%Convert2Conservative(pvar,cvar)
369 SELECT TYPE(bwest => timedisc%Boundary%boundary(west)%p)
370 CLASS IS (boundary_custom)
371 CALL bwest%SetCustomBoundaries(mesh,physics, &
372 (/custom_nograd,custom_outflow,custom_kepler,custom_nograd/))
376 SELECT TYPE(beast => timedisc%Boundary%boundary(east)%p)
377 CLASS IS (boundary_custom)
378 CALL beast%SetCustomBoundaries(mesh,physics, &
379 (/custom_nograd,custom_outflow,custom_kepler,custom_nograd/))
382 CALL physics%Convert2Conservative(pvar,cvar)
384 WRITE (mdisk_str,
'(ES8.2)') mdisk
385 CALL mesh%Info(
" DATA-----> initial condition: Mestel's disk")
386 CALL mesh%Info(
" disk mass: " // trim(mdisk_str))
394 CLASS(timedisc_base),
INTENT(IN) :: Timedisc
395 INTEGER :: i, n, clock
396 INTEGER,
DIMENSION(:),
ALLOCATABLE :: seed
400 CALL random_seed(
size = n)
402 CALL system_clock(count=clock)
403 seed = clock + 37 * (/ (i - 1, i = 1, n) /)
405 seed = seed + timedisc%GetRank()
407 CALL random_seed(put = seed)
integer, save default_mpi_real
default real type for MPI
pure real function, dimension(size(ephir%data2d, dim=1)) omega(ephir, velocity)
subroutine initdata(Mesh, Physics, Fluxes, Timedisc)
subroutine makeconfig(Sim, config)
physics module for 1D,2D and 3D non-isothermal Euler equations
subroutine initrandseed(Physics)