Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 428

User defined functions from Matlab for COMSOL simulation

$
0
0
Hi,

I am trying to model turbulent flow as well as time-dependent species equation in a certain domain, where the species concentrations at some of the boundaries vary with time (NOT known in analytical form or as data Table). These boundary conditions need to be obtained through a completely separate procedure at each time step. I already have that part coded up in Fortran (which can be easily rewritten as m code). I am looking for a way to couple these two domains. At each time step, I want the comsol simulation to call my subroutine (.m or .c code), obtain the numerical values of those boundary conditions, solve the problem in its domain, and if a certain convergence criterion is satisfied, then moves on to next time step (and if not, calls the subroutine again in the same time-step). First, I need to know if this is feasible in comsol, and if so, what is the procedure? Is there any documentation (or possibly webinar) that I can look at?

An alternative would be to write the entire program in matlab, where comsol simulation is called at every time-step (reverse procedure!). I am using version 3.4, but should be able to use 4.0 as well.

Any help or comment is really appreciated!
Sam

Viewing all articles
Browse latest Browse all 428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>