How to Assign Different Time-Dependent Inflow Velocities to Multiple Boundaries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Assign Different Time-Dependent Inflow Velocities to Multiple Boundaries

somotono
I am using FEATool for CFD simulations of congenital heart disease.
To replicate certain anatomical scenarios, such as a shunt from the systemic artery to the pulmonary artery, I need to apply different time-dependent velocity waveforms to multiple inflow boundaries.
For example:
One surface (e.g., pulmonary artery inflow) needs a pulmonary waveform;
Another surface (e.g., systemic-to-pulmonary shunt) requires a different systemic waveform.
While the GUI seems limited in assigning different inflow functions to different boundaries, I would appreciate any guidance on how to achieve this setup.
If defining these conditions in MATLAB script is required, a basic example would be very helpful.
Thank you in advance for your support.
Reply | Threaded
Open this post in threaded view
|

Re: How to Assign Different Time-Dependent Inflow Velocities to Multiple Boundaries

Precise Simulation
Administrator
Hello,

Thank you for using the toolbox. Regarding applying time varying and instationary velocity profiles to inflow boundaries, if the waveform has a simple analytical description (sin, cos, etc) it should be possible to enter it directly, as in the instationary flow around a cylinder example

   6*sin(pi*t/8)*(y*(0.41-y))/0.41^2

where "6*y*(0.41-y)/0.41^2" describes a fully developed laminar flow profile (spatially), and "sin(pi*t/8)" the time varying component.

For more complex cases, for example where your waveform or flow profile is described by tabulated data, you would need to use a custom user defined function. For the example above it could look something like:

   6*my_waveform(t)*(y*(0.41-y))/0.41^2

Where the "my_waveform.m" (Matlab m-)script function can look something like:

    function [ output ] = my_waveform( t )

    persistent waveform_data  % Persistent data
    if( isempty(waveform_data) )   % Load and define on function call.
       waveform_data = load( 'path_to_ascii_waveform_data_file.txt' );
    end

    waveform_at_t = interp1( waveform_data(:,1), waveform_data(:,2), t );

    output = waveform_at_t * ones(size(t));  % Return result same size as requested input
                                             % (more important with spatial coordinates as inputs).

where the waveform data file is a simple Ascii text file, with the first column time values, and second waveform magnitude. And here using the Matlab functions load for loading data and interp1 for interpolation.