User defined solver Dirichlet boundary conditions

Discussion about coding and new developments
Post Reply
hisham.noaman
Posts: 4
Joined: 25 Sep 2020, 11:24
Antispam: Yes

User defined solver Dirichlet boundary conditions

Post by hisham.noaman »

Hey Guys

i am trying to make a user defined solver, and i am only in the step of defining the Dirichlet boundary condition through a user defined function but it seems that the solver calls the user defined function normally but the calculated data are not saved. In the attached files,sorry it is a little bit messy, there is the dummy solver called PreciceAdapter.F90 what i am doing the steps as follows
- defining local variable
-Allocating memory for retrieved data from Elmer
-looping over boundary elements
-printing data of temperature and dummy variable(called from within the loop)

the user defined function,for both the temperature and dummy variable are just retrieving time and setting value to it
the user defined function file that sets temperature, is called HeatSolveUDF.F90
the user defined function file that sets temperature, is called DummySolverUDF.F90
the case.sif has 3 solvers(Navier-stokes,HeatSolve and DummySolver) and for boundary condition 4, the variables are assigned using the user defined functions

the problem that when i print the values for the dummy variable it is never updated as in the screenshot, the value of the temperature is 5 because it is updated to be equal to time,but the dummy value is zero, it is supposed to have same value, i do not know why, if anybody could help it would be great.

i can only upload 3 files so the .sif in the post, but if someone is interested to help i can give him the the screenshot by any other way

Header
CHECK KEYWORDS Warn
Mesh DB "." "."
Include Path ""
Results Directory "./Results"
End

Simulation
Max Output Level = 5
Coordinate System = Cartesian
Coordinate Mapping(3) = 1 2 3
Simulation Type = Transient
Steady State Max Iterations = 1
Output Intervals = 1
Timestepping Method = BDF
BDF Order = 1
Timestep intervals = 50
Timestep Sizes = 0.05
Solver Input File = case.sif
Post File = case.vtu
End

Constants
Gravity(4) = 0 -1 0 9.82
Stefan Boltzmann = 5.67e-08
Permittivity of Vacuum = 8.8542e-12
Boltzmann Constant = 1.3807e-23
Unit Charge = 1.602e-19
End

Body 1
Target Bodies(1) = 4
Name = "Body 1"
Equation = 1
Material = 1
Body Force = 1
Initial condition = 1
End



Solver 1
Equation = Navier-Stokes
Procedure = "FlowSolve" "FlowSolver"
Variable = Flow Solution[Velocity:2 Pressure:1]
Exec Solver = Always
Stabilize = True
Bubbles = False
Lumped Mass Matrix = False
Optimize Bandwidth = True
Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-7
Nonlinear System Max Iterations = 5
Nonlinear System Newton After Iterations = 3
Nonlinear System Newton After Tolerance = 1.0e-3
Nonlinear System Relaxation Factor = 1
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStab
Linear System Max Iterations = 500
Linear System Convergence Tolerance = 1.0e-10
BiCGstabl polynomial degree = 2
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 10
Linear System Precondition Recompute = 1
End



Solver 2
Equation = Heat Equation
Procedure = "HeatSolve" "HeatSolver"
Variable = Temperature
Exec Solver = Always
Stabilize = True
Bubbles = False
Lumped Mass Matrix = False
Optimize Bandwidth = True
Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-7
Nonlinear System Max Iterations = 20
Nonlinear System Newton After Iterations = 3
Nonlinear System Newton After Tolerance = 1.0e-3
Nonlinear System Relaxation Factor = 1
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStab
Linear System Max Iterations = 500
Linear System Convergence Tolerance = 1.0e-10
BiCGstabl polynomial degree = 2
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 10
Linear System Precondition Recompute = 1
End

Solver 3
Equation = "DummySolver"
Variable = "DummyVariable"
Procedure = "PreciceAdapter" "PreciceLoop"
Element = "p:2"
Linear System Solver = Direct
Steady State Convergence Tolerance = 1.0e-5
End

Equation 1
Name = "Navier_Stokes_Heat"
Convection = Computed
Active Solvers(3) = 2 1 3
End

Material 1
Name = "Water (room temperature)"
Reference Temperature = 300
Viscosity = 1.002e-3
Heat expansion Coefficient = 0.207e-3
Heat Conductivity = 0.58
Relative Permittivity = 80.1
Sound speed = 1497.0
Heat Capacity = 4183.0
Density = 998.3
End

Body Force 1
Name = "buoyancy"
Boussinesq = True
End

Initial Condition 1
Name = "liquid_Initial_Condition"
Velocity 2 = 0.0
Velocity 1 = 0.0
Temperature = 300
End

Boundary Condition 1
Target Boundaries(1) = 1
Name = "Fluid_Walls"
Noslip wall BC = True
Temperature = 300
End

Boundary Condition 2
Target Boundaries(1) = 2
Name = "Inlet"
Velocity 1 = 1.0
Temperature = 310
End

Boundary Condition 3
Target Boundaries(1) = 3
Name = "Outlet"
Velocity 2 = 0.0
End

Boundary Condition 4
Target Boundaries(1) = 6
Name = "Coupling_boundary"
Noslip wall BC = True
Temperature = Variable Coordinate 1
Real Procedure "HeatSolveUDF" "setTemp"
DummyVariable = Variable Coordinate 1
Real Procedure "DummySolverUDF" "setDummy"

End


Regards
Hisham
Attachments
HeatSolveUDF.F90
user defined function for temperature
(761 Bytes) Downloaded 277 times
DummySolverUDF.F90
user defined function for dummy variable
(773 Bytes) Downloaded 267 times
PreciceAdapter.F90
user defined solver
(5.1 KiB) Downloaded 273 times
Post Reply