Skip to content

Commit

Permalink
Updating to current master.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcotela committed Aug 3, 2017
2 parents a320897 + 2e80f87 commit f56da31
Show file tree
Hide file tree
Showing 867 changed files with 29,690 additions and 710,729 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)

# Define custom compiler build types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,32 +448,4 @@ void StructuralMeshMovingElement::CalculateRightHandSide(VectorType& rRightHandS
}
}

// Only called in the CalculateLocalSystem Function above
void StructuralMeshMovingElement::CalculateAndAddRHS(VectorType& rRightHandSideVector)
{
const SizeType NumNodes = this->GetGeometry().PointsNumber();
const unsigned int dimension = this->GetGeometry().WorkingSpaceDimension();

if (rRightHandSideVector.size() != mLocalSize)
rRightHandSideVector.resize(mLocalSize, false);

GeometryType& rGeom = this->GetGeometry();
for (SizeType iNode = 0; iNode < NumNodes; ++iNode)
{
// Note that we need to divide by the neighbours since the final RHS
// needs
// to be the desired value
//(the addition below is done as many times as elements we have where
// this node appears)

int number_neighbours = rGeom[iNode].GetValue(NEIGHBOUR_ELEMENTS).size();

rRightHandSideVector[dimension * iNode + 0] +=
rGeom[iNode].GetSolutionStepValue(MESH_RHS_X) / number_neighbours;
rRightHandSideVector[dimension * iNode + 1] +=
rGeom[iNode].GetSolutionStepValue(MESH_RHS_Y) / number_neighbours;
rRightHandSideVector[dimension * iNode + 2] +=
rGeom[iNode].GetSolutionStepValue(MESH_RHS_Z) / number_neighbours;
}
}
} // Namespace Kratos
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ class StructuralMeshMovingElement : public Element
void CalculateRightHandSide(VectorType& rRightHandSideVector,
ProcessInfo& rCurrentProcessInfo);

void CalculateAndAddRHS(VectorType& rRightHandSideVector);

///@}
///@name Access
///@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ void AddCustomStrategiesToPython()
bases< BaseSolvingStrategyType >, boost::noncopyable >
("LaplacianMeshMovingStrategy",
init<ModelPart&, LinearSolverType::Pointer, int, bool >() )
.def("MoveNodes",&LaplacianMeshMovingStrategy< SparseSpaceType, LocalSpaceType, LinearSolverType >::MoveNodes)
;

class_< StructuralMeshMovingStrategy< SparseSpaceType, LocalSpaceType, LinearSolverType >,
bases< BaseSolvingStrategyType >, boost::noncopyable >
("StructuralMeshMovingStrategy",
init<ModelPart&, LinearSolverType::Pointer, int, bool, bool >() )
.def("MoveNodes",&StructuralMeshMovingStrategy< SparseSpaceType, LocalSpaceType, LinearSolverType >::MoveNodes)
.def("UpdateReferenceMesh",&StructuralMeshMovingStrategy< SparseSpaceType, LocalSpaceType, LinearSolverType >::UpdateReferenceMesh)
.def("CalculateMeshVelocities",&StructuralMeshMovingStrategy< SparseSpaceType, LocalSpaceType, LinearSolverType >::CalculateMeshVelocities)
;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ class LaplacianMeshMovingStrategy : public SolvingStrategy<TSparseSpace,

}

double Solve()
void Initialize() override
{}

double Solve() override
{
KRATOS_TRY;

Expand All @@ -205,7 +208,7 @@ class LaplacianMeshMovingStrategy : public SolvingStrategy<TSparseSpace,
rCurrentProcessInfo[FRACTIONAL_STEP] = 3;
mstrategy_z->Solve();

MoveNodes();
MoveMesh();

//clearing the system if needed
if(mreform_dof_at_every_step == true) {
Expand Down Expand Up @@ -267,14 +270,14 @@ class LaplacianMeshMovingStrategy : public SolvingStrategy<TSparseSpace,
KRATOS_CATCH("");
}

virtual void SetEchoLevel(int Level)
virtual void SetEchoLevel(int Level) override
{
mstrategy_x->SetEchoLevel(Level);
mstrategy_y->SetEchoLevel(Level);
mstrategy_z->SetEchoLevel(Level);
}

void MoveNodes()
void MoveMesh() override
{
for (ModelPart::NodeIterator i = BaseType::GetModelPart().NodesBegin();
i != BaseType::GetModelPart().NodesEnd(); ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
#include "solving_strategies/schemes/residualbased_incrementalupdate_static_scheme.h"
#include "solving_strategies/builder_and_solvers/residualbased_block_builder_and_solver.h"
#include "custom_elements/structural_meshmoving_element.h"
#include "processes/find_nodal_neighbours_process.h"

#include "ale_application.h"

Expand Down Expand Up @@ -153,8 +152,10 @@ class StructuralMeshMovingStrategy : public SolvingStrategy<TSparseSpace,

virtual ~StructuralMeshMovingStrategy() {}

void Initialize() override
{}

double Solve()
double Solve() override
{
KRATOS_TRY;

Expand All @@ -173,7 +174,7 @@ class StructuralMeshMovingStrategy : public SolvingStrategy<TSparseSpace,

// Update FEM-base
CalculateMeshVelocities();
MoveNodes();
MoveMesh();

// Clearing the system if needed
if(mreform_dof_at_every_step == true)
Expand Down Expand Up @@ -226,12 +227,12 @@ class StructuralMeshMovingStrategy : public SolvingStrategy<TSparseSpace,
KRATOS_CATCH("");
}

virtual void SetEchoLevel(int Level)
void SetEchoLevel(int Level) override
{
mstrategy->SetEchoLevel(Level);
}

void MoveNodes()
void MoveMesh() override
{
for (ModelPart::NodeIterator i = BaseType::GetModelPart().NodesBegin();
i != BaseType::GetModelPart().NodesEnd(); ++i)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,61 +1,55 @@
from __future__ import print_function, absolute_import, division
from KratosMultiphysics import *
from KratosMultiphysics.ALEApplication import *
from KratosMultiphysics.FluidDynamicsApplication import *
from KratosMultiphysics.ExternalSolversApplication import *
CheckForPreviousImport()

import KratosMultiphysics
import KratosMultiphysics.ALEApplication as ALEApplication
import KratosMultiphysics.FluidDynamicsApplication as FluidDynamicsApplication
import KratosMultiphysics.ExternalSolversApplication as ExternalSolversApplication
KratosMultiphysics.CheckForPreviousImport()
import navier_stokes_solver_vmsmonolithic


def CreateSolver(model_part, custom_settings):
return ALENavierStokesSolverVMSMonolithic(model_part, custom_settings)

class ALENavierStokesSolverVMSMonolithic(navier_stokes_solver_vmsmonolithic.NavierStokesSolver_VMSMonolithic):

class ALENavierStokesSolverVMSMonolithic(navier_stokes_solver_vmsmonolithic.NavierStokesSolver_VMSMonolithic):
def __init__(self, model_part, custom_settings):
# get ale solver type
self.ale_solver_type = custom_settings["ale_solver_type"].GetString()
valid_ale_solver_types = ["mesh_solver_structural_similarity"]
if self.ale_solver_type not in valid_ale_solver_types:
raise Exception("Invalid ale_solver_type: " + self.ale_solver_type)
# remove the ale solver type from settings so we can reuse the navier stokes constructor
navier_stokes_settings = custom_settings
navier_stokes_settings.RemoveValue("ale_solver_type")
# call navier stokes constructor
super().__init__(model_part, navier_stokes_settings)
# remove the ale_settings so we can use the navier stokes constructor
navier_stokes_settings = custom_settings.Clone()
navier_stokes_settings.RemoveValue("ale_settings")
super(ALENavierStokesSolverVMSMonolithic, self).__init__(model_part, navier_stokes_settings)
# create ale solver
ale_solver_module = __import__(self.ale_solver_type)
ale_settings = Parameters("{}") # for now use default settings
self.ale_solver = ale_solver_module.CreateSolver(self.main_model_part, ale_settings)
print("Construction of ALENavierStokesSolverVMSMonolithic finished")
ale_solver_type = custom_settings["ale_settings"]["solver_type"].GetString()
valid_ale_solver_types = ["mesh_solver_structural_similarity"]
if ale_solver_type not in valid_ale_solver_types:
raise Exception("Invalid ALE solver_type: " + ale_solver_type)
ale_solver_module = __import__(ale_solver_type)
self.ale_solver = ale_solver_module.CreateSolver(self.main_model_part, custom_settings["ale_settings"])
print("::[ALENavierStokesSolverVMSMonolithic]:: Construction finished")

def AddVariables(self):
# add base class variables
super().AddVariables()
# add ale variables
super(ALENavierStokesSolverVMSMonolithic, self).AddVariables()
self.ale_solver.AddVariables()
print("ALE variables added correctly")
print("::[ALENavierStokesSolverVMSMonolithic]:: Variables ADDED.")

def AddDofs(self):
# add base class dofs
super().AddDofs()
# add ale dofs
super(ALENavierStokesSolverVMSMonolithic, self).AddDofs()
self.ale_solver.AddDofs()
print("ALE dofs added correctly")
print("::[ALENavierStokesSolverVMSMonolithic]:: DOFs ADDED.")

def Initialize(self):
super().Initialize()
super(ALENavierStokesSolverVMSMonolithic, self).Initialize()
self.ale_solver.Initialize()
print("::[ALENavierStokesSolverVMSMonolithic]:: Finished initialization.")

def SolveFluid(self):
super().Solve()
def GetFluidSolver(self):
return super(ALENavierStokesSolverVMSMonolithic, self)

def SolveMeshMotion(self):
self.ale_solver.Solve()
def GetMeshMotionSolver(self):
return self.ale_solver

def Solve(self):
self.SolveMeshMotion()
self.SolveFluid()
self.GetMeshMotionSolver().Solve()
self.GetFluidSolver().Solve()

def MoveNodes(self):
self.ale_solver.MoveNodes()
def MoveMesh(self):
self.GetMeshMotionSolver().MoveMesh()
Original file line number Diff line number Diff line change
@@ -1,66 +1,62 @@
from __future__ import print_function, absolute_import, division
from KratosMultiphysics import *
from KratosMultiphysics.ALEApplication import *
from KratosMultiphysics.FluidDynamicsApplication import *
import KratosMultiphysics
import KratosMultiphysics.ALEApplication as ALEApplication
import KratosMultiphysics.FluidDynamicsApplication as FluidDynamicsApplication
from KratosMultiphysics.mpi import *
from KratosMultiphysics.TrilinosApplication import *
from KratosMultiphysics.ExternalSolversApplication import *
CheckForPreviousImport()

import KratosMultiphysics.TrilinosApplication as TrilinosApplication
KratosMultiphysics.CheckForPreviousImport()
import trilinos_navier_stokes_solver_vmsmonolithic
import mesh_solver_base


def CreateSolver(model_part, custom_settings):
return ALETrilinosNavierStokesSolverVMSMonolithic(model_part, custom_settings)

class ALETrilinosNavierStokesSolverVMSMonolithic(trilinos_navier_stokes_solver_vmsmonolithic.NavierStokesMPISolver_VMSMonolithic):

class ALETrilinosNavierStokesSolverVMSMonolithic(trilinos_navier_stokes_solver_vmsmonolithic.NavierStokesMPISolver_VMSMonolithic):
def __init__(self, model_part, custom_settings):
# get ale solver type
self.ale_solver_type = custom_settings["ale_solver_type"].GetString()
valid_ale_solver_types = ["trilinos_mesh_solver_structural_similarity"]
if self.ale_solver_type not in valid_ale_solver_types:
raise Exception("Invalid ale_solver_type: " + self.ale_solver_type)
# remove the ale solver type from settings so we can reuse the navier stokes constructor
navier_stokes_settings = custom_settings
navier_stokes_settings.RemoveValue("ale_solver_type")
# call navier stokes constructor
super().__init__(model_part, navier_stokes_settings)
# remove the ale_settings so we can use the navier stokes constructor
navier_stokes_settings = custom_settings.Clone()
navier_stokes_settings.RemoveValue("ale_settings")
super(ALETrilinosNavierStokesSolverVMSMonolithic, self).__init__(model_part, navier_stokes_settings)
# create ale solver
ale_solver_module = __import__(self.ale_solver_type)
ale_settings = Parameters("{}") # for now use default settings
self.ale_solver = ale_solver_module.CreateSolver(self.main_model_part, ale_settings)
ale_solver_type = custom_settings["ale_settings"]["solver_type"].GetString()
valid_ale_solver_types = ["trilinos_mesh_solver_structural_similarity"]
if ale_solver_type not in valid_ale_solver_types:
raise Exception("Invalid ALE solver_type: " + ale_solver_type)
ale_solver_module = __import__(ale_solver_type)
self.ale_solver = ale_solver_module.CreateSolver(self.main_model_part, custom_settings["ale_settings"])
if mpi.rank == 0:
print("Construction of ALENavierStokesSolverVMSMonolithic finished")
print("::[ALETrilinosNavierStokesSolverVMSMonolithic]:: Construction finished")

def AddVariables(self):
# add base class variables
super().AddVariables()
# add ale variables
super(ALETrilinosNavierStokesSolverVMSMonolithic, self).AddVariables()
self.ale_solver.AddVariables()
if mpi.rank == 0:
print("ALE variables added correctly")
print("::[ALETrilinosNavierStokesSolverVMSMonolithic]:: Variables ADDED.")

def AddDofs(self):
# add base class dofs
super().AddDofs()
# add ale dofs
super(ALETrilinosNavierStokesSolverVMSMonolithic, self).AddDofs()
self.ale_solver.AddDofs()
if mpi.rank == 0:
print("ALE dofs added correctly")
print("::[ALETrilinosNavierStokesSolverVMSMonolithic]:: DOFs ADDED.")

def Initialize(self):
super().Initialize()
super(ALETrilinosNavierStokesSolverVMSMonolithic, self).Initialize()
self.ale_solver.Initialize()
if mpi.rank == 0:
print("::[ALETrilinosNavierStokesSolverVMSMonolithic]:: Finished initialization.")

def SolveFluid(self):
super().Solve()
def GetFluidSolver(self):
return super(ALETrilinosNavierStokesSolverVMSMonolithic, self)

def SolveMeshMotion(self):
self.ale_solver.Solve()
def GetMeshMotionSolver(self):
return self.ale_solver

def Solve(self):
self.SolveMeshMotion()
self.SolveFluid()
self.GetMeshMotionSolver().Solve()
self.GetFluidSolver.Solve()

def MoveNodes(self):
self.ale_solver.MoveNodes()
def MoveMesh(self):
self.GetMeshMotionSolver().MoveMesh()
Loading

0 comments on commit f56da31

Please sign in to comment.