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

Can I differentiate this function? #603

Open
sjj199405 opened this issue Jul 19, 2023 · 0 comments
Open

Can I differentiate this function? #603

sjj199405 opened this issue Jul 19, 2023 · 0 comments

Comments

@sjj199405
Copy link

def gasrt1(MU, WAVENO, SFCTEMP, SFCEMIS, NLEV, TEMP, TAU, COALB): ###与我们的计算是一致的
RAD1UP = np.zeros(NLEV)
RAD0DN = np.zeros(NLEV)
PLANCK0 = 1.1911E-5 * WAVENO3 / (np.exp(1.4388 * WAVENO / TEMP[0]) - 1)
for i in range(NLEV-1):
PLANCK1 = 1.1911E-5 * WAVENO
3 / (np.exp(1.4388 * WAVENO / TEMP[i+1]) - 1)
TAUO = TAU[i] / MU
TRANS = np.exp(-TAUO)
DELPLANCK = (PLANCK1 - PLANCK0) / TAUO
RAD0DN1 = RAD0DN[i] * TRANS + COALB[i] * (PLANCK1 - DELPLANCK - TRANS * (PLANCK1 - DELPLANCK * (1.0 + TAUO)))
RAD0DN[i+1]=RAD0DN1
PLANCK0 = PLANCK1
PLANCKSFC = 1.1911E-5 * WAVENO3 / (np.exp(1.4388 * WAVENO / SFCTEMP) - 1)
RAD1UP0 = SFCEMIS * PLANCKSFC + RAD0DN1 * (1 - SFCEMIS)
RAD1UP[-1]=RAD1UP0
PLANCK1 = 1.1911E-5 * WAVENO
3 / (np.exp(1.4388 * WAVENO / TEMP[NLEV-1]) - 1)
for i in range(NLEV-2, -1, -1):
PLANCK0 = 1.1911E-5 * WAVENO**3 / (np.exp(1.4388 * WAVENO / TEMP[i]) - 1)
TAUO = TAU[i] / MU
TRANS = np.exp(-TAUO)
DELPLANCK = (PLANCK1 - PLANCK0) / TAUO
RAD1UP0 = RAD1UP0 * TRANS + COALB[i] * (PLANCK0 + DELPLANCK - TRANS * (PLANCK0 + DELPLANCK * (1.0 + TAUO)))
RAD1UP[i] = RAD1UP0
PLANCK1 = PLANCK0
return RAD1UP, RAD0DN

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

No branches or pull requests

2 participants
@sjj199405 and others