forked from KratosMultiphysics/Kratos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
867 changed files
with
29,690 additions
and
710,729 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 32 additions & 38 deletions
70
applications/ALEapplication/python_scripts/ale_navier_stokes_solver_vmsmonolithic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
72 changes: 34 additions & 38 deletions
72
...ications/ALEapplication/python_scripts/ale_trilinos_navier_stokes_solver_vmsmonolithic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.