Solving PDE with COMSOL Script: Parametric Study & Initial Solution

  • Thread starter py_engineer
  • Start date
  • Tags
    Comsol
In summary, the person is trying to define an equation parameter which will be used in all the following steps of a parametric study, but is not able to do it. They mention looking into the Solver Manager, but do not mention any specific steps.
  • #1
py_engineer
12
0
Hi,

I am using COMSOL Script and I am trying to figure out something.

Let's say I am only solving one PDE which solution is 'phi'. And I am doing a parametric study, so I am solving it for different biases 'Va' from 0V to -1V. My geometry is simply a rectangle.

As part of the PDE, I have a parameter 'equ.f' which I set to be equal to 'Rec'. 'Rec' is defined in 'fem.globalexpr'.

For Va=0 (initial solution), I set 'Rec' to be 0. But then, for all the following steps, I want 'Rec' to be a function of the solution 'phi' found by COMSOL at Va=0. Is there a way to do that? Basically, I want to be able to use the initial solution in order to define an expression which is to be used in all the following steps..

I tried to solve for Va=0, then save the FEM structure, and use it to define 'Rec' by doing something like Rec=posteval(fem,'phi','solnum'1), and then solve again for the following steps. But it seems the format is not compatible. I get an error like 'cannot evaluate 'Rec', etc. So it didn't work.. (or maybe I didn't do it right..)

Any ideas would be GREATLY appreciated! Thanks!
 
Engineering news on Phys.org
  • #2
May be I'm not getting this all (please educate :smile: ), but have you tried looking at solver manager and what's in there with respect to initial solution, storing a solution, using the current solution as an initial value etc.?
 
  • #3
Thanks for your answer! I actually looked a little bit into the Solver Manager, and the Help docs on this. And from what I understand, I can use a previous solution as an initial solution for the next step.

But what I'm trying to do, is to use a previous solution in order to define an equation parameter which will be used in the next step.. So it's a little bit different and, although I need to look more into COMSOL Help, I haven't found how to do that yet..
 
  • #4
In principle it sounds something which you might be able to do by introducing a nonlinear dependency (or history dependency might be a term for this case), or an additional "coupling" perhaps (not perhaps in the most traditional sense of a coupling, but occasionally use them [a PDE form for example] to introduce dependencies over time history). There are a bunch of ways of defining different sorts of expressions you can use in your equations (all the expression types, global equations, function definitions, couplings, script m - files etc.) so would think something might be appropriate (if nothing a tuned comsol script can do a whole lot of things to a model like read initial values etc.).
 
  • #5
Hi,

I was wondering if you ever figured out how you could do this. I have the same problem and I have no clue on how to solve it. I am able to save final solution of the first solver as the initial value for the second one but in my second solver I have expressions that are dependent on this initial value and I am not able to make them work.

Any Ideas??

Thanks!
 

1. What is COMSOL Script and how does it relate to solving PDEs?

COMSOL Script is a programming language used in the COMSOL Multiphysics software for solving partial differential equations (PDEs). It allows users to create custom scripts to automate the solving process and perform parametric studies.

2. What is a parametric study and why is it useful in solving PDEs?

A parametric study involves varying one or more parameters in a PDE model to understand their impact on the solution. This is useful in identifying the most influential parameters and optimizing the model for desired results.

3. How do you perform a parametric study in COMSOL Script?

To perform a parametric study in COMSOL Script, you can use the built-in functionality for defining parameters and creating parameter sweeps. The script can also be used to automate the solving process and collect data from each parameter variation.

4. What is an initial solution and why is it important in solving PDEs?

An initial solution is the first guess or approximation of the solution to a PDE. It is important because it helps guide the numerical solver towards the actual solution and can significantly reduce the solving time.

5. Can COMSOL Script be used for solving all types of PDEs?

Yes, COMSOL Script can be used to solve a wide range of PDEs, including elliptic, parabolic, and hyperbolic equations. It also has the flexibility to handle complex geometries and boundary conditions, making it a versatile tool for PDE solving.

Similar threads

  • Mechanical Engineering
Replies
1
Views
676
Replies
5
Views
1K
  • Mechanical Engineering
Replies
8
Views
2K
  • Differential Equations
Replies
2
Views
1K
  • Differential Equations
Replies
5
Views
2K
Replies
2
Views
247
  • Calculus and Beyond Homework Help
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Advanced Physics Homework Help
Replies
7
Views
975
Replies
2
Views
3K
Back
Top