1 | from dynamico import getargs |
---|
2 | getargs.add("--nx", type=int, default=64, |
---|
3 | help="number of points along the x axis") |
---|
4 | getargs.add("--ny", type=int, default=0, |
---|
5 | help="number of points along the y axis, defaults to nx") |
---|
6 | getargs.add("--Lx", type=float, default=0., |
---|
7 | help="domain size along x, defaults to nx") |
---|
8 | getargs.add("--Ly", type=float, default=0., |
---|
9 | help="domain size along y, defaults to ny") |
---|
10 | |
---|
11 | args = getargs.parse() |
---|
12 | for arg in vars(args): print arg, getattr(args, arg) |
---|
13 | |
---|
14 | from dynamico import meshes |
---|
15 | import numpy as np |
---|
16 | import netCDF4 as cdf |
---|
17 | import argparse |
---|
18 | |
---|
19 | nx, ny, Lx, Ly, llm, nqdyn = args.nx, args.ny,args.Lx, args.Ly, 1, 1 |
---|
20 | if ny==0 : ny=nx |
---|
21 | if Lx==0. : Lx=nx |
---|
22 | if Ly==0. : Ly=ny |
---|
23 | |
---|
24 | dx,dy=Lx/nx,Ly/ny |
---|
25 | mesh = meshes.Cartesian_Mesh(nx,ny,llm,nqdyn,Lx,Ly,0.) |
---|
26 | print('Successfully initialized Cartesian mesh') |
---|
27 | mesh.ncwrite('cart_%03d_%03d.nc'%(nx,ny)) |
---|
28 | print('Successfully written Cartesian mesh to NetCDF File') |
---|