Sitelet https://github.com/jefflarkin/miniWeather/pull/1/commits/4303ec062a72f6de416bb15aa1f61316124f9c6f
Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c2190e6
Initial check-in of python/miniWeather.py
mhoemmen Mar 3, 2025
1a1120c
Progress on Python port; not done yet
mhoemmen Mar 4, 2025
609c239
Progress on porting to Python
mhoemmen Mar 4, 2025
bd6a3de
Progress on porting to Python
mhoemmen Mar 4, 2025
d5634d2
Progress on porting to Python (print statements)
mhoemmen Mar 4, 2025
3fe5584
All C++ code is now Python code
mhoemmen Mar 4, 2025
2967153
Run-time debugging of port
mhoemmen Mar 4, 2025
3d9794e
More run-time debugging
mhoemmen Mar 4, 2025
6762e76
More run-time debugging
mhoemmen Mar 4, 2025
880ee6a
It runs to completion without errors
mhoemmen Mar 5, 2025
01e45bc
Debugging Python (C is OK)
mhoemmen Mar 6, 2025
2d4f752
Remove some Python / C diffs
mhoemmen Mar 6, 2025
f9b94f6
Make Python flux like C flux
mhoemmen Mar 6, 2025
52e035b
Make direction_switch the same; verify
mhoemmen Mar 6, 2025
6506342
Reconcile more, but no change in results
mhoemmen Mar 6, 2025
53dbd0e
Reconcile more, but no change in results
mhoemmen Mar 6, 2025
4c6fd20
Reconcile collision; didn't help
mhoemmen Mar 6, 2025
8dd07fb
More reconciling: abs -> math.fabs in set_halo_values_x
mhoemmen Mar 6, 2025
5ae15b1
Remove superfluous comments
mhoemmen Mar 6, 2025
bc5c387
Change Python to run THERMAL not INJECTION
mhoemmen Mar 7, 2025
81ae53d
Fix MPI_Info_dup error in C output
mhoemmen Mar 10, 2025
da28c55
C: output updates
mhoemmen Mar 10, 2025
a3cdf1f
C: debug output to stderr not stdout
mhoemmen Mar 10, 2025
79212d0
C: Add build script that works for me
mhoemmen Mar 10, 2025
953601e
Python: Starting on netcdf output
mhoemmen Mar 10, 2025
185fcaf
Python: netcdf output 2
mhoemmen Mar 10, 2025
5c2206a
Python: netcdf output 3 (may have fixed it)
mhoemmen Mar 10, 2025
a1d2fc3
Fix Python output
mhoemmen Mar 10, 2025
07e0ccc
Update ncview home page
mhoemmen Mar 10, 2025
6cb325e
C: temporarily fix sim params
mhoemmen Mar 12, 2025
fc81e1e
C: output control (still need to test)
mhoemmen Mar 12, 2025
bb31b7b
C: Remove hard-coding of parameters
mhoemmen Mar 12, 2025
4303ec0
Python: x boundary injection hack
mhoemmen Mar 12, 2025
8c41a31
Build script: Change default model
mhoemmen Mar 17, 2025
74a519e
Python: Add option only to output theta (temp density)
mhoemmen Mar 17, 2025
9483925
Python: Remove injection boundary special case
mhoemmen Mar 17, 2025
a01bc20
Python: Restore default model
mhoemmen Mar 17, 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
Python: x boundary injection hack
For injection only, change the right boundary to be Dirichlet.

Add a C(++) build script for Linux + gcc.
  • Loading branch information
mhoemmen committed Mar 12, 2025
commit 4303ec062a72f6de416bb15aa1f61316124f9c6f
25 changes: 25 additions & 0 deletions c/build/cmake_linux_gnu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

SRC_ROOT=../../../src/miniWeather/c
OPT_FLAGS="-g -O2"

#PNETCDF_LIB=/usr/lib/x86_64-linux-gnu
#PNETCDF_LDFLAGS="-L${PNETCDF_LIB} -lpnetcdf"
PNETCDF_LDFLAGS="-lpnetcdf"
#PNETCDF_CXXFLAGS="-I$/usr/include"
PNETCDF_CXXFLAGS=""

DATA_SPEC="DATA_SPEC_INJECTION"

cmake \
-DCMAKE_CXX_COMPILER=mpic++ \
-DCMAKE_C_COMPILER=mpicc \
-DCMAKE_Fortran_COMPILER=mpif90 \
-DCXXFLAGS="${OPT_FLAGS} ${PNETCDF_CXXFLAGS}" \
-DLDFLAGS="${PNETCDF_LDFLAGS}" \
-DNX=200 \
-DNZ=100 \
-DSIM_TIME=1200 \
-DOUT_FREQ=10 \
-DDATA_SPEC="${DATA_SPEC}" \
${SRC_ROOT}
22 changes: 15 additions & 7 deletions python/miniWeather.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
# So, you'll want to have nx_glob be twice as large as nz_glob
nz_glob: int = 50 # Number of total cells in the z-direction
nx_glob: int = 2 * nz_glob # Number of total cells in the x-direction
sim_time: real = 700.0 # How many seconds to run the simulation
sim_time: real = 1000.0 # How many seconds to run the simulation
output_freq: real = 10.0 # How frequently to output data to file (in seconds)
#data_spec_int: int = DATA_SPEC_INJECTION # How to initialize the data
data_spec_int: int = DATA_SPEC_COLLISION #DATA_SPEC_THERMAL # How to initialize the data
data_spec_int: int = DATA_SPEC_INJECTION # How to initialize the data
#data_spec_int: int = DATA_SPEC_COLLISION #DATA_SPEC_THERMAL # How to initialize the data
# ///////////////////////////////////////////////////////////////////////////////////////
# // END USER-CONFIGURABLE PARAMETERS
# ///////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -507,10 +507,18 @@ def set_halo_values_x(
# //////////////////////////////////////////////////////
for ll in range(NUM_VARS):
for k in range(nz):
state[ll,hs+k,0 ] = state[ll,hs+k,nx+hs-2];
state[ll,hs+k,1 ] = state[ll,hs+k,nx+hs-1];
state[ll,hs+k,nx+hs ] = state[ll,hs+k,hs ];
state[ll,hs+k,nx+hs+1] = state[ll,hs+k,hs+1 ];
if data_spec_int == DATA_SPEC_INJECTION:
# Dirichlet boundary on the right ONLY avoids
# spurious reflections on the right and four corners.
# This should not be considered physical and does not
# conserve energy (but injection doesn't anyway).
state[ll,hs+k,nx+hs ] = 0.0
state[ll,hs+k,nx+hs+1] = 0.0
else:
state[ll,hs+k,0 ] = state[ll,hs+k,nx+hs-2]
state[ll,hs+k,1 ] = state[ll,hs+k,nx+hs-1]
state[ll,hs+k,nx+hs ] = state[ll,hs+k,hs ]
state[ll,hs+k,nx+hs+1] = state[ll,hs+k,hs+1 ]

if data_spec_int == DATA_SPEC_INJECTION:
if myrank == 0:
Expand Down