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.
How to define a multi-step function variable in COMSOL
Posted Jan 15, 2016, 4:00 a.m. EST Parameters, Variables, & Functions Version 5.2 0 Replies
Please login with a confirmed email address before reporting spam
I am using COMSOL 5.2 and going to solve the following equation
dC/dt=d(K*dC/dx)/dx
in which t is time and the problem is one dimensional (x). K is a function of C as K = K(C). C is obviously a spatio-temporal variable and at each time step the total value of C across the domain would be C_total. for example at the beginning of the process C_total is let's say 10, which is the same as C values across the domain. but then afterwards C at each position is different than C_total.
So here is my problem; K is dependent on C and C_total through a multi-step function, e.g.
for 8<C_total<=10
0<C<2; K = C^2+8;
2<=C<8; K =8* C^2+1;
8<=C<10; K = exp(C)+8;
for 0<C_total<=8
1<C<2; K = C^3+4;
2<=C<8; K =2* C+10;
8<=C<10; K = exp(2*C)+11;
I don't know how to introduce this type of variable into COMSOL. I guess I should use MATLAB, but I have also never tried to couple MATLAB and COMSOL. Therefore if the answer to my problem is by coupling MATLAB and COMSOL, it would be great if tell me how this can be established. Thank you!
Hello Alireza A. Moghaddam
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.