HaoZhongkai / GNOT

26 stars 14 forks source link

Implementation with Geo-FNO NACA dataset #7

Closed 270415 closed 3 months ago

270415 commented 4 months ago

Hi dear author,

Thanks for your paper and implementation. Possibly a silly question, could you please provide more specific details about running the model using the NACA dataset? As for the NACA dataset used in FNO(-interp), directly using mask and Mach number as input and output may not fit into the model architecture.

HaoZhongkai commented 4 months ago

Could you please provide more details? In my opinion, NACA will be a simple dataset and you can directly pad it to a regular grid.

270415 commented 4 months ago

Thank you so much for your reply. My doubt is that NACA(-interp) dataset doesn't seem to fit the input format in this paper since it only has mask&Mach number: Dataset = [ [X1, Y1, Theta1, Inputs_funcs1], [X2, Y2, Theta2, Inputs_funcs2], ... ] Maybe I haven't figured it out yet, should I use FNOdataset for this or any other method? Thanks in advance.

HaoZhongkai commented 4 months ago

Yes, I think you need to use FNOdataset class.

JRowbottomGit commented 3 months ago

Dear HaoZhongkai and picpic117, I also had some trouble running GNOT with the FNOdataset class for Darcy2d and NS2d from the FNO paper. I noticed FNOdataset is missing some of the attributes and methods of MIOdataset that raises quite a few bugs when running in the training pipeline. Before I spend time debugging the necessary fixes can I ask do you have a runable version of the FNOdataset class that I could use? Also can I ask would one expect a difference in model performance between using FNO and MIOdataset classes and which was used for the results in the published paper. Many thanks! James

HaoZhongkai commented 3 months ago

Hi, I'm not sure what bugs you meet. But you could try CGPT model on Darcy2d/NS2d and check whether it works.

JRowbottomGit commented 3 months ago

Dear Zhongkai Hao,

thank you for your response. Model CGPTNO does run for darcy2d. Could I ask your advice on data format/shapes.

i) Running model CGPTNO with data: train_mat = loadmat(data_path + 'piececonst_r241_N1024_smooth1.mat') sol = train_mat['sol'] #(1024, 241, 241) coeff = train_mat['coeff'] #(1024, 241, 241) train_dataset = FNODataset(coeff, sol, name=args.dataset, train=True, test=False, normalize_y=False, y_normalizer=None, normalize_x = False) effectively gives 241 nodes with input dim 242=241+1=CGPTNO(trunk_size=trunk_size + theta_size..

ii) whereas running something like: x_pos = np.linspace(0, 1, coeff.shape[1]) y_pos = np.linspace(0, 1, coeff.shape[2]) vec_pos = np.stack(np.meshgrid(x_pos, y_pos), axis=-1).reshape(-1, 2) repeated_pos = np.repeat(vec_pos[np.newaxis, :, :], coeff.shape[0], axis=0) vec_coeff = coeff.reshape(coeff.shape[0], -1)[..., np.newaxis] train_pos_coeff = np.concatenate([repeated_pos, vec_coeff], axis=-1) vec_sol = sol.reshape(sol.shape[0], -1)[..., np.newaxis] train_dataset = FNODataset(train_pos_coeff, vec_sol, name=args.dataset, train=True, test=False, normalize_y=False, y_normalizer=None, normalize_x = False) effectively gives 58081=2412 nodes with input dim 3 and the models runs much much slower**.

I did this because the FNODataset has comment 2. X: concat of [pos, a], , we directly reshape them into a B*N*C array and it feels more aligned with the paper to feed concatenated positions and features to the CGPTNO model.

Appreciated to hear your thoughts on which is the correct approach here or if you have similar code to share.

Best wishes James

HaoZhongkai commented 3 months ago

Hi James, I think (ii) is the correct way to run the code. If you run the full resolution of the Darcy2d dataset, it will be very slow. GNOT has a great advantage on small meshes but is not that efficient for dense regular grids.

best, Zhongkai

JRowbottomGit commented 3 months ago

Thanks for your reply HaoZhongkai, that's understood as the model is more a graph based approach. Appreciate your time.

L-I-M-I-T commented 2 months ago

Dear Zhongkai Hao and JRowbottomGit, I have some problem about the ns2d-time experiment here. Should I concatenate the coordinates (2-d) with the first 10 frames as input X thus I get the shape of [batch_size, 6464, 12] and use the last 10 frames as output Y thus I get the shape of [batch_size, 6464, 10] ? In this case, there will be only trunk_mlp and no branch_mlp since there is no Inputs_funcs ?