deepxde
deepxde copied to clipboard
Implementation of source terms
Hi Lulu, I am implementing the 15 coupled equations described in this file: gaseificador.pdf These are the equations without source terms working fine if lambda_eff and const1 are considered constant:
for k in range(7): y_rhoG[k] = epsdrhoG_t[k]+UgdrhoG_z[k]+rhoG[k]dUg_z-D(d2rhoG_z[k]-drhoGm_zdrhoG_z[k]/rhoGm+rhoG[k](drhoGm_z/rhoGm)*2-rhoG[k]d2rhoGm_z/rhoGm) y_rhoGm = const1(TgdrhoGm_z+rhoGmdTg_z) -Us+Ug y_Ug = epsdrhoGm_t + rhoGmdUg_z + UgdrhoGm_z y_Us = rhoSindUs_z for k in range(3): y_rhoS[k] = drhoS_t[k] + rhoS[k]dUs_z + UsdrhoS_z[k] y_Tg = eps(rhoGmdHg_t+HgdrhoGm_t)+UgrhoGmdHg_z+UgHgdrhoGm_z+rhoGmHgdUg_z -lambda_eff[0]d2Tg_z-dlambda_eff[0]dTg_z y_Ts = rhoSin(dHs_t +UsdHs_z+Hs*dUs_z)-lambda_eff[1]*d2Ts_z - dlambda_eff[1]*dTs_z
const1 and lambda depends on variables like Tg e Ts. When I try to include these variables explicitly or the source terms on the right side (which also depend on a almost all variables) it starts to show Nan values in the training. Could you please give me some insight what the problem can be? Thanks in advance.
Please use
your code
to insert your code from the toolbar provided when you write something in Issues section.
So your code will look something like this.
for k in range(7):
y_rhoG[k] = epsdrhoG_t[k]+UgdrhoG_z[k]+rhoG[k]dUg_z-D(d2rhoG_z[k]-drhoGm_zdrhoG_z[k]/rhoGm+rhoG[k](drhoGm_z/rhoGm)**2-rhoG[k]d2rhoGm_z/rhoGm)
y_rhoGm = const1(TgdrhoGm_z+rhoGmdTg_z) -Us+Ug
y_Ug = epsdrhoGm_t + rhoGmdUg_z + UgdrhoGm_z
y_Us = rhoSindUs_z
for k in range(3):
y_rhoS[k] = drhoS_t[k] + rhoS[k]dUs_z + UsdrhoS_z[k]
y_Tg = eps*(rhoGmdHg_t+HgdrhoGm_t)+UgrhoGmdHg_z+UgHgdrhoGm_z+rhoGmHgdUg_z -lambda_eff[0]d2Tg_z-dlambda_eff[0]dTg_z
y_Ts = rhoSin(dHs_t +UsdHs_z+Hs*dUs_z)-lambda_eff[1]*d2Ts_z - dlambda_eff[1]*dTs_z
Sorry looks like you are solving a chemistry problem. Can you reply to the following?
- How many inputs and outputs variable do you have?
- Did you use
L-BFGS
optimiser? I won't go into details but this might be your culprit. TryAdam
. - Can you link a solution to this problem using other conventional methods. Just wanted to see if the solution is stiff.
Dear Prakhar Sharma,
- The problem has 2 inputs (t and z) and 15 outputs (7 rhoG[k], 3 rhoS[k], rhoGm, Ug, Us, Tg, Ts).
- I used both of them:
model = dde.Model(data, net)
model.compile("adam", lr=1e-3)
model.train(epochs=5000)
model.compile("L-BFGS")
losshistory, train_state = model.train()
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
- These are some results obtained with finite differences:
Do you think the problem has something to do with the form of the source terms? Or maybe there are too many equations to solve?
Good comments from @praksharma
I would start with simple ODE system, before trying this one with 15 outputs.
Dear Lulu,
I started implementing the equations one by one and testing the convergence. It worked for all of them without the sources and keeping lambda constant. Now the non convergence problem appear when I include just one of the sources. I could send you the whole script. Maybe you have an idea what the problem could be. Thanks again, Daniela.
OK. Then how about trying a simpler source first?
@dmaionchi Please share your code here.
Hi Prakhar Sharma,
You can find the code as an attachment. Thank you again for your help.
Regards, Daniela Maionchi
Em qui., 14 de abr. de 2022 às 23:01, Prakhar Sharma < @.***> escreveu:
@dmaionchi https://github.com/dmaionchi Please share your code here. I am free on weekend. I will use other libraries as well, to see if it works.
— Reply to this email directly, view it on GitHub https://github.com/lululxvi/deepxde/issues/610#issuecomment-1099805019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYGTXUM46FEBJU7UPJQUZADVFDLW3ANCNFSM5TD53SRQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi Praksha and @lululxvi, I would like to know if you could take a look at the code and find the problem. Thanks again, Daniela.