Posted Wed, 15 Feb 2017 11:49:15 GMT by Anner Paldor Student
Hello,
I am modeling a 2D aquifer, and I always record the results in full mode (DAC file). When I want to export the results of some measure (say head, or darcy flux) I simply go to the desired time-step in the DAC file, right-click the component in the view-components window, and then export. The thing is, when I export the Darcy flux results, it exports it as a scalar, with only the magnitude, whereas I am interested in the vector output with the 2 components (vx and vy). I know I can set observation points on the nodes I am interested in and then save the results in a reduced mode (DAR file) and then I can get vx and vy, but it seems weird to me that this is impossible to do with a DAC file.

Has anyone else encountered this problem? Any suggestions?

Many thanks in advance,
Anner.
Posted Wed, 15 Feb 2017 12:43:30 GMT by Björn Kaiser
Currently, the GUI does not enable you to derive the different components of the Darcy-vector. However, you can use the FEFLOW API by writing few lines in Python/C/C++.

Here is a small snippet, which illustrates one possible workflow. The script does the following:
[list]
[li]Load the FEFLOW Kernel as an external module. [/li]
[li]Create three Nodal Distributions to store three different components of the Darcy-vector (3D model is assumed)[/li]
[li]Make the three Nodal Distributions time-dependent[/li]
[li]Start the simulation an write the components to the distributions after each time-step[/li]
[/list]
[font=courier][color=blue]
import sys, os
sys.path.append('C:\\Program Files\\DHI\\2016\\FEFLOW 7.0\\bin64')
import ifm

# Assign scalar quantities of vector components to nodal distributions
def postTimeStep(doc):

    for nNode in range(0,nNodes):
        doc.setNodalRefDistrValue(rID_velX, nNode, doc.getResultsXVelocityValue(nNode))
        doc.setNodalRefDistrValue(rID_velY, nNode, doc.getResultsYVelocityValue(nNode))
        doc.setNodalRefDistrValue(rID_velZ, nNode, doc.getResultsZVelocityValue(nNode))

try:
    #Get current working directory
    dir=os.getcwd()

    #Definition of files
    FEM_FILE=dir+'\\exercise_fri20.fem'
    FEM_FILE_OUT = dir + '\\exercise_fri20_OUT.fem'
    DAC_FILE=dir+'\\exercise_fri20.dac'

    print "Input: " + FEM_FILE
    print "Output: " + DAC_FILE

    #Load document
    doc=ifm.loadDocument(FEM_FILE)

    # Enable reference distribution recording
    bEnable = 1 # disable = 0, enable = 1

    # Create and enable distribution recording
    doc.createNodalRefDistr("Velocity_X")
    rID_velX = doc.getNodalRefDistrIdByName("Velocity_X")
    doc.enableNodalRefDistrRecording(rID_velX,bEnable)

    doc.createNodalRefDistr("Velocity_Y")
    rID_velY = doc.getNodalRefDistrIdByName("Velocity_Y")
    doc.enableNodalRefDistrRecording(rID_velY,bEnable)

    doc.createNodalRefDistr("Velocity_Z")
    rID_velZ = doc.getNodalRefDistrIdByName("Velocity_Z")
    doc.enableNodalRefDistrRecording(rID_velZ,bEnable)

    nNodes = doc.getNumberOfNodes()

    # Start simulator
    doc.startSimulator(DAC_FILE)

    #Stop simulator
    doc.stopSimulator()

except Exception as err:
    print>>sys.stderr,'Error: '+str(err)+'!'
    sys.exit(-1);
[/color][/font]
Please note that the script does not have been carefully tested.

If you want to load an existing dac-file instead of starting the simulation you can use the callback [font=courier][color=blue]doc.loadTimeStep() [/color][/font] instead of [font=courier][color=blue]postTimeStep()[/color][/font]. This callback is supported by the Python API only.

Posted Tue, 21 Feb 2017 18:21:28 GMT by Anner Paldor Student
Many thanks, Bjorn. Unfortunately, I am unfamiliar with Python coding (to my shame...).
I guess I'll stick to the old (and quite cumbersome) DAR export.

Posted Tue, 21 Feb 2017 19:28:49 GMT by Björn Kaiser
Thanks for your reply Anner. From our training course at the last FEFLOW conference I know you develop in Matlab. The Python API is definitely not a big deal. Please contact me in the FEFLOW Support and we will solve it together. I would be glad to hear from you.
Posted Tue, 21 Feb 2017 19:42:42 GMT by Björn Kaiser
I am sure you will like the Python API.
Posted Sun, 26 Feb 2017 13:03:19 GMT by Anner Paldor Student
Hi Bjorn,
Sounds good. I've been meaning to jump into the Python water for some time now... This is probably the time. I'll be in touch with you.

Many many thanks again.
Posted Mon, 27 Feb 2017 10:06:44 GMT by Björn Kaiser
Great Anner... let's get in touch via mail.

You must be signed in to post in this forum.