How to pass parameters in user defined function in applyBoundaryCondition()?
1 view (last 30 days)
Show older comments
What I want to do:
Create a time dependent geometry changing at every iteration, mesh it, solve a pde with time dependent boundary condtions and repeat
What I tried:
Method 1:
- initialize
- for t = 0:delta_t:t_final:
- update geometry by geometryFromMesh(..)
- generateMesh
- apply boundary condtion
- condtion is parameter dependent, can't pass my parameter in my custom function in thermalBC(model, Face, --, HeatFlux, @externalHeatFlux) (thermalBC is similar to applyBoundaryCondition)
- solve pde for single instance
- repeat
Q1. How can I pass a parameter in my function @externalHeatFlux to be used in thermalBC(model, Face, --, HeatFlux, @externalHeatFlux)?
Essentially I want to pass the parameter 'time' because the heat source is time dependent. But you can say state.time is automatically passed in this function (explained in documentation of thermalBC)
I don't want to go this way because:
Method 2:
- Initialize, make geometry, mesh, applyBC using state.time as passed default
- set tlist = [0:delta_t:t_final)
- then later use solve(thermalmodel, tlist)
- can't change the geometry! Because solve(..) solves for whole duration considering same geometry.
Q2. Can I update geometry somehow so that I solve the pde step by step, not in one shot like solve(model, tlist). This method inherently assumes that geometry will be the same.
I am confused between using solve(model, t_list) to solve for all time instance, and using changing geometry with simple loops.
I would personally prefer a solution helping in method 1 because that looks more systematic and clean. Someone working with pdes can look into it and help! I would be grateful.
Thanks in advance.
0 Comments
Answers (0)
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!