Please wait...
×

Error

Posted Wed, 17 Aug 2011 05:21:23 GMT by mwtoews
This is not an IFM question, but is the closest forum category match to post this question.

I would like to know how to determine the nodal in/out flow terms from data in an ASCII DAC file. I've already done the hard work (using Python, NumPy and HDF5 for caching), and I have structured arrays of data that I can slice and do custom budget reporting.

But the problem is that the structure in the ASCII DAC file does not match the FEFLOW 5.4 File Format document. I have tested the following with a DAC file saved as ASCII for version 5.4 and 6.0 from the Classic interface. The format for both versions appears to be almost identical.

In normal words, my FEM problem is a transient flow only, with 1 layer. A few excerpts from the FEM portion of the file is as follows:

[tt]CLASS (v.6.006)
  2    1    0    3    1    0    8    8    0
DIMENS
31032  29487      6    730  2000      0      7      0      1    -1      0      1    17      0      0      0      0
...
STATELEV
    3    1
[/tt]
Based on the above excerpts, the following parameters are extracted:
CLASS: ic1=2; ic2=1; proj=0; ndm=3; n_layers=1; ic0=0
DIMENS: np=31032; ne=29487; nbn=6; numb_dt=730; phreatic=1
STATELEV: slice1: 3 (Movable); slice2: 1 (Fixed)

Furthermore, several other parameters can be determined, using the logic provided in section 3.2.4.1 "General Structure of the data block":
[table]
[tr]
[td]num_slices:[/td][td]2[/td][td][tt](n_layers + 1)[/tt][/td]
[/tr]
[tr]
[td]nodes_per_slice[/td][td]15516[/td][td][tt](np/num_slices)[/tt][/td]
[/tr]
[tr]
[td]num_t:[/td][td]731[/td][td][tt](numb_dt + 1)[/tt][/td]
[/tr]
[tr]
[td]is_3D_problem:[/td][td]True[/td][td][tt](ndm == 3)[/tt][/td]
[/tr]
[tr]
[td]is_mass_transport:[/td][td]False[/td][td][tt](ic1 == 0)[/tt][/td]
[/tr]
[tr]
[td]is_thermohaline_transport:[/td][td]False[/td][td][tt](ic1 == 8 )[/tt][/td]
[/tr]
[tr]
[td]is_heat_transport:[/td][td]False[/td][td][tt](ic1 == 5)[/tt][/td]
[/tr]
[tr]
[td]is_unconfined:[/td][td]True[/td][td][tt](phreatic == 1)[/tt][/td]
[/tr]
[tr]
[td]is_slice1_free_movable:[/td][td]True[/td][td][tt](statelev[0] == 3)[/tt][/td]
[/tr]
[/table]

All of the above makes perfect sense, when looking at the problem settings in the FEFLOW 6.0 GUI. However, the table12 formatted nodal datasets in the file does not match the documentation. In total I read 7 parts (not 6, as I would have expected):
[list type=decimal]
[li][tt]head_data[/tt] with dim=31032
        (min: 108.8, mean: 208.0, max: 296.6)[/li]
[li][tt]vx_data[/tt] with dim=31032
        (min: -32.43, mean: -0.026, max: 22.6)[/li]
[li][tt]vy_data[/tt] with dim=31032
        (min: -33.3, mean: 1.6 , max: 13.3)[/li]
[li][tt]vz_data[/tt] with dim=31032
        (min: -23.5, mean: -0.011, max: 2.84)[/li]
[li][tt]slice_elevation_data[/tt] with dim=15516
        (min: 108.8, mean: 193.9, max: 296.6)[/li]
[li][tt]acceleration_data_mass[/tt] with dim=31032
        (min: 108.8, mean: 208.0, max: 315.8 )[/li]
[li][tt]unknown[/tt] with dim=31032
        (min: -8.77, mean: 0.00182, max: 18.64)[/li]
[/list]

After [tt]unknown[/tt], the [tt]flow_cbc_data[/tt] is clearly listed to the end of each data block ([tt]FBCCEND[/tt]), so I know I've isolated the correct portion of the data block (I'm less interested in the [tt]flow_cbc_data[/tt] part, and skip past it to [tt]FBCCEND[/tt]). I've verified that parts 1 to 5 are correctly extracted, as their values can be viewed/verified in the FEFLOW 6.0 GUI for randomly selected nodes/timesteps. The remaining parts 6 and 7 I'm not certain about. The sequence of nodal data blocks are documented as follows:
[tt]if (ic2 != 2) { // True
    acceleration_data_mass // Read as part 6
    if (ic1 != 2) { // False
        if (ic2 == 1) { // True
            acceleration_data_flow // Not read
        }
        if (ic1 == 8 ) { // False
            acceleration_data_heat // Not read
        }
    }
}
// Read undocumented part 7
[/tt]

What is [tt]acceleration_data_mass[/tt], and why is it being read for a flow-only problem? Why isn't [tt]acceleration_data_flow[/tt] being read? What is the 7th part (I've labeled this [tt]unknown[/tt])? It shouldn't be there, but I have 31032 values in table12 format remaining before [tt]flow_cbc_data[/tt] starts, so it is something worth storing in the DAC.

Now back to the in/out flows for budget calculation. How does FEFLOW calculate this for a given node? Is it the difference of acceleration data between two time steps? I can't seem to get the same values by doing calculations as I can see in the FEFLOW GUI for Flow > Budget.

Any help is appreciated. Let me know if more info is needed.
Posted Wed, 14 Sep 2011 17:03:37 GMT by Denim Umeshkumar Anajwala
Just out of curiosity: Have you ever looked into using a Plug-in/IFM code instead? That might be (much) easier than reading this kinda data from a DAC file.

Chris
Posted Wed, 14 Sep 2011 21:38:26 GMT by mwtoews
Chris, this is the route I'm now on. I have determined the DAC file does not have any budget info, and has decaying documentation. I discovered two days ago that writing my first IFM plug-in is actually not difficult (and I barely know C++). My working code is something like:

[code]
static void PostTimeStep (IfmDocument pDoc)
...
IfmBool res;
IfmBudget *pBudget = IfmBudgetFlowCreate(pDoc);
IfmBudgetComponents budget;

int np = IfmGetNumberOfNodes(pDoc);
for (int node=0; node < np; node++)
{
res = IfmBudgetComponentsQueryFlowAtNode(pDoc, pBudget, node, &budget);
/* Do something with:
budget.area_flux;
budget.boundary_flux;
budget.total_flux; */
}
// Free memeory
IfmBudgetClose(pDoc, pBudget);
...
[/code]
Posted Wed, 14 Sep 2011 23:08:54 GMT by Denim Umeshkumar Anajwala
Way to go!

It's been a long time since I looked at an ASCII DAC file and its documentation. That's why I couldn't really comment on your original post. And I'm not surprised the documentation can't keep up with the FeFlow development.

I've been using IFM programming for about 6 years now and I'am glad you discovered it now. Even though there are little details that can make C++ programming challenging, I hope you'll find it just as useful as I do.

What exactly are you trying to achieve with this Plug-In?
Posted Wed, 14 Sep 2011 23:45:19 GMT by mwtoews
Ultimately, I need to do some bulk comparison of landuse/pumping between a baseline and several scenarios. In order to do this, I need to have node-by-node output for each timestep for flow budget, head, etc., but to do this type of analysis, the simulation results need to be processed in some high-level interactive array environment, such as MATLAB, Python (NumPy), R, etc.

Basically, my plug-in saves the full simulation results into a single HDF5 file with several useful 2D datasets (head, boundary_flux, area_flux, etc.) with dimensions (np, numb_dt). After the simulation is complete, I can open the .h5 dataset file anywhere else (e.g. HDF5View, MATLAB, or Python) to process my data and find differences between baseline and each scenario, visualize/map differences, etc.

At this moment, I'm nearly finished my IFM module, and am focusing on populating the .h5 file using the HDF C++ API. The finished IFM plug-in will be similar to my wishlist item: [url=http://www.feflow.info/forum/index.php/topic,961.0.html]http://www.feflow.info/forum/index.php/topic,961.0.html[/url]. (Sorry .. I can't share the full IFM add-in due to work restrictions.)

You must be signed in to post in this forum.