Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Change boundary conditions during a transient solution
Posted Jun 24, 2010, 4:29 a.m. EDT Porous Media Flow, Modeling Tools & Definitions, Parameters, Variables, & Functions Version 4.3a 13 Replies
Please login with a confirmed email address before reporting spam
in an acousitc transient simulation, I would like to change a boundary condition during the simulation. I would to impose on this boundary:
1. a pressure condition during the 100 first time steps
2. an impedance boundary condition during the next time steps
Is it possible? With the solver sequence? How to do it?
Thank you. Pascal
Please login with a confirmed email address before reporting spam
There are methods to do this but they are somewhat tricky and the solvers migh miss the point and not converge over the transition.
1) you can always put a time dependent value for a BC (boundary condition) as a fullydefinedfunction (if possible with a derivative) or jsut as a bolean function p=p0*(t<1[s]) a more abrupt method, also tricky to get converging
2) you can adapt the full equations by adding several outof the COMSOL control = "locked equations" directly in the Physics - Equation Settings ... tabs) but you might fool the solvers and not converge.
3) probably the best, you run your simulation as two distinguised steps, with a "save solution" in bewteen and a restart in the new conditions. This is partially manul, partially by the solver manager in V3.5, and most probably fuilly automatic in V4 (I havent tried that combination yet)
Hope this helps
Ivar
Please login with a confirmed email address before reporting spam
Thank you for your rapid answer.
I'm Pascal, I work with Anne-Sophie on a ultrasound wave propagation through the skull and we share the same dicsussion count.
I tried the method 3) run the simulations as 2 steps. The methodology I used is :
1) I run the simulation 1 with the wanted pressure profile imposed on the boundary conditions
2) I change the boundary condition
3) In the solver manager I fix the initial values with the current solution
4) I run simulation 2
-> This method works BUT :
The initial value of simulation 2 is only based on the last time step of simulation 1. This meens that, going from simulation 1 to 2, we keep the pressure field (p), but we lose the information on dp/dt, and this has for effect that the pressure wave does not propagate as it should.
-> Is there a possibility to initialize simulation 2 based on the 2 last time steps of simulation 1 in order to keep the information based on the derivates (dp/dt)? In this case, we could say that :
simulation 1 + simulation 2 = complete simulation
Pascal
Please login with a confirmed email address before reporting spam
yes I beleive you should study the doc on the "Solve - Parametric sweep" of V3.5 this will generate a series of files but i believe you should get there when mixing with your previous explanations.
One thing though, I ususally put a "store solution" in betweent he two runs, in this way you store all cases/solutions for the first sweep. And you can select to restart from just one in the Solve manager Initial value, run the case, then in the Sequence tab, store the current settings
Have fun Comsolin
ivar
Please login with a confirmed email address before reporting spam
I have been able to run several simple cases and switch the B.C. between runs and use the solution as the initial conditions for the next run, but this is very user intensive and prone to errors, especially when there are many B.C. that change. Do you have any suggestions for automating this?
I recently switched to V4 hoping this would be easier than in v3.5 but it does not seem to be.
Please login with a confirmed email address before reporting spam
I was also talking about changing the "type" of BC, but this is essentially to change the equations with a " bolean time switch". but as I said these changes are delicate as they tend to confuse the solver settings that are mostly optimised by COMSOl for what it understands from the initial settings. So sometime to stop the run at a given time, and restart with "manually switched BC are easier, and converges better
Have fun Comsoling
ivar
Please login with a confirmed email address before reporting spam
I haven't read through the whole thread but I thought I would chime in since I have run into this sort of problem in the past while modeling a simple transient heat transfer problem in v 3.5a where I had to alternate between Dirichlet and Neumann boundary conditions many times. There are two feasible approaches both of which worked for me:
1- Use Matlab scripting to run essentially a series of distinct consecutive problems every time the BC changes- this is the same approach that Ivar is suggesting only made a little more manageable by automating through Matlab scripting.
2- Use an approach called "stiff spring method" to emulate Dirichlet condition while still implementing it as a Neumann condition. In essence you use only one type of BC but through some numerical tricks and boolean operators you make it behave like a different type of BC when some criteria are satisfied. I am not sure if an analogous trick applies to your problem's physics and BC. See attached.
Good luck
Ozgur
I am also trying to have a change in boundary conditions during a transient solution. My problem is not just changing the value of a boundary condition, but the type of boundary condition changes as well. In addition to this, the B.C. needs to cycle many times, not just once.
I have been able to run several simple cases and switch the B.C. between runs and use the solution as the initial conditions for the next run, but this is very user intensive and prone to errors, especially when there are many B.C. that change. Do you have any suggestions for automating this?
I recently switched to V4 hoping this would be easier than in v3.5 but it does not seem to be.
Attachments:
Please login with a confirmed email address before reporting spam
I have used this approach (your #3) on a similar problem in the past with good success, but I am having difficulty implementing it in COMSOL 4.0. Have you been able to figure out how to store a solution and use it as an initial condition in a continuation run in COMSOL 4.0 yet? It was straightforward enough in 3.5a, but the documentation for the new interface is a little opaque on this topic.
Thanks!
Paul
Please login with a confirmed email address before reporting spam
The store solution is there you need to use the right click on the Study nodes but you cannot reorder a sequence made by the system (yet I have heard it is to come soon).
Good luck
Ivr
Please login with a confirmed email address before reporting spam
I'm trying your suggestion:
1- Use Matlab scripting to run essentially a series of distinct consecutive problems every time the BC changes- this is the same approach that Ivar is suggesting only made a little more manageable by automating through Matlab scripting.
Do you have an example Matlab script for comsol v4 that you could post?
Thanks
Please login with a confirmed email address before reporting spam
I haven't figured out v4 with Matlab yet, I coded it in v3.5 compatible m file.
Take a look at the stiff spring method though, it is a pretty powerful approach and easy to implement.
Ozgur
Ozgur ,
I'm trying your suggestion:
1- Use Matlab scripting to run essentially a series of distinct consecutive problems every time the BC changes- this is the same approach that Ivar is suggesting only made a little more manageable by automating through Matlab scripting.
Do you have an example Matlab script for comsol v4 that you could post?
Thanks
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.