A craft of Airfoil-CNN
Airfoil CNN
This code is personal version network of paper Prediction of Aerodynamic Flow Fields Using Convolutional Neural Networks.
Mapping the airfoil to aerodynamic flow fields use the network in the paper.
Environment
Conda: 4.10.3
Python: 3.9.6
PyTorch: 1.9.0
torchvision: 0.10.0
Dataset
The dataset is in file folder data.
test.txt
: a txt record the type of aircraft, angle of attack, Reynolds Number as for test datasettrain.txt
: a txt record the type of aircraft, angle of attack, Reynolds Number as for train datasetimage
: a image file folderinput
: the Signed Distance Function(SFD) of airfoiloutput
: the aerodynamic flow fields(p,u,v)predict
: the predict image generated by the trained model
Model
model_train.pt
: save the parameters of model after training.
Structures such as the checkpoint code.
def checkpoint(model_path, model, lr, optimizer, epoch):
# model_path = '../model/model_epoch_{}.pt'.format(epoch)
state = { 'model': model.state_dict(), 'optimizer': optimizer.state_dict(), 'epoch': epoch, 'lr': lr}
torch.save(state, model_path)
print('Checkpoint saved at epoch {}'.format(epoch))
Code
All the code in file folder src
. The function of the code like the name.
Run
cd src
python train.py --image_path='../data/image/' --train_path='../data/train.txt' --lr=5e-3 --batch_size=64 --epochs=50 --rate=0.5
TensorBoard
tensorboard --logdir=runs
GitHub
You can see my code in there https://github.com/Zongziyu/Airfoil-CNN/
还没有评论,来说两句吧...