Skip to content

How to use a discrete function in NeumannBC #987

Discussion options

You must be logged in to vote

Results of: 1D heat conduction with a heat flux boundary condition as a discrete function of time.

import deepxde as dde
import tensorflow as tf
import numpy as np
import numbers

# parameters

L = 1;
time =1;
q = 1;
T0 = 0;
k = 1.2;
rho = 1;
cp = 1;
alpha = k/(rho*cp)

#anchors
tt = np.arange(0,time+0.001,time/50).reshape(-1,1)
xx = np.zeros([len(tt),1])
ancora_x = np.hstack([xx,tt])

#heat flux function
fluxo = np.zeros([len(tt),1])
for i in range(len(tt)):
    if i>5 and i<=35:
        fluxo[i]=q

# PointSetBC for 1D neumann bc 
class PointSetBCDot(object):

    def __init__(self, points, values, component, j):
        self.points = np.array(points)
        if not isinstance(values, nu…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@rodrigogdourado
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by rodrigogdourado
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants