Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: custom physical constants for each process #123

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

brian-rose
Copy link
Collaborator

Proof-of-concept addressing #120

Here we add a new attribute const to every Process object, which by default is a dictionary of all the standard physical constants.

User can then make modified copies of the dictionary and pass as input to new models.

Currently implemented only for the EBM. For example:

import climlab
from attrdict import AttrDict
e1 = climlab.EBM() 
const2 = AttrDict(e1.const)
const2['a'] *= 2.  # double the radius of the planet 
e2 = climlab.EBM(const=const2) 
e1.step_forward()
e2.step_forward()
# the heat transport is different due to the different sizes
print(e2.heat_transport - e1.heat_transport)

I don't necessarily think this is best implementation but just wanted to see if this works.

@brian-rose
Copy link
Collaborator Author

Note, this does not address the problem that the radiation codes (RRTMG, CAM3) set their own constants at Fortran level. That will require a deeper dive into the Fortran code.

@codecov-io
Copy link

Codecov Report

Merging #123 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #123   +/-   ##
=====================================
  Coverage       0%     0%           
=====================================
  Files          66     66           
  Lines        3547   3580   +33     
  Branches      316    316           
=====================================
- Misses       3546   3579   +33     
  Partials        1      1
Impacted Files Coverage Δ
climlab/model/column.py 0% <0%> (ø) ⬆️
climlab/convection/akmaev_adjustment.py 0% <0%> (ø) ⬆️
climlab/radiation/insolation.py 0% <0%> (ø) ⬆️
climlab/process/time_dependent_process.py 0% <0%> (ø) ⬆️
climlab/utils/thermo.py 0% <0%> (ø) ⬆️
climlab/solar/orbital_cycles.py 0% <0%> (ø) ⬆️
climlab/convection/convadj.py 0% <0%> (ø) ⬆️
climlab/radiation/radiation.py 0% <0%> (ø) ⬆️
climlab/dynamics/meridional_moist_diffusion.py 0% <0%> (ø) ⬆️
climlab/domain/axis.py 0% <0%> (ø) ⬆️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd6d075...e825a76. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants