I am using the PDE in COMSOL 4.4. And I need to set the Dirichlet boundary condition on a face. But the boundary condition only would be used under certain conditions. (eg. only A>0, the Dirichlet boundary condition would be used, if A
There exists an "if" syntax in variables (at least in 4.2) but this may yield convergence problem, because when your condition switches, your boundary condition will changes abruptly.
A better way to achieve that is to use a "step" function in Global definitions. These functions have the advantage to be smoothable at the discontinuity and to obtain an infinitely differentiable function. Then use this step to adapt to your switchable boundary condition.
I wonder however, from a mathematical point of view, how a Dirichlet condition can become unnecessary in some cases... ? Wouldn't the problem be under-constrained in this case ? Or does the BC switch to another type of condition (for example Neumann)?
Thank you very much! You are right, I need to change the Dirichlet boundary condition to the Neumann boundary when the A0, the Dirichlet boundary condition would be used, when the A
I have also the same question. I am agree with step, but I do not know how could I employ this in COMSOL. I think defining a constrain could help but i do not know how to point the normal of the surface.For example I want to say the normal flux is equal to q0. How can I write such condition in the R in constraint?
I worked on the problem and I found a solution. I am going to simulate a problem using Dirichlet boundary condition but the concentration should not be negative, and hence, if the concentration be negative I needed to switch to Neumann to hold it zero.
Here what I did and it worked.
I have introduced a step function in my variables for smooth transient (step1). Then I have added a Flux/Source boundary condition on the boundary.
For the box of boundary flux/source I have set:
an expression the same as the flux term in the governing equations for example:
where c and a and gamma are the values the same as those utilized in the PDEs. Dirit is the
This firsts term which has been multiplied by (1-step1(u3)) could eliminate the original flux in the definition of this type of B.C.; when step1 is active (one) and the problem remains with the Dirichlet boundary condition and q0 is the Neumann one.
When the step1 is inactive (zero) the Newmann boundary condition is active. When step1 is active (one) the Newmann boundary condition is inactive and the term
-(nx*(c*ux-a*u3+gamma)+ny*(c*uy-a*u3+gamma) ) would eliminate the flux in the B.C. and remains with Dirit which is the Dirichlet boundary condition. The boundary absorption q should be set as a large number such as 1000.
In this regard I have switched properly between both boundary conditions.