subdomain and cell volumes

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

subdomain and cell volumes

peteri
Hello,

For some post-processing analysis, I need the volumes of the subdomains or alternately the individual cell volumes and a mapping of cells to subdomain.  I don't see volume info in the featool structure.  Is it stored somewhere or are there tools to easily do the volume calculation from the grid definitions?  I could do it manually for the subdomains but would prefer to use the model's own calculations of it for consistency and simplicity.  Thanks in advance for any tips.

Best,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: subdomain and cell volumes

Precise Simulation
Administrator
This post was updated on .
peteri wrote
I need the volumes of the subdomains or alternately the individual cell volumes and a mapping of cells to subdomain.  I don't see volume info in the featool structure.  Is it stored somewhere or are there tools to easily do the volume calculation from the grid definitions?  I could do it manually for the subdomains but would prefer to use the model's own calculations of it for consistency and simplicity.
You can maybe use the pre-defined reserved variable "h_grid" for the mean cell diameter and subdomain integration defined as (https://featool.com/doc/physics#phys_coef_notes)
    h_grid :=  cell_volume^(1/n_sdim)


If that is not sufficient you would have to calculate it manually from the mesh information defined in (https://featool.com/doc/grid#grid_ref_mtrl):
    fea.grid.p  -  grid points/vertices
    fea.grid.c  -  grid cell connectivity
    fea.grid.s  -  subdomain indices

Reply | Threaded
Open this post in threaded view
|

Re: subdomain and cell volumes

Precise Simulation
Administrator
In reply to this post by peteri
To correct the previous reply, the subdomain volumes can simply be gotten from:

    n_subd = max(fea.grid.s);
    for i_subd=1:n_subd
      vol_subd(i_subd) = intsubd( '1', fea, i_subd );
    end

or alternatively via "h_grid" and the cell volumes:

    n_sdim = size(fea.grid.p,1);
    p_centroid = squeeze(mean(reshape(fea.grid.p(:,fea.grid.c), [n_sdim,size(fea.grid.c)]), 2));
    v_cell = evalexpr( 'h_grid', p_centroid, fea ) .^ n_sdim;

    n_subd = max(fea.grid.s);
    for i_subd=1:n_subd
        vol_subd(i_subd) = sum(v_cell(fea.grid.s == i_subd));
    end
Reply | Threaded
Open this post in threaded view
|

Re: subdomain and cell volumes

peteri
Thank you for the follow-up on this - I'll give it a try!

Another question came up regarding the FEAtool variables but I'll start a new thread.

Peter