MCPcopy Create free account
hub / github.com/DedalusProject/dedalus / __init__

Method __init__

dedalus/core/solvers.py:546–591  ·  view source on GitHub ↗
(self, problem, timestepper, enforce_real_cadence=100, warmup_iterations=10, profile=PROFILE_DEFAULT, parallel_profile=PARALLEL_PROFILE_DEFAULT, **kw)

Source from the content-addressed store, hash-verified

544 matrices = ['M', 'L']
545
546 def __init__(self, problem, timestepper, enforce_real_cadence=100, warmup_iterations=10, profile=PROFILE_DEFAULT, parallel_profile=PARALLEL_PROFILE_DEFAULT, **kw):
547 logger.debug('Beginning IVP instantiation')
548 # Setup timing and profiling
549 self.dist = problem.dist
550 self._bcast_array = np.zeros(1, dtype=float)
551 self.init_time = self.world_time
552 if profile or parallel_profile:
553 parallel_mkdir(PROFILE_DIRECTORY, comm=self.dist.comm)
554 self.profile = True
555 self.parallel_profile = parallel_profile
556 self.setup_profiler = cProfile.Profile()
557 self.warmup_profiler = cProfile.Profile()
558 self.run_profiler = cProfile.Profile()
559 self.setup_profiler.enable()
560 else:
561 self.profile = False
562 # Build subsystems and subproblems
563 super().__init__(problem, **kw)
564 # Build LHS matrices
565 self.build_matrices(self.subproblems, ['M', 'L'])
566 # Compute total modes
567 local_modes = sum([prod(sp.shape) for sp in self.subproblems])
568 self.total_modes = self.dist.comm.allreduce(local_modes, op=MPI.SUM)
569 # Create RHS handler
570 F_handler = self.evaluator.add_system_handler(iter=1, group='F')
571 for eq in problem.eqs:
572 F_handler.add_task(eq['F'])
573 F_handler.build_system()
574 self.F = F_handler.fields
575 # Initialize timestepper
576 if isinstance(timestepper, str):
577 timestepper = timesteppers.schemes[timestepper]
578 self.timestepper = timestepper(self)
579 # Attributes
580 self.sim_time = self.initial_sim_time = problem.time.allreduce_data_max(layout='g')
581 self.iteration = self.initial_iteration = 0
582 self.warmup_iterations = warmup_iterations
583 if np.isrealobj(self.dtype.type()):
584 self.enforce_real_cadence = enforce_real_cadence
585 else:
586 self.enforce_real_cadence = None
587 # Default integration parameters
588 self.stop_sim_time = np.inf
589 self.stop_wall_time = np.inf
590 self.stop_iteration = np.inf
591 logger.debug('Finished IVP instantiation')
592
593 @property
594 def sim_time(self):

Callers

nothing calls this directly

Calls 8

parallel_mkdirFunction · 0.85
zerosMethod · 0.80
add_system_handlerMethod · 0.80
build_systemMethod · 0.80
allreduce_data_maxMethod · 0.80
__init__Method · 0.45
build_matricesMethod · 0.45
add_taskMethod · 0.45

Tested by

no test coverage detected