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.
initial conditions Set As Step Dependent
Posted Mar 26, 2024, 7:10 a.m. EDT 9 Replies
Please login with a confirmed email address before reporting spam
In a study with step 1 stationary+step 2 time dependent, I hope to use different initial conditions, i.e. in step 1 with u=0 and in step 2 with u=1. If the above can be achieved, all steps can be run in one go during the same study. Can the above steps be set?
Please login with a confirmed email address before reporting spam
You can have two different Initial Values nodes. In the study step, you disable one using Modify model configuration for study step.
-------------------Henrik Sönnerlind
COMSOL
Please login with a confirmed email address before reporting spam
Thank you Dr Sönnerlind. But it seems the default initial value node isn't allowed to be disabled. Then with 2 such initial value nodes how to enable/disable them?
If that can be done, what part of the solution does step 2 inherit from step 1? By default, if no particular treatment is done to the initial values, step 2 (no matter what initial conditions to apply) should inherit the full solution of step 1 as its initial conditions?
Please login with a confirmed email address before reporting spam
Since Initial Condition nodes override each other, you can, for example use them in the following way:
In the first (default) node, you set the initial conditions for study step 1. Then, you add another node in which you set the initial conditions for study step 2. In step 1, you disable the second Initial Condition node under Modify model configuration for study step. Due to the override properties, you do not have to make any modifications to step 2.
-------------------Henrik Sönnerlind
COMSOL
Please login with a confirmed email address before reporting spam
Thank you Dr Sönnerlind. I strictly follow your advice (In step 1, disable the second Initial Condition node under Modify model configuration for study step) as in the attached figure. But the block never moves. It seems that the second initial condition isn't applied at all by the software.
Attachments:
Please login with a confirmed email address before reporting spam
Will the interface of "values of dependent variables" and " Initial values of variables solved for" be relevant to this question?
Please login with a confirmed email address before reporting spam
That is correct. You need to take initial values from User Controlled -> Initial Expression in the second study. The default is to use results from the previous study as initial conditions.
-------------------Henrik Sönnerlind
COMSOL
Please login with a confirmed email address before reporting spam
That is correct. You need to take initial values from User Controlled -> Initial Expression in the second study. The default is to use results from the previous study as initial conditions.
Then in such a case, the solution of the current step has nothing to do with the solution of the preceding step under the same study? This is equivalent to putting these steps in separate studies?
Please login with a confirmed email address before reporting spam
In most cases, it will be the same, yes. There are some subtle exceptions, for example if you don't solve for the same degrees of freedom in both study steps. But by making the appropriate settings, you can obtain the same results using either two studies or two study steps within one study. it is more a matter of convenience. Study steps within one study are mainly intended for cases where there is a chain of solutions that depend on each other.
There are some other differences, not directly related to the solution. There will, for example, be a difference in how default plots are generated when you switch between two study steps and two studies.
-------------------Henrik Sönnerlind
COMSOL
Please login with a confirmed email address before reporting spam
Thank you so much Dr Sönnerlind
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.
Suggested Content
- BLOG How to Simulate the Carrier Dynamics in Semiconductor Devices
- KNOWLEDGE BASE Solving time dependent models with inconsistent initial values
- KNOWLEDGE BASE Improving Convergence of Transient Models
- BLOG How to Save Computational Time with a One-Way Coupling Approach
- FORUM initial/boundary conditions set as step dependent