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

time dependent dirichlet boundary condition #111

Open
sezerh24 opened this issue Jul 17, 2024 · 3 comments
Open

time dependent dirichlet boundary condition #111

sezerh24 opened this issue Jul 17, 2024 · 3 comments

Comments

@sezerh24
Copy link

Hi,

How can i implement time dependent dirichlet boundary condition. Lets say I am solving for the temperature in 1D, at the left boundary T left b = T0 + A*t, where T0 is is the temperature at boundary at t = 0; A is a constant and t is the time in this case.

Thank you

@sezerh24
Copy link
Author

Indeed, I had find out how to implement time dependent bc. I knew about ramp function, however, I did not know that the system can update the boundary condition at each time: here is the implementation of time dependent BC:

Tf is the surface temperature and it change with the time according to the following function:

Tf(t) = Tₐ + (1100-(Tₐ-273.18))(1-exp(-exp(0.71log(t/124.8)))) - 100*(1-exp(-exp(0.71*log(t/124.8))))

function bconditionsT!(f,u,bnode,data)
v=ramp(bnode.time,dt=(0,final_t),du=(Tf(bnode.time), Tf(bnode.time)))
boundary_dirichlet!(f,u,bnode,species=Tₙ,region=1,value=v)
boundary_dirichlet!(f,u,bnode,species=mₙ,region=2,value=0)
end

@j-fu
Copy link
Owner

j-fu commented Jul 23, 2024

I think you don't need the ramp function here - you can just write
v=Tf(bnode.time)

The ramp function is meant to help with the situation where e.g. at t=0 we have a zero initial value, and want to set a nonzero Dirichlet bc u=u_d for t>0. In this case, the timestep adapation would struggle. Using ramp(t, dt=(0,delta), du=(0,u_d)) allows to ramp up the bc from zero during the small time interval (0,delta), and the time step control can adapt.

@j-fu
Copy link
Owner

j-fu commented Jul 23, 2024

Note to self - there should be an example clarifying this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants