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

Development #39

Open
wants to merge 75 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
a1f365f
Working couplings but bug in double counting north
phamkh Jul 22, 2024
88884e0
Merge branch 'development' into ApexCoupling
phamkh Jul 22, 2024
64f2365
Fixing folded hemisphere conductance
phamkh Jul 31, 2024
c8a40e0
Enabled Coupling compilation
AnonNick Jul 31, 2024
7b4222a
Update for engage
AnonNick Aug 7, 2024
fe38c10
fixes for engage
AnonNick Aug 8, 2024
40d8eac
Updated return fucntions
AnonNick Aug 8, 2024
dff827b
Bugfix resource allocation
AnonNick Aug 12, 2024
5f14b23
inp name scheme and secout bugfix
AnonNick Aug 12, 2024
6226f01
Updated module list derecho
AnonNick Aug 12, 2024
5266272
engage roor dir dependency and rollback module list
AnonNick Aug 12, 2024
3c164aa
Bigfixes standalone
AnonNick Aug 12, 2024
250d690
Parameter skip on coupling
AnonNick Aug 12, 2024
8459cf8
coupled option for standalone removed
AnonNick Aug 12, 2024
2dc342c
Merge branch 'development' into ApexCoupling
phamkh Aug 13, 2024
c417d1b
Added 644 file permission to duv.F
AnonNick Aug 13, 2024
86020c0
jouleheat.tex set to 644
AnonNick Aug 13, 2024
7d26d20
Merge branch 'dev_fix_aurora' into ApexCoupling
phamkh Aug 13, 2024
716b155
Added GPI and SOURCE automation
AnonNick Aug 19, 2024
cd55c04
Merge branch 'development' into ApexCoupling
phamkh Aug 21, 2024
5bae58a
Engage pbs modifications
AnonNick Aug 21, 2024
c1129b5
bigfixes
AnonNick Aug 23, 2024
9d64f37
enage interpolation scale up
AnonNick Aug 26, 2024
3bdca41
Add input parameters for O+
hzfywhn Aug 26, 2024
6ef33c9
Bugfixes
AnonNick Aug 28, 2024
7e2418f
Projectcode fix
AnonNick Aug 28, 2024
bc691d6
TIEGCMRUN call via pbs fix
AnonNick Aug 29, 2024
2bb73f8
removed log tar files
AnonNick Aug 29, 2024
53ae75f
FOR TESTING: reduced standalone res, default resource increase
AnonNick Aug 29, 2024
5dd8e5b
First pass at a gitignore file
wiltbemj Aug 29, 2024
e721552
Job chain bugfix
AnonNick Aug 30, 2024
57fc554
GSWM upscaling
AnonNick Aug 30, 2024
e78b1bf
Bugfix standalone tiegcm
AnonNick Aug 30, 2024
364d122
Removed oneway for GTR
AnonNick Sep 6, 2024
c10971f
PRIHIST fix
AnonNick Sep 6, 2024
99261f4
Merge branch 'dev_improve_oplus' into ApexCoupling
phamkh Sep 6, 2024
4208aa5
Adding a few rp updates
phamkh Sep 9, 2024
d557852
Merge branch 'ApexCoupling' into dev_engage
AnonNick Sep 11, 2024
860d325
Engage res upscaling change
AnonNick Sep 12, 2024
602c764
Bugfixes
AnonNick Sep 16, 2024
0585511
Merge pull request #19 from NCAR/dev_improve_oplus
hzfywhn Sep 16, 2024
f5a6ab2
Coupling fix + code refactor
AnonNick Sep 20, 2024
d017664
Merge branch 'development' into ApexCoupling
phamkh Sep 22, 2024
b4b8b08
Making GTR work with Voltron Plumbing Rework
phamkh Sep 23, 2024
1b985a8
Adding Ti and Te cap to input
phamkh Sep 26, 2024
a914eb0
Fix OP_PROD output
hzfywhn Oct 29, 2024
e1ca9c5
Merge pull request #24 from NCAR/dev_fix_op_prod
hzfywhn Oct 29, 2024
9fcc903
Bugfix for OneWay Mapping
phamkh Nov 12, 2024
1ba0b68
PFE uppdates
AnonNick Nov 13, 2024
5d97556
Merge pull request #25 from NCAR/dev_engage_test
AnonNick Nov 13, 2024
d743d3a
Merge branch 'development' into dev_engage
AnonNick Nov 13, 2024
5c9aae9
Merge branch 'development' into ApexCoupling
phamkh Nov 13, 2024
71a0558
Merge pull request #22 from NCAR/ApexCoupling
phamkh Nov 13, 2024
06492fd
Merge branch 'development' into dev_engage
AnonNick Nov 13, 2024
eb0266e
Merge pull request #23 from NCAR/dev_engage
AnonNick Nov 14, 2024
5153552
Merge pull request #28 from NCAR/dev_engage
AnonNick Nov 18, 2024
b0a5b62
PFE resource/ tgcmdata fix
AnonNick Nov 26, 2024
cd3b4b2
Merge pull request #30 from NCAR/dev_engage_test
AnonNick Nov 27, 2024
8548110
Change ring average parameters
hzfywhn Dec 2, 2024
28b98ef
Merge pull request #33 from NCAR/dev_ringave
hzfywhn Dec 2, 2024
5c5e923
Merge pull request #34 from NCAR/development
AnonNick Dec 2, 2024
62e89e6
Added Flags
AnonNick Jan 9, 2025
f2daa30
Added defaults for engage
AnonNick Jan 9, 2025
88c3b53
Merge pull request #35 from NCAR/dev_engage_test
AnonNick Jan 9, 2025
3426e9c
Merge pull request #31 from NCAR/dev_engage
hzfywhn Jan 9, 2025
594b8f5
Rewrite oplus (#21)
hzfywhn Jan 18, 2025
0cbe8ce
New reaction rate for NO chemistry (#29)
hzfywhn Jan 21, 2025
5cfd01c
Bugfix for dimension mismatch
hzfywhn Jan 23, 2025
4730ee7
Change description of output variable (#36)
hzfywhn Jan 23, 2025
b1fee19
Merge pull request #38 from NCAR/dev_file_perm
AnonNick Jan 23, 2025
05c759a
Merge pull request #37 from NCAR/dev_fix_oplus
hzfywhn Jan 23, 2025
84185ee
Update apex using IGRF14
hzfywhn Jan 24, 2025
00a84d2
Rewrite lamdas
hzfywhn Jan 25, 2025
3b9490f
Merge pull request #40 from NCAR/dev_update_igrf
hzfywhn Feb 6, 2025
d26dc04
Merge pull request #41 from NCAR/dev_rewrite_lamdas
hzfywhn Feb 10, 2025
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
Prev Previous commit
Next Next commit
Bugfixes
  • Loading branch information
AnonNick committed Aug 28, 2024
commit 6ef33c991daa4d37285ee2adc2d15055f4900c44
27 changes: 18 additions & 9 deletions tiegcmrun/tiegcmrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def interp3d(variable, inlev, inlat, inlon, outlev, outlat, outlon, extrap):
Returns:
ndarray: The interpolated variable with shape (noutlev, noutlat, noutlon).
"""

ninlev = len(inlev)
noutlev = len(outlev)
noutlat = len(outlat)
Expand Down Expand Up @@ -210,6 +211,7 @@ def interpic(fin, hres, vres, zitop, fout):
Returns:
None
"""
print(f"Interpolating primary file {fin} to create new primary file {fout} at horizontal resolution {hres} and vertical resolution {vres} with zitop {zitop}.")
# Some additional attributes for 4D fields
lower_cap = 1e-12
fill_top = ['TN', 'UN', 'VN', 'OP', 'TI', 'TE', 'N2D', 'O2P', 'TN_NM', 'UN_NM', 'VN_NM', 'OP_NM']
Expand Down Expand Up @@ -1160,9 +1162,9 @@ def select_source_defaults(options, option_descriptions):
if time_dhms[0] >= 1 and time_dhms[0] <81:
source_default = find_file(f"decsol_f{f107}*",TIEGCMDATA)
elif time_dhms[0] >= 81 and time_dhms[0] <173:
source_default = find_file(f'junsol_f{f107}*',TIEGCMDATA)
elif time_dhms[0] >= 173 and time_dhms[0] <265:
source_default = find_file(f'mareqx_f{f107}*',TIEGCMDATA)
elif time_dhms[0] >= 173 and time_dhms[0] <265:
source_default = find_file(f'junsol_f{f107}*',TIEGCMDATA)
elif time_dhms[0] >= 265 and time_dhms[0] <356:
source_default = find_file(f'seqex_f{f107}*',TIEGCMDATA)
elif time_dhms[0] >= 356:
Expand Down Expand Up @@ -2040,13 +2042,17 @@ def find_file(pattern, path):
return None


def alter_datetime_seconds(datetime_str, seconds):
def get_engage_start_time(datetime_str, seconds):
# Parse the input datetime string
dt = datetime.fromisoformat(datetime_str)

# Subtract the seconds using timedelta
new_dt = dt - timedelta(seconds=seconds)

if new_dt.time() != datetime.min.time():
# Adjust to the previous midnight
new_dt = datetime.combine(new_dt.date(), datetime.min.time())

# Return the new datetime as a string in the same format
return new_dt.isoformat()

Expand Down Expand Up @@ -2127,7 +2133,7 @@ def engage_parser(engage_parameters):
gcm_spin_up_time = int(o['gcm_spin_up_time'])
conda_env = o['conda_env']

start_date = alter_datetime_seconds(coupled_start_date,gamera_spin_up_time+gcm_spin_up_time)
start_date = get_engage_start_time(coupled_start_date,gamera_spin_up_time+gcm_spin_up_time)

o = engage_parameters["voltron"]
voltron_dtOut = int(float(o['output']['dtOut']))
Expand Down Expand Up @@ -2186,7 +2192,7 @@ def segment_inp_pbs(options, run_name, pbs, engage_options=None):
segment_options = copy.deepcopy(og_options)
segment_start = segment[0]
segment_stop = segment[1]
segment_options["simulation"]["job_name"] = job_name+"-{:02d}".format(segment_number)
segment_options["simulation"]["job_name"] = job_name+"-{:02d}".format(segment_number +1)
if segment_number == 0:
segment_options["inp"]["SOURCE"] = og_options["inp"]["SOURCE"]
segment_options["inp"]["SOURCE_START"] = og_options["inp"]["SOURCE_START"]
Expand Down Expand Up @@ -2235,10 +2241,11 @@ def segment_inp_pbs(options, run_name, pbs, engage_options=None):
f.write(f"sys.path.append('{TIEGCMHOME}/tiegcmrun')\n")
f.write("import tiegcmrun\n")
f.write("print(f'tiegcmrum from {tiegcmrun.__file__}')\n")
vertres_coupled, mres_coupled, nres_grid_coupled, STEP_coupled = resolution_solver(engage_options["horires_coupled"],engage_options)
horires_coupled = engage_options["horires_coupled"]
vertres_coupled, mres_coupled, nres_grid_coupled, STEP_coupled = resolution_solver(horires_coupled,engage_options)
SOURCE_coupling = os.path.join(os.path.dirname(segment_options["model"]["data"]["workdir"]),f'{engage_options["job_name"]}_prim.nc')
input_standalone = segment_options["inp"]["SECOUT"].strip("'")
f.write(f"tiegcmrun.interpic('{input_standalone}',{float(engage_options['horires_coupled'])},{float(vertres_coupled)},{float(segment_options['model']['specification']['zitop'])},'{SOURCE_coupling}')\n")
f.write(f"tiegcmrun.interpic('{input_standalone}',{float(horires_coupled)},{float(vertres_coupled)},{float(segment_options['model']['specification']['zitop'])},'{SOURCE_coupling}')\n")
interpolation_pbs = [f'conda activate {engage_options["conda_env"]}',f'python {interpolation_script}']
segment_options["job"]["job_chain"] = interpolation_pbs
pbs_script = create_pbs_scripts(segment_options,run_name,segment_number)
Expand Down Expand Up @@ -2274,8 +2281,10 @@ def engage_run(options, debug, coupling, engage):

in_prim = options_standalone["inp"]["SOURCE"]
out_prim = f'{options_standalone["model"]["data"]["workdir"]}/{options_standalone["simulation"]["job_name"]}_prim.nc'
options["inp"]["SOURCE"] = out_prim
interpic (in_prim,float(options_standalone['model']['specification']['horires']),float(options_standalone['model']['specification']['vertres']),float(options_standalone['model']['specification']['zitop']),out_prim)
options_standalone["inp"]["SOURCE"] = out_prim
horires_standalone= engage["horires"]
vertres_standalone, mres_standalone, nres_grid_standalone, STEP_standalone = resolution_solver(horires_standalone,engage)
interpic (in_prim,float(horires_standalone),float(vertres_standalone),float(options_standalone['model']['specification']['zitop']),out_prim)
standalone_inp_files,standalone_pbs_files, standalone_log_files,pristart_times, pristop_times=segment_inp_pbs(options_standalone, options_standalone["simulation"]["job_name"],pbs, engage)
#For coupled
pbs=False
Expand Down