Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: alperaltuntas/CESM
ref: cesm3_0_beta03_gui
ref: cesm3_0_beta06_gui
path: CESM
#submodules: recursive

Expand Down
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing to visualCaseGen

Thank you for your interest in contributing to visualCaseGen!

We welcome contributions that fix bugs, introduce new features, and enhance the usability, robustness, or performance of the tool. Here's how you can get involved:

## Getting Started

Fork the repository and clone your fork.

Follow the instructions in the visualCaseGen documentation to set up your local visualCaseGen environment: https://esmci.github.io/visualCaseGen/

Create a new branch for your feature or bugfix.

## What You Can Contribute

- Bug fixes and issue resolutions
- Enhancements to the GUI or core functionality
- Improved documentation or examples
- Code cleanup and test coverage

## Guidelines

- Follow the existing code style and structure.
- Include clear commit messages.
- Test your changes before submitting.
- Add tests if you introduce new features.
- Open a Pull Request with a short summary of your changes.
- If addressing an open issue, mention it in your PR (e.g., Closes #42).

## Reporting Issues

Please use the GitHub Issues page to report bugs or suggest features. When reporting:

- Include the version of visualCaseGen you used and details about your system environment.
- Provide clear steps to reproduce the issue.
- Include screenshots or logs if helpful.
2 changes: 1 addition & 1 deletion external/ipyfilechooser
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "visualCaseGen"
version = "0.1.1"
version = "0.1.3"
authors = [
{ name = "Alper Altuntas, NCAR", email = "[email protected]" }
]
Expand All @@ -9,7 +9,7 @@ readme = "README.md"
license = { file = "LICENSE.md" }
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: LGPL",
"License :: OSI Approved :: Apache 2.0 License",
"Programming Language :: Python",
"Framework :: Jupyter"
]
Expand All @@ -35,4 +35,4 @@ requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["ProConPy", "visualCaseGen"]
packages = ["ProConPy", "visualCaseGen"]
6 changes: 3 additions & 3 deletions tests/1_unit/test_cores_case_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def test_calc_cores_based_on_grid_cases():
assert CaseCreator._calc_cores_based_on_grid(33) == 1

# Test ideal cores amount
assert CaseCreator._calc_cores_based_on_grid(800*128) == 128
assert CaseCreator._calc_cores_based_on_grid(300*128) == 128

assert CaseCreator._calc_cores_based_on_grid(800*32) == 128
assert CaseCreator._calc_cores_based_on_grid(300*32) == 128

assert CaseCreator._calc_cores_based_on_grid(740 * 780) == 768
assert CaseCreator._calc_cores_based_on_grid(740 * 780) == 2048



16 changes: 9 additions & 7 deletions visualCaseGen/custom_widget_types/case_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,21 @@ def _apply_all_xmlchanges(self, do_exec):
xmlchange("NTASKS_OCN",cores, do_exec, self._is_non_local(), self._out)

@staticmethod
def _calc_cores_based_on_grid( num_points, min_points_per_core = 32, max_points_per_core = 800, ideal_multiple_of_cores_used = 128):
def _calc_cores_based_on_grid( num_points, min_points_per_core = 32, max_points_per_core = 300, ideal_multiple_of_cores_used = 128):
"""Calculate the number of cores based on the grid size."""


min_cores = math.ceil(num_points/max_points_per_core)
max_cores = math.ceil(num_points/min_points_per_core)
max_cores = math.ceil(num_points/min_points_per_core)

# If min_cores is less than the first multiple of ideal cores, just return the min_cores
if max_cores < ideal_multiple_of_cores_used:
return min_cores

# Request a multiple of the entire core (ideal_multiple_of_cores_used) starting from the min
ideal_cores = ((min_cores + ideal_multiple_of_cores_used - 1) // ideal_multiple_of_cores_used) * ideal_multiple_of_cores_used
if ideal_cores <= max_cores:
return ideal_cores
else:
return (max_cores+min_cores)//2
return ideal_cores


def _apply_user_nl_changes(self, model, var_val_pairs, do_exec, comment=None, log_title=True):
"""Apply changes to a given user_nl file."""
Expand Down Expand Up @@ -586,7 +588,7 @@ def _apply_mom_namelist_changes(self, do_exec):
# Determine timesteps based on the grid resolution (assuming coupling frequency of 1800.0 sec):
res_x = float(cvars['OCN_LENX'].value) / int(cvars["OCN_NX"].value)
res_y = float(cvars['OCN_LENY'].value) / int(cvars["OCN_NY"].value)
dt = 600.0 * min(res_x,res_y) # A 1-deg grid should have ~600 sec tstep (a safe value)
dt = 7200.0 * min(res_x,res_y) # A 1-deg grid should have ~600 sec tstep (a safe value)
# Make sure 1800.0 is a multiple of dt and dt is a power of 2 and/or 3:
dt = min((1800.0 / n for n in [2**i * 3**j for i in range(10) for j in range(6)] if 1800.0 % n == 0), key=lambda x: abs(dt - x))
# Try setting dt_therm to dt*4, or dt*3, or dt*3, depending on whether 1800.0 becomes a multiple of dt:
Expand Down
Loading