80 REAL,
PARAMETER :: gn = 6.67384e-11
81 REAL,
PARAMETER :: year = 3.15576e+7
82 REAL,
PARAMETER :: parsec = 3.0857e+16
83 REAL,
PARAMETER :: au = 1.49598e+11
84 REAL,
PARAMETER :: msun = 1.989e+30
85 REAL,
PARAMETER :: rg = 8.31
87 REAL,
PARAMETER :: simtime = 1.0e+4*year
88 REAL,
PARAMETER :: mbh = 1.0e+7*msun
89 REAL,
PARAMETER :: mratio = 0.1
90 REAL,
PARAMETER :: mdisk = mratio*mbh
91 REAL,
PARAMETER :: temp = 100.0
92 REAL,
PARAMETER :: noise = 0.3
94 INTEGER,
PARAMETER :: phys = euler
95 REAL,
PARAMETER :: mu = 6.02e-4
96 REAL,
PARAMETER :: gamma = 1.4
97 REAL,
PARAMETER :: beta_vis = 1.0e-3
99 REAL,
PARAMETER :: rmin = 5.0e-2 * parsec
100 REAL,
PARAMETER :: rmax = 1.e+0 * parsec
101 REAL,
PARAMETER :: rgeo = 1.0 * parsec
102 INTEGER,
PARAMETER :: mgeo = logcylindrical
103 INTEGER,
PARAMETER :: xres = 64
104 INTEGER,
PARAMETER :: yres = 128
105 INTEGER,
PARAMETER :: zres = 1
107 INTEGER,
PARAMETER :: onum = 100
108 CHARACTER(LEN=256),
PARAMETER :: &
109 ofname =
'markward', &
112 CLASS(
fosite),
ALLOCATABLE :: sim
118CALL asl_library_initialize()
124CALL initdata(sim%Timedisc,sim%Mesh,sim%Physics,sim%Fluxes,sim%Sources)
129CALL asl_library_finalize()
138 TYPE(dict_typ),
POINTER :: config
141 TYPE(dict_typ),
POINTER :: mesh,boundary,timedisc,datafile,&
142 sources,fluxes,grav,physics,&
147 "output/bccsound" / 1, &
155 "variables" / primitive, &
156 "limiter" / vanleer, &
160 "meshtype" / midpoint, &
165 "xmin" / log(rmin/parsec), &
166 "xmax" / log(rmax/parsec), &
174 "decomposition" / (/-1,1,1/), &
175 "output/volume" / 1 )
178 "western" / custom, &
179 "eastern" / custom, &
180 "southern" / periodic, &
181 "northern" / periodic, &
182 "bottomer" / reflecting, &
183 "topper" / reflecting)
189 "output/height" / 1, &
190 "self/gtype" / spectral, &
192 "pmass/gtype" / pointmass, &
193 "pmass/potential" / newton, &
194 "pmass/mass" / mbh, &
195 "pmass/outbound" / 1)
199 "stype" / disk_cooling, &
204 "rhomin" / 1.0e-30, &
209 "stype" / viscosity, &
211 "dynconst" / beta_vis, &
212 "output/stress" / 1, &
213 "output/dynvis" / 1, &
214 "output/kinvis" / 1, &
219 "diskcooling" / cooling, &
226 "tol_rel" / 1.0e-3, &
228 "stoptime" / simtime, &
229 "dtlimit" / 1.0e-4, &
232 "maxiter" / 2000000000)
237 CALL setattr(timedisc,
"tol_abs", (/1.0e-3, 1.0e-1, 1.0e-01, 1.0e+10/))
238 CALL setattr(timedisc,
"output/xmomentum", 0)
239 CALL setattr(timedisc,
"output/ymomentum", 0)
240 CALL setattr(timedisc,
"output/energy", 0)
241 CALL setattr(timedisc,
"output/rhs", 0)
242 CALL setattr(timedisc,
"output/external_sources", 0)
244 CALL sim%Error(
"MakeConfig",
"Physics model not supported.")
249 "fileformat" / vtk, &
250 "filename" /
"mestel", &
255 "physics" / physics, &
258 "boundary" / boundary, &
259 "sources" / sources, &
260 "timedisc" / timedisc, &
261 "datafile" / datafile)
266 SUBROUTINE initdata(Timedisc,Mesh,Physics,Fluxes,Sources)
272 CLASS(timedisc_base),
INTENT(INOUT) :: Timedisc
273 CLASS(mesh_base),
INTENT(IN) :: Mesh
274 CLASS(physics_base),
INTENT(INOUT) :: Physics
275 CLASS(fluxes_base),
INTENT(INOUT) :: Fluxes
276 CLASS(sources_list),
ALLOCATABLE,
INTENT(INOUT) :: Sources
281 CLASS(marray_base),
ALLOCATABLE :: rands,Sigma
286 CHARACTER(LEN=20) :: mdisk_str
292 IF (
ALLOCATED(sources)) &
293 sp => sources%GetSourcesPointer(gravity)
294 IF (.NOT.
ASSOCIATED(sp)) &
295 CALL physics%Error(
"mestel::InitData",
"no gravity term initialized")
298 ALLOCATE(rands,sigma)
299 rands = marray_base()
302 CALL random_number(rands%data1d)
304 CALL asl_random_create(rng, asl_randommethod_mt19937_64)
305 CALL asl_random_distribute_uniform(rng)
306 n = (mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)
307 CALL asl_random_generate_d(rng, n, rands%data1d)
308 CALL asl_random_destroy(rng)
310 rands%data1d(:) = rands%data1d(:) * noise * 2.0 + (1.0 - noise)
313 sigma = marray_base()
314 sigma%data1d(:) = rands%data1d(:) * rmin/mesh%radius%data2d(:,2)
317 mass = sum(mesh%volume%data1d(:)*sigma%data1d(:),mask=mesh%without_ghost_zones%mask1d(:))
319 CALL mpi_allreduce(mpi_in_place,mass,1,default_mpi_real,mpi_sum, &
320 mesh%comm_cart,ierror)
324 SELECT TYPE(bwest => timedisc%Boundary%boundary(west)%p)
325 CLASS IS (boundary_custom)
326 CALL bwest%SetCustomBoundaries(mesh,physics, &
327 (/custom_nograd,custom_outflow,custom_kepler,custom_nograd/))
331 SELECT TYPE(beast => timedisc%Boundary%boundary(east)%p)
332 CLASS IS (boundary_custom)
333 CALL beast%SetCustomBoundaries(mesh,physics, &
334 (/custom_reflect,custom_reflect,custom_logexpol,custom_reflect/))
337 SELECT TYPE (pvar => timedisc%pvar)
340 pvar%density%data1d(:) = sigma%data1d(:) * mdisk / mass
342 CALL gp%UpdateGravity(mesh,physics,fluxes,pvar,0.0,0.0)
345 pvar%velocity%data4d(:,:,:,1:physics%VDIM) = &
346 timedisc%GetCentrifugalVelocity(mesh,physics,fluxes,sources,(/0.,0.,1./),gp%accel%data4d)
349 IF (mesh%OMEGA.GT.0.0) &
350 pvar%velocity%data2d(:,2) = pvar%velocity%data2d(:,2) - mesh%OMEGA*mesh%radius%data2d(:,2)
352 pvar%pressure%data1d(:) = physics%constants%RG/physics%MU * temp * pvar%density%data1d(:)
354 CALL physics%Error(
"mestel::InitData",
"unsupported state vector")
357 IF (mesh%fargo%GetType().EQ.2) &
358 timedisc%w(:,:) = sqrt(physics%constants%GN*(mbh/mesh%radius%bcenter(:,mesh%JMIN,:)))
360 CALL physics%Convert2Conservative(timedisc%pvar,timedisc%cvar)
363 WRITE (mdisk_str,
'(ES10.2)') mdisk/msun
364 CALL mesh%Info(
" DATA-----> initial condition: Mestel's disk")
365 CALL mesh%Info(
" disk mass: " // trim(mdisk_str) //
" M_sun")
367 DEALLOCATE(rands,sigma)
373 CLASS(physics_base),
INTENT(IN) :: Physics
374 INTEGER :: i, n, clock
375 INTEGER,
DIMENSION(:),
ALLOCATABLE :: seed
379 CALL random_seed(
size = n)
381 CALL system_clock(count=clock)
382 seed = clock + 37 * (/ (i - 1, i = 1, n) /)
384 seed = seed + physics%GetRank()
386 CALL random_seed(put = seed)
subroutine initdata(Mesh, Physics, Fluxes, Timedisc)
subroutine makeconfig(Sim, config)
subroutine initrandseed(Physics)
physics module for 1D,2D and 3D non-isothermal Euler equations
generic source terms module providing functionaly common to all source terms
generic gravity terms module providing functionaly common to all gravity terms