Skip to content

Commit

Permalink
Merge pull request KratosMultiphysics#707 from KratosMultiphysics/fea…
Browse files Browse the repository at this point in the history
…ture-unmerged-release-fixes

Feature unmerged release fixes
  • Loading branch information
roigcarlo authored Aug 3, 2017
2 parents 82132f0 + 213ff6e commit 2e80f87
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 53 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project (KratosMultiphysics)

# Set here the version number **** only update upon tagging a release!
set (KratosMultiphysics_MAJOR_VERSION 5)
set (KratosMultiphysics_MINOR_VERSION 0)
set (KratosMultiphysics_MINOR_VERSION 1)
set (KratosMultiphysics_PATCH_VERSION 0)

# Get subversion data. This is done automagically by the cmakes
Expand Down
2 changes: 1 addition & 1 deletion applications/FluidDynamicsApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ install(TARGETS KratosFluidDynamicsApplication DESTINATION libs )

if(${INSTALL_TESTING_FILES} MATCHES ON)
get_filename_component (CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN "*.json" PATTERN "*.mdpa" PATTERN ".svn" EXCLUDE)
endif(${INSTALL_TESTING_FILES} MATCHES ON)

if(${INSTALL_PYTHON_FILES} MATCHES ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ int FractionalStep<TDim>::Check(const ProcessInfo &rCurrentProcessInfo)
if(this->GetGeometry()[i].HasDofFor(PRESSURE) == false)
KRATOS_THROW_ERROR(std::invalid_argument,"missing PRESSURE component degree of freedom on node ",this->GetGeometry()[i].Id());
}

// If this is a 2D problem, check that nodes are in XY plane
if (this->GetGeometry().WorkingSpaceDimension() == 2)
{
Expand Down Expand Up @@ -1113,7 +1113,7 @@ void FractionalStep<TDim>::CalculateGeometryData(ShapeFunctionDerivativesArrayTy
for (unsigned int g = 0; g < rGeom.IntegrationPointsNumber(GeometryData::GI_GAUSS_2); g++)
rGaussWeights[g] = DetJ[g] * IntegrationPoints[g].Weight();


/*
const GeometryType& rGeom = this->GetGeometry();
const SizeType NumNodes = rGeom.PointsNumber();
Expand Down Expand Up @@ -1195,15 +1195,15 @@ double FractionalStep<TDim>::EffectiveViscosity(double Density,
double ElemSize,
const ProcessInfo &rProcessInfo)
{
double Csmag = this->GetValue(C_SMAGORINSKY);
const FractionalStep<TDim>* const_this = static_cast<const FractionalStep<TDim>*> (this);
const double Csmag = const_this->GetValue(C_SMAGORINSKY);
double Viscosity = 0.0;
this->EvaluateInPoint(Viscosity,VISCOSITY,rN);

if (Csmag > 0.0)
{
double StrainRate = this->EquivalentStrainRate(rDN_DX); // (2SijSij)^0.5
double LengthScale = Csmag*ElemSize;
LengthScale *= LengthScale; // square
const double StrainRate = this->EquivalentStrainRate(rDN_DX); // (2SijSij)^0.5
const double LengthScale = std::pow(Csmag*ElemSize, 2);
Viscosity += 2.0*LengthScale*StrainRate;
}

Expand Down Expand Up @@ -1450,7 +1450,7 @@ void FractionalStep<TDim>::CalculateProjectionRHS(VectorType& rMomentumRHS,
const array_1d<double,3>& vel = this->GetGeometry()[i].FastGetSolutionStepValue(VELOCITY);
for (SizeType d = 0; d < TDim; ++d)
Convection[d] += ConvOp[i] * vel[d];

}

array_1d<double,TDim> PressureGradient(TDim,0.0);
Expand Down Expand Up @@ -1494,10 +1494,10 @@ void FractionalStep<TDim>::CalculateProjectionRHS(VectorType& rConvTerm,

array_1d<double,3> Convection(3,0.0);
for (unsigned int i = 0; i < NumNodes; ++i)
{
{
const array_1d<double,3>& vel = this->GetGeometry()[i].FastGetSolutionStepValue(VELOCITY);
for (unsigned int d = 0; d < TDim; ++d)
Convection[d] += ConvOp[i] * vel[d];
Convection[d] += ConvOp[i] * vel[d];
}

array_1d<double,TDim> PressureGradient(TDim,0.0);
Expand Down Expand Up @@ -1585,7 +1585,7 @@ void FractionalStep<TDim>::ModulatedGradientDiffusion(MatrixType& rDampMatrix,

// C_epsilon
const double Ce = 1.0;

// ksgs
double ksgs = -4*AvgDeltaSq*GijSij/(Ce*Ce*Gkk);

Expand Down
2 changes: 1 addition & 1 deletion applications/SolidMechanicsApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(${INSTALL_TESTING_FILES} MATCHES ON)
get_filename_component (CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN "*.json" PATTERN "*.mdpa" PATTERN ".svn" EXCLUDE)
endif(${INSTALL_TESTING_FILES} MATCHES ON)

if(${INSTALL_PYTHON_FILES} MATCHES ON)
Expand Down
4 changes: 2 additions & 2 deletions applications/StructuralMechanicsApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

if(${INSTALL_TESTING_FILES} MATCHES ON)
get_filename_component (CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" EXCLUDE)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN "*.json" PATTERN "*.mdpa" PATTERN ".svn" EXCLUDE)
endif(${INSTALL_TESTING_FILES} MATCHES ON)

if(${INSTALL_PYTHON_FILES} MATCHES ON)
get_filename_component (CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python_scripts DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN "*.csv")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python_scripts DESTINATION applications/${CURRENT_DIR_NAME} FILES_MATCHING PATTERN "*.py" PATTERN "*.csv")
endif(${INSTALL_PYTHON_FILES} MATCHES ON)

# get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
Expand Down
2 changes: 0 additions & 2 deletions embedded_python/krun_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@

Py_NoSiteFlag = 1;
Py_SetProgramName(wchar_argv[0]);

Py_Initialize();

PySys_SetArgv(argc-1, &wchar_argv[1] );
Expand Down Expand Up @@ -104,7 +103,6 @@

PyObject* sysPath = PySys_GetObject((char*)"path");
PyList_Insert(sysPath,0, PyString_FromString("."));
PyList_Insert(sysPath,0, PyString_FromString("python27.zip"));
PySys_SetArgv(argc-1,&argv[1]);

char filename[1024];
Expand Down
2 changes: 1 addition & 1 deletion external_libraries/mpi_python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ add_definitions( -w )
###############################################################
add_library(mpipython SHARED ${MPI_PYTHON_SOURCES})

target_link_libraries(mpipython ${Boost_PYTHON_LIBRARIES} ${PYTHON_LIBRARIES} ${MPI_LIBRARIES})
target_link_libraries(mpipython ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${MPI_LIBRARIES})

set_target_properties(mpipython PROPERTIES PREFIX "")

Expand Down
67 changes: 32 additions & 35 deletions kratos/solving_strategies/strategies/solving_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
// Multi-Physics
//
// License: BSD License
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Riccardo Rossi
//
//
//

#if !defined(KRATOS_SOLVING_STRATEGY )
Expand Down Expand Up @@ -77,50 +77,50 @@ class SolvingStrategy
public:
///@name Type Definitions
///@{

// typedef std::set<Dof::Pointer,ComparePDof> DofSetType;

typedef typename TSparseSpace::DataType TDataType;

typedef typename TSparseSpace::MatrixType TSystemMatrixType;

typedef typename TSparseSpace::VectorType TSystemVectorType;

typedef typename TSparseSpace::MatrixPointerType TSystemMatrixPointerType;

typedef typename TSparseSpace::VectorPointerType TSystemVectorPointerType;

typedef typename TDenseSpace::MatrixType LocalSystemMatrixType;

typedef typename TDenseSpace::VectorType LocalSystemVectorType;

typedef Scheme<TSparseSpace, TDenseSpace> TSchemeType;

typedef BuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver> TBuilderAndSolverType;

typedef typename ModelPart::DofType TDofType;

typedef typename ModelPart::DofsArrayType DofsArrayType;

// typedef Dof<TDataType> TDofType;

// typedef PointerVectorSet<TDofType, IdentityFunction<TDofType> > DofsArrayType;

// typedef PointerVectorSet<TDofType, IndexedObject> DofsArrayType;

typedef typename DofsArrayType::iterator DofIteratorType;

typedef typename DofsArrayType::const_iterator DofConstantIteratorType;

typedef ModelPart::NodesContainerType NodesArrayType;

typedef ModelPart::ElementsContainerType ElementsArrayType;

typedef ModelPart::ConditionsContainerType ConditionsArrayType;

/** Counted pointer of ClassName */
KRATOS_CLASS_POINTER_DEFINITION(SolvingStrategy);

///@}
///@name Life Cycle
///@{
Expand All @@ -131,26 +131,26 @@ class SolvingStrategy
*/

SolvingStrategy(
ModelPart& rModelPart,
ModelPart& rModelPart,
bool MoveMeshFlag = false
)
: mrModelPart(rModelPart)
{
SetMoveMeshFlag(MoveMeshFlag);
}

///@}

/** Destructor.
*/

///@{
virtual ~SolvingStrategy(){}

///@}

/**OPERATIONS ACCESSIBLE FROM THE INPUT:*/

///@{

/**
Expand All @@ -166,7 +166,6 @@ class SolvingStrategy
*/
virtual void Initialize()
{
KRATOS_ERROR << "You are calling to the base class method Initialize, please define in you derived class the method" << std::endl;
}

/**
Expand All @@ -181,17 +180,16 @@ class SolvingStrategy
Predict();
SolveSolutionStep();
FinalizeSolutionStep();
return 0.0;

return 0.0;

}

/**
* Clears the internal storage
*/
virtual void Clear()
{
KRATOS_ERROR << "You are calling to the base class method Clear, please define in you derived class the method" << std::endl;
}

/**
Expand Down Expand Up @@ -316,20 +314,20 @@ class SolvingStrategy
if (GetModelPart().NodesBegin()->SolutionStepsDataHas(DISPLACEMENT_X) == false)
{
KRATOS_ERROR << "It is impossible to move the mesh since the DISPLACEMENT var is not in the Model Part. Either use SetMoveMeshFlag(False) or add DISPLACEMENT to the list of variables" << std::endl;
}
}

NodesArrayType& NodesArray = GetModelPart().Nodes();
const int numNodes = static_cast<int>(NodesArray.size());

#pragma omp parallel for
for(int i = 0; i < numNodes; i++)
for(int i = 0; i < numNodes; i++)
{
auto itNode = NodesArray.begin() + i;

noalias(itNode->Coordinates()) = itNode->GetInitialPosition().Coordinates();
noalias(itNode->Coordinates()) += itNode->FastGetSolutionStepValue(DISPLACEMENT);
}

if (this->GetEchoLevel() != 0 && GetModelPart().GetCommunicator().MyPID() == 0 )
{
std::cout<<" MESH MOVED "<<std::endl;
Expand Down Expand Up @@ -390,9 +388,9 @@ class SolvingStrategy
{
itCond->Check(GetModelPart().GetProcessInfo());
}

return 0;

KRATOS_CATCH("")
}

Expand Down Expand Up @@ -496,4 +494,3 @@ class SolvingStrategy
} /* namespace Kratos.*/

#endif /* KRATOS_SOLVING_STRATEGY defined */

45 changes: 45 additions & 0 deletions scripts/packaging/linux/pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# This file is used to make a package of kratos in linux. It has been optimized to run with
# the 16.04 LTS of ubuntu

KRATOS_MAJOR="5" # Kratos major
KRATOS_MINOR="1" # Kratos minor
KRATOS_ARCHY="64"
KRATOS_NEWSD="Beta Release"
KRATOS_TVERS="${KRATOS_MAJOR}.${KRATOS_MINOR}"
KRATOS_TDATE="XX-XX-XX"

KRATOS_RLS="$HOME/KratosRelease"
KRATOS_SRC="$HOME/KratosSource"
KRATOS_CMP="$HOME/KratosInstall"
KRATOS_AUX="$HOME/KratosLibsForPack64"

GIDINT_SRC="$HOME/GidInterface"
GIDINT_KTS=""

DEPLOY_DIR="$HOME/KratosDeploy"

# Obtain the Git hash for the current version
GIT_HASH=`git --git-dir="${KRATOS_SRC}/.git" rev-parse --short HEAD`
GIT_BRAN=`git --git-dir="${KRATOS_SRC}/.git" rev-parse --abbrev-ref HEAD`
GIT_NUMB="${GIT_HASH}(${GIT_BRAN})"

# Clean up old releases and files in the stage folder to prevent problems
rm -rf ${KRATOS_RLS}/*

# Copy Kratos, Kratos.gid and additional libs to the local release dir
cp -r ${GIDINT_SRC}/* ${KRATOS_RLS}
cp -r ${KRATOS_CMP}/* ${KRATOS_RLS}/kratos.gid

# Remove simlinks to system libs that are from not default packages
rm ${KRATOS_RLS}/kratos.gid/libs/libtrilinos*
rm ${KRATOS_RLS}/kratos.gid/libs/libmetis*

# Copy the extra needed libs
cp -r ${KRATOS_AUX}/* ${KRATOS_RLS}/kratos.gid

# Create a tar
tar -czf "${KRATOS_RLS}/kratos-${KRATOS_MAJOR}.${KRATOS_MINOR}-${GIT_NUMB}-linux-${KRATOS_ARCHY}.tar.gz" -C "${KRATOS_RLS}" kratos.gid

cp "${KRATOS_RLS}/kratos-${KRATOS_MAJOR}.${KRATOS_MINOR}-${GIT_NUMB}-linux-${KRATOS_ARCHY}.tar.gz" "${DEPLOY_DIR}/kratos-${KRATOS_MAJOR}.${KRATOS_MINOR}-${GIT_NUMB}-linux-${KRATOS_ARCHY}.tar.gz"
Loading

0 comments on commit 2e80f87

Please sign in to comment.