42 REAL,
PARAMETER :: gn = 1.0
43 REAL,
PARAMETER :: au = 1.0
44 REAL,
PARAMETER :: msun = 1.0
46 REAL,
PARAMETER :: tsim = 10
47 REAL,
PARAMETER :: valpha = 1e-3
51 REAL,
PARAMETER :: mbh1 = 0.4465*msun
52 REAL,
PARAMETER :: mbh2 = 0.4465*msun
54 REAL,
PARAMETER :: excent = 0.0
55 REAL,
PARAMETER :: semma = 0.224*au
57 REAL,
PARAMETER :: rgap = 2.5*semma
61 REAL,
PARAMETER :: mu = 2.35e-3
62 REAL,
PARAMETER :: rg = 8.31447
64 REAL,
PARAMETER :: gpar = au
65 REAL,
PARAMETER :: rmin = 1.5*semma
66 REAL,
PARAMETER :: rmax = 5.0*au
67 INTEGER,
PARAMETER :: xres = 128
68 INTEGER,
PARAMETER :: yres = 128
69 INTEGER,
PARAMETER :: zres = 1
71 INTEGER,
PARAMETER :: onum = 100
72 CHARACTER(LEN=256),
PARAMETER &
74 CHARACTER(LEN=256),
PARAMETER &
77 CLASS(
fosite),
ALLOCATABLE :: sim
85 CALL initdata(sim%Mesh, sim%Physics, sim%Timedisc, sim%Fluxes, sim%Sources)
95 CLASS(fosite),
INTENT(INOUT) :: Sim
96 TYPE(Dict_TYP),
POINTER :: config
97 TYPE(Dict_TYP),
POINTER :: mesh, physics, fluxes, boundary,grav, &
98 sources, binary, vis, timedisc, datafile, &
102 omega = sqrt(gn*(mbh1+mbh2)/semma)/semma
103 period = 2.*pi /
omega 109 "meshtype" / midpoint, &
110 "geometry" / logcylindrical, &
115 "xmin" / log(rmin/gpar), &
116 "xmax" / log(rmax/gpar), &
125 "decomposition" / (/ -1, 1, 1/), &
127 IF (
omega.GT.0.0)
CALL setattr(mesh,
"omega",
omega)
131 "problem" / euler_isotherm, &
132 "units" / geometrical,&
133 "output/fcsound" / 1, &
134 "output/bccsound" / 1)
141 "southern" / periodic, &
142 "northern" / periodic, &
143 "bottomer" / reflecting,&
144 "topper" / reflecting &
152 "variables" / primitive, &
153 "limiter" / vanleer, &
159 "stype" / viscosity, &
160 "vismodel" / alpha, &
162 "dynconst" / valpha, &
166 "stype" / rotating_frame)
170 "gtype" / pointmass_binary, &
175 "output/binpos" / 1, &
176 "output/omega" / 1, &
177 "semimayoraxis" / semma)
185 "output/height" / 1, &
186 "output/potential"/ 1, &
199 "stoptime" / (period*tsim), &
200 "dtlimit" / 1.0e-40,&
201 "tol_rel" / 1.0e-3, &
202 "tol_abs" / (/ 1.0e-08, 1., 1.0e-08 /), &
204 "maxiter" / 100000000)
208 "fileformat" / vtk, &
209 "filename" / (trim(odir) // trim(ofname)), &
213 "physics" / physics, &
216 "boundary" / boundary, &
217 "sources" / sources, &
218 "timedisc" / timedisc, &
219 "datafile" / datafile)
223 SUBROUTINE initdata(Mesh,Physics,Timedisc,Fluxes,Sources)
227 CLASS(mesh_base),
INTENT(IN) :: Mesh
228 CLASS(physics_base),
INTENT(INOUT) :: Physics
229 CLASS(timedisc_base),
INTENT(INOUT) :: Timedisc
230 CLASS(fluxes_base),
INTENT(INOUT) :: Fluxes
231 CLASS(sources_base),
POINTER :: Sources
234 CLASS(sources_base),
POINTER :: sp
235 CLASS(sources_gravity),
POINTER :: gp
241 REAL,
DIMENSION(:,:,:),
POINTER :: r, Sigma
242 REAL,
DIMENSION(:,:,:,:),
POINTER :: r_faces
243 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX) :: bccsound
244 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,6) :: fcsound
245 CHARACTER(LEN=32) :: info_str
248 r => mesh%RemapBounds(mesh%radius%bcenter)
249 r_faces => mesh%RemapBounds(mesh%radius%faces)
252 bccsound = hratio*sqrt((mbh1+mbh2)*physics%constants%GN/r(:,:,:))
254 fcsound(:,:,:,i) = hratio*sqrt((mbh1+mbh2)*physics%constants%GN/r_faces(:,:,:,i))
258 SELECT TYPE (phys => physics)
260 CALL phys%SetSoundSpeeds(mesh,bccsound)
261 CALL phys%SetSoundSpeeds(mesh,fcsound)
264 CALL phys%Error(
"InitData",
"physics not supported")
269 SELECT TYPE(bwest => timedisc%Boundary%boundary(west)%p)
270 CLASS IS (boundary_custom)
271 CALL bwest%SetCustomBoundaries(mesh,physics, &
272 (/custom_nograd,custom_outflow,custom_kepler/))
274 SELECT TYPE(beast => timedisc%Boundary%boundary(east)%p)
275 CLASS IS (boundary_custom)
276 CALL beast%SetCustomBoundaries(mesh,physics, &
277 (/custom_nograd,custom_outflow,custom_kepler/))
283 IF (
ASSOCIATED(sp).EQV..false.)
RETURN 285 CLASS IS(sources_gravity)
291 IF (.NOT.
ASSOCIATED(sp))
CALL physics%Error(
"mmsn::InitData",
"no gravity term initialized")
298 SELECT TYPE (pvar => timedisc%pvar)
301 pvar%density%data3d(:,:,:) =
fgap(r(:,:,:),rgap)*sigma0*0.1*xscale*r(:,:,:)**(-1.5)
308 CALL gp%UpdateGravity(mesh,physics,fluxes,pvar,0.0,0.0)
309 pvar%velocity%data4d(:,:,:,1:physics%VDIM) = &
310 timedisc%GetCentrifugalVelocity(mesh,physics,fluxes,sources,(/0.,0.,1./),gp%accel%data4d)
313 pvar%velocity%data4d(:,:,:,2) = pvar%velocity%data4d(:,:,:,2) - mesh%OMEGA*r(:,:,:)
315 CALL physics%Error(
"mmsn::InitData",
"unsupported state vector")
319 CALL physics%Convert2Conservative(timedisc%pvar,timedisc%cvar)
321 IF (mesh%FARGO.EQ.2) &
322 timedisc%w(:,:) = sqrt(physics%constants%GN*(mbh1+mbh2)/mesh%radius%bcenter(:,mesh%JMIN,:))
325 CALL mesh%Info(
" DATA-----> initial condition: " //
"MMSN - Setup")
326 WRITE (info_str,
'(ES8.2)') xscale
327 CALL mesh%Info(
" disk mass: " // trim(info_str) //
" MMSN")
331 ELEMENTAL REAL FUNCTION fgap(R, Rgap)
333 REAL,
INTENT(IN) :: r, rgap
335 fgap = 1./(1. + exp(-(r-rgap)/(0.1*rgap)))
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 isothermal Euler equations
elemental real function fgap(R, Rgap)