New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to define Hard Constraint for a specific BC #252
Comments
based on the paper with the title of "Systematic Construction of Neural Forms for Solving Partial Differential Equations Inside Rectangular Domains, Subject to Initial, Boundary and Interface Conditions", I tried to define hard BCs for T(r_in, t)=T_star and T(r_out, t)=0, T(x,0)=0, but I think this does not satisfy the boundary conditions: for second output y[:,1:2]: I have no idea how can I define these hard BCs? |
The paper you mentioned is a good reference. If you still cannot define hard BCs based on that paper, you can only use hard BCs for some BCs, and for the other BCs, use the standard loss functions. |
@lululxvi |
Then impose T* as hard constraint. |
@lululxvi would you please help me with the code how can I impose T* as hard bc? |
Something like def f(x, y):
r, t = x[:, 0:1], x[:, 1:2]
T_star = ... # the function on t
return (r - r_in) * y + T_star
net.apply_output_transform(f) |
Dear @lululxvi |
It should be exactly zero, see Section 2.3 in https://arxiv.org/abs/2102.04626. If not, then there must be something wrong with the code. |
@lululxvi Thank you, I will read it carefully. |
Dear @lululxvi ,
After treatment, the losses of bc_1, bc_3 and ic_1 are all 0, They are also fixed at 0.
Is that right? Is there any difference from the previous grammar? |
@FZUcipher Yes, your code looks good. |
Hello @lululxvi,
Thank you for all the responses you have given up to now. Previously I have sent you my code and the training loss was large, so you suggested using "hard BCs" but I have a problem with defining BCs as hard constraints. I attached my initial and boundary conditions. For the first output variable (displacement) I wrote the following code but for the second output variable (temperature) I have no idea how to define hard BCs and Dirichlet IC so as to satisfy them.
r_out=1.5
net.apply_output_transform( lambda x, y : tf.concat( [ (1-x[:,0:1])*(1.5-x[:,0:1])*((1-np.exp(-x[:,1:2])**2)*y[ :, 0:1], **(for this one I have no idea)** ], axis =1 ) )
1- is the first argument right?
2-How can I define the second argument to satisfy the Dirichlet boundary and initial conditions?
The text was updated successfully, but these errors were encountered: