Extracting Total Discharge versus Time for a Drain

I'm modeling a constant head pumping test and I would like to extract the discharge rate versus time during a coupled flow phase. Is it possible to obtain the discharge for times other than the final solution time? Ideally I'd like to use the Curves to plot discharge versus time. Anyone know how to do this?

Thanks,

Martin

Parents
  • Hello Martin,

    It is possible to extract the values by command line and using Python.

    The result per step can give you the different Time and also the result for TotalDischarge for the drain element. 

    The command I used for the example that follows is:
    getresults Drain_1_1 Step_26 ResultTypes.Drain.TotalDischarge "Node"

    Now, things can be easily extracted with Python and that is the case I show below. I based this on an existing example we have on our Wiki page:
    https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/45455/how-to-get-a-load---displacement-curve-using-scripting-interface

    In the example below I create a function and I loop over the phases list provided (here only one phase) and the drain element needed. Then, I create a matplolib plot and a text file to process data later on.

    This example can be more efficient and fit-to-purpose but I think it serves as a good example for what you need.

    from plxscripting.easy import *
    localhostport = 10001
    s_o, g_o = new_server('localhost', localhostport, password='YOUR_PASSWORD')
    
        
    def get_drain_results(filename, phases_o, drain):
        # initial data for eventual table columns    
        col_phases = ["Phase"]
        col_time = ["Time"]    
        col_totdischarge = ["TotalDischarge"] 
    
        # look into all phases, all steps: 
        for phase in phases_o: 
            for step in phase.Steps: 
                col_phases.append(phase.Name) 
                time = step.Reached.Time.value
                time_short = '{:.3f}'.format(time)  # reduce to 3 digits after decimal point
                col_time.append(time_short)
                col_totdischarge.append(g_o.getresults(drain, step, g_o.ResultTypes.Drain.TotalDischarge, "Node")[-1])
    
    
        if filename is not None: 
            with open(filename,"w") as file: 
                for results in zip(col_phases, col_time, col_totdischarge): 
                    print('\t'.join(["{}".format(i) for i in results]), file=file) 
    
    
        # Make a quick plot of the Discharge-Time curve 
        import matplotlib.pyplot as plt 
        plt.plot(col_time[1:], col_totdischarge[1:] )
        plt.xlabel('Time (days)')
        plt.ylabel('Total Discharge (m3/day/m)')
        plt.title('Discharge-Time curve') 
        plt.grid(True)
        plt.savefig("load_displ_curve.png")
        if filename: 
            plt.savefig(filename.replace(".txt", ".png")) 
        plt.show()
    
    
    get_drain_results(filename = r'D:\drain_data_per_step.txt', phases_o = [g_o.Phase_1], drain = g_o.Drain_1_1)
    

Reply
  • Hello Martin,

    It is possible to extract the values by command line and using Python.

    The result per step can give you the different Time and also the result for TotalDischarge for the drain element. 

    The command I used for the example that follows is:
    getresults Drain_1_1 Step_26 ResultTypes.Drain.TotalDischarge "Node"

    Now, things can be easily extracted with Python and that is the case I show below. I based this on an existing example we have on our Wiki page:
    https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/45455/how-to-get-a-load---displacement-curve-using-scripting-interface

    In the example below I create a function and I loop over the phases list provided (here only one phase) and the drain element needed. Then, I create a matplolib plot and a text file to process data later on.

    This example can be more efficient and fit-to-purpose but I think it serves as a good example for what you need.

    from plxscripting.easy import *
    localhostport = 10001
    s_o, g_o = new_server('localhost', localhostport, password='YOUR_PASSWORD')
    
        
    def get_drain_results(filename, phases_o, drain):
        # initial data for eventual table columns    
        col_phases = ["Phase"]
        col_time = ["Time"]    
        col_totdischarge = ["TotalDischarge"] 
    
        # look into all phases, all steps: 
        for phase in phases_o: 
            for step in phase.Steps: 
                col_phases.append(phase.Name) 
                time = step.Reached.Time.value
                time_short = '{:.3f}'.format(time)  # reduce to 3 digits after decimal point
                col_time.append(time_short)
                col_totdischarge.append(g_o.getresults(drain, step, g_o.ResultTypes.Drain.TotalDischarge, "Node")[-1])
    
    
        if filename is not None: 
            with open(filename,"w") as file: 
                for results in zip(col_phases, col_time, col_totdischarge): 
                    print('\t'.join(["{}".format(i) for i in results]), file=file) 
    
    
        # Make a quick plot of the Discharge-Time curve 
        import matplotlib.pyplot as plt 
        plt.plot(col_time[1:], col_totdischarge[1:] )
        plt.xlabel('Time (days)')
        plt.ylabel('Total Discharge (m3/day/m)')
        plt.title('Discharge-Time curve') 
        plt.grid(True)
        plt.savefig("load_displ_curve.png")
        if filename: 
            plt.savefig(filename.replace(".txt", ".png")) 
        plt.show()
    
    
    get_drain_results(filename = r'D:\drain_data_per_step.txt', phases_o = [g_o.Phase_1], drain = g_o.Drain_1_1)
    

Children
No Data