-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
783 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
BoxLib backend for PyClaw | ||
========================= | ||
|
||
This backend uses the C++ version of the CCSE BoxLib_ library. To | ||
install BoxLib, `download BoxLib`_ and | ||
|
||
.. code-block:: sh | ||
git clone https://ccse.lbl.gov/pub/Downloads/BoxLib.git | ||
cd BoxLib/Src/Python | ||
python setup.py install --user | ||
.. _BoxLib: https://ccse.lbl.gov/BoxLib/index.html | ||
.. _`download BoxLib`: https://ccse.lbl.gov/Downloads/downloadBoxLib.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Main boxclaw package""" | ||
|
||
import os | ||
import logging, logging.config | ||
|
||
# Default logging configuration file | ||
_DEFAULT_LOG_CONFIG_PATH = os.path.join(os.path.dirname(__file__),'log.config') | ||
del os | ||
|
||
# Setup loggers | ||
logging.config.fileConfig(_DEFAULT_LOG_CONFIG_PATH) | ||
|
||
__all__ = [] | ||
|
||
# Module imports | ||
__all__.extend(['Controller','Dimension','Patch','Domain','Solution','State','CFL','riemann']) | ||
from .controller import Controller | ||
from clawpack.boxclaw.geometry import Patch, Domain | ||
from clawpack.pyclaw.geometry import Dimension | ||
from .solution import Solution | ||
from .state import State | ||
from .cfl import CFL | ||
|
||
__all__.extend(['ClawSolver1D','ClawSolver2D','ClawSolver3D','SharpClawSolver1D','SharpClawSolver2D','SharpClawSolver3D']) | ||
from .classic.solver import ClawSolver1D,ClawSolver2D,ClawSolver3D | ||
from .sharpclaw.solver import SharpClawSolver1D,SharpClawSolver2D,SharpClawSolver3D | ||
|
||
__all__.append('BC') | ||
from clawpack.pyclaw.solver import BC | ||
|
||
# Sub-packages | ||
import limiters | ||
from limiters import * | ||
__all__.extend(limiters.__all__) | ||
|
||
import plot | ||
__all__.append('plot') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
class CFL(object): | ||
"""Parallel CFL object, responsible for computing the | ||
Courant-Friedrichs-Lewy condition across all processes. | ||
""" | ||
|
||
def __init__(self, global_max): | ||
self._local_max = global_max | ||
self._global_max = global_max | ||
|
||
def get_global_max(self): | ||
r""" | ||
Compute the maximum CFL number over all processes for the current step. | ||
This is used to determine whether the CFL condition was | ||
violated and adjust the timestep. | ||
""" | ||
import boxlib | ||
self._reduce_vec.array = self._local_max | ||
self._global_max = boxlib.bl[0].ReduceRealMax(self._local_max) | ||
return self._global_max | ||
|
||
def get_cached_max(self): | ||
return self._global_max | ||
|
||
def set_local_max(self,new_local_max): | ||
self._local_max = new_local_max | ||
|
||
def update_global_max(self,new_local_max): | ||
import boxlib | ||
self._global_max = boxlib.bl[0].ReduceRealMax(new_local_max) | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python | ||
|
||
def configuration(parent_package='',top_path=None): | ||
from numpy.distutils.misc_util import Configuration | ||
config = Configuration('classic', parent_package, top_path) | ||
return config | ||
|
||
if __name__ == '__main__': | ||
from numpy.distutils.core import setup | ||
setup(**configuration(top_path='').todict()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
r""" | ||
Module containing the PetClaw solvers | ||
This file currently only exists so that these solvers have a different | ||
__module__ property, used by pyclaw.solver.Solver.__init__ to | ||
determine the containing claw_package to use. | ||
""" | ||
|
||
from __future__ import absolute_import | ||
from clawpack import pyclaw | ||
|
||
class ClawSolver1D(pyclaw.ClawSolver1D): | ||
r""" | ||
Parallel solver for 1D problems using classic Clawpack algorithms. | ||
""" | ||
|
||
__doc__ += pyclaw.util.add_parent_doc(pyclaw.ClawSolver1D) | ||
|
||
class ClawSolver2D(pyclaw.ClawSolver2D): | ||
r""" | ||
Parallel solver for 2D problems using classic Clawpack algorithms. | ||
""" | ||
|
||
__doc__ += pyclaw.util.add_parent_doc(pyclaw.ClawSolver2D) | ||
|
||
class ClawSolver3D(pyclaw.ClawSolver3D): | ||
r""" | ||
Parallel solver for 3D problems using classic Clawpack algorithms. | ||
""" | ||
|
||
__doc__ += pyclaw.util.add_parent_doc(pyclaw.ClawSolver3D) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
Module for BoxClaw controller class. | ||
""" | ||
|
||
from clawpack import pyclaw | ||
|
||
class Controller(pyclaw.controller.Controller): | ||
"""Parallel Controller Class""" | ||
|
||
__doc__ += pyclaw.util.add_parent_doc(pyclaw.controller.Controller) | ||
|
||
def __init__(self): | ||
super(Controller,self).__init__() | ||
self.output_format = 'multifab' | ||
|
||
def is_proc_0(self): | ||
import boxlib | ||
return boxlib.rank() == 0 | ||
|
||
def log_info(self, str): | ||
import logging | ||
if self.is_proc_0(): | ||
logging.info(str) | ||
else: | ||
pass |
Oops, something went wrong.