Build Calculix2.6.1 in Mingw64

There is detailed description here http://mechanicalhacks.wordpress.com/2011/03/29/building-calculix-to-run-native-on-64-bit-windows/. But it doesnot works well, at least for ccx2.6.1. Here are some complemetation

1. Build  ARPACK.
    Modify ARmake.inc at follows
1) home="your current ARPACK home";
2) PLAT=anything you like. It would be appended in your library name.
3) Change the DIRS as
     DIRS = $(UTILdir)  $(SRCdir)
4) Make sure file second.f, which would in standard LAPACK library, in folder UTIL is not in your compile list.
5) RANLIB  = touch

2. Build spooles
   Following modifictions
1) Modify line 9 of SPOOLES.2.2/Tree/src/MakeGlobalLib from drawTree.c to draw.c
2) Modify line 204 of SPOOLES.2.2/MT/src/QRfactorMT.c from
   tids[myid]=0;
to memset(&tids[myid], 0, sizeof(pthread_t) );
3) Modify Make.inc
  THREAD_LIBS= -lpthread
4) Modify makefile
  uncomment
  #  cd MT               ; make lib
in make lib option

3. Build Calculix
1) Add #include "pthread.h" into file CalculiX.h
2) Modify Makefile as follows
  ・ Indicate where library of spooles, ARAPCK, BLAS and Lapack in in include in your LIBS, just like

DIR=../../../../solver/SPOOLES.2.2
BLASDIR = ../../../../solver/lapack-3.4.2
LIBDIR=/c/mingw64/x86_64-w64-mingw32/lib


LIBS = \
    $(DIR)/MT/src/spoolesMT.a \
       $(DIR)/spooles.a \
       ../../../../solver/ARPACK/libarpack_WIN64.a \
    $(BLASDIR)/liblapack.a $(BLASDIR)/librefblas.a \
       $(LIBDIR)/libpthread.a \
       $(LIBDIR)/libm.a


 Then just make it. That's all!


 


矢量沿曲线的平移

话说黄帝蚩尤大战于涿鹿, 其时浓雾弥漫, 不知东西. 黄帝造指南車辨识道路......
Fig.1 Parralel transport of a vector along a great circle of the sphere

现在考虑A部落的士兵在指南車的指引下向正南C, D部落的士兵在指南車的指引下也向正南C前进, 当他们在C点汇合时发现A,D指南車的指向是不同的!这一结果与我们在欧式空间的平行的概念大不相同.

  1. 曲面上的"平行移动"・协变导数
  上面的例子说明我们需要重新定义所谓平行这一概念. 不与欧式空间的平行的概念相冲突, 我们小心地定义所谓平行是矢量V沿曲线U的方向导数为零

  注意到上述导数其实尚未有明确的定义,我们把球面上的矢量V写成球坐标形式
,其在欧式空间中沿 轴的方向导数为

将基矢的偏导表述为基矢和球面法向n的线性函数

该式称为高斯方程. 这里为克氏符,为Weingarten方程. 注意到, K和$\Gamma$的两个下标是对称的.

   但对于黄帝部落而言,他们只知道球面上的东西,对球面外的法线一无所知! 在球面世界上来看, 上述方向导数为

在这里称为矢量V沿$\nu$轴的协变或绝对导数, 与欧式空间中方向导数相比较, 它去掉了球面法向的变化, 如下图
Fig.2 欧式空间的平行移动(V->V')和曲面空间的平行移动(V->V'')([1]p.102)

   矢量沿曲线的协变导数为零就是矢量沿曲线的平行移动条件.

   现在把矢量V沿方向U的协变导数写成.可以看出是一(1,1)张量, 称为协变导数.

   2. 克氏符・联络
   在欧式空间中克氏符的计算方法在高斯方程中给出.在曲面(黎曼)空间中,我们先要定义其度规, 然后设度规沿任一曲线的协变导数为零,由此推出克氏符的计算方法,称为与度规相适配的克氏符.

交换上式下标abc的顺序可的


由此可以得到

称为Levi-Civita联络. 克氏联络还有一个简单的表达式([3]p106-108)

由此


   3. 1形式的协变导数
   考虑一标量

可定义

为1形式的协变导数.由于上面方程的左边和倒数第二项都是张量, 该1形式的协变导数也是张量. 此时



主要参考文献
1. A. Zee, Einstein Gravity in a Nutshell, 2013, Princeton University
2. B.F.Schutz, Geometrical methods of mathematical physics, 1980, Cambridge Univeristy
3. S. Weinberg, Gravitation and cosmology: Principles and applications of the general theory of relativity, 1971, John Wiley & Sons

连续体的数学定义

在JE. Marsden & TJR Hughes的Mathematical foundations of elasticity(1993)中,变形体定义为
   A simple body is an open set $B\in R^3$

JT. Oden(Applied Functional Analysis, 1979)的定义为
  A continuous body is an open subset of the three-dimensional Euclidean space $R^3$

但这些定义不足于基本的变形计算, 连续体的数学定义似乎定义为带边的微分流形(Manifold with boundary)为好.

Build Elmer in MingW64

To compile Elmer-trunk-svn4252

1. Refer to the script suggested,  following script is adopted

#!/bin/sh -f
export ELMER_HOME=/c/Myprograms/Fortran/Elmer/elmertest
export ELMER_POST_HOME=$ELMER_HOME/share/elmerpost
export ELMER_FRONT_HOME=$ELMER_HOME/share/elmerfront

export PATH=$ELMER_HOME/bin:$PATH

export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export FC=x86_64-w64-mingw32-gfortran
export F77=x86_64-w64-mingw32-gfortran
export CPP=x86_64-w64-mingw32-cpp
export LDFLAGS="-L/c/Myprograms/Fortran/Elmer/elmertest/lib -Xlinker --stack=1000000000 "

modules="matc umfpack mathlibs elmergrid meshgen2d eio hutiter fem post front"

for m in $modules; do
  cd $m
  ./configure --prefix=$ELMER_HOME
  make
  make install
  cd ..
done

2. Type in ./configure. Several problems exists
1)  Makefiles generated includes -lm', which is supposed to link libm.a. You may need delete all of them.
2) cpp is needed even if you use export CPP=***. Just copy one with exactly this name.
3) Delete link of _muldc3.o in your Makefiles.

3.  Some link to AMD function in UMFPACK fails. Use offically one instead.
http://www.cise.ufl.edu/research/sparse/amd/

4. You may also need tcl/tk installed to compile Elmer GUI.

TortoiseGit下GitHub环境的设定: 从登录到Repository的建立

1. 在https://github.com/ 登录一个新帐号
2. 在GiHub中建立一个新的Repository



3.  选定Repository类型为SSH


4.  回到GitHub主页

5. 安装TortoiseGit

6. 执行TortoiseGit下的Puttygen程序产生公开键和秘密键

7. 在GitHub中登录公开键






8.  在本地环境下使用TortoiseGit建立本地Repository.

9.  在本地Repository中增加文件add->commit->push
 
 
 
 
10. 在按下push后设定秘密键
 
 
 

11. 确认文件已经载入GitHub.


参考资料




 

A tool set to manage variables or curves with multi-layer dependence

1. Objective

   A variable, such as Young's modulus of a elastic media, or a curve, such as stress-strain relations may depends upon various variables as temperature, mass densities of purities etc. This tool provides function of reading and fetching relevant data as independent variables are given.

2. Algorithm

    A tree structure with its node composed by a std::vector<double> is adopted.

3. Functions

1) Read data in tabular form as below
  • Each line of input data must be
---------------------------------------------------------------------------------------------------
    Dependent data1, Dependent data2, ..., independent data1, independent data2, ...
---------------------------------------------------------------------------------------------------
The number of dependents and independents is not limited but constrained by the limit of layer of recursive functions of the compiler used. By the way, data in a line may separated by common or space.
  • Independent data must be inputted in increasing sequences, i.e, input minor value at first and max at last. No sort function here.
  • To define multi-layer dependents, define independent data j while independent j+1 keep constant.

An example,
1.0  3.3  5.0  10.
3.0  4.3  6.0  10.
2.0  5.3  7.0  10.
4.0  6.3  8.0  10.
1.0  3.5  4.0  20.
3.0  4.5  6.0  20.
5.0  5.5  8.0  20.
2.0  6.5  10.0  20.

In this table, the first two column are dependent data while the other two are independent data. Here, when independent data2=10, independent data1 changes from 5.0 to 8.0. When independent data2=20, independent data1 changes from 4.0 to 10.0.

  I think the above format is same with format using by ABAQUS in its field variable dependence definition of material data.

  To read the data and construct our tree structure, just call
------------------------------------------------------------------------
      XYLIB::CVectorTree a(int ncomp, std::ifstream& file)
------------------------------------------------------------------------
where ncomp is the number of dependent data.

2)  Data fetch. Two types interface provides,
---------------------------------------------------------------------
bool GetValue(ValueType& idata,ValueType& odata )
bool GetGrad(ValueType& idata,ValueType& odata)
---------------------------------------------------------------------
Here, we provide independent data into idata and get value needed in odata. When using GetValue, eg., we can get the Young's modulus and Poisson's ratio at temperature T. When using GetGrad, eg., we can get the derivative of the stress-strain curve at temperature T and strain E etc. And, all the data are obtained by linear interpolation. If the independent variables run out the range of the table data defined, we try to find the nearest one (min or max value defined in table).

4. Usages

 1) Download the source code from: https://github.com/hillyuan/FEComponent/blob/master/include/misc/VectTree.h
2)  Just include the header file VectorTree.h

Example:

#include <iostream>
#include "VectTree.h"

int main()
{
    std::ifstream ifs( "input.txt" );
    if( ifs.fail() ) {
        std::cerr << "File do not exist.\n";
        exit(0);
    }
    XYLIB::CVectorTree a(2,ifs);
    a.Show(a.GetRoot());
    std::vector<double_t> idata, odata, odata1;
    idata.push_back(7.5);
    idata.push_back(15.0);
    if(  a.GetValue(idata, odata) ) {
        std::cerr << "Fails to get value.\n";
        exit(0);
    }
    std::cout << "result:"<<odata.size()<< "  "<<odata[0] <<"  "<<odata[1] << std::endl;
    if( a.GetGrad(idata, odata1) ) {
        std::cerr << "Fails to get gradient.\n";
        exit(0);
    }
    std::cout << "result:"<<odata1.size()<< "  "<<odata1[0] << "  "<<odata[1];
    return 0;
}

The example of context of input.txt here:
1.0 3.3 5.0 10.
3.0 4.3 6.0 10.
2.0 5.3 7.0 10.
4.0 6.3 8.0 10.
1.0 3.5 4.0 20.
3.0 4.5 6.0 20.
5.0 5.5 8.0 20.
2.0 6.5 10.0 20.

在cygwin或mingw中使用intel编译器

1. 在windows cmd shell环境下设定intel 编译环境
如;
# 进入command prompt, 执行ipsxe-comp-vars.bat or ifortvars.bat and iclvars.bat(该文件名和安装路径与版本有关)
# 直接执行上述, 如Start -> Programs -> Intel Software Development Tools -> Intel Fortran Compiler 10 -> Visual Fortran Build Enviornment

2. 键入C:\msys\1.0\ msys.bat进入msys, 或
    键入c:\cygwin\bin\bash.exe --login 进入cygwin

3. Ready

VS Code下cmake, c++编译,调试环境的构成步骤

1   下载必须extension      按[Ctrl+Shift+X]打开extension窗口,选择安装"C/C++", "CMake", "CMake Tools" 2   在VSCode下打开作业目录 ...