You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dear Lulu,
I am trying to solve for heat diffusivity 1D model. I have 1D model (rod). I set left side to temperature 30, right side to 20. Initial temperature is 20. Also, I know temperatures at different points and time. By using those data, I want to compute heat diffusivity of the material.
Unfortunately, it is not converging. Can you please give me suggestions, what can I do?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Dear Lulu,
I am trying to solve for heat diffusivity 1D model. I have 1D model (rod). I set left side to temperature 30, right side to 20. Initial temperature is 20. Also, I know temperatures at different points and time. By using those data, I want to compute heat diffusivity of the material.
Unfortunately, it is not converging. Can you please give me suggestions, what can I do?
Here is the code
import deepxde as dde
import numpy as np
from deepxde.backend import tf
C = dde.Variable(2.0)
def pde(x, y):
dy_t = dde.grad.jacobian(y, x, i=0, j=1)
dy_xx = dde.grad.hessian(y, x, i=0, j=0)
def func(x):
geom = dde.geometry.Interval(0, 1)
timedomain = dde.geometry.TimeDomain(0, 1)
geomtime = dde.geometry.GeometryXTime(geom, timedomain)
bc = dde.DirichletBC(geomtime, func, lambda _, on_boundary: on_boundary)
ic = dde.IC(geomtime, func, lambda _, on_initial: on_initial)
observe_x = np.vstack((np.linspace(0, 1, num=10), np.full((10), 1))).T
observe_y = dde.PointSetBC(observe_x, func(observe_x), component=0)
data = dde.data.TimePDE(
geomtime,
pde,
[bc, ic, observe_y],
num_domain=40,
num_boundary=20,
num_initial=10,
anchors=observe_x,
solution=func,
num_test=10000,
)
layer_size = [2] + [32] * 3 + [1]
activation = "tanh"
initializer = "Glorot uniform"
net = dde.maps.FNN(layer_size, activation, initializer)
model = dde.Model(data, net)
model.compile(
"adam", lr=0.001, metrics=["l2 relative error"], external_trainable_variables=C
)
variable = dde.callbacks.VariableValue(C, period=1000)
losshistory, train_state = model.train(epochs=50000, callbacks=[variable])
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
Beta Was this translation helpful? Give feedback.
All reactions