The component of y is missing. #1181
Unanswered
ngaiheibrian
asked this question in
Q&A
Replies: 2 comments 2 replies
-
|
You have to put your code inside markdown code block. dy1_tt = dde.grad.hessian(y, x, component=0, i=0, j=0)
dy2_tt = dde.grad.hessian(y, x, component=1, i=0, j=0)
dy3_tt = dde.grad.hessian(y, x, component=2, i=0, j=0)
dy4_tt = dde.grad.hessian(y, x, component=3, i=0, j=0)
dy5_tt = dde.grad.hessian(y, x, component=4, i=0, j=0)
u = torch.where(torch.less(x[:, 0:1], time_applied), ui * torch.sin(2 * np.pi * x[:, 0:1]), 0) |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
And guys, I have another question. As I am working on a project that I need to train a model to predict a bridge motion which contains over 80k node and it is impossible to write the program using the method ie dy1 dy2..... , is there any tips for me to build a model using deepxde? |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
Hello Sir, I am new to deepxde and try to apply it on my project. However, my code was failed to run.
It showed:
raise ValueError("The component of y is missing.")
ValueError: The component of y is missing.
I would be grateful if you can point out which part of my code is wrong.
Thanks
"""Backend supported: tensorflow.compat.v1, tensorflow, pytorch, paddle, jax"""
import deepxde as dde
import matplotlib.pyplot as plt
import numpy as np
from scipy import integrate
Import tf if using backend tensorflow.compat.v1 or tensorflow
from deepxde.backend import tf
Import torch if using backend pytorch
import torch
Import paddle if using backend paddle
import paddle
Import jax.numpy if using backend jax
import jax.numpy as jnp
def ode_system(x,y):
m=0.2591
k=100
damping_ratio=0.05
c=damping_ratio
time_applied=1
ui=193
u=0
def boundary(_, on_initial):
return on_initial
def func(x):
"""
y1 = sin(x)
y2 = cos(x)
"""
return np.hstack(x)
geom = dde.geometry.TimeDomain(0, 20)
ic1 = dde.icbc.IC(geom, lambda x: 0, boundary, component=0)
ic2 = dde.icbc.IC(geom, lambda x: 0, boundary, component=1)
ic3 = dde.icbc.IC(geom, lambda x: 0, boundary, component=2)
ic4 = dde.icbc.IC(geom, lambda x: 0, boundary, component=3)
ic5 = dde.icbc.IC(geom, lambda x: 0, boundary, component=4)
data = dde.data.PDE(geom, ode_system, [ic1, ic2, ic3, ic4, ic5], 35, 2, solution=func, num_test=100)
layer_size = [1] + [50] * 3 + [5]
activation = "tanh"
initializer = "Glorot uniform"
net = dde.nn.FNN(layer_size, activation, initializer)
model = dde.Model(data, net)
model.compile("adam", lr=0.001, metrics=["l2 relative error"])
losshistory, train_state = model.train(iterations=20000)
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
Beta Was this translation helpful? Give feedback.
All reactions