← Back to team overview

yade-users team mailing list archive

[Question #698705]: Batch

 

New question #698705 on Yade:
https://answers.launchpad.net/yade/+question/698705

Hi,

I have began to work with batch mode. I run a script in batch mode, where I read the materials parameter (k1 and kp) from the table.
The code work in regular mode, but does gives following error message in batch mode:

#0 (k1=700,kp=10) FAILED  (exit status 256), duration 00:00:01, log tablet_compaction_dual_punch_PH101.py.k1=700,kp=10.log

Here is my table
k1 kp 
700 7000 
650 7800 
600 12000 

here is my code:
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 15 16:29:55 2021

@author: njb18198
"""

#!/usr/bin/env python
#encoding: ascii

# Testing of the Deformation Enginge with Luding Contact Law
# Modified Oedometric Test
# The reference paper [Haustein2017]
from __future__ import print_function
from yade import utils, plot, timing
from yade import pack
import pandas as pd
import numpy as np
from PIL import Image
from yade import pack, export
from scipy.interpolate import interp1d
from csv import writer
import os
from yade.params.table import *


o = Omega()

# Physical parameters
fr = 0.41
rho = 1561
Diameter = 7.9e-5
D=Diameter
r1 = Diameter/2
#r2 = Diameter/2
k1 = k1
kp = kp*k1
kc = k1 * 0.1
ks = k1 * 0.1
DeltaPMax = Diameter/3.0
Chi1 = 0.34

o.dt = 1.0e-7
particleMass = 4.0/3.0*math.pi*r1*r1*r1*rho
m_tot=4e-06
no_p=m_tot/particleMass

Vi1 = math.sqrt(k1/particleMass)*DeltaPMax*Chi1
PhiF1=0.999
#PhiF1 = DeltaPMax*(kp-k1)*(r1+r2)/(kp*2*r1*r2)

Tab_rad=0.001
Cyl_height=0.0092
cross_area=math.pi*(Tab_rad**2)



Comp_press_up= 0.56e8
Comp_force_up=Comp_press_up*cross_area

Comp_press_lp= 0.56e8
Comp_force_lp=Comp_press_lp*cross_area


compression_data_save=[]
sc_por=0.3

#Read exp data
path_data='/home/mithushan/Compaction_data'
Exp=pd.read_csv(os.path.join(path_data,r'Compaction_results_PH101_porosity_22.csv'))
Exp.Compression_pressure=Exp.Compression_pressure/2
idxmax_Exp=Exp.idxmax(axis = 0)
Exp_loading=Exp[0:idxmax_Exp.Compression_pressure+1]
Exp_unloading=Exp[idxmax_Exp.Compression_pressure+1:len(Exp)]
#*************************************
def append_list_as_row(file_name, list_of_elem):
    # Open file in append mode
    with open(file_name, 'a+', newline='') as write_obj:
        # Create a writer object from csv module
        csv_writer = writer(write_obj)
        # Add contents of list as last row in the csv file
        csv_writer.writerow(list_of_elem)


# Add material
mat1 = O.materials.append(LudingMat(frictionAngle=fr, density=rho, k1=k1, kp=kp, ks=ks, kc=kc, PhiF=PhiF1, G0 = 0.0))


# Spheres for compression and walls
sp=pack.SpherePack()
sp.makeCloud((-7.5*Diameter,-7.5*Diameter,-57*Diameter),(7.5*Diameter,7.5*Diameter,57.0*Diameter), rMean=Diameter/2.0,rRelFuzz=0.18,num=round(no_p))
sp.toSimulation(material=mat1)
walls=O.bodies.append(yade.geom.facetCylinder((0,0,0),radius=Tab_rad,height=Cyl_height,segmentsNumber=20,wallMask=6,material=mat1))

# Add engines
o.engines = [
  ForceResetter(),
  InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.05),
                         Bo1_Wall_Aabb(),
                         Bo1_Facet_Aabb()
                         ]),
  InteractionLoop(
    [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.05),
     Ig2_Facet_Sphere_ScGeom(),
     Ig2_Wall_Sphere_ScGeom()],
    [Ip2_LudingMat_LudingMat_LudingPhys()],
    [Law2_ScGeom_LudingPhys_Basic()]
  ),
  NewtonIntegrator(damping=0.1, gravity=[0, 0, -9.81]),
  PyRunner(command='checkForce()', realPeriod=1, label="fCheck"),
  #DeformControl(label="DefControl")
]


def checkForce():
    if O.iter < 450000:
        return
    if unbalancedForce() > 1:
        return
    global upper_punch
    upper_punch=O.bodies.append(geom.facetCylinder((0,0,((-Cyl_height/2)+0.0002)+utils.aabbDim()[2]),Tab_rad-.00001,0,segmentsNumber=50,wallMask=1))
    for i in upper_punch:
        body= O.bodies[i]
        body.state.vel = (0,0,-1)
    global lower_punch
    lower_punch= O.bodies.append(geom.facetCylinder((0,0,(-Cyl_height/2)-0.0002),Tab_rad-.00001,0,segmentsNumber=50,wallMask=1))
    for n in lower_punch:
        body= O.bodies[n]
        body.state.vel = (0,0,1)
    fCheck.command = 'unloadPlate()'

def unloadPlate():
    force_up=0
    for i in upper_punch:
        body= O.bodies[i]
        force_up=force_up+abs(O.forces.f(body.id)[2])
    force_lp=0
    for n in lower_punch:
        body = O.bodies[n]
        force_lp = force_lp + abs(O.forces.f(body.id)[2])
    if ((force_up > Comp_force_up) and (force_lp > Comp_force_lp)):
        for i in upper_punch:
            body= O.bodies[i]
            body.state.vel = (0,0,1)
        for n in lower_punch:
            body= O.bodies[n]
            body.state.vel = (0,0,-1)
        fCheck.command = 'stopUnloading()'

def stopUnloading():
    force_up=0
    for i in upper_punch:
        body= O.bodies[i]
        force_up=force_up+(O.forces.f(body.id)[2])
    force_lp=0
    for n in lower_punch:
        body = O.bodies[n]
        force_lp = force_lp + abs(O.forces.f(body.id)[2])
    if ((force_up==0) and (force_lp==0)):
    	plot.saveDataTxt(O.tags['d.id']+'.txt')
        o.pause()    
      


O.run()
# when running with yade-batch, the script must not finish until the simulation is done fully
# this command will wait for that (has no influence in the non-batch mode)
waitIfBatch()

path_save='/home/mithushan/Compaction_data'    
compression_data=pd.DataFrame(compression_data_save, columns=['Porosity','Compression_pressure'])
compression_data.to_csv(os.path.join(path_save,r'compression_data.csv'))



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.