Implementation of forward PINN on Polymerization reaction dataset #1634
Unanswered
AbdullahElyas
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to implement forward PINN on Polymerization reaction dataset. The dataset is generated using CFD. There are two different domains defined:
2)Outer domain has a stationary reference frame
The PDE equation is different for both the domains. I am trying to calculate the loss from PDE residuals for both the domains. I have tried to separately calculate the PDE residuals within the pde(x,y) function and then added residuals from both the domains to get net residuals at each training point. My question is: Is there a better way anyone can suggest to implement this. Currently I am not getting right results.
I have defined a dummy hypercube geometry of dimension 6 as my input size is 6. I have used anchors to define the training points. Moreover, I have used the pointsetBC for providing the training dataset.
I am attaching the code here .I would appreciate any assistance you can provide.
Thanks
loading data function
def load_training_data(num):
loading data
data_X,data_Y,data_p = load_training_data(5000)
print(data_X.shape)
print(data_Y.shape)
ob_u = data_Y[:,0:1]
ob_v = data_Y[:,1:2]
ob_w = data_Y[:,2:3]
ob_p = data_Y[:,3:4]
ob_T = data_Y[:,4:5]
ob_I = data_Y[:,5:6]
ob_M = data_Y[:,6:7]
ob_xyt = data_X
ob_xyt2 = data_p
del data_X,data_Y
pde function for pde residual calculation
def pde(x, y):
xmin = [0, 0, 0, 0, 0, 0]
xmax = [1, 1, 1, 1, 1, 1]
hypercube = dde.geometry.Hypercube(xmin, xmax)
observe_u = dde.icbc.PointSetBC(ob_xyt, ob_u, component=0)
observe_v = dde.icbc.PointSetBC(ob_xyt, ob_v, component=1)
observe_w = dde.icbc.PointSetBC(ob_xyt, ob_w, component=2)
observe_p = dde.icbc.PointSetBC(ob_xyt, ob_p, component=3)
observe_T = dde.icbc.PointSetBC(ob_xyt, ob_T, component=4)
observe_I = dde.icbc.PointSetBC(ob_xyt, ob_I, component=5)
observe_M = dde.icbc.PointSetBC(ob_xyt, ob_M, component=6)
data = dde.data.PDE(
hypercube,
pde,
[observe_u,observe_v,observe_w,observe_p,observe_T,observe_I,observe_M],
num_domain=0,
num_boundary=0,
anchors=ob_xyt2
)
Set up early stopping. Monitor the loss value, stop training when loss stops improving by a certain amount.
early_stopping = EarlyStopping(min_delta=1e-5, patience=50)
checkpointer = dde.callbacks.ModelCheckpoint(
"..\checkpoint\model", verbose=1, save_better_only=True
)
Neural Network setup
layer_size = [6] + [50] * 6 + [7]
activation = "tanh"
initializer = "Glorot uniform"
net = dde.maps.FNN(layer_size, activation, initializer)
resampler = dde.callbacks.PDEPointResampler(period=100)
model = dde.Model(data, net)
Compile, train and save model
model.compile("adam", lr=1e-4, loss_weights=[1, 0.01, 0.01, 0.01,1,1,1,1,0.01,0.001,1,1])
model.restore("model-200.pt")
loss_history, train_state = model.train(
iterations=10000, display_every=1, disregard_previous_best=True, callbacks=[resampler,checkpointer,early_stopping])
model.save(save_path = ".\model2")
Beta Was this translation helpful? Give feedback.
All reactions