Computer Methods in Materials Science – Endnote style
Styl do tworzenia bibliografii wg. formatu Computer Methods in Materials Science (Informatyka w technologii materiałów) dla Endnote.
Styl do tworzenia bibliografii wg. formatu Computer Methods in Materials Science (Informatyka w technologii materiałów) dla Endnote.
Skrypt pobiera tensor naprężeń z pliku wynikowego abaqusa a następnie tworzy krzywą odkształcenie/naprężenie. Skrypt działa równolegle Skrypt pobiera maksymalne wartości z ostatniego kroku obliczeń i zapisuje je do pliku
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
__author__ = "Krzysztof Bzowski" __version__ = "1.0.0" from abaqusConstants import * from math import * import odbAccess import multiprocessing as mp import os ################# CONFIGS ##################### odb11File = 'SSRVE_11' odb12File = 'SSRVE_12' odb22File = 'SSRVE_22' maxPercent = 0.01 ############################################### def avgMaxFromPercentList(l, percent, revSort): l.sort(reverse=revSort) maxElements = int(ceil(len(l) * maxPercent)) lmax = l[:maxElements] avg = sum(lmax) / float(len(lmax)) return avg def Analize(resultFile, direction, inOrder): try: os.remove(resultFile + '.txt') except OSError: pass try: os.remove(resultFile + '_MAX.txt') except OSError: pass odb = odbAccess.openOdb(resultFile+'.odb', readOnly=True) step=odb.steps['Step-1'] frames = step.frames # Stress/Strain Curve for frame in frames: stress=frame.fieldOutputs['S'].getSubset(position=INTEGRATION_POINT).values strain=frame.fieldOutputs['PE'].getSubset(position=INTEGRATION_POINT).values volumes=frame.fieldOutputs['EVOL'].values count = len(volumes) summVol = 0 summStress = 0 summStrains = 0 for i in range(0, count): s = stress[i].data[direction] # S p = strain[i].data[direction] # PE v = volumes[i].data # VOLUME summVol += v summStress += s*v summStrains += p*v avgStress = summStress/summVol avgStrain = summStrains/summVol myFile = open(resultFile+'.txt', 'a') myFile.write('{0}\t{1}\n'.format(abs(avgStrain), abs(avgStress))) myFile.close() # Max stress / strain lastFrame = frames[-1] stress=lastFrame.fieldOutputs['S'].getSubset(position=INTEGRATION_POINT).values strain=lastFrame.fieldOutputs['PE'].getSubset(position=INTEGRATION_POINT).values count = len(stress) stressList = [None] * count strainList = [None] * count for i in range(0, count): stressList[i] = stress[i].data[direction] # S strainList[i] = strain[i].data[direction] # PE maxStress = avgMaxFromPercentList(stressList, maxPercent, inOrder) maxStrain = avgMaxFromPercentList(strainList, maxPercent, inOrder) file = open(resultFile+'_MAX.txt', 'w') file.write('{0}\t{1}\n'.format(maxStrain, maxStress)) file.close() odb.close() if __name__ == '__main__': print __name__ direction11 = 0 direction22 = 1 direction12 = 3 p11 = mp.Process(target=Analize, args=(odb11File, direction11, False)) p22 = mp.Process(target=Analize, args=(odb22File, direction22, False)) p12 = mp.Process(target=Analize, args=(odb12File, direction12, True)) p11.start() p22.start() p12.start() p11.join() p22.join() p12.join() |
Dotyczy Boost 1.56. I Android NDK r10b W katalogu tools\build\src\ umieścić plik user-config.jam (przykładowy znajduje się w \tools\build\example\) o następującej treści:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import os ; androidNDKRoot = e:/Android-SDK/android-ndk-r10b ; # put the relevant path using gcc : android : $(androidNDKRoot)/standalone-toolchain/bin/arm-linux-androideabi-g++ : <compileflags>--sysroot=$(androidNDKRoot)/platforms/android-19/arch-arm <compileflags>-mthumb <compileflags>-Os <compileflags>-fno-strict-aliasing <compileflags>-O2 <compileflags>-DNDEBUG <compileflags>-g <compileflags>-lstdc++ <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include <compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include <compileflags>-D__GLIBC__ <compileflags>-D_GLIBCXX__PTHREADS <compileflags>-D__arm__ <compileflags>-D_REENTRANT <archiver>$(androidNDKRoot)/standalone-toolchain/bin/arm-linux-androideabi-ar <ranlib>$(androidNDKRoot)/standalone-toolchain/bin/arm-linux-androideabi-ranlib ; |
Kompilację uruchomić jako:
|
1 |
b2 --without-python --without-mpi --without-serialization threading=multi link=static runtime-link=static toolset=gcc-android target-os=linux threadapi=pthread --stagedir=android stage |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
from cStringIO import StringIO from UserString import MutableString import time max = 100000 print "Benchmarking ", max, " string concatenations." start = time.time() buf1 = StringIO() for i in range(1,max): buf1.write(str(i)) end = time.time() print "StringIO write():\t", end - start start = time.time() buf2 = MutableString() for i in range(1,max): buf2 += str(i) end = time.time() print "MutableString +=:\t", end - start start = time.time() buf3 = "" for i in range(1,max): buf3 += str(i) end = time.time() print "String +=:\t\t", end - start start = time.time() buf4 = MutableString() for i in range(1,max): buf4.append(str(i)) end = time.time() print "MutableString Append():\t", end - start start = time.time() buf5 = ''.join([`num` for num in xrange(max)]) end = time.time() print "String join():\t\t", end - start |
|
1 2 3 4 5 6 |
Benchmarking 100000 string concatenations. StringIO write(): 0.0330123901367 MutableString +=: 23.9283676147 String +=: 25.2034454346 MutableString Append(): 25.2694396973 String join(): 0.0279998779297 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#!/bin/bash # prune include files one at a time, recompile, and put them back if it doesn't compile # arguments are list of files to check removeinclude() { file=$1 header=$2 perl -i -p -e 's+([ \t]*#include[ \t][ \t]*[\"\<]'$2'[\"\>])+//REMOVEINCLUDE $1+' $1 } replaceinclude() { file=$1 perl -i -p -e 's+//REMOVEINCLUDE ++' $1 } for file in $* do #echo $file includes=`grep "^[ \t]*#include" $file | awk '{print $2;}' | sed 's/[\"\<\>]//g'` echo $includes for i in $includes do touch $file # just to be sure it recompiles removeinclude $file $i if make -j10 >/dev/null 2>&1; then grep -v REMOVEINCLUDE $file > tmp && mv tmp $file echo removed $i from $file else replaceinclude $file echo $i was needed in $file fi done done |
Skrypt usuwa kolejne #include a następnie rekompiluje kod by sprawdzić czy nadal działa. Jako argument skrypt przyjmuje katalog z plikami do sprawdzenia.
Narzędzie do statycznego analizowania kodu C++.
|
1 |
./cppcheck /home/kbzowski/femafat_new/ --std=c++11 --report-progress --enable=all -I /packages/deal.ii/8.2pre-gcc482/include/ -I /packages/boost/1.55.0-gcc482/ --xml --xml-version=2 -i /home/kbzowski/femafat_new/CMakeFiles 2> /home/kbzowski/femafat_new/cppcheck.xml |
-I – Include directory -i – Ignore directory –xml – Wyjście jako xml (potrzebne do raportów HTML) –enable=all – Sprawdza co się da Generowanie raportów HTML:
|
1 |
cppcheck-htmlreport --file=/home/kbzowski/femafat_new/cppcheck.xml --report-dir=/home/kbzowski/femafat_new/Reports --source-dir=/home/kbzowski/femafat_new |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#include <math.h> #include <iostream> using namespace std; extern "C" void uhard(double *, double *, double *, double *, double *, double *, double *, double *, int *, int *, int *, int *, int *, int *, char *, int *, double *, int *, double *, double *, int*, double *); /** User subroutine UHARD: is called at all material calculation points of elements for which the material definition includes user-defined isotropic hardening or cyclic hardening for metal plasticity; - can be used to define a material's isotropic yield behavior; - can be used to define the size of the yield surface in a combined hardening model; - can include material behavior dependent on field variables or state variables; - and requires, when appropriate, that the values of the derivatives of the yield stress (or yield surface size in combined hardening models) be defined with respect to the strain, strain rate, and temperature. */ void uhard(double *syield, double *hard, double *eqplas, double *eqplasrt, double *time, double *dtime, double *temp, double *dtemp, int *noel, int *npt, int *layer, int *kspt, int *kstep, int *kinc, char *cmname, int *nstatev, double *statev, int *numfieldv, double *predef, double *dpred, int *numprops, double *props) { // USER CODING TO DEFINE: // SYIELD - (sigma_0) - Yield stress for isotropic plasticity. Yield surface size for combined hardening. // hard[0] - Variation of SYIELD with respect to the equivalent plastic strain // hard[1] - Variation of SYIELD with respect to the equivalent plastic strain rate, This quantity is not used with the combined hardening model. // hard[2] - Variation of SYIELD with respect to temperature, This quantity is required only in adiabatic, fully coupled temperature-displacement, and thermal-electrical-structural analyses. // statev@nstatev - Array containing the user - defined solution - dependent state variables at this point.These are supplied as values at the beginning of the increment or as values updated by other user subroutines and must be returned as values at the end of the increment. // VARIABLES PASSED IN FOR INFORMATION: // eqplas - Equivalent plastic strain // eqplasrt - Equivalent plastic strain rate // time[0] - Value of step time at the beginning of the current increment. // time[1] - Value of total time at the beginning of the current increment. // dtime - Time increment // temp - Temperature at the beginning of the increment. // dtemp - Increment of temperature. // noel - Element number. // npt - Integration point number. // layer - Layer number(for composite shells and layered solids). // kspt - Section point number within the current layer. // kstep - Step number. // kinc - Increment number. // cmname - User - specified material name, left justified. // nstatv - User - specified number of solution - dependent state variables associated with this material // numfieldv - Number of field variables. // predef@numfieldv - Array of interpolated values of predefined field variables at this material point at the start of the increment based on the values read in at the nodes(initial values at the beginning of the analysis and current values during the analysis). // dpred@numfieldv - Array of increments of predefined field variables at this material point for this increment; this includes any values updated by user subroutine USDFLD. // numprops - Number of hardening properties entered for this user - defined hardening definition. // props@numprops - Array of hardening properties entered for this user - defined hardening definition. double a = 800; double n = 0.2; const double zero = 0.0; double eps = 0; if(*eqplas == zero) { eps = 0.01; } // syield - Naprezenie - obliczone na podstawie odksztalcenia eqpla *syield = a * powf(eps, n); // hard[0] - wartosc pochodnej po odksztalceniu hard[0] = a * n * powf(eps, n - 1); // hard[1] - wartosc pochodnej po predkosci odksztalcenia // hard[2] - wartosc pochodnej po temperaturze return; } |
HELP:
|
1 |
abaqus debug help |
ŚRODOWISKO: Abaqus < 6.14.x – abaqus_v6.env lub Abaqus >= 2016: Dassault Systemes\SimulationServices\V6R2016x\win_b64\SMA\site\win86_64.env
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
compile_cpp=['cl', '/c', '/W0', '/MD', '/TP', '/EHsc', '/DNDEBUG', '/DWIN32', '/DTP_IP', '/D_CONSOLE', '/DNTI', '/DFLT_LIC', '/DOL_DOC', '/D__LIB__', '/DHKS_NT', '/D_WINDOWS_SOURCE', '/DFAR=', '/D_WINDOWS', '/DABQ_WIN86_64', '%P', # '/O1', # <-- Optimization '/Zi', # <-- Debug symbols '/I%I'] compile_fmu=['win64CmpWrp', '-m64', '-msvc9', 'cl', '/LD', '/D_WINDOWS', '/TC', '/W0', '/I%I'] compile_fortran=['ifort', '/c','/DABQ_WIN86_64', '/extend-source', '/fpp', '/iface:cref', '/recursive', '/Qauto-scalar', '/QxSSE3', '/QaxAVX', '/heap-arrays:1', '/Od', '/Ob0', # <-- Optimization Debugging '/Zi', # <-- Debugging '/include:%I'] link_sl=['LINK', '/nologo', '/NOENTRY', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64', '/NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB', '/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:LIBIFCOREMD.LIB', '/DEFAULTLIB:LIBIFPORTMD.LIB', '/DEFAULTLIB:LIBMMD.LIB', '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib', '/FIXED:NO', '/dll', '/debug', # <-- Debugging '/def:%E', '/out:%U', '%F', '%A', '%L', '%B', 'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib', 'advapi32.lib'] link_exe=['LINK', '/nologo', '/INCREMENTAL:NO', '/subsystem:console', '/machine:AMD64', '/STACK:20000000', '/NODEFAULTLIB:LIBC.LIB', '/NODEFAULTLIB:LIBCMT.LIB', '/DEFAULTLIB:OLDNAMES.LIB', '/DEFAULTLIB:LIBIFCOREMD.LIB', '/DEFAULTLIB:LIBIFPORTMD.LIB', '/DEFAULTLIB:LIBMMD.LIB', '/DEFAULTLIB:kernel32.lib', '/DEFAULTLIB:user32.lib', '/DEFAULTLIB:advapi32.lib', '/FIXED:NO', '/LARGEADDRESSAWARE', '/debug', # <-- Debugging '/out:%J', '%F', '%M', '%L', '%B', '%O', 'oldnames.lib', 'user32.lib', 'ws2_32.lib', 'netapi32.lib', 'advapi32.lib'] |
EXAMPLE:
|
1 2 |
compilervars.bat intel64 abaqus -debug -standard -input Job-1 -user myuhard -job Job-1 -interactive |
ReAttach
Otwieranie nowej zakładki ConEmu z Windows Command Prompt (cmd) w aktualnie wyświetlonym katalog w Total Commanderze:
|
1 |
"C:\Program Files\ConEmu\ConEmu64.exe" -single -cmd cmd /K "cd %p" |
lub
|
1 |
"C:\Program Files\ConEmu\ConEmu64.exe" -single -cmd "{Shells::cmd}" /K "cd %p" |