Skip to content
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

MoL : AssertionError: Boundary condition is not on a boundary of the domain, or is not a valid boundary condition #396

Closed
ruidanielgm opened this issue Jun 4, 2024 · 0 comments
Labels
question Further information is requested

Comments

@ruidanielgm
Copy link

ruidanielgm commented Jun 4, 2024

I'm trying to use Method of Lines to simulate gas-phase fixed bed experiments. This involves solving PDE's+DAE's+NLAE for the mass, energy and momentum balances in space and time. I started just with the mass balance (P, u0 and T constant in space and time) and I think it was working fine. However, now I have the momentum balance, and a problem is appearing. The mass balance consists of an algebraic equation and a dif. equation in space. The problem is on the BC for the momentum balance. When I discretize, I get this: AssertionError: Boundary condition u0(0, t) ~ 0.011033525276772852 is not on a boundary of the domain, or is not a valid boundary condition or AssertionError: Boundary condition P(0.236, t) ~ 100000.0 is not on a boundary of the domain, or is not a valid boundary condition. I've seen this issue on other people, but no one seemed to have solved it.

eq =[
#Mass balance
    #Equation 1 
    Dt(Cg1(z,t)) ~ (ebed*Dax*(Dzz(Cg1(z,t))) 
        - (Dz(u0(z,t))*Cg1(z,t) + (u0(z,t)*Dz(Cg1(z,t)))) 
        - (1-ebed)*apM*kf*(Cg1(z,t)-Cs1(z,t)) ) / ebed, 
    Dt(Cg2(z,t)) ~ (ebed*Dax*(Dzz(Cg2(z,t))) 
        - (Dz(u0(z,t))*Cg2(z,t) + (u0(z,t)*Dz(Cg2(z,t)))) 
        - (1-ebed)*apM*kf*(Cg2(z,t)-Cs2(z,t)) ) / ebed,   
    #Equation 2 
    Cg1(z,t) ~ y1(z, t) * Cgt(z,t),
    Cg2(z,t) ~ y2(z, t) * Cgt(z,t),
    #Equation 3 
    #Cgt(z,t) ~ Cg1(z,t) + Cg2(z,t),
    y1(z,t) ~ 1 - y2(z,t),
    #Equation 4 
    Dt(q1(z,t)) ~ (apM*kf*(Cg1(z,t)-Cs1(z,t))) / rop, 
    Dt(q2(z,t)) ~ (apM*kf*(Cg2(z,t)-Cs2(z,t))) / rop,
    #Equation 5 
    Dt(q1(z,t)) ~ kldf[1] * (q1star(z,t) - q1(z,t)),
    Dt(q2(z,t)) ~ kldf[2] * (q2star(z,t) - q2(z,t)),
    #Equation 6 
    Pmp1(z,t) ~ Cs1(z,t) * (R*T), #later, T will be T(z,t)
    Pmp2(z,t) ~ Cs2(z,t) * (R*T), #later, T will be T(z,t)
    #Equation 7 
    S1(z,t) ~ S0[1] * exp(DH[1]/(R*T)), #later, T will be T(z,t)  
    S2(z,t) ~ S0[2] * exp(DH[2]/(R*T)), #later, T will be T(z,t)
    #Equation 8 - Isotherm
    q1star(z,t) ~ w[1] * qsat[1] * S1(z,t) * Pmp1(z,t) / (1 + S1(z,t)*Pmp1(z,t) + S2(z,t)*Pmp2(z,t)),
    q2star(z,t) ~ w[2] * qsat[2] * S2(z,t) * Pmp2(z,t) / (1 + S1(z,t)*Pmp1(z,t) + S2(z,t)*Pmp2(z,t)), 

#Momentum Balance
    Mw(z,t) ~ Mwi[1] * y1(z,t) + Mwi[2] * y2(z,t),
    Dz(P(z,t)) ~ (150*visc*(1-ebed)^2/(ebed^3*dp^2)*u0(z,t) + 1.75*(1-ebed)/(ebed^3*dp)*Cgt(z,t)*Mw(z,t)*u0(z,t)*abs(u0(z,t)))   /(-1),
    Cgt(z,t) ~ P(z,t) / (R * T)
]
#BCs
#initial values
P_start = Phigh;
T_start =  40+273.15;

Cg1_start = y_start[1]*P_start/(R*T_start);
Cg2_start = y_start[2]*P_start/(R*T_start);

Cs1_start = Cg1_start;
Cs2_start = Cg2_start;

S1_start = S0[1] * exp(DH[1]/(R*T_start));
S2_start = S0[2] * exp(DH[2]/(R*T_start));


Pmp1_start = Cs1_start * (R*T_start);
Pmp2_start = Cs2_start * (R*T_start);

q1_start = w[1] * qsat[1] * S1_start * Pmp1_start / (1 + S1_start*Pmp1_start + S2_0*Pmp2_start);
q2_start = w[2] * qsat[2] * S2_start * Pmp2_start / (1 + S1_start*Pmp1_start + S2_0*Pmp2_start);

Cgt_start =  P_start / (R*T_start);

u0inlet=(q_feed/bed_area)*(Tinlet/273.15) * (1/60) * (1e5/Phigh); 
Cinlet = P_start/(R*Tinlet); 

u0_start = u0inlet * Cinlet / Cgt_start


bcs = [
    Dz(Cg1(0,t)) ~ (yinfeed[1]*u0inlet*Cinlet - Cg1(0,t)*u0(0,t)) / (-ebed*Dax), 
    Dz(Cg2(0,t)) ~ (yinfeed[2]*u0inlet*Cinlet - Cg1(0,t)*u0(0,t)) / (-ebed*Dax), 
    Dz(Cg1(z_max,t)) ~ 0, 
    Dz(Cg2(z_max,t)) ~ 0,     

    y1(z,0) ~ y_start[1], 
    y2(z,0) ~ y_start[2], 
    Pmp1(z,0) ~ Pmp1_start, #later, T will be T(z,0)
    Pmp2(z,0) ~ Pmp2_start, #later, T will be T(z,0)
    
    Cg1(z,0) ~ Cg1_start, 
    Cg2(z,0) ~ Cg2_start, 
    S1(z,0) ~ S1_start,
    S2(z,0) ~ S2_start,
    q1(z,0) ~ q1_start,
    q2(z,0) ~ q2_start,
    Cgt(z,0) ~  Cgt_start,

    u0(0,t) ~ u0_start, 
    P(z_max,t) ~ Phigh
] 

let me know if you need more information

@ruidanielgm ruidanielgm added the question Further information is requested label Jun 4, 2024
@ruidanielgm ruidanielgm changed the title MTK : AssertionError: Boundary condition is not on a boundary of the domain, or is not a valid boundary condition MoL : AssertionError: Boundary condition is not on a boundary of the domain, or is not a valid boundary condition Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant