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.

Non-passive Lagrangian particles / modifying Comsol solution vectors

Please login with a confirmed email address before reporting spam

Does anyone know if it is possible to modify the solution vector between time steps in a transient model (e.g., scripting using MATLAB)? I think what I'm looking for is basically an inverse of the "mpheval" or "mphgetu" commands, but I'm relatively new to scripting in Comsol and I may be taking a less-than-optimal approach.

By way of background, I am modeling low Reynolds number thermochemical convection in a compositionally heterogeneous, viscous fluid that is subject to irreversible phase changes. I handle the compositional heterogeneity using Lagrangian particles, and I have written a routine in MATLAB that allows me to track large numbers (>1e6) of particles through the velocity and temperature fields obtained from a Comsol model. Knowing the p and T of the individual particles over time, as well as their phase history, allows me to determine when/where each particle experiences a phase transition.

My problem is this. Currently the interaction between the particles and the velocity and temperature fields obtained from Comsol is one way: u, p and T from Comsol determine the p-T trajectories of the particles. What I would like to do is to allow information from the particles to feedback on the flow. The simplest example of this is the enthalpy (latent heat) associated with the various phase changes, which alters the temperature (and thereby buoyancy and viscosity) of the system locally. I can currently calculate the latent heat loss associated with each particle at each time step within my MATLAB routine, and I would like to simply "correct" the temperature field after each time step to account for this. Basically the algorithm I have in mind is as follows:

1. Given u, p and T at time t, solve for u, p and T at time t+dt using Comsol
2. Advect particles given u, p and T from Comsol
3. Calculate latent heat associated with phase change for each particle over timestep, given its p, T and composition
4. Correct T field using latent heat obtained from particles ==> call this modified field T'
5. Repeat from #1, using modified temperature field (T') as starting point for next time step

I have implemented this approach before in CFD models at a source code level (Fortran, C), but I'm having trouble figuring out how exactly to go about it in Comsol. (The instructions for the API seem somewhat opaque.) Any suggestions/advice would be greatly appreciated.

Thanks!
Paul

0 Replies Last Post 20.07.2010, 22:55 GMT-4
COMSOL Moderator

Hello Paul Hall

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.

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.